Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add eaglesakura/agent-skills --skill workspace-count-tokensgit clone --depth 1 https://github.com/eaglesakura/agent-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/eaglesakura/agent-skills/workspace-count-tokens)<a href="https://agentmods.dev/skills/eaglesakura/agent-skills/workspace-count-tokens"><img src="https://agentmods.dev/badge/skills/eaglesakura/agent-skills/workspace-count-tokens/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/eaglesakura/agent-skills/workspace-count-tokens"><img src="https://agentmods.dev/badge/skills/eaglesakura/agent-skills/workspace-count-tokens.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00106 | $0.00950 |
| Opus 5 | $0.00053 | $0.00475 |
| Sonnet 5 | $0.00021 | $0.00190 |
| Haiku 4.5 | $0.00011 | $0.00095 |
Grade A, and why
workspace-count-tokens scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
Workspace / Count Tokens
ファイルベースでトークン量を概算する。課金トークンや Cursor UI 表示との一致は保証しない。 出力は必ず assets/report.md の見出し・表カラムに従う。
いつ使うか
- デフォルト Context や SKILL / docs のトークン概算を測る・比較するとき
- 「コンテキストサイズ」「SKILL が何トークンか」を知りたいとき
いつ使わないか
- 会話全体・ツール結果込みの実リクエスト課金を監査するとき
- 単一ファイルの厳密カウントだけで足りるとき
計測対象
| 区分 | デフォルト(常時) | 動的(最大) |
|---|---|---|
AGENTS.md / alwaysApply rules / .cursorrules |
本文 | - |
| 非 always の rule | description のみ | - |
SKILL.md |
description のみ | 全文(他 SKILL 経由の追加ロードは含めない) |
docs/ doc/ references/ |
含めない | 全文 |
User Skills(--include-user-skills) |
description | 全文 |
含めない: システムプロンプト、ツール/MCP スキーマ、User Rules(Settings)、オープン中ファイル、会話履歴。
手順
scripts/count_workspace_tokens.pyを 実行する(自前集計よりスクリプト優先)- 標準出力のレポートを assets/report.md 構成のままユーザーへ示す(3セクションを混ぜない)
- 各セクション先頭の統計(
ファイル数合計/トークン量合計)を残す トークン量合計は常にキロトークン(例:0.7K Tokens、5.0K Tokens、小数点以下第1位)
- 各セクション先頭の統計(
- 概算である旨と未計測項目を一言添える
tiktokenが無ければスクリプトの提案どおりインストールを案内する- 結果を残すなら
.ai-agent/tmp/へ(workspace-agent-temporary)
# 推奨依存
python3 -m pip install tiktoken
# または: python3 -m venv /tmp/tokencount && /tmp/tokencount/bin/pip install tiktoken
# SKILL_DIR は本 SKILL.md があるディレクトリ
SCRIPT="$SKILL_DIR/scripts/count_workspace_tokens.py"
python3 "$SCRIPT" --root .
# multi-root は --root を繰り返し。ユーザー SKILL 込みは --include-user-skills。JSON は --json。
パス解決は workspace-resolve-file-path に従う。トークナイザは tiktoken の o200k_base、無ければ chars/4。
DO / DO NOT
- DO: デフォルトと動的(SKILL / ドキュメント)を分けて報告する
- DO NOT: UI のコンテキスト%や課金トークンと同一視する
- DO NOT: eval / iteration / skill-snapshot 配下を本番 SKILL として数える
What ships with it
2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 12d ago First seen · 67 lines · 106 tokens per session scan A 8b11f13e9e47
workspace-count-tokens is a skill published in the GitHub repository eaglesakura/agent-skills (2 stars, last pushed 6d ago), licensed MIT. It adds 106 tokens to every session and 950 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
systematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.
local-ai-agents
Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…
next-cache-components-adoption
Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…
chat-pet-sprite-creation
Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.
cpu-profile-analysis
Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…
insight-error-page
Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…