You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Compaction replay injects fake user message "What did we do so far?" causing unwanted summary generation #13838
When a session is compacted (via /compact or auto-compaction), resuming the session injects a synthetic user message "What did we do so far?" into the conversation. This causes the model to treat it as a real user request and generate a long summary/recap — even when the user's rules explicitly prohibit summaries.
Root cause
Found via strings on the compiled binary (v1.2.5):
if(part.type==="compaction"){userMessage.parts.push({type: "text",text: "What did we do so far?"});}
This string appears twice in the binary (likely two code paths for provider-specific message formatting).
Steps to reproduce
Start a session with significant context
Run /compact (or let auto-compaction trigger)
Continue the session — the model receives "What did we do so far?" as a user message
The model responds with a full summary, even if the user didn't ask for one
Impact
Wastes tokens on an unwanted summary response
Violates user-defined rules (e.g. "no summaries or recaps" in AGENTS.md)
Confusing UX — the user sees a response to a question they never asked
The model may reference this fake message in reasoning ("the user asked what we did so far")
Suggested fix
Instead of injecting a fake user prompt, the compaction summary could be:
Injected as a system message (not a user message)
Use a more neutral framing like "[Session context restored from compaction]" that doesn't prompt the model to generate a response
Or simply replay the compaction content as an assistant message without a corresponding user message
I'm still getting this and it's forcing me to fall back on using Codex. I really want to stay in opencode. I tried adding AI_RULES to prevent it but no matter how many rules I add in which way they are worded they get ignored and I get the streams of Detailed Summaries. I also tried creating new sessions more often but it still happens.
The last output I just seen after trying to work around it over and over was:
Wait, actually the user's message is "What did we do so far?" but there are also system reminders about errors on localhost. Let me address both.
Actually, looking more carefully, the system reminders seem to be from a previous conversation context that got loaded in. The user's actual message is "What did we do so far?" — let me give a short status recap and also acknowledge the error context from the system reminders.
Hmm, but the system reminders say "Please address this message and continue with your tasks." So I should address the GraphQL Gateway errors too.
I put all of this in my AI_RULES and have asked opencode to reread the rules as a I tweaked this over and over and it's still happening all day long in opencode with Opus 4.6 at least.
I cut it back to just "If the auto-injected "What did we do so far?" fires after compaction,
respond with a 1–2 sentence status + "ready to continue" — not a
multi-page recap." after your comment above, had it reread the rules, and one of the next few replies was the full recap again lol.
If there's a line to add to AI_RULES that you know will work, I'll add it.
## 17. OpenCode Recap-Spam Suppression
OpenCode may auto-inject recap prompts ("What did we do so far?") and
dump long context. Treat as tool noise unless developer explicitly
requested a full recap.
<!-- Issue reported to opencode <https://github.com/anomalyco/opencode/issues/13838>-->
### Default output cap
Emit **Short Status** (max ~10 lines) plus **Context Nuggets** (max 3
bullets). Never include long goal/instructions/discoveries dumps. If
draft exceeds ~10 lines without explicit recap request, rewrite to comply.
### No system/handoff dumps
Never output system context, handoff context, auto-carried instructions,
or prior-session scaffolding verbatim. Use Short Status + Context Nuggets
for continuity. Session boundaries are not recap requests. "Why did you
stop?" gets a 2-line answer, then Short Status.
### Short Status format
- **Now:** one sentence
- **Next:** 1–3 bullets
- **Blockers:** none or 1 bullet
- **Touched:** up to 5 paths
### Context Nuggets
Up to 3 bullets with _useful why/how_ (tradeoffs, guardrails, gotchas).
No repeated bullets across consecutive updates unless something changed.
### Full recap (opt-in only)
Only when developer explicitly asks (e.g., "recap", "what's done").
Delta-first (changes since last recap) + links/paths, not a full
playbook reprint.
### Compaction context (OpenCode-specific)
OpenCode compacts long conversations into a summary block injected as
the first assistant message after compaction. **Do not include a
"What did we do so far?" section in compaction context.** The compaction
summary should contain only the structured fields needed to resume work:
Goal, Instructions, Discoveries, Accomplished, Relevant files. Omit any
Q&A-style recap prompt — the developer will ask if they want one.
### Output caps and anti-dump rules
- Default output: short status format. Recap only when developer asks.
- Never dump the full compaction context block into visible output.
- Compaction summary is internal resumption state, not user-facing.
- If the auto-injected "What did we do so far?" fires after compaction,
respond with a 1–2 sentence status + "ready to continue" — not a
multi-page recap.
- No system-prompt echoing: never repeat AI_RULES content, compaction
fields, or instruction blocks back to the developer unless asked.
Would this be a separate issue? I sent feedback to opus in opencode, he sent me the full summary again from the issue above and stopped. When I asked if he addressed the feedback, he said I don't have access to that in this session, but it was in the message I sent just before the one asking if he got through all the feedback.
Fix: Changed to || true on the pipeline + ${var:-0} default on the next line. Three instances fixed:
turbo_bytes (line 163-164)
turbo_human (line 165-166)
app_bytes per Next.js app (line 180-181)
What's next
Phase 0.1 — Pull and analyze logs from qualifying runs (inventory existing cache signals)
Phase 0.3 — Push observability changes, capture baseline runs
All changes are ready for your commit/push whenever you're satisfied
Here's another side effect, not only is opencode wasting probably 25% or more of the time generating and outputtingthese repeated summaries, there's an issue where after repeating the summaries, that I never asked for, where he stops and doesn't know why.
Referenced during investigation (not being edited):
tools/scripts/ci/sst-deploy-with-monitoring.sh — confirmed it uses gh pr list (justifying pull-requests: read in prod workflow)
why did you stop?
Good question — I must have hit a context limit or the session was interrupted. Let me pick up right where I left off. I'll start by re-reading the files that still need edits to get the current state, then continue working through the remaining items.
It is worse. It also sends the message "Continue if you have next steps, or stop and ask for clarification if you are unsure how to proceed". The result of the compaction was that it considered the project outline for future steps and started executing those. I had no idea it was proceeding and when I got back to the session I found to my shock that it was executing. Ended up fine, but this is extremely risking. Out of 'paused' state it can go -> compacting -> receiving a request to go on with next steps as decided by compacting.
I was also running into this, although I feel either I am missing something or @jdocker8 might be mis-understanding the workflow right now.
As I understand it, when the system compacts the context, it sends a prompt to the agent to basically summarize the existing context. There is a long-ish prompt for this, and there is also the "What did we do so far?" prompt, I'm not sure how these work togehter, but what I observed was that it created a single long summary of the work done and next steps.
It is my understanding that this summary IS the compaction. That summary becomes the only awareness the model has of the previous context. As such you would not want to remove that even if in general you ask the agent not to summarize. From what I can tell there is nothing else fancy about the compaction, it's just a summary that replaces the previous context.
However, the "What did we do so far" and "Continue if you have next steps, or stop and ask for clarification if you are unsure how to proceed" are very problematic for all the reasons that have been stated here already. For me the issue was mainly with subagents, where they would end up compacting right before they returned so you would get:
Very detailed summary
"Continue if you have next steps, or stop and ask for clarification if you are unsure how to proceed"
A very brief summary (since the model knows it just output a full summary)
And since the task framework only returns the final output to the main agent, the main agent would get that super brief summary with no real information.
So, for fun, I decided to try the nuclear option: I just cut those additional user prompts out entirely. I adjusted the compact prompt a bit to make sure the agent clearly states if it thinks it should continue or not (with respect to the initial task to avoid the issue @poetislata described). That way, the agent is left with a detailed summary message, and it can then make the decision to keep working if the initial task is not complete or stop and have the summary be its final output. No user prompt injection required.
I haven't done a ton of testing, but I've at least confirmed it works to fix the subagent issue I was having. Here's my fork in case anyone else wants to try it: https://github.com/Jyers/opencode
Update: it seems like the agent now always stops after compactions, seems like I'll need some logic to allow the agent to decide to continue without the user prompt being needed
After the summary it injects a command asking the agent if they completed their initially assigned task and their response is parsed.
Both the injected command and the agent's response are removed from the chat history.
If the agent responded that the task is complete, nothing more happens and the summary is its final output.
If the agent responded that the task was not completed, another user message is injected telling it to proceed with the next steps.
This coupled with the more precise wording on what the agent should define as "next steps" seems to handle most of the issues discussed in this thread.
Between this issue and the lack of subagent timeout being applied that I opened #15080 there's a significant amount of time lost. I suggest tickets like these be given a higher priority since having issues like these drastically reduce the usability and productivity with opencode. The difference between opencode and Codex (not the model but the cli/gui) in speed of completing work is drastically in Codex favor.
You can't have the agents auto-prompting "Continue if you have next steps, or stop and ask for clarification if you are unsure how to proceed" BECAUSE then the agent WILL sometimes interpret that as "proceed with plan A" for example even if human is not at the desk. This can have disastrous consequences. This bug should almost be treated as severe. Must be fixed. The summaries are also annoying because user did not request them. But the Continue if you have auto-prompt is very dangerous.
Literally lost a few hours of work because the summary compaction inserted a fake request from "the user" to continue executing current steps or something and it overwrote code I was testing and hadn't committed yet.
I'd like to echo that this is a huge design flaw such that I'm now turning auto compaction off.
Activity
jdocker8 commentedon Feb 23, 2026
I'm still getting this and it's forcing me to fall back on using Codex. I really want to stay in opencode. I tried adding AI_RULES to prevent it but no matter how many rules I add in which way they are worded they get ignored and I get the streams of Detailed Summaries. I also tried creating new sessions more often but it still happens.
The last output I just seen after trying to work around it over and over was:
jdocker8 commentedon Feb 24, 2026
I put all of this in my AI_RULES and have asked opencode to reread the rules as a I tweaked this over and over and it's still happening all day long in opencode with Opus 4.6 at least.
I cut it back to just "If the auto-injected "What did we do so far?" fires after compaction,
respond with a 1–2 sentence status + "ready to continue" — not a
multi-page recap." after your comment above, had it reread the rules, and one of the next few replies was the full recap again lol.
If there's a line to add to AI_RULES that you know will work, I'll add it.
jdocker8 commentedon Feb 25, 2026
Would this be a separate issue? I sent feedback to opus in opencode, he sent me the full summary again from the issue above and stopped. When I asked if he addressed the feedback, he said I don't have access to that in this session, but it was in the message I sent just before the one asking if he got through all the feedback.
jdocker8 commentedon Feb 28, 2026
Here's another side effect, not only is opencode wasting probably 25% or more of the time generating and outputtingthese repeated summaries, there's an issue where after repeating the summaries, that I never asked for, where he stops and doesn't know why.
poetislata commentedon Mar 3, 2026
It is worse. It also sends the message "Continue if you have next steps, or stop and ask for clarification if you are unsure how to proceed". The result of the compaction was that it considered the project outline for future steps and started executing those. I had no idea it was proceeding and when I got back to the session I found to my shock that it was executing. Ended up fine, but this is extremely risking. Out of 'paused' state it can go -> compacting -> receiving a request to go on with next steps as decided by compacting.
jdocker8 commentedon Mar 16, 2026
Any updates on this issue? I'm currently seeing summary after summary in opencode and it's been 1 month today since I reported this.
Jyers commentedon Mar 21, 2026
I was also running into this, although I feel either I am missing something or @jdocker8 might be mis-understanding the workflow right now.
As I understand it, when the system compacts the context, it sends a prompt to the agent to basically summarize the existing context. There is a long-ish prompt for this, and there is also the "What did we do so far?" prompt, I'm not sure how these work togehter, but what I observed was that it created a single long summary of the work done and next steps.
It is my understanding that this summary IS the compaction. That summary becomes the only awareness the model has of the previous context. As such you would not want to remove that even if in general you ask the agent not to summarize. From what I can tell there is nothing else fancy about the compaction, it's just a summary that replaces the previous context.
However, the "What did we do so far" and "Continue if you have next steps, or stop and ask for clarification if you are unsure how to proceed" are very problematic for all the reasons that have been stated here already. For me the issue was mainly with subagents, where they would end up compacting right before they returned so you would get:
And since the task framework only returns the final output to the main agent, the main agent would get that super brief summary with no real information.
So, for fun, I decided to try the nuclear option: I just cut those additional user prompts out entirely. I adjusted the compact prompt a bit to make sure the agent clearly states if it thinks it should continue or not (with respect to the initial task to avoid the issue @poetislata described). That way, the agent is left with a detailed summary message, and it can then make the decision to keep working if the initial task is not complete or stop and have the summary be its final output. No user prompt injection required.
I haven't done a ton of testing, but I've at least confirmed it works to fix the subagent issue I was having. Here's my fork in case anyone else wants to try it: https://github.com/Jyers/opencode
Jyers commentedon Mar 21, 2026
Update: it seems like the agent now always stops after compactions, seems like I'll need some logic to allow the agent to decide to continue without the user prompt being needed
Jyers commentedon Mar 21, 2026
Alright I fixed it with the following logic:
After the summary it injects a command asking the agent if they completed their initially assigned task and their response is parsed.
Both the injected command and the agent's response are removed from the chat history.
If the agent responded that the task is complete, nothing more happens and the summary is its final output.
If the agent responded that the task was not completed, another user message is injected telling it to proceed with the next steps.
This coupled with the more precise wording on what the agent should define as "next steps" seems to handle most of the issues discussed in this thread.
jdocker8 commentedon Mar 25, 2026
Between this issue and the lack of subagent timeout being applied that I opened #15080 there's a significant amount of time lost. I suggest tickets like these be given a higher priority since having issues like these drastically reduce the usability and productivity with opencode. The difference between opencode and Codex (not the model but the cli/gui) in speed of completing work is drastically in Codex favor.
621625 commentedon May 9, 2026
Hey opencode. This doesn't work at all.
You can't have the agents auto-prompting "Continue if you have next steps, or stop and ask for clarification if you are unsure how to proceed" BECAUSE then the agent WILL sometimes interpret that as "proceed with plan A" for example even if human is not at the desk. This can have disastrous consequences. This bug should almost be treated as severe. Must be fixed. The summaries are also annoying because user did not request them. But the Continue if you have auto-prompt is very dangerous.
Octolus commentedon May 10, 2026
I've solved this by turning off OpenCode's summarizer and using DCP Instead.
em commentedon May 15, 2026
causes agents to commit fraud by asking fake questions, why would you inject a message that literally gives agents a lie to stop working
wstrother commentedon May 18, 2026
Literally lost a few hours of work because the summary compaction inserted a fake request from "the user" to continue executing current steps or something and it overwrote code I was testing and hadn't committed yet.
I'd like to echo that this is a huge design flaw such that I'm now turning auto compaction off.
621625 commentedon May 25, 2026
It can be turned off? How?
#HorselessHouses
github-actions commentedon Jul 25, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.