contextburn

ai.arsentevPublished by arsentev.aiv0.2.1Updated Oct 24, 2026

Run efficiency for coding agents: share of paid tokens that became output, not context re-reading.

VerifiedSTDIODesktop onlyDeveloper ToolsData & Analytics

Overview

AI-generated overview

Lets a coding agent read its own token run efficiency from local Claude Code transcripts, showing how much paid context became output.

What you can do
The package ships a dependency-free stdio MCP server with two tools: run_efficiency returns the token and cost-weighted shares as structured data, and spend_breakdown returns the full report. It parses the Claude Code transcripts already on the machine, deduplicates usage records by message id, and weights the cost share with per-model prices kept in the script. Nothing leaves the machine.
When to use it
Useful when you want an assistant to check mid-session how much of the paid context is being re-read rather than turned into output, or to compare run efficiency across sessions, models and working styles. It is aimed at Claude Code users who already have local transcripts.
Requirements
Runs locally over stdio, launched for example with uvx from the PyPI package contextburn. It needs Python 3 and reads local Claude Code transcripts under ~/.claude/projects. No accounts, API keys or network access are declared. Optional settings include CONTEXTBURN_LANG, CONTEXTBURN_DAY_START, CONTEXTBURN_WARN and CONTEXTBURN_ALARM.
Before you install
It reads local Claude Code transcript files, which may contain conversation content, though the README states nothing leaves the machine and there are no network calls. The cost-weighted share depends on a price table kept in the script, so it can go stale when prices change. Transcript support is limited to Claude Code for now.

Installation

In SourceWeft

  1. Open contextburn in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

[contextburn: real output over 24 hours — useful work 0.18% of tokens, context re-reading 98.4%, cost-weighted useful work 6.7%, one useful token costs 555 paid tokens]

[DOI 10.5281/zenodo.22712985]

contextburn reads the transcripts Claude Code already writes on your machine and tells you what share of the tokens you paid for became model output — and how much was the agent re-reading context it had already sent.

Token counters answer "how much did I spend?". This answers "how much of it was work?" — a normalised share, so it can be compared across sessions, models and ways of working.

Try it

bash
cp bin/contextburn ~/bin/contextburn && chmod +x ~/bin/contextburn   # python3 only, no dependenciescontextburn detail 24

Demo

[contextburn detail 72 over the 36 experiment runs: 168 sessions, useful work 1.44% of tokens, context re-reading 94.4%, cost-weighted 28.8%]

Real output over the session logs of the 36 runs behind the U-curve report — nothing else on the machine. Video with DOI: 10.5281/zenodo.22713920. The runs themselves are open: Hugging Face (DOI 10.57967/hf/10366) · Kaggle · OSF (DOI 10.17605/OSF.IO/5QTWY).

Why two numbers

[Same 12 tasks, one long session versus twelve short, 3 runs each: token efficiency 1.11% vs 1.12%, no difference; cost-weighted efficiency 31.6% vs 24.6%, seven points apart]

  • By tokens the share barely moves. Every agent step resends the accumulated context, so re-reading dominates whatever you do — it describes the agent.
  • Cost-weighted the share does move, because cached reads are priced far below fresh input and output. It depends on how you run sessions — it describes you.

The comparison above comes from a controlled experiment with its dataset and analysis scripts: Clear Every Third Task: A Measured U-Curve in the Context Economy of Coding Agents.

How it counts

  • Reads local Claude Code transcripts (~/.claude/projects/**/*.jsonl). Nothing leaves the machine — no network calls at all.
  • Deduplicates usage records by message id and keeps the element-wise maximum. A streaming runtime writes an early snapshot and a final record for the same call: counting both double-counts it, keeping only the first halves the output.
  • Weights the cost share with per-model prices kept at the top of bin/contextburn. Update them there when they change.

Commands

commandwhat it shows
contextburnwhat is burning tokens right now
contextburn detail [hours]run efficiency, sessions, and what specifically inflated the context
contextburn windowthe current 5-hour subscription window
contextburn --jsonmachine-readable state (used by the menu-bar app)
contextburn --probe <hours>raw JSON dump of the parsed sessions
contextburn --efficiency [hours]run efficiency as JSON
contextburn mcpstart the MCP server

Configuration

settingdefaultmeaning
CONTEXTBURN_LANG or ~/.config/contextburn/langeninterface language: en or ru
CONTEXTBURN_DAY_START6hour your day starts — the daily total resets here
CONTEXTBURN_WARN30000000tokens/hour that turns the menu-bar counter yellow
CONTEXTBURN_ALARM90000000tokens/hour that turns it red

The language file exists because the menu-bar app is launched from Finder, where environment variables never reach it: echo ru > ~/.config/contextburn/lang switches both the app and the CLI.

MCP server

Let the agent read its own run efficiency mid-session. The package ships a dependency-free MCP server (stdio) with two tools: run_efficiency returns the shares as structured data, and spend_breakdown returns the full report.

bash
claude mcp add contextburn -- uvx contextburn mcp

Or install it as a Claude Code plugin, which registers the same server:

text
/plugin marketplace add arsentev-ai/contextburn/plugin install contextburn@contextburn

Editor extensions

Menu-bar app (macOS)

app/main.swift is a small status-bar app. It polls contextburn --json once a minute and shows the current burn rate with an hourly graph; click a bar to see that hour's breakdown.

bash
swiftc -O -o ContextBurn app/main.swift

Set CONTEXTBURN_BIN=/path/to/contextburn if the CLI is not in ~/bin or the usual Homebrew paths.

Limits

  • Claude Code transcripts only, for now.
  • The cost-weighted share is only as current as the price table in bin/contextburn.

Citing

Software DOI (all versions): 10.5281/zenodo.22712985. GitHub's "Cite this repository" button gives the reference; metadata is in CITATION.cff.

Author

Evgenii Arsentev — arsentev.ai · ORCID 0000-0002-9120-7298

This project was published as tokmon on its first day and renamed to avoid confusion with unrelated tools of that name; TOKMON_* environment variables still work.

License

MIT — see LICENSE.

Source: README.md at commit 2f7ac04

Tools

0
SourceWeft has not started this package in its sandbox yet, so its tools are not known.

Version history

1
  1. v0.2.1LatestSep 16, 2026

Score

50% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts