Compact Claude Code between tasks
The author built catnap, a Claude Code plugin that tells Claude at 50% context to finish its task, write a handoff, and trigger compaction itself.
After adopting catnap, 0 of 129 compactions hit mid-task, versus 78 of 82 before. It used 56% fewer tokens than default auto-compact.
Overview
How it was set up
Claude Code plugin using the mods feature (needs 2.1.287 or later). Thresholds at 50%, 60% and 70% context are all settings. Tested on Windows and Linux.
Worth knowing
Claude Code only. The memory test used made-up coding tasks on a 200K window. Lowering the default auto-compact threshold gets most of the way there.
A prompt to start from
The source does not show the prompt.
Sources 1
History
- Source published
- 2026-10-20
- Added to Agentic Feats
- 2026-10-26
- Pick
- No
- Markdown copy
- /c/compact-claude-code-between-tasks.md
More in setup and meta
38 featsResultTickets run unattended with per-turn cost receipts; one ticket reached $402 over nine runs before the cost showed in the app, which prompted a fix.
ResultEight identical TypeScript checks dropped from 22.32 s to 4.46 s on an M1 Pro, and digests cut context by about 97%.
ResultA demo shows Claude building the bat project (223 crates) with a single bar that fills during the build and turns green when done.