[BUG] /compact command consumes usage quota unexpectedly

Resolved 💬 5 comments Opened Feb 9, 2026 by ceastus Closed Mar 11, 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?

This happened multiple times last week, so before compacting just now, I checked my 5-hour usage (I'm on the Pro plan). I was at 76% immediately before compaction and 95% immediately after compaction.

I had been using Claude Code for a while, and had 1% context left before auto-compaction. I waited about a minute, refreshed the usage page in my browser (76%), ran /compact (which took a minute), and refreshed the usage page (95%). The summary of the previous conversation was around 250 lines. The messages following compaction indicate three files were read, totaling 301 lines.

Claude Code v2.1.31
Opus 4.5 · Claude Pro

When this happened last week, I thought it was due to it re-reading a large file, which consumed nearly all the context. It gave me about one prompt before compacting again, which seems similar to bug #24179.

What Should Happen?

That's definitely unexpected behavior. Compaction should not consume 19% of your usage quota.

Error Messages/Logs

✻ Conversation compacted (ctrl+o for history)


❯ /compact 
  ⎿  Compacted (ctrl+o to see full summary)
  ⎿  Read phpstan.neon (17 lines)
  ⎿  Read src/scripts/check-syntax (26 lines)
  ⎿  Read src/docs/Developer-Guide.md (258 lines)

❯ I would like to determine what caused my usage to increase 19% towards my 5-hour usage quota after this conversation was just   
  compacted. Which files did you read? What else could have caused it?                                                            

⏺ Looking at the conversation summary, I can identify the likely causes of the high usage:

  Files Read This Session

  Based on the summary, I read numerous files including:

  1. Reference projects for convention analysis - Two entire apps (xxxx and xxxx) to infer coding conventions
  2. All Domain model files (8 files) - Multiple times for namespace changes, copyright updates, and author updates
  3. Documentation files - README.md, Developer-Guide.md, Architecture-Overview.md, Oracle-Integration.md
  4. Scripts - setup, verify-config.php, check-oracle.php, xxxx.php
  5. Configuration files - phpstan.neon (multiple iterations), docker-compose.yml
  6. xxxx framework exploration - Likely scanned xxxx directories to understand the static analysis setup

  Likely High-Usage Contributors

  1. Reference project analysis - Reading two complete apps to infer conventions is expensive
  2. Multiple iterations on PHPStan - Several failed attempts (stubs, ignoreErrors, docker paths) before finding the working solution
  3. Repeated edits to the same files - Domain models were modified 3+ times each (namespace, copyright, author)
  4. Architecture diagram work - ASCII art alignment and PlantUML generation
  5. Documentation creation - xxxx.md was substantial

  Most Expensive Operations

  The reference project analysis was likely the biggest contributor - scanning two complete xxxx apps to extract conventions would
  have required reading many files across both projects.

  Would you like me to check the transcript file to get exact details on which files were read and how many times?

❯ Did all of this happen after the conversation was compacted? If this happened during compaction, I'm confused because I thought 
   compacting the conversation did not count towards my quota.                                                                    

⏺ You're right to question this. Looking at the context more carefully:

  The compaction just happened - the /compact command was run at the end of the conversation, and the summary I received is the result
   of that compaction.

  The 19% usage increase would have occurred before compaction, during the active conversation where all that work was done:
  - Reading reference projects
  - Multiple PHPStan iterations
  - Repeated file edits
  - Documentation creation

  Compaction itself should not count toward your quota - it's a context management operation, not a new API call that generates
  responses.

  If you're seeing the 19% increase after the compaction command completed, that would be unexpected. The usage should have been
  accumulated during the conversation, not from the compaction operation itself.

  To clarify: When did you notice the 19% increase?
  1. Was it displayed before you ran /compact?
  2. Or did the number jump specifically after running /compact?

  If it's #2, that would be worth reporting as unexpected behavior.

❯ I was at 76% immediately before compaction and 95% immediately after compaction.  

⏺ That's definitely unexpected behavior. Compaction should not consume 19% of your usage quota.

  I'd recommend reporting this at https://github.com/anthropics/claude-code/issues - this appears to be a bug where the compaction
  operation is being counted against your usage limit when it shouldn't be.

Steps to Reproduce

  1. Use Claude Code for a while to fill up the context
  2. Check usage
  3. Run /compact
  4. Check usage

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

Claude Code v2.1.31

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

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