Conversation
…rst README (#137) - 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: Automaker <automaker@localhost> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
✅ Files skipped from review due to trivial changes (6)
WalkthroughAdds a recap feature that auto-generates 1–3 sentence summaries after agent turns, plus related settings, UI components, commands, a client-side hook to orchestrate generation, core recap generation logic, and README quick-start updates for setup. Changes
Sequence DiagramsequenceDiagram
participant User
participant App as AppContainer
participant Hook as useRecap
participant Config as Config/Settings
participant Generator as generateRecap
participant Model as ContentGenerator
participant UI as History/UI
User->>App: send message / agent produces response
App->>Hook: observe streaming state
Note over Hook: Detect turn start -> record time & history length
Note over Hook: Detect streaming completion
Hook->>Config: read merged settings & thresholds
alt thresholds met and recap enabled
Hook->>Generator: call generateRecap(history, abortSignal)
Generator->>Model: append prompt + recent items -> generateContent()
Model-->>Generator: content response
Generator-->>Hook: parsed recap text or null
alt recap produced
Hook->>UI: addItem({type: 'recap', text})
UI->>UI: render RecapMessage
else no recap / error
Hook-->>Hook: skip (log on non-abort errors)
end
else thresholds not met or disabled
Hook-->>Hook: skip recap
end
Note over Hook: on unmount -> abort in-flight requests
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
packages/cli/src/ui/commands/insightCommand.ts (1)
24-32: Localize the new/insightstatus/toggle messages.These new strings bypass
t(...)while the rest of this command is localized, which can cause mixed-language output.Proposed refactor
function statusMessage(context: CommandContext): SlashCommandActionReturn { const enabled = context.services.settings.merged.insight?.enabled ?? true; return { type: 'message', messageType: 'info', content: enabled - ? 'Insight: enabled. Run /insight to generate a report.' - : 'Insight: disabled. Run /insight enable to turn it back on.', + ? t('Insight: enabled. Run /insight to generate a report.') + : t('Insight: disabled. Run /insight enable to turn it back on.'), }; } @@ return { type: 'message', messageType: 'info', content: value - ? 'Insight enabled. Run /insight to generate a report.' - : 'Insight disabled. Run /insight enable to turn it back on.', + ? t('Insight enabled. Run /insight to generate a report.') + : t('Insight disabled. Run /insight enable to turn it back on.'), }; } @@ name: 'status', - description: 'Show insight enabled status', + description: t('Show insight enabled status'), @@ name: 'enable', - description: 'Enable /insight report generation', + description: t('Enable /insight report generation'), @@ name: 'disable', - description: 'Disable /insight report generation', + description: t('Disable /insight report generation'),Also applies to: 47-50, 64-78
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/cli/src/ui/commands/insightCommand.ts` around lines 24 - 32, The statusMessage function (and the additional message blocks around lines 47-50 and 64-78 in insightCommand.ts) currently use hard-coded English strings; replace those literals with localized strings using the existing t(...) translation helper used elsewhere in this command, e.g., call t('insight.status.enabled') and t('insight.status.disabled') (or appropriate keys) instead of the raw 'Insight: enabled...' / 'Insight: disabled...' text, and update the other message-return blocks (same file, same function names/return objects) to use t(...) so all user-facing messages are localized consistently.packages/cli/src/ui/commands/recapCommand.ts (1)
25-35: Consider localizing new/recapuser-facing strings.The new status/confirmation text is hardcoded English. Using
t(...)here would keep command UX consistent in non-English locales.Also applies to: 47-49, 55-75
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/cli/src/ui/commands/recapCommand.ts` around lines 25 - 35, The hardcoded English strings in the recap command UI should be localized: replace the literal strings inside the content array returned (e.g., `Recap: ${enabled ? 'enabled' : 'disabled'}`, `Duration threshold: ${seconds}s`, `Tool-call threshold: ${toolCalls}`, and the enabled/disabled helper lines) with calls to the translation helper (t(...)) using appropriate keys and interpolations; also update the other user-facing strings in the same module (the strings referenced around the `recapCommand` handler and the messages at the other occurrences noted) to use t(...) with interpolated variables instead of hardcoded text so the command respects locale settings.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/cli/src/ui/hooks/useRecap.ts`:
- Around line 79-89: When detecting the Idle→non-Idle transition in useRecap
(the block that updates turnRef.current when prev === StreamingState.Idle and
streamingState !== StreamingState.Idle), also immediately abort any in-flight
recap generation so a stale recap can’t complete mid-turn: invoke the same
cancellation/cleanup logic you call later for stale recaps (the existing recap
abort or cleanup routine used elsewhere in this hook), clear/reset any
recap-related state (e.g., pending recap promise/abort controller and partial
recap result), and ensure history/turnRef are set after the cancel so the new
turn starts with a clean slate.
In `@README.md`:
- Around line 72-74: The README's fenced env snippet lacks a language tag
(markdownlint MD040); update the fenced code block that contains the
OPENAI_API_KEY example by adding a language identifier (e.g., "dotenv") after
the opening triple backticks so the block becomes ```dotenv and satisfies
linting and improves readability.
---
Nitpick comments:
In `@packages/cli/src/ui/commands/insightCommand.ts`:
- Around line 24-32: The statusMessage function (and the additional message
blocks around lines 47-50 and 64-78 in insightCommand.ts) currently use
hard-coded English strings; replace those literals with localized strings using
the existing t(...) translation helper used elsewhere in this command, e.g.,
call t('insight.status.enabled') and t('insight.status.disabled') (or
appropriate keys) instead of the raw 'Insight: enabled...' / 'Insight:
disabled...' text, and update the other message-return blocks (same file, same
function names/return objects) to use t(...) so all user-facing messages are
localized consistently.
In `@packages/cli/src/ui/commands/recapCommand.ts`:
- Around line 25-35: The hardcoded English strings in the recap command UI
should be localized: replace the literal strings inside the content array
returned (e.g., `Recap: ${enabled ? 'enabled' : 'disabled'}`, `Duration
threshold: ${seconds}s`, `Tool-call threshold: ${toolCalls}`, and the
enabled/disabled helper lines) with calls to the translation helper (t(...))
using appropriate keys and interpolations; also update the other user-facing
strings in the same module (the strings referenced around the `recapCommand`
handler and the messages at the other occurrences noted) to use t(...) with
interpolated variables instead of hardcoded text so the command respects locale
settings.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 54dc9db8-990e-4784-bb74-b10c66bd50c6
📒 Files selected for processing (13)
README.mdpackages/cli/src/config/settingsSchema.tspackages/cli/src/services/BuiltinCommandLoader.tspackages/cli/src/ui/AppContainer.tsxpackages/cli/src/ui/commands/insightCommand.tspackages/cli/src/ui/commands/recapCommand.tspackages/cli/src/ui/components/HistoryItemDisplay.tsxpackages/cli/src/ui/components/messages/RecapMessage.tsxpackages/cli/src/ui/hooks/useRecap.tspackages/cli/src/ui/types.tspackages/core/src/index.tspackages/core/src/recap/index.tspackages/core/src/recap/recapGenerator.ts
| // Edge: Idle → non-Idle (turn started) | ||
| if ( | ||
| prev === StreamingState.Idle && | ||
| streamingState !== StreamingState.Idle | ||
| ) { | ||
| turnRef.current = { | ||
| startTime: Date.now(), | ||
| historyLengthAtStart: history.length, | ||
| }; | ||
| return; | ||
| } |
There was a problem hiding this comment.
Abort stale recap generation when a new turn begins.
Right now, cancellation happens only at Line [114], which is too late for the case where a prior recap is still generating and the next turn has already started. That stale result can still be appended mid-turn.
Proposed fix
if (
prev === StreamingState.Idle &&
streamingState !== StreamingState.Idle
) {
+ // Cancel recap generation from the previous turn so it can't land mid-turn.
+ abortRef.current?.abort();
+ abortRef.current = null;
+
turnRef.current = {
startTime: Date.now(),
historyLengthAtStart: history.length,
};
return;Also applies to: 113-124
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/cli/src/ui/hooks/useRecap.ts` around lines 79 - 89, When detecting
the Idle→non-Idle transition in useRecap (the block that updates turnRef.current
when prev === StreamingState.Idle and streamingState !== StreamingState.Idle),
also immediately abort any in-flight recap generation so a stale recap can’t
complete mid-turn: invoke the same cancellation/cleanup logic you call later for
stale recaps (the existing recap abort or cleanup routine used elsewhere in this
hook), clear/reset any recap-related state (e.g., pending recap promise/abort
controller and partial recap result), and ensure history/turnRef are set after
the cancel so the new turn starts with a clean slate.
| ``` | ||
| OPENAI_API_KEY=sk-your-key-here | ||
| ``` |
There was a problem hiding this comment.
Add a language to the fenced env snippet (markdownlint MD040).
Line 72 should specify a code-block language to satisfy linting and improve readability.
Suggested doc fix
-```
+```dotenv
OPENAI_API_KEY=sk-your-key-here</details>
<details>
<summary>🧰 Tools</summary>
<details>
<summary>🪛 markdownlint-cli2 (0.22.1)</summary>
[warning] 72-72: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
</details>
</details>
<details>
<summary>🤖 Prompt for AI Agents</summary>
Verify each finding against the current code and only fix it if needed.
In @README.md around lines 72 - 74, The README's fenced env snippet lacks a
language tag (markdownlint MD040); update the fenced code block that contains
the OPENAI_API_KEY example by adding a language identifier (e.g., "dotenv")
after the opening triple backticks so the block becomes ```dotenv and satisfies
linting and improves readability.
</details>
<!-- fingerprinting:phantom:poseidon:hawk:92957d93-a68e-4819-9f29-e2676566b5e0 -->
<!-- d98c2f50 -->
<!-- This is an auto-generated comment by CodeRabbit -->
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
Summary
Merge strategy
Use merge commit (not squash) per branch-strategy.
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
/recapcommand to view/toggle recap settings;/insightgainsstatus,enable,disablesubcommands.Documentation
Chores