ctx-receipt is a command-line tool for inspecting the preloaded context of AI coding assistants. It helps developers understand what assistants such as Claude Code, Codex CLI, Cursor, and Gemini CLI have already loaded before the first prompt is entered, and how many tokens that content consumes.
Purpose
AI coding assistants preload instruction files, skill descriptions, and MCP tool definitions at startup. When a project uses multiple assistants and multiple MCP servers, it is difficult to see the cost of this preloaded content in one place. ctx-receipt scans the project directory and the user home directory configuration, finds what each assistant will load, and prints a receipt showing token estimates for each item.
Key capabilities
- Unified cross-assistant view: Displays the preloaded content of Claude Code, Codex CLI, Cursor, and Gemini CLI side by side.
- Pre-session and CI integration: Can be run before starting a session, or in CI so that a growing CLAUDE.md or a newly added MCP server becomes visible in pull requests.
- Comprehensive counting: Counts rule files and their imports, skill lists, custom agents, automatic memory, and MCP tools, and distinguishes between always-loaded and on-demand content.
- Calibration against Claude Code's /context: Provides rough Claude tokenizer estimates based on comparisons with real projects.
- Shareable output: Supports
--svgto generate receipt cards,--mdto generate reports, and--jsonto generate JSON. - Secret safety: MCP configurations often contain API keys; ctx-receipt never prints them, and tests verify this.
Usage
Requires Node.js 20 or later. You can use npx ctx-receipt directly without installation, or install it via npm and then use it. Common commands include scanning the current folder and home directory configuration, and using --mcp to start and measure MCP servers.
Example:
npx ctx-receipt
In CI, you can use the GitHub Action to write the receipt to the job summary and fail the step when the total loaded amount exceeds the budget. You can also check with a one-line command:
npx ctx-receipt --no-user --budget 8000
Use cases
- Developers want to understand the context overhead of multiple AI coding assistants in a project.
- Teams monitor context budgets in pull requests to prevent rule files or MCP servers from bloating the context.
- Need to generate shareable context receipt cards or reports.
Limitations
- All token counts are offline estimates using the o200k_base tokenizer and differ from the results of each assistant's own tokenizer.
- Does not include each assistant's own system prompt and built-in tools.
- Cannot read settings stored inside the application rather than in files (such as Cursor's user rules and in-app toggles).
- Behavior is based on each assistant's official documentation (checked on 2026-11-12 and 2026-11-13); assistant updates may cause differences.
- Using
--mcpstarts MCP servers, which may use the network; by default no servers are started. - Only measures; does not rewrite or compress anything.