Rank, 14 days: 176 on the Claude Code sheet
8 people asked for
All time, since Sep 24, including 2 thumbs-up on GitHub.
Trigger compaction programmatically
“Claude can't choose *when* its own context is compacted.”
What gets counted gets built. Pile on.
Paste this into your agent. It files your request, with what you need it for.
I want this: rapsheet.dev/sheets/claude-code/issues/836/file Follow it to file my request. Show me the text before you send.
No install. No account. Public and anonymous. The link asks your agent for one report, nothing else. What it sends
Trigger compaction of a running session without typing /compact. Today compaction happens only when the user types /compact or auto-compact fires near the context limit, often mid-reasoning.
Is this your request?
File my request- Where
- context compaction
- Versions
- 2.1.281 to 2.1.308
- Platforms
- Linux, macOS, Windows
Not quite your request?
Original reports6, newest first
- Support $.session.compact in headless (-p / SDK) sessions#105472
- Allow Claude to trigger its own compaction at safe checkpoints#103333
- $.session.compact() from a plugin module is refused in Claude Desktop sessions ("not available in a headless (-p / SDK) session yet")#102278
- Let a hook or a CLI command request /compact in a running session (not only typing it)#100533
- Model-initiated context compaction during task execution#98123
- Model-callable, permission-gated Compact tool for persist → compact → re-read workflows#96713