jpskill.com
💬 コミュニケーション コミュニティ

token-usage-auditor

Audit project token usage from local Codex and Claude Code logs. Use when the user asks to measure token burn, token consumption, project attention, agent usage, Codex/Claude Code usage, token efficiency, or lifecycle telemetry for a project.

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o token-usage-auditor.zip https://jpskill.com/download/8064.zip && unzip -o token-usage-auditor.zip && rm token-usage-auditor.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/8064.zip -OutFile "$d\token-usage-auditor.zip"; Expand-Archive "$d\token-usage-auditor.zip" -DestinationPath $d -Force; ri "$d\token-usage-auditor.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して token-usage-auditor.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → token-usage-auditor フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1
📖 Claude が読む原文 SKILL.md(中身を展開)

この本文は AI(Claude)が読むための原文(英語または中国語)です。日本語訳は順次追加中。

Token Usage Auditor

Measure token usage as project telemetry: where agent attention went, how much fresh work versus cached context was spent, and which sessions should be tied back to project phases and artifacts.

Skill Directory Layout

<installed-skill-dir>/
├── SKILL.md
├── scripts/
│   └── collect_token_usage.py
└── references/
    └── data-model.md

Core Principles

  • Treat token usage as attention and cost telemetry, not as quality by itself.
  • Prefer local exact logs for Codex and Claude Code before asking the user for estimates.
  • Keep raw prompts and message text out of project memory by default; record only session metadata, usage totals, classification, and artifact links.
  • Preserve agent-specific token fields. Do not collapse prompt cache reads, cache creation, fresh input, reasoning output, and normal output into one unexplained number.
  • Mark inferred phase/task labels with confidence. Do not invent artifact links when no commit, report, run, or paper section can be tied to a session.

Quick Start

For the current project, run:

python3 <installed-skill-dir>/scripts/collect_token_usage.py --project-root .

For a recent window:

python3 <installed-skill-dir>/scripts/collect_token_usage.py --project-root . --since 2026-05-01 --until 2026-05-31

To write repo-local reports:

python3 <installed-skill-dir>/scripts/collect_token_usage.py --project-root . --format markdown --output docs/reports/token_usage/2026-05.md
python3 <installed-skill-dir>/scripts/collect_token_usage.py --project-root . --format json --output memory/token_ledger/sessions.json

The script is read-only with respect to Codex and Claude Code logs. It writes only when --output is provided.

Workflow

  1. Identify the project root.

    • Use git rev-parse --show-toplevel when possible.
    • For research project control roots, use the shared root if the user wants cross-component accounting, or code/ / paper/ if they want component-local accounting.
  2. Run the collector.

    • Include --since and --until when the user asks for a week, month, phase, or release window.
    • Use --format markdown for discussion and --format json when updating project memory.
    • Use --codex-root or --claude-root only when logs live outside the defaults.
  3. Interpret the report.

    • total_context_tokens: all context observed by the agent, including cached reads when the provider reports them.
    • fresh_tokens: non-cached input plus cache creation plus output. Use this as the closer proxy for incremental cost/effort.
    • cached_tokens: prompt-cache reads or cached input. Use this as context reuse, not equal fresh work.
    • session_count: number of project-matched local sessions.
  4. Add project labels only when supported.

    • phase: idea, literature, design, implementation, experiment, diagnosis, writing, rebuttal, release, maintenance, tooling, project-management.
    • task_type: design, implementation, debug, writing, review, release, sync, setup, experiment, diagnosis, literature, coordination.
    • confidence: exact, inferred, manual, unknown.
  5. Connect to artifacts.

    • Link sessions to commits, PRs, experiment runs, reports, paper sections, or memory updates only when there is evidence from git history, docs, user notes, or the session metadata.
    • If artifact linkage is not known, leave it blank and report the session as unlinked.

Updating Project Memory

Use references/data-model.md when writing long-lived project memory.

Recommended outputs:

  • docs/reports/token_usage/YYYY-MM.md for human-readable monthly reports
  • memory/token_ledger/sessions.json for structured session summaries
  • memory/token_ledger/README.md only if the project needs policy notes

Do not commit copied raw transcript logs unless the user explicitly asks and privacy has been reviewed.

Report Framing

When summarizing, separate these conclusions:

  • attention allocation: what the project focused on
  • fresh token burn: approximate incremental token cost
  • context reuse: cached/read context that made work cheaper or less repetitive
  • yield: shipped commits, reports, experiments, paper sections, decisions, or memory updates
  • friction: repeated context setup, failed commands, abandoned branches, duplicate analysis, or high-burn sessions without artifacts

Avoid saying high token burn means good work. Prefer phrasing such as: "token usage was concentrated in experiment diagnosis; yield was decision-heavy rather than commit-heavy."