feat(cli): long-turn recap card + /recap, /insight toggles + setup-first README#137
Merged
Merged
Conversation
…rst README - Recap: appends a "※ where we left off" card after agent turns longer than recap.thresholdSeconds (300s) or recap.thresholdToolCalls (15). Modeled on cc-2.18's awaySummary, but triggered by turn duration/tool count rather than terminal blur. Generated by `generateRecap` (packages/core/src/recap/) using the configured model with a 1-3 sentence prompt; returns null on abort/error so it can never crash a turn. Wired into AppContainer via useRecap. - Settings: new top-level `recap` (enabled, thresholdSeconds, thresholdToolCalls) and `insight` (enabled) keys on the user-scope schema. Both default to enabled — no experimental gate. - Slash commands: new /recap with status|enable|disable subactions. /insight gains the same subactions; bare /insight still runs the report but errors with a hint when disabled. - Rendering: new MessageType.RECAP + HistoryItemRecap, rendered dim with the U+203B (※) marker via RecapMessage. - README: replace hand-written settings.json in the Quick Start with `proto setup` (the existing interactive wizard); keep the JSON example below as advanced/manual setup. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (13)
WalkthroughThis pull request introduces a new "Recap" feature that summarizes where the conversation left off after long agent turns, along with configuration controls. It adds recap generation logic to the core package, CLI slash commands for enable/disable/status, UI components for displaying recaps, and updates the settings schema with recap configuration options. Changes
Sequence DiagramsequenceDiagram
participant User
participant UI as AppContainer/UI
participant Hook as useRecap Hook
participant Client as geminiClient
participant Config as Config
participant History as HistoryManager
User->>UI: Starts turn (streaming begins)
activate Hook
Hook->>Hook: Record turn start time & history length
User->>UI: Turn completes (streaming ends)
Hook->>Hook: Calculate elapsed time & tool_call count
alt Duration or Tool Count Exceeds Threshold
Hook->>Hook: Check for existing recap in recent history
alt No existing recap found
Hook->>Client: getHistory() for conversation context
Client-->>Hook: Return recent conversation
Hook->>Config: Get content generator & model
Config-->>Hook: Return generator
Hook->>Client: generateRecap(config, conversation, abortSignal)
Client->>Client: Slice last 30 content items
Client->>Client: Invoke model with recap prompt
Client-->>Hook: Return recap text
Hook->>History: addItem(type: RECAP, text)
History-->>UI: Update history display
UI->>UI: Render RecapMessage component
User->>User: See recap summary
else Recap already exists
Hook->>Hook: Skip generation
end
else Thresholds not met
Hook->>Hook: Do nothing
end
deactivate Hook
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
awaySummary, but triggered by turn duration / tool count rather than terminal blur (which protoCLI doesn't have a focus listener for).recap.{enabled,thresholdSeconds,thresholdToolCalls}andinsight.enabledkeys. Default ON — no experimental gate./recap(status|enable|disable)./insightgains the same subactions; bare/insightstill runs the report but errors with a hint when disabled.proto setupbecomes the recommended Quick Start path; manual JSON kept below as advanced.Files
packages/core/src/recap/recapGenerator.ts— LLM call (generateContent, 30-msg window, 1-3 sentence prompt). Returns null on abort/error.packages/cli/src/ui/hooks/useRecap.ts— watchesstreamingStateIdle ↔ non-Idle edges, tracks per-turn duration +tool_groupcount, fires recap when thresholds exceeded.packages/cli/src/ui/components/messages/RecapMessage.tsx— dim text +※(U+203B) marker.packages/cli/src/ui/commands/recapCommand.ts— new toggle command.packages/cli/src/ui/commands/insightCommand.ts— extended with status/enable/disable subactions.packages/cli/src/config/settingsSchema.ts— schema entries.packages/cli/src/ui/AppContainer.tsx— mountsuseRecap.README.md—proto setup-first quick start.Test plan
vitest run packages/cli(3,767 pass, 7 skipped)tsc -p packages/corecleantsc -p packages/cliclean/recap disable→ verify no card next long turn/insight disable→ verify bare/insighterrors with hint🤖 Generated with Claude Code
Summary by CodeRabbit
Documentation
proto setupcommandNew Features
/recapand/insightslash commands withstatus,enable, anddisablesubcommands