Feature request: auto-checkpoint and context refresh at configurable threshold
Problem
When working on long multi-step tasks (especially with subagents that inflate context quickly), the conversation quality degrades as context fills up. Today the only option is:
- The agent manually notices it's near the limit
- The agent writes a checkpoint file
- The user manually types
/clear - The user manually pastes "Resume from <checkpoint-path>"
Steps 3 and 4 require user intervention for what should be an automatic process. The agent can miss the threshold (as it did for me today), and the user shouldn't need to babysit context management.
Proposed Solution
A configurable setting that triggers automatic context management:
{
"contextManagement": {
"autoCheckpointThreshold": 0.6,
"checkpointDir": "~/.cache/claude/states/",
"autoResume": true
}
}
When context remaining hits the threshold:
- System automatically runs a checkpoint protocol (saves session state to a file)
- System performs compaction or clear
- System resumes from the checkpoint — transparently to the user
Alternatively, expose a hook event like context_threshold_reached that users could wire up to custom behavior.
Workaround Today
A memory rule that tells the agent to proactively #save and suggest /clear — but this relies on the agent remembering to check, which is unreliable especially after large subagent returns that rapidly inflate context.
Context
Working on a large Chromium/GStreamer codebase with frequent subagent delegations (planner, coder agents). A single planner agent return can add 80k+ tokens to context, blowing past any threshold the agent was supposed to monitor.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗