anomalyco / anomalyco/opencode
[FEATURE] Add auto-compact threshold for long sessions
Open
@nexxeln is already working on this.
Since Aug 2, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Problem
Currently opencode TUI has no automatic context compression. After long sessions, context grows uncontrollably (observed 160K+ tokens), forcing manual compact command.
Proposed Solution
Add configuration for automatic compression:
{
"session": {
"maxContextTokens": 120000,
"autoCompactThreshold": 0.75
}
}
When context reaches 75% of max, auto-trigger compact to ~40-50% threshold.
Why
- Openclaw has similar auto-compact feature (works well)
- Qwen3.5-122B has 128K context limit, 75% (96K) is safe operational threshold
- Current manual workflow is error-prone for long debugging sessions
Impact
- Preserve session continuity without manual intervention
- Prevent GPU memory overload during long tasks
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.