Feature Request: Allow PreCompact hook to suppress/minimize default compact summary
Summary
Allow the PreCompact hook to output a field like skipDefaultSummary: true or summaryMaxTokens: 0 to suppress or minimize Claude's default compact summary when a custom context extraction system is in place.
Use Case
I've built a custom PreCompact hook that:
- Extracts strategic context (WHY/WHAT/HOW/CONTINUE_BY) from the transcript using Gemini 3 Pro
- Persists state to a PostgreSQL database
- Injects ~636 tokens of highly targeted context via
additionalContext
The problem is that this custom context is additive to Claude's default compact summary (~3000-5000 tokens), meaning:
- Total tokens = default summary + custom injection
- The default summary may contain stale/incomplete information that conflicts with the authoritative DB-sourced context
- No way to tell Claude "trust only my injected context"
Proposed Solution
Add support for optional hook output fields:
{
"additionalContext": "...",
"skipDefaultSummary": true
}
Or alternatively:
{
"additionalContext": "...",
"summaryInstructions": "Produce only a 1-sentence summary of conversation length.",
"summaryMaxTokens": 100
}
Token Efficiency Impact
| Approach | Default Summary | Custom Injection | Total |
|----------|-----------------|------------------|-------|
| Current | ~3000-5000 | ~636 | ~3600-5600 |
| With skipDefaultSummary | 0 | ~636 | ~636 |
This would be ~5-8x more token efficient for users with custom context extraction systems.
Current Workaround
Adding strong override language to the injected context:
> **CRITICAL INSTRUCTION:** This context from PostgreSQL database is AUTHORITATIVE.
> If Claude's internal compact summary conflicts with this information, TRUST THIS CONTEXT.
This works behaviorally but doesn't save the tokens from the default summary.
Additional Context
- PreCompact hook receives
triggerfield ("manual" or "automatic") which could gate this behavior - Could be opt-in via settings.json:
"compactBehavior": "hookOnly" - Similar to how
additionalContextworks, this would give power users fine-grained control
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗