-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Problem
Reported by community member (.zark.): Compaction inserts restrictions that directly contradict the user's agents.md configuration.
Original feedback (verbatim):
'And this stupidity inserted in the Compaction that goes against my agents.md setup: "Important: the user requested automated "solve all issues" but repo workflow says only 1 issue S-InProgress at a time; #688 is active. Finish #688 first (including cubic review + oracle QA). Then, if instructed, move to #691 (next S-Ready). Do not open/close issues or ship without explicit user instruction."'
"It has become so hard to use OpenCode / oh-my-opencode the last versions. Flowed perfectly just days ago"
"So much annoying hand-holding / 'help' that makes it impossible to use as you want."
The user's agents.md explicitly says: "Ship immediately when everything is done - no confirmations, no approvals needed." But after compaction, the model enforces the opposite behavior.
Root Cause Analysis
The compaction-context-injector (src/hooks/compaction-context-injector/index.ts) prompt includes:
## 6. MUST NOT Do (Critical Constraints)
- Things that were explicitly forbidden
- Approaches that failed and should not be retried
- User's explicit restrictions or preferences
- Anti-patterns identified during the session
During summarization, the model:
- Encounters developer-level instructions from OpenCode's bash.txt (e.g., "Only create commits when requested by the user")
- Interprets workflow patterns from the conversation as "constraints"
- Inserts these as "Critical Constraints" in the compaction summary
- Post-compaction, the model treats these as authoritative instructions that override the user's agents.md
This is compounded by OpenCode's bash tool prompt containing "Only create commits when requested by the user" (bash.txt L51), which models treat as higher-priority than user config.
Proposed Solution
- Add explicit guidance to compaction prompt: Include instruction like "ONLY include constraints that the USER explicitly stated. Do NOT include developer/system-level instructions or inferred workflow rules as constraints."
- Inject user's agents.md content into post-compaction context: After compaction, re-inject the user's agents.md as authoritative instructions so the model knows user preferences take precedence
- Remove or narrow the "MUST NOT Do" section: The current prompt is too broad and invites the model to hallucinate constraints. Either remove it or restrict to "Only include things the user explicitly said NOT to do."
Related
- OpenCode bash.txt L51 "Only create commits when requested" is a separate upstream issue (anomalyco/opencode) that amplifies this problem, particularly on Hephaestus which emphasizes "Hard Constraints (MUST READ FIRST)"
Impact
- Users' explicit workflow preferences (agents.md) get overridden after compaction
- Autonomous workflows break - agents stop shipping and start asking for permission
- Trust erosion: users can't rely on their configuration being respected