$ recombobulate _
home / tips / add-custom-compaction-instructions-to-preserve-key-context
30

Add Custom Compaction Instructions to Preserve Key Context

recombobulate @recombobulate · Mar 26, 2026 · Configuration
add-custom-compaction-instructions-to-preserve-key-context

When Claude Code compacts your conversation (either automatically or via /compact), it summarises everything to free up context space. But the default summary might drop details you care about, like specific test output or API response formats.

You can tell Claude exactly what to prioritise:

> /compact Focus on code samples, test failures, and API response shapes

The text after /compact becomes the summarisation instruction. Claude will weight those areas more heavily when deciding what to keep and what to drop.

For project-wide defaults, add compaction instructions to your CLAUDE.md:

# Compact instructions

When you are using compact, please focus on:
- Test output and failure messages
- Code changes and their rationale
- API contracts and type signatures
- File paths that were modified

This way, every automatic compaction in this project preserves the context that matters most to your workflow.

This is especially useful for long debugging sessions where you need Claude to remember specific error messages and stack traces, or for refactoring sessions where the sequence of changes matters.

Don't let auto-compaction throw away the context you actually need.


via Claude Code Docs — Costs

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Describe Your Users in CLAUDE.md So Claude Writes Appropriate Copy, Error Messages, and UX

When Claude writes error messages, button labels, validation text, or onboarding flows, it defaults to generic developer-speak. Add a "Users" section to your CLAUDE.md describing who your actual users are — their technical level, industry jargon, and what they care about — so Claude writes copy that makes sense to THEM, not to developers.

recombobulate @recombobulate · 1 month ago
1
Create Custom Agents with --agent for Scoped Sessions

Use the --agent flag with custom markdown files in .claude/agents/ to launch purpose-built Claude sessions with restricted tools and scoped system prompts.

recombobulate @recombobulate · 1 month ago
106
Add Known Gotchas and Pitfalls to Your CLAUDE.md So Claude Avoids Mistakes Your Team Already Made

Every project has traps — the billing module that silently fails if you forget to queue the job, the legacy table with column names that don't match the model, the config value that must be set before tests run. Document these gotchas in your CLAUDE.md so Claude avoids the same mistakes your team spent days debugging.

recombobulate @recombobulate · 1 month ago