ClaudeHack
0

Add Compact Instructions to CLAUDE.md so every /compact keeps what matters

Context Management·13 hours ago·verified 13 hours ago·easy·~5 min setup·verified

Declare a Compact Instructions section in CLAUDE.md so both manual /compact and autocompact preserve the project’s critical decisions by default.

The problem

Steering `/compact focus on …` works once, but autocompact still fires later with generic criteria and drops the constraints you always need.

The hack

Add a `## Compact Instructions` section to CLAUDE.md listing what must survive (active goal, open decisions, failing tests) and what to drop (rabbit holes, resolved debugging).

Why it works

Community playbooks and Anthropic’s compaction model: CLAUDE.md guidance applies to every compaction, including auto — project defaults beat one-off focus strings.

Setup

1. Open CLAUDE.md and add a short Compact Instructions section. 2. List must-keep items (current goal, API contracts, failing tests) and safe-to-drop noise. 3. During a long session, run `/compact` or wait for autocompact. 4. Confirm critical constraints still present via `/btw` or a quick probe question.

Additional details

Example section: ```markdown ## Compact Instructions Keep: current task goal, open design decisions, failing tests, API contracts. Drop: resolved rabbit holes, repeated tool output, abandoned approaches. ```

Source

anthropic·View original →·by Anthropic + community

Does this still work?

0 said it works · 0 said it's broken

Related

Discussion

No comments yet. Be the first to say whether this worked for you.