Claude AI Session Compaction Issues and Workarounds

How Compaction Works
Claude sessions are stored as JSONL files at ~/.claude/projects/{encoded-cwd}/sessions/{id}.jsonl. Each conversation turn is a JSON block. When compaction triggers, original blocks remain in the file, but a new block with a compressed summary gets appended. After compaction, the model works from the summary instead of the full conversation history.
Test Results
With a coding project at 90% context fill (before the 1 million token increase), the user tested 10 questions covering simple recall, 6-hop dependency chains, entity disambiguation, negation chaining, absence detection, and conflict detection.
- Pre-compaction: ~9.75/10 accuracy with Opus 4.6 finding scattered facts across 418K tokens
- Post-compaction (Default): ~5/10 accuracy with 3,461 tokens (121x compression). Same session, same questions resulted in hallucinated incorrect answers.
- Post-compaction (Manual Opus): ~9.75/10 accuracy with 6,080 tokens (69x compression). Using a custom compaction prompt with Opus preserved important information.
Why the Difference
According to Anthropic's documentation, the API defaults to using the same model for compaction. The user was running Opus 4.6 on medium compute, so default compaction should have used Opus too. The quality difference suggests issues with the summarization prompt, thinking/compute budget, or both.
Workarounds
Approach 1: Opus Compaction - Turn off auto-compaction and implement a background process that measures token counts for Claude Code instances. Trigger compaction using Opus with a custom prompt (potentially with user authorization).
Approach 2: spaCy NER Pre-seeding - Instead of starting sub-agents with zero context, use spaCy NER to extract proper nouns, numbers, service names, ports, and key identifiers from project files. Inject this as a lightweight entity briefing (few hundred tokens) at startup to inform agents about existing resources without narrative bloat.
📖 Read the full source: r/ClaudeAI
👀 See Also

Claude Token Counter Updated with Model Comparison Feature
Simon Willison's Claude Token Counter tool now supports comparing token counts across different Claude models. The update reveals Opus 4.7 uses 1.0–1.35× more tokens than Opus 4.6 due to an updated tokenizer, potentially increasing costs by around 40% despite identical pricing.

EsoLang-Bench: A Coding Benchmark Using Esoteric Languages to Test LLM Reasoning
Researchers created EsoLang-Bench, a coding benchmark using esoteric programming languages like Brainfuck and Whitespace to test whether LLMs can reason or just pattern-match. The best result across GPT-5.2, O4-mini, Gemini, Qwen, and Kimi was 11.2%.

Claude-IDE-Bridge Now Works on Remote Servers for AI-Assisted Development
The Claude-IDE-Bridge tool now connects Claude AI to remote development environments on VPS or cloud machines, allowing access to live diagnostics, open files, and test failures from any device.

Hubcap Bridge: Persistent Two-Way Messaging Between CLI and Browser JavaScript via CDP
Hubcap Bridge is a new feature in the Hubcap CLI tool that creates a persistent two-way message channel between local processes and JavaScript running in browser pages via the Chrome DevTools Protocol. It enables Claude Code skills to interact with web apps through their internal JavaScript APIs without requiring public API access.