Feature request: let the agent self-manage its context window when it detects degradation

Open 💬 2 comments Opened Jun 13, 2026 by SomeoneIsWorking

Summary

Allow the agent to detect its own context-window degradation and manage its context autonomously (self-compact / summarize-and-rehydrate / signal "start fresh"), instead of relying on the human to notice and intervene.

Problem

In very long single-context sessions (e.g. iterative build → test → diagnose reverse-engineering loops), the agent's effectiveness visibly degrades as the window fills:

  • It re-reads files it already read, and repeats earlier mistakes (e.g. disassembling a stale memory dump, or reading main RAM instead of an MMIO register it had already located).
  • It loses track of which artifacts/dumps are current.
  • Per-step cost rises (huge tool outputs re-enter context) while quality drops.

The human can see this happening, but the available levers are awkward:

  • /clear and /compact typed mid-turn don't reliably interrupt/reset an in-flight agent (observed: repeated /clear had no effect while the agent was working).
  • The agent itself has no first-class way to trigger context management — it can only keep going (getting less effective) or stop and ask the human to start a fresh session.

Request

Give the agent the ability to:

  1. Detect degradation (heuristics: context-fill %, repeated reads of the same file, re-derivation of facts already established, declining edit/verify success rate).
  2. Act on it autonomously:
  • self-trigger a compaction/summarization and continue from a clean summary;
  • checkpoint durable state and re-hydrate from it (agents already tend to commit findings to repo docs — let them re-read those instead of the full transcript);
  • or surface "I'm degraded — recommend a fresh context" as a first-class, reliable signal/action.

Why it matters

Long autonomous debugging/porting sessions naturally outgrow a single window. Today the human has to babysit context health and manually reset at the right moment. Letting the agent recognize degradation and compact/reset itself (or hand off cleanly) would preserve output quality across long-running tasks without manual intervention.

Notes

Filed at a user's request, from a real multi-hour single-context engineering session where the agent's later-stage quality dropped and /clear//compact mid-session didn't take effect.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗