
contextburn
ai.arsentev由 arsentev.ai 發布v0.2.1更新於 Oct 24, 2026
Run efficiency for coding agents: share of paid tokens that became output, not context re-reading.
概覽
讓程式開發助理從本機 Claude Code 紀錄讀取自身的 token 執行效率,顯示付費脈絡中轉為輸出的比例。
- 可以做什麼
- 這個套件附帶一個無相依性的 stdio MCP 伺服器,提供兩個工具:run_efficiency 以結構化資料回傳 token 與成本加權占比,spend_breakdown 回傳完整報告。它解析機器上既有的 Claude Code 紀錄,依訊息 id 去重使用紀錄,並用腳本中保存的各模型價格計算成本占比。資料不會離開本機。
- 適用情境
- 適合讓助理在對話進行中查看有多少付費脈絡被重複讀取而非轉為輸出,也適合跨工作階段、模型與工作方式比較執行效率。主要面向已有本機紀錄的 Claude Code 使用者。
- 執行需求
- 透過 stdio 在本機執行,例如用 uvx 從 PyPI 套件 contextburn 啟動。需要 Python 3,並讀取 ~/.claude/projects 下的本機 Claude Code 紀錄。未宣告需要帳號、API 金鑰或網路存取。可選設定包括 CONTEXTBURN_LANG、CONTEXTBURN_DAY_START、CONTEXTBURN_WARN 與 CONTEXTBURN_ALARM。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 contextburn,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
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
Demo
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
- 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
Configuration
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.
Or install it as a Claude Code plugin, which registers the same server:
Editor extensions
- VS Code-compatible editors (VSCodium, Cursor, Windsurf, Gitpod…) — Open VSX: arsentev-ai.contextburn. A status bar meter over the local CLI; source in
editors/vscode. - Raycast — source in
editors/raycast, Store submission pending.
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.
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.
來源:README.md,提交 2f7ac04
工具
0版本歷史
1- v0.2.1最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分