[FEATURE] Enhance compaction system with customizable prompts and compression formats

Resolved 💬 3 comments Opened Feb 21, 2026 by Seithx Closed Feb 25, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

I need more control over Claude Code's conversation compaction system to optimize token usage and preserve context relevant to my workflow. The current compaction system uses internal, non-configurable prompts and human-readable formatting that wastes tokens. When working on long coding sessions, I frequently hit context limits and lose important context because the compaction process doesn't understand what information is most valuable for my specific project and workflow.

Proposed Solution

I'd like to be able to configure custom compaction instructions through settings files (like .claude/compaction.md or settings.json) that specify:

What types of information to preserve during compaction (e.g., function definitions, error messages, architectural decisions)
Custom follow-up instructions that apply after compaction
Compression format preferences (human-readable vs machine-optimized formats like pipe-delimited)
The /compact command should accept optional custom instructions, and auto-compaction should respect these user-defined preferences. The interface should show current compaction settings and allow easy switching between different compaction strategies.

Alternative Solutions

I've tried working around this by manually running /compact more frequently, but this still uses the same internal prompts. I've also attempted to add custom instructions in my CLAUDE.md file, but these don't affect the compaction process itself.

Priority

Medium - Would be very helpful

Feature Category

CLI commands and flags

Use Case Example

I'm working on a complex refactoring task that requires understanding the entire codebase architecture. The conversation spans multiple hours and includes important architectural decisions, error patterns, and debugging insights. When auto-compaction triggers, it summarizes in a generic way that loses the specific technical details I need. With custom compaction instructions, I could preserve function signatures, error messages, and architectural decisions while compressing less critical conversational fluff. This would save me time because I wouldn't need to re-explain context or restart conversations when compaction loses important information.

Additional Context

The current compaction system was made instant in v2.0.64 and supports automatic compaction that can be toggled via /config .

Pipe-delimited compression formats would be more token-efficient than human-readable summaries since LLMs don't need human-friendly formatting to process compressed context effectively.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗