anomalyco / anomalyco/opencode
Add configurable token usage threshold alert for agents
Open
@kitlangton is already working on this.
Since Aug 22, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Problem
When a session approaches the token limit, compaction kicks in silently and older context gets summarized. By the time the user notices degraded quality, they've already lost detail from earlier in the conversation. There's no way to proactively know when to start a new session.
Proposed solution
Add a configurable compaction.alert option (e.g. 0.8 for 80%) that triggers a visible warning to the user when token usage crosses the threshold. This could be:
- A TUI notification/banner
- An agent-injected message in the conversation
- A configurable action (e.g. "warn", "auto-compact", "notify")
Config example
{
"compaction": {
"auto": true,
"alert": 0.8
}
}
Use case
Users working on long sessions (debugging, planning, large refactors) would benefit from knowing when to start a fresh chat to maintain conversation quality, rather than discovering context loss after the fact.
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.