[FEATURE] Allow custom instructions for auto-compact via settings or CLAUDE.md

Resolved 💬 4 comments Opened Dec 16, 2025 by mlaaaaden Closed Dec 20, 2025

Problem Statement

When auto-compact triggers, the generated summaries are often too generic and lose critical details like:

  • Specific file changes and paths
  • Error messages and debugging steps
  • Architectural decisions and their rationale
  • Function names, configuration values, and implementation details

This forces users to redo work after auto-compact because Claude loses context about what was already accomplished. The only current workaround is disabling auto-compact entirely and managing context manually.

Proposed Solution

Allow users to define custom instructions for auto-compact summaries via:

  1. settings.json option:
{
  "autoCompact": {
    "customInstructions": "Preserve all file paths, function names, error messages, debugging steps, and architectural decisions. Do not abstract or generalize."
  }
}
  1. CLAUDE.md section that gets respected during auto-compact:
# Auto-Compact Instructions
When compacting, preserve:
- All file modifications with exact paths
- Error messages verbatim
- Debugging steps taken
- Code patterns and architectural decisions
  1. PreCompact hook enhancement: Allow custom_instructions to be injected programmatically for auto-triggered compaction (currently only available for manual /compact).

Additional Context

  • Related issues: #6689 (--no-auto-compact flag), #11819 (configurable threshold), #3349 (pre/post compact hooks)
  • Current PreCompact hook receives empty custom_instructions for auto-trigger, making it impossible to influence summary quality programmatically
  • Many power users disable auto-compact entirely due to this limitation, losing the convenience feature

Expected Behavior

Users should be able to define what details matter most for their workflow, and auto-compact should respect these preferences when generating summaries.

View original on GitHub ↗

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