Feature Request: Allow PreCompact hook to suppress/minimize default compact summary

Resolved 💬 3 comments Opened Dec 5, 2025 by EmanuelFaria Closed Dec 9, 2025

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:

  1. Extracts strategic context (WHY/WHAT/HOW/CONTINUE_BY) from the transcript using Gemini 3 Pro
  2. Persists state to a PostgreSQL database
  3. 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 trigger field ("manual" or "automatic") which could gate this behavior
  • Could be opt-in via settings.json: "compactBehavior": "hookOnly"
  • Similar to how additionalContext works, this would give power users fine-grained control

View original on GitHub ↗

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