[BUG] Context window shows 45k autocompact buffer on fresh session with no conversation history

Resolved 💬 3 comments Opened Oct 24, 2025 by centricle Closed Oct 28, 2025

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?

Description

When starting a completely fresh Claude Code session, the /context command shows a 45k token autocompact buffer and 63k total tokens used (31%), despite only loading system prompts, tools, and memory files that should total ~17.6k tokens.

Impact

This might just be a bug in the output of the /context tool, but my expectation would be that the autocompact buffer shouldn't exist yet (no conversation to compact). So either /context is misreporting the actual token usage or something else is happening that I've been unable to find in the docs.

Also could be that the Autocompact _buffer_ is just reserved context space? But reporting it as "used" seems odd/confusing, making it difficult to understand actual available context space, because it's unclear if this phantom buffer actually reduces available working context or not.

Reproduction Output:

~ % mkdir claude-context-test && cd claude-context-test
claude-context-test % claude --version
2.0.26 (Claude Code)
claude-context-test % claude

╭─── Claude Code v2.0.26 ─────────────────────────────────────────────────────╮
│                                       │ Tips for getting started            │
│          Welcome back ksmith!         │ Ask Claude to create a new appor c… │
│                                       │                                     │
│───────────────────────────────────────│                                     │
│                ▐▛███▜▌                │ Recent activity                     │
│               ▝▜█████▛▘               │ No recent activity                  │
│                 ▘▘ ▝▝                 │                                     │
│                                       │                                     │
│        Sonnet 4.5 · Claude Max        │                                     │
│   /Users/ksmith/claude-context-test   │                                     │
╰─────────────────────────────────────────────────────────────────────────────╯

/context
⎿
    Context Usage
    ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛀ ⛁ ⛀   claude-sonnet-4-5-20250929 · 63k/200k tokens (31%)
    ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶
    ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ System prompt: 2.2k tokens (1.1%)
    ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ System tools: 13.2k tokens (6.6%)
    ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ Memory files: 2.2k tokens (1.1%)
    ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ Messages: 8 tokens (0.0%)
    ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛶ Free space: 137k (68.7%)
    ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛝ ⛝ ⛝   ⛝ Autocompact buffer: 45.0k tokens (22.5%)
    ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝
    ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝

Memory files · /memory
└ User (/Users/ksmith/.claude/CLAUDE.md): 2.2k tokens

SlashCommand Tool · 0 commands
└ Total: 864 tokens

What Should Happen?

  • Autocompact buffer should be 0 tokens
  • Total usage should be ~17.6k tokens (matching the itemized sum)
  • Used percentage should be ~8.8% (17.6k/200k), not 31%

Error Messages/Logs

Steps to Reproduce

  1. Create new, empty directory
  2. Run claude to start a new session
  3. Run /context as the first and only command
  4. Observe the token usage breakdown

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.26 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

_No response_

View original on GitHub ↗

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