AgentReceipt

Adding an MCP server mid-session rewrites your whole cache

Tool definitions sit at the very start of every request. Change them and every cached token after them is invalid. What it costs, and how to spot it on a receipt.

Requests are cached as a prefix: tools first, then the system prompt, then messages. Anything that changes the tool list, such as connecting or reloading an MCP server, changes the first bytes of the prefix, and nothing after it can be read from cache.

On a receipt this looks like a large cache write with no idle gap and no model switch. AgentReceipt labels it “cache rewritten mid-session”.

How to fix it

  • Connect MCP servers before starting a task.
  • Avoid tools that change their own definitions during a session.
  • Edit CLAUDE.md between sessions.

See it in your own session

Drop the session file below. Every step this applies to is flagged on the receipt with what it cost and what fixing it would have saved.

Itemize your own session

Drop a Claude Code or Codex log. It is parsed in your browser, and you get your real numbers instead of a model.

Drop a session log here

Claude Code ~/.claude/projects/…/*.jsonl, a Codex rollout ~/.codex/sessions/…/rollout-*.jsonl, or the claude-code-action execution file.

Parsed in your browser. Your prompts and code never leave this tab.