spiiritual/claude-code-stuff/tree/main/plugins/better-compaction
better-compaction
턴이 끝날 때까지 자동 압축을 미루고 설정 가능한 effort 수준으로 요약하면서 프롬프트 캐시를 보존하는 Claude Code 플러그인입니다.
이 mod 소개
better-compaction은 claude-code-stuff 플러그인 marketplace를 통해 배포되는 Claude Code 모드입니다. 압축 방식을 두 가지로 바꿉니다. 모델 턴이 끝날 때까지 자동 압축을 기다리며(컨텍스트가 설정 가능한 임계값, 기본 80%,을 넘거나 prompt-too-long 오류가 발생한 경우 제외), 자체 effort 수준(기본 medium)으로 요약을 실행하면서 같은 모델을 유지해 프롬프트 캐시를 보존합니다. CLAUDE_CODE_ENABLE_FUNCTION_HOOKS로 function hooks를 활성화해야 합니다. /config에는 deferCompaction, deferUnderPercent 및 compactionEffort 설정이 노출됩니다. 헤드리스 모드에서는 지연된 압축이 다음 프롬프트 시작 시 실행됩니다. 저장소에는 whiteboard-defense 플러그인도 포함되어 있습니다.
설치
먼저 작성자의 README에서 marketplace와 플러그인 이름을 확인하세요. 저장소 구조에 따라 명령어가 달라질 수 있습니다.
claude plugin marketplace add spiiritual/claude-code-stuff claude plugin install better-compaction
원문 / README
claude-code-stuff
A Claude Code plugin marketplace.
/plugin marketplace add spiiritual/claude-code-stuff
/plugin install better-compaction@claude-code-stuff
better-compaction
A Claude Mod that fixes two things about compaction:
- Waits for the turn to end. Auto-compaction no longer interrupts the model mid-turn; it runs as soon as the turn finishes. Past 80% of the context window (configurable), or after a prompt-too-long error, it compacts mid-turn as usual.
- Summarizes at its own effort. The summary runs at a lower effort than the conversation (default
medium). The model stays the same, so the prompt cache is kept. Subagents running during a summary keep their own effort.
Mods need function hooks on. Add this to ~/.claude/settings.json:
{ "env": { "CLAUDE_CODE_ENABLE_FUNCTION_HOOKS": "1" } }
Settings, in /config:
| Option | Default | |
|---|---|---|
| deferCompaction | on | Wait for the turn to end before compacting |
| deferUnderPercent | 80 | Stop waiting once the context is this full (% of the window) |
| compactionEffort | medium | inherit, low, medium, high, xhigh or max |
Measured on a 214k-token session (3 runs each, recall quiz of 22 facts):
| Effort | Summary time | Quiz | |---|---|---| | low | 31s | 20.2 | | medium | 46s | 20.8 | | high | 59s | 20.7 | | xhigh | 76s | 19.8 | | max | 164s | 20.8 |
Recall was the same within noise at every level, while time grew with effort.
In headless mode (-p, SDK) the deferred compaction runs at the start of the next prompt instead of right after the turn.
whiteboard-defense
/plugin install whiteboard-defense@claude-code-stuff
For Mitchell Hashimoto's whiteboard defense: you should be able to explain any customer-facing system you ship and defend its decisions, even if Claude wrote the code.
/whiteboard-defense planreplaces the written plan. Claude draws the system as a real diagram, asks you the decisions that matter as consequence stories ("server dies mid-refund: customer charged with no refund, or refund 30s late?"), then has you explain it back./whiteboard-defense grillquizzes you after building: why X over Y, what a malicious user can do, where it fails. Answers are graded against the code, and drift from the plan is flagged.
Plans are saved as cards in the plugin's data folder, never in your repo.
The diagrams are pictures drawn in the transcript by a mod, so they need function hooks on (see above), macOS (it renders with the built-in qlmanage), and a terminal that shows images (Ghostty, kitty, iTerm2, WezTerm; not tmux). Anywhere else you get a text diagram.
