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
Auto-compaction causes the subagent to lose its original context, possibly the system prompt as well #6535
I’m honestly frustrated, this is the second time it has happened.
I have a QA Specialist subagent whose prompt explicitly instructs it to perform only QA-related tasks. However, due to auto-compaction, it loses the original context provided by the main agent. As a result, it suddenly starts reading the planned features document and working on the next phase without my permission.
This is problematic because the subagent was specifically designed to handle QA tasks, not to build or implement new features.
How can I prevent this from happening again in the future?
The core issue appears to be that auto-compaction may be incompletely preserving the subagent's system prompt and specialized instructions. Issues #4483 and #4102 directly address similar problems where context or instructions are lost after compaction.
Feel free to ignore if none of these address your specific case.
also having similar issue, but with manual /compact. is this session context limit expected? even tho it might not be the best practice having large sessions, it is quite frustrating to lose like this
@esau-morais there are times when even compact attempts are over the token limit, so I would not be surprised that those using truncation to hack over this limitation would have other side effects. I feel like agents needs to carry on their "identity" in working memory, while other less important long-term memory can be parked into documents.
Activity
github-actions commentedon Dec 31, 2025
This issue might be a duplicate of existing issues. Please check:
The core issue appears to be that auto-compaction may be incompletely preserving the subagent's system prompt and specialized instructions. Issues #4483 and #4102 directly address similar problems where context or instructions are lost after compaction.
Feel free to ignore if none of these address your specific case.
rekram1-node commentedon Dec 31, 2025
Can u share a session this happened in?
opencode export > session.jsongasatrya commentedon Dec 31, 2025
@rekram1-node Here it is
session.json
esau-morais commentedon Jan 3, 2026
also having similar issue, but with manual
/compact. is this session context limit expected? even tho it might not be the best practice having large sessions, it is quite frustrating to lose like thisTomLucidor commentedon Jan 21, 2026
@esau-morais there are times when even compact attempts are over the token limit, so I would not be surprised that those using truncation to hack over this limitation would have other side effects. I feel like agents needs to carry on their "identity" in working memory, while other less important long-term memory can be parked into documents.
github-actions commentedon Mar 28, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.