Session automatically compacted, destroying the entire working context #1934

Open
opened 2026-02-16 17:33:19 -05:00 by yindo · 5 comments
Owner

Originally created by @raymelon on GitHub (Oct 3, 2025).

Originally assigned to: @thdxr on GitHub.

Is this a normal behavior? The agent basically forgotten everything about the session.

It's a hassle to refresh the agent on the task at hand, let alone make it remember about every key detail about the session.

I just don't think compacting the session in the middle of build mode is ideal as well. It can cause the agent to go haywire since it starts to assume outrageous things.

Originally created by @raymelon on GitHub (Oct 3, 2025). Originally assigned to: @thdxr on GitHub. Is this a normal behavior? The agent basically forgotten everything about the session. It's a hassle to refresh the agent on the task at hand, let alone make it remember about every key detail about the session. I just don't think compacting the session in the middle of build mode is ideal as well. It can cause the agent to go haywire since it starts to assume outrageous things.
Author
Owner

@github-actions[bot] commented on GitHub (Oct 3, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #2234: compact causes llm to forget convo - Similar issue where Claude forgets conversation after compaction
  • #2736: Remove auto-compact (or at least don't default to having it on) - Discusses how auto-compact makes the agent forget critically important context
  • #2787: bug: Q is too eager to compact the context window - Reports premature compaction that causes the agent to lose its train of thought
  • #2707: Context summarization loses current working directory and project location - Shows how compaction causes loss of important context like working directory
  • #940: Preload instructions after /compact - Indicates that instructions are also lost during compaction

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Oct 3, 2025): This issue might be a duplicate of existing issues. Please check: - #2234: compact causes llm to forget convo - Similar issue where Claude forgets conversation after compaction - #2736: Remove auto-compact (or at least don't default to having it on) - Discusses how auto-compact makes the agent forget critically important context - #2787: bug: Q is too eager to compact the context window - Reports premature compaction that causes the agent to lose its train of thought - #2707: Context summarization loses current working directory and project location - Shows how compaction causes loss of important context like working directory - #940: Preload instructions after /compact - Indicates that instructions are also lost during compaction Feel free to ignore if none of these address your specific case.
Author
Owner

@arsham commented on GitHub (Oct 3, 2025):

You can /undo the compaction. I know it is not ideal but you get back to the previous state.

@arsham commented on GitHub (Oct 3, 2025): You can `/undo` the compaction. I know it is not ideal but you get back to the previous state.
Author
Owner

@fkukuck commented on GitHub (Oct 3, 2025):

How can we set OPENCODE_DISABLE_AUTOCOMPACT in the opencode.json?

@fkukuck commented on GitHub (Oct 3, 2025): How can we set OPENCODE_DISABLE_AUTOCOMPACT in the `opencode.json`?
Author
Owner

@rekram1-node commented on GitHub (Oct 3, 2025):

@fkukuck you just need to export OPENCODE_DISABLE_AUTOCOMPACT

@rekram1-node commented on GitHub (Oct 3, 2025): @fkukuck you just need to export `OPENCODE_DISABLE_AUTOCOMPACT`
Author
Owner

@fkukuck commented on GitHub (Oct 10, 2025):

I've opened a PR to set this setting easier
https://github.com/sst/opencode/pull/3078

@fkukuck commented on GitHub (Oct 10, 2025): I've opened a PR to set this setting easier https://github.com/sst/opencode/pull/3078
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1934