[BUG] Context compaction triggers too frequently and takes too long, disrupting workflow

Resolved 💬 3 comments Opened Mar 10, 2026 by YooClid Closed Apr 16, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Context compaction occurs very frequently during normal development sessions and takes a significant amount of time to complete, during which the user cannot interact with Claude.

Problems:

  1. Frequency: Compaction triggers multiple times per session, even during moderate-length conversations. In a single working session (~2-3 hours), compaction can occur 3-5+ times.
  2. Duration: Each compaction takes 30-60+ seconds, during which the user must wait with no progress on their task.
  3. Context loss: After compaction, Claude loses critical context — forgets rules it wrote to memory files, misidentifies data sources, and repeats mistakes that were already corrected earlier in the session.
  4. Cumulative impact: Frequent compaction + context loss + repeated corrections = significant productivity drain. The user ends up spending more time re-explaining than getting work done.

Real-world impact: In a trading system management session, compaction caused Claude to read a 3-day-old cache file instead of calling a live API (a rule explicitly saved to memory/critical_rules.md), resulting in position data that was 12x wrong (BTC showed 1.79M KRW vs actual 148K KRW).

What Should Happen?

  1. Compaction should trigger less frequently — optimize context usage to delay compaction
  2. Compaction should be faster (ideally under 10 seconds)
  3. After compaction, persistent memory files (especially critical_rules.md) should be re-read and actively applied, not just passively loaded

Error Messages/Logs

Steps to Reproduce

  1. Start a Claude Code session with a moderately complex project (40K+ lines codebase)
  2. Work for 30-60 minutes on tasks that involve reading files, running commands, and editing code
  3. Observe that context compaction triggers, pausing all interaction for 30-60 seconds
  4. After compaction, ask Claude to perform a task that was constrained by a rule written earlier in the session
  5. Claude violates the rule — the compaction summary did not preserve the constraint

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.71

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

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