Agent Cost Report
它能做什么
这个智能体会针对使用 Claude Code 等 AI 工具的成本生成详细报告。它会估算 token 的花费,并找出浪费的地方。
适用场景
- ✓当管理层需要了解 AI 项目的成本时。
- ✓在一次高强度使用之后,想了解投入产出比(ROI)时。
- ✓分析 AI 任务中的浪费情况,比如重复、返工或走错方向。
技能链接
https://github.com/thedotmack/claude-mem/blob/main/claude-mem-cursor/skills/agent-cost-report/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“生成上周的成本报告,重点关注浪费情况。”
每周 5 个新技能,1 分钟读完。
工作原理
它会分析 AI 使用日志,根据公开价格计算成本,并把信息整理成易读的报告。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Agent Cost Report
Claude-Mem / Claude Code skill. Runtime is the scripts/ pipeline (transcripts → tokens → dollars → Timing-style report) plus a progressive Mem Search review pass that confirms the drafted labels. The Notion draft is SPEC history only — never the product, never the runtime, never the ship vehicle.
Resolve the absolute directory containing this SKILL.md; all helper paths are relative to that directory. ${CLAUDE_SKILL_DIR} is the shortcut: python3 "${CLAUDE_SKILL_DIR}/scripts/acr.py" …. Python 3.9+ standard library only, with IANA timezone data for America/Los_Angeles; no pip installs. tzdata is the only exception to the no-pip-installs rule, and only when acr.py exits saying that timezone data is unavailable (stock Windows Python ships none): show the user the lines it printed and ask (AskUserQuestion) before installing it. On a yes, run the line for your shell (the plain quoted line in Bash or cmd, the PowerShell: line in PowerShell), then rerun the failed command. Setting PYTHONTZPATH instead needs no install. The look lives in scripts/acr/render.py, never here.
Purpose
Turn Claude-Mem activity into a manager-readable cost and failure report.
Product idea: a reusable skill that searches Claude-Mem via Mem Search, reconstructs real units of work, assigns cost and failure categories, and renders a printable report.
Insight north star
The headline is dollars, to two decimals, labeled. The dollars come from Claude Code transcripts (exact per-reply token usage) priced at OpenRouter public list prices, so they are ESTIMATED. Measured provider spend appears only when a sanctioned source gives it. Directly under the dollars: what the mistakes cost, what shipped, and both on one time axis.
Questions the report must answer
- What work was completed?
- What did each outcome cost?
- What was wasted through looping, hedging, wrong turns, rework, or poor routing?
- Were any unauthorized actions attempted?
- What should the manager change next?
Primary unit = cost per completed outcome (not cost per observation).
When to use
- "Agent cost report" / "cost per outcome" / "failure economics" / "was this session worth it" / "what did the agents cost this week"
- After a real Mem session dig when leadership needs outcome economics
- Sample / ship packs that need self-contained HTML + JSON + CSV + evidence
Memory dig mechanics: the claude-mem mem-search skill (progressive recall).
Default scope (ALWAYS)
- Unless the user names a specific session / range / project, the window is the last 7 full days in PT, not counting today:
end= the PT midnight that started today (exclusive),start=end − 7 days. The default window never contains a partial day (G3, Alex 2026-09-25). - Explicit windows:
--start YYYY-MM-DD --end YYYY-MM-DD(PT calendar days, end exclusive). An explicit--endlater than today marks the last day "partial, generated HH:MM PT". - One session:
--session <content_session_id>. One project plus a period:--project <name> --start … --end …(worktrees of the project are included). - The report Scope strip shows the PT range, and Details list every session id in scope.
Progressive Mem Search (ALWAYS)
Follow the claude-mem mem-search three layers. Keep spend light.
- Search — get an index of IDs (titles, types, token hints).
- Timeline — only around anchors you care about.
- Observations —
get_observationsfor the filtered IDs you will cite as evidence.
Recipe:
- Resolve scope (default: the last 7 full PT days).
- Search → collect IDs.
- Timeline for thin context only.
- Observations for intended / actual / outcome / waste / rework / blocked / unauthorized / status.
- Group into named work items + failure events.
- Calculate line-item costs.
- Render HTML + optional PDF (+ json/csv/evidence).
- Keep evidence IDs in the appendix — do not dump entire timelines into the main report.
ADHD process bullets:
- Search first → pick IDs → timeline only if context is thin → fetch only needed obs.
- Work-item titles are invented for managers ("Restore search after Chroma crash-loop"); observation titles stay evidence-only.
- Evidence appendix lists obs IDs + short titles; main sections stay outcome-first.
…
常见问题
什么是“token”?
token 是 AI 处理的一小段文本。文本越多,token 越多,成本也越高。
这些成本是精确的吗?
不是,成本是根据 OpenRouter 等服务的公开价格估算的,实际费用可能会有所不同。
“失败类型”是什么意思?
它们是用来描述出错情况的分类,比如重复循环(looping)、返工(rework)或走错方向(wrong turns)。
详情
作者的原始描述
Believable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.
repo: thedotmack/claude-mem
热度
- GitHub 星标
- 101k
- 排名
- #1260
- 许可证
- Apache-2.0
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
claude-mem-install
101k帮助你的智能体在不同环境中设置 Claude-Mem。你可以选择使用本地或远程工作进程,并配置观察功能。
mem-search
101k让你的智能体搜索过去的记忆。适合回忆之前的解决方案,或旧会话中的工作内容。
host-observer
101k帮助你的智能体响应 Claude-Mem 观察者任务。它只能回复“skip_summary”或完整的 XML 观察记录。
mem-setup
101k让你的智能体与用户一起设置 Claude-Mem。它会连接用户的账户,并配置云同步。