From f5476d25b4aced166f9ae18dd67994fcdcf9ff6e Mon Sep 17 00:00:00 2001 From: can1357 Date: Thu, 30 Apr 2026 04:26:45 +0200 Subject: [PATCH] fix(coding-agent): stop anchoring auto-continue prompt on stale 'Next Steps' The autoContinue post-compaction prompt echoed the summary's '## Next Steps' heading, but that section is generated only from the compacted tail; the kept ~20k recent tokens are not fed to the summarizer. When the user pivoted within the kept window, 'Continue if you have next steps.' anchored the model on the now-outdated plan instead of the latest intent. Move the prompt to prompts/system/auto-continue.md (per AGENTS.md no-inline-prompts rule) and rewrite it to direct the model to re-read the kept recent messages and follow the user's most recent request, explicitly allowing it to stop when nothing remains. Fixes #840 --- packages/coding-agent/src/prompts/system/auto-continue.md | 1 + packages/coding-agent/src/session/agent-session.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 packages/coding-agent/src/prompts/system/auto-continue.md diff --git a/packages/coding-agent/src/prompts/system/auto-continue.md b/packages/coding-agent/src/prompts/system/auto-continue.md new file mode 100644 index 000000000..a68b9db67 --- /dev/null +++ b/packages/coding-agent/src/prompts/system/auto-continue.md @@ -0,0 +1 @@ +Resume work on the user's most recent intent. Re-read the kept recent messages above the summary to confirm what the user asked for last; if their latest request supersedes earlier plans recorded in the summary, follow the latest request. If there is nothing left to do, say so briefly instead of inventing further work. diff --git a/packages/coding-agent/src/session/agent-session.ts b/packages/coding-agent/src/session/agent-session.ts index dfb352999..894ebcabf 100644 --- a/packages/coding-agent/src/session/agent-session.ts +++ b/packages/coding-agent/src/session/agent-session.ts @@ -121,6 +121,7 @@ import { import { getCurrentThemeName, theme } from "../modes/theme/theme"; import type { PlanModeState } from "../plan-mode/state"; import autoHandoffThresholdFocusPrompt from "../prompts/system/auto-handoff-threshold-focus.md" with { type: "text" }; +import autoContinuePrompt from "../prompts/system/auto-continue.md" with { type: "text" }; import eagerTodoPrompt from "../prompts/system/eager-todo.md" with { type: "text" }; import handoffDocumentPrompt from "../prompts/system/handoff-document.md" with { type: "text" }; import ircIncomingTemplate from "../prompts/system/irc-incoming.md" with { type: "text" }; @@ -1221,11 +1222,11 @@ export class AgentSession { await this.#promptWithMessage( { role: "developer", - content: [{ type: "text", text: "Continue if you have next steps." }], + content: [{ type: "text", text: autoContinuePrompt }], attribution: "agent", timestamp: Date.now(), }, - "Continue if you have next steps.", + autoContinuePrompt, { skipPostPromptRecoveryWait: true }, ); };