[Bug] Message history token calculation exceeds context window limit

Resolved 💬 4 comments Opened Feb 6, 2026 by jmclaughlin724 Closed Mar 6, 2026

Bug Description
Messages size is egregiously incorrect. It's miscalculating context size and causing rapid, inaccurate messages bloat causing context to spike. It's unusable for more than 2-3 messages at this point.
❯ /context
⎿ Context Usage
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ claude-opus-4-6 · 126k/200k tokens (63%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁
⛀ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛀ Estimated usage by category
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ System prompt: 17.6k tokens (8.8%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ System tools: 23.3k tokens (11.6%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ MCP tools: 11.5k tokens (5.7%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ Custom agents: 5.1k tokens (2.6%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ Memory files: 6.2k tokens (3.1%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ Skills: 5.7k tokens (2.9%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ Messages: 267.8k tokens (133.9%)
⛝ Autocompact buffer: 33k tokens (16.5%)

Environment Info

  • Platform: darwin
  • Terminal: ghostty
  • Version: 2.1.34
  • Feedback ID: a6625764-6d8a-4fc2-83da-b845bc891e5c

View original on GitHub ↗

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