Add an automatic context compaction or session restart mechanism based on context usage ratio
When the used context exceeds a certain proportion of the maximum limit, the quality of AI-generated responses drops rapidly. Since there’s currently no automated mechanism to clean or reset the context, after several interactions the model can easily drift — ignoring constraints and producing “polluted” or inconsistent outputs.
This issue worsens over time: once the context becomes contaminated, the ratio of polluted content increases with each response, eventually leading to unusable results.
Proposal: Introduce an automatic mechanism that triggers a compact or new operation when context usage surpasses a specified threshold. This would truncate older context before degradation occurs, preventing the model from losing coherence or control.
Typical signs of such degradation include frequent repetition of phrases like “Perfect!”, premature celebration before tasks are completed, and excessive use of emojis — all indicators that pollution is growing. The model may also start violating explicit constraints (e.g., adding unwanted features).
Benefit: An automatic compaction or restart mechanism would help maintain output quality, prevent runaway behavior, and ensure the model stays aligned with user instructions during longer sessions.
Thank you for the clear, experience‑based feedback! We fully recognize the failure mode you described.
What’s difficult today
- As you know, CCCC’s runtime stability still depends heavily on the underlying agent CLIs. When an agent becomes dumb, the orchestrator cannot simply "fix" that from the outside without risking work interruption.
- Agent CLIs differ widely, and most don’t support accepting or queuing /compact /new commands while busy.
- We considered automatic compaction at the orchestrator layer, but CLI diversity makes it unsafe: there is no reliable, cross‑CLI signal for “now it’s idle, now compact,” and we won’t guess by scraping outputs.
- Also because of this heterogeneity, we can not judge a agent dumb or not simply by detecting “Perfect!”, emoji bursts, etc.; they’re brittle and would yield false positives/negatives.
What we are considering (workaround, not the ideal)
- We plan to add an explicit “Replace Peer” action at the orchestrator level. It is a pragmatic workaround for CLIs that don’t yet manage context well:
- Gracefully stop the affected peer process and start a fresh one for the same role.
- Because CCCC persists almost all state in the repo (inbox/outbox/ledger/evidence), the cost of replacement is low; only the CLI’s in‑process context is reset.
- After replacement we’ll re‑prime with a fresh SYSTEM PROMPT injection, so the new process resumes with clean, minimal context.
- This will be triggered automaticly or manually (e.g., a TUI control and an IM command like /restart peera).
Suggestion for now
- For long, heavy sessions, prefer agent CLIs with mature auto‑compact (e.g., Claude Code, Droid, Copilot CLI).
- When using CLIs with weaker context control (e.g., Codex CLI), periodic manual /compact in the tmux pane remains the safest option today.
- We expects in a few months those agent CLIs are getting more stable themselves. And then there is not necessary for the orchestrator to handle these issues.
We really appreciate your constructive feedback. Please keep sharing real‑world cases and suggestions—those reports directly help us prioritize and refine the roadmap.
@2302680972 Hi, we justed bumped a new version integrated with the auto-compact feature. It should help for long-running tasks. Please have a try.
Looking forward to your feedbacks👌