diff --git a/.changeset/compaction-summary-task-status.md b/.changeset/compaction-summary-task-status.md new file mode 100644 index 0000000000..4acb37d98f --- /dev/null +++ b/.changeset/compaction-summary-task-status.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +Reduce post-compaction task drift: the compaction summary now records whether each earlier request still visible in the conversation was finished, abandoned, or superseded, so the agent no longer restarts long-completed work after auto compaction. diff --git a/packages/agent-core/src/agent/compaction/compaction-instruction.md b/packages/agent-core/src/agent/compaction/compaction-instruction.md index d137e3ca3a..0b83bba7d3 100644 --- a/packages/agent-core/src/agent/compaction/compaction-instruction.md +++ b/packages/agent-core/src/agent/compaction/compaction-instruction.md @@ -24,6 +24,15 @@ continue: above all the actual ask. If several requests are in play, say which one governs the next move, and re-quote any still-relevant earlier request that may have scrolled out of the kept messages. +- The fate of every earlier request still visible in your kept messages: old + user prompts survive compaction verbatim, but with none of your answers + attached, so a long-finished request reads exactly like a pending one. Go + through them and mark each plainly — done (and where its output landed), + abandoned, superseded by a newer request, or still open. This applies doubly + to kept messages that carry their own instructions, such as a skill + activation or slash command: record whether you already carried that + instruction out. Never leave a completed request unmarked — the next turn + re-executes anything that looks unanswered. - The instructions and constraints currently in force (user preferences, project rules, environment and tooling limits) — condensed to what still matters, keeping decisions you have already settled (what you chose and why) diff --git a/packages/agent-core/src/agent/compaction/compaction-summary-prefix.md b/packages/agent-core/src/agent/compaction/compaction-summary-prefix.md index f814a9f84c..652d6a7abc 100644 --- a/packages/agent-core/src/agent/compaction/compaction-summary-prefix.md +++ b/packages/agent-core/src/agent/compaction/compaction-summary-prefix.md @@ -1 +1 @@ -The conversation so far has been compacted to free up context. What follows is your own working summary of this task — use it to continue your train of thought rather than starting over. Treat it as notes, not proof: where it says a step was done, tests passed, or a fix worked, verify that yourself before relying on it. Any user messages earlier in this context are preserved verbatim from the compacted conversation; where a system-reminder note among them marks an omitted middle section, the user messages it replaced are covered by this summary. +The conversation so far has been compacted to free up context. What follows is your own working summary of this task — use it to continue your train of thought rather than starting over. Treat it as notes, not proof: where it says a step was done, tests passed, or a fix worked, verify that yourself before relying on it. Any user messages earlier in this context are preserved verbatim from the compacted conversation, stripped of the answers they originally received; where the summary marks such a request as completed, abandoned, or superseded, do not start it over. Where a system-reminder note among them marks an omitted middle section, the user messages it replaced are covered by this summary. diff --git a/packages/agent-core/test/agent/compaction/full.test.ts b/packages/agent-core/test/agent/compaction/full.test.ts index abc4138dfa..5582725d64 100644 --- a/packages/agent-core/test/agent/compaction/full.test.ts +++ b/packages/agent-core/test/agent/compaction/full.test.ts @@ -79,12 +79,12 @@ describe('FullCompaction', () => { [emit] compaction.started { "trigger": "manual", "instruction": "Keep the important test facts." } [wire] llm.tools_snapshot { "hash": "4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945", "tools": [], "time": "