
agentburn
io.github.Socialpranker由 GitHub 帳號 Socialpranker 發布v0.14.0更新於 Oct 24, 2026
Local profiler: which usage window took you out, and where your agent's money goes
概覽
本機唯讀的用量分析器,讓助理回報自己的 token 用量與花費流向,並依用量視窗、來源與提交細分。
- 可以做什麼
- 回報整體消耗:總量、依來源(cron、子代理、閘道、命令列)的花費、夜間開銷、子代理彙總與固定開銷
- 回報用量視窗:尖峰與典型滾動 5 小時視窗對比、視窗被什麼填滿、實測上限與撞牆時間
- 回報上下文成本:上下文大小分布、在某個門檻執行 /clear 能省下多少、每個技能載入的成本
- 回報每次 git 提交與每個儲存庫的成本,僅讀取 git log
- 解釋行為面的發現,例如重複讀取迴圈、重試風暴與閒置心跳
- 產生可分享的匿名摘要卡片,只含類別、模型與總量
- 適用情境
- 適合讓助理自己回答關於其 token 消耗、訂閱視窗額度或 API 花費的問題,資料來自本機既有日誌。適用於使用 Claude Code、Codex CLI、Gemini CLI、opencode、OpenClaw 或 Hermes Agent,並想釐清哪個視窗或哪類工作最耗預算的人。
- 執行需求
- 以本機 stdio 程序在使用者機器上執行,透過 uvx 從 PyPI 套件 agentburn 啟動,因此需要 Python 與 uv。它會讀取受支援代理的本機日誌與資料庫檔案(例如 Claude Code 工作階段紀錄、Codex rollout、Hermes 狀態資料庫),並在使用者家目錄下寫入解析快取。未宣告需要帳號、API 金鑰或環境變數。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 agentburn,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
[PyPI] [Python] [zero deps] [tests] [MIT]
Claude Code · Codex CLI · Gemini CLI · opencode · OpenClaw · Hermes Agent — one normalized core, local, read-only, zero dependencies
You didn't run out on your average day
You ran out inside one window. On this machine that window was 5.4× the median one — same person, same week, same subscription.
Your assistant's own logs already know which window it was and what filled it. Nothing else on your machine does: the built-in counter shows a total, your invoice shows a total, and neither says which five hours took you out.
One command, no account, nothing leaves your computer:
Two ways agents cost you, two questions
Both read the same local logs. Neither invents a number the data doesn't contain.
[agentburn limits — peak window, typical window, what fills it]agentburn limits — the subscription view
Optimizing a subscription doesn't change your bill. It changes how far you get before you're cut off. That is a window problem, and windows need intra-session resolution — a single session routinely spans several of them.
-
Peak vs typical. Your worst rolling 5-hour window against the median of your own active ones. The ratio is the finding: a wall is hit by the peak.
-
What filled it — by model, by source (you / subagents / scheduled work), and by kind (cache reads vs cache writes vs output).
-
Measured against your own wall — automatically. Anthropic doesn't publish the formula behind those allowances, so agentburn refuses to invent a threshold. But Claude Code writes the cut-off into the transcript itself ("You've hit your session limit · resets 8:30pm"), and every one of those moments is a measured ceiling. With several, the ceiling is their median:
No cut-off in your logs yet?
--hit "2026-08-20 14:30"names one by hand. A measured ceiling is remembered in~/.agentburn/ceiling.json, so the status line below knows it too. -
Codex: the provider's own reading. Codex CLI writes
rate_limits.used_percentnext to every request. agentburn pairs each reading with your weighted usage of the same window and takes the median — a ceiling from the provider's arithmetic, not from a cut-off. Treat it as an estimate: that percentage counts every device and app on the account, while your local rollouts are only part of it — and when Codex stops reporting a window (plan or client change), a later peak is flagged as measured on earlier windows, not sold as an overrun. -
Time to wall. Ceiling minus the current window, divided by the pace of the last half hour. The number you actually want while working.
-
The week, too. The heaviest rolling 7-day span, how much of it this week already is, and a weekly ceiling when Claude Code recorded a weekly cut-off.
-
By project. Sessions record their working directory; the peak window is split by it.
agentburn statusline — the wall, live, inside Claude Code
One line, no colour, built for Claude Code's statusLine:
Reads only the last three days of logs (the ceiling comes from the state file), so it stays cheap enough to run on every turn.
agentburn context — what a long context costs
Every call re-reads its whole context, and on a subscription that re-reading is the window: a turn at 300k costs what three turns at 100k cost. Claude Code records the exact context size of every call, so this is measured, not modelled:
- The
/cleararithmetic — the part of every call's context above a threshold, at the cache-read rate: the honest saving of a restart habit, assuming the same work in shorter sessions. - Skill costs, measured — the context growth right after a lone
Skillcall, median of recent loads. Bundled skills never touch the disk; the transcript sees all of them. - By effort level — how much of the window each
effortsetting took. - Findings with a lever land in
agentburn fix: the restart threshold, and the heavy skills.
agentburn commits — what a commit cost you
Sessions record their working directory and branch; your repositories record when each commit landed. The usage between two consecutive commits is what the second one cost — read-only git log, nothing written:
Weighted tokens = tokens × published price ratios (cache read 0.1×, cache write 1.25×, output per model), normalized to one input token of the reference model. Every ratio is public; none of them is a guess about how the provider counts.
agentburn — the money view
- Where it burns — by source:
cron/subagent/gateway:telegram|discord|whatsapp/cli. Always-on ≠ free. - 🌙 While you slept — the overnight bill, isolated and named (
--night 23-7). - Fixed overhead — uncached input tokens per API call, per source, calibrated against a public benchmark.
- Subagent rollups — delegation cost chained back to the session that spawned it.
agentburn why— behavioral forensics: re-read loops, retry storms, idle heartbeats, per-cron receipts, context thrash.agentburn fix— ready-to-paste config patches, dry-run by design.
agentburn fix — findings become config, not advice
Not "consider a cheaper model" but the exact file and the exact lines. Patch generators exist only for levers verified against the agent's own source or documented configuration:
There is no --apply on purpose: it's your agent's config. Paste it yourself, then prove the saving with --save-baseline → --compare.
Why trust these numbers
Token trackers quietly disagree with each other (2–91× in public issue threads). agentburn takes the opposite stance:
- Numbers come from the agent's own accounting, read-only. No scraping, no proxies, no guessing.
- One reply is counted once. Claude Code writes one transcript line per content block, each carrying the same
usage; summing lines inflates calls and tokens ~1.8×. agentburn deduplicates byrequestId(found and fixed in 0.14.0 — earlier absolute totals from this tool were inflated by that factor; ratios were not). - Provider-billed costs are shown as-is; estimates are marked
~; mixed data is labeled mixed. - Where a price doesn't exist, none is invented. Claude Code records no costs and subscription usage has no honest per-token price — so that adapter reports tokens and windows, never dollars.
- Sessions with messages but zero recorded tokens (known accounting gaps, e.g. hermes-agent #12023) are detected: totals become an explicit lower bound, and fixing the accounting becomes recommendation #1.
- Result weights on agents that don't record them are labeled estimates, and only ever used to rank findings against each other.
Speed
Transcripts are append-only, so they are parsed once. Each file's parse is cached under its size and mtime in ~/.agentburn/cache, and a run reuses every file that hasn't changed:
A file that grew is re-parsed and re-cached; nothing else is touched. --no-cache (or AGENTBURN_NO_CACHE=1) forces a full re-parse, --clear-cache deletes it. The cache is derived data — deleting it costs time, nothing else.
Privacy
Everything runs locally and reads your logs read-only. No network calls, no telemetry, no accounts. The report is yours. The only commands that touch the network say so: drift GETs a public trends file, --submit opens a prefilled issue you review and send.
The parse cache in ~/.agentburn/cache (mode 0700) holds the same tool names and truncated argument keys the reports show, derived from logs already on this machine — never message content. --clear-cache removes it.
Why this exists
Always-on agents bill you around the clock — and their built-in counters only show totals:
"73% of every API call is fixed overhead — ~13.9K tokens of tool definitions and system prompt, resent every time." — hermes-agent #4379
"One entrant wrote about waking up to a $47 surprise bill from an overnight run — that's not an exotic failure, it's the default behavior of an unsupervised loop." — dev.to
How it compares
ccusage and codeburn are excellent at what they do — agentburn deliberately starts where they stop (ccusage scoped per-tool analysis out).
Supported agents
One normalized model, one adapter per agent. Run agentburn and every agent found on the machine gets its own report.
Adapters are ~150 lines over a shared model — PRs for the next one welcome.
Everything else
🔌 agentburn mcp — your agent answers for its own bill
A zero-dependency MCP stdio server exposing burn_report / burn_limits / burn_context / burn_commits / burn_why / burn_card. Register it and ask "where do you burn my money?" — it profiles its own database and explains.
Prefer skills? There's a ready SKILL.md for ~/.claude/skills/agentburn/ (or the Hermes/OpenClaw equivalents).
📤 --share — an anonymized card, safe to post
Categories, models and totals only; session titles, paths and content are excluded by construction. --svg card.svg renders the same card as an image.
📐 --save-baseline / --compare — prove the saving
Snapshot your pace, change the config, then agentburn --compare shows the delta — pace-normalized, so a 7-day baseline compares honestly with a 30-day window. Every recommendation becomes a testable promise.
🧭 agentburn drift — your spend × the world's direction
Are you paying for a model the world is leaving? Your side is computed locally; the world side is one read-only GET of token-history's public trend JSON (archived daily from OpenRouter's rankings). Nothing about you is sent anywhere; --trends FILE works fully offline.
🧠 agentburn explain — LLM interpretation, local-first
The default endpoint is localhost; a remote one requires --yes-remote and receives a redacted summary (titles → session-N, paths → basenames, content never present to begin with).
🩺 agentburn doctor + 🚨 sentinel mode
doctor names the broken combinations (provider × model × source) behind zero-usage and unpriced sessions, and generates a ready-to-paste upstream bug report — counters only.
Sentinel mode is a budget guard for server agents:
📊 agentburn rank — the Burn Index (community percentiles)
Anonymous percentiles of efficiency — the benchmark volume-leaderboards can't be: nothing here rewards burning more. Joining is consent-by-click: agentburn --submit prints the exact anonymized payload (ratios and a coarse spend band — never raw volumes, titles or paths), then a prefilled GitHub-issue link that you open and submit. Percentiles need 5+ setups per metric before they mean anything.
Related
token-history — the macro view: daily archive of which agents the world uses. agentburn is the micro view: where yours burns.
License
MIT
mcp-name: io.github.Socialpranker/agentburn
the token-* family · token-history — which agents the world runs · agentburn — where yours burns
if this saved you a window's worth of work, a ⭐ helps the next person find it
來源:README.md,提交 a966ae9
工具
0版本歷史
1- v0.14.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分