Agent skill

Context Budget

by affaan-m in affaan-m/ECC

エージェント、スキル、MCPサーバー、ルールにわたってClaude Codeのコンテキストウィンドウ消費を監査します。肥大化、冗長なコンポーネントを特定し、優先順位付けされたトークン節約の推奨事項を生成します。

MITAuto-check passedAgent Workflows

Install Context Budget

skills CLI
$ npx skills add affaan-m/ECC --skill context-budget -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install affaan-m/ECC context-budget --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/affaan-m/ECC.git skills-src && mkdir -p .claude/skills && cp -r skills-src/docs/ja-JP/skills/context-budget .claude/skills/context-budget && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
context-budget
GitHub stars
276k
Token cost
~981 tokens
SKILL.md length
94 words
Files
1
Skills in repo
683
Repo updated
First seen
Licence
MIT

At a glance

エージェント、スキル、MCPサーバー、ルールにわたってClaude Codeのコンテキストウィンドウ消費を監査します。肥大化、冗長なコンポーネントを特定し、優先順位付けされたトークン節約の推奨事項を生成します。

  • Tasks that involve Context engineering
  • SKILL.md covers 使用時期, 動作方法, 例 and ベストプラクティス
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Context Budget is an agent skill from affaan-m/ECC. エージェント、スキル、MCPサーバー、ルールにわたってClaude Codeのコンテキストウィンドウ消費を監査します。肥大化、冗長なコンポーネントを特定し、優先順位付けされたトークン節約の推奨事項を生成します。

Its SKILL.md is about 980 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Agent Workflows, covering Context engineering. It works with Model Context Protocol. The repository describes itself as: The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond. The licence is MIT.

When your agent uses it

  • Tasks that involve Context engineering

Example prompts

  • “/context-budget”

What it can do on your machine

Read from SKILL.md and the folder at commit 4eb71d9. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Context Budget loads about 981 tokens when it runs. Until then it costs about 30 tokens; SKILL.md has 94 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~30
When it runs · the whole SKILL.md, loaded when a task matches
~981

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from affaan-m/ECC at commit 4eb71d9, republished under its MIT licence (© affaan-m). 94 words, ~981 tokens.

Download SKILL.mdSave it as .claude/skills/context-budget/SKILL.md (or your agent's skills folder).
name
context-budget
description
エージェント、スキル、MCPサーバー、ルールにわたってClaude Codeのコンテキストウィンドウ消費を監査します。肥大化、冗長なコンポーネントを特定し、優先順位付けされたトークン節約の推奨事項を生成します。
origin
ECC

コンテキストバジェット

Claude Codeセッションで読み込まれたすべてのコンポーネントのトークンオーバーヘッドを分析し、コンテキストスペースを取り戻すための実用的な最適化を表示します。

使用時期

  • セッションのパフォーマンスが低下しているか、出力品質が低下している場合
  • 多くのスキル、エージェント、またはMCPサーバーを追加した後
  • 実際に持っているコンテキストのヘッドルームを確認したい場合
  • コンポーネントを追加する計画があり、スペースがあるか確認したい場合
  • /context-budgetコマンドを実行する場合(このスキルがそれをサポートします)

動作方法

フェーズ1: インベントリ

すべてのコンポーネントディレクトリをスキャンしてトークン消費を推定します:

エージェント (agents/*.md)

  • ファイルごとの行数とトークンをカウント(単語数 × 1.3)
  • descriptionフロントマターの長さを抽出
  • フラグ: 200行超のファイル(重い)、30単語超のdescription(肥大化したフロントマター)

スキル (skills/*/SKILL.md)

  • SKILL.mdごとのトークンをカウント
  • フラグ: 400行超のファイル
  • .agents/skills/の重複コピーを確認 — 二重カウントを避けるために同一コピーをスキップ

ルール (rules/**/*.md)

  • ファイルごとのトークンをカウント
  • フラグ: 100行超のファイル
  • 同一言語モジュール内のルールファイル間のコンテンツの重複を検出

MCPサーバー (.mcp.jsonまたはアクティブなMCP設定)

  • 設定されたサーバー数と合計ツール数をカウント
  • スキーマオーバーヘッドをツールあたり約500トークンと推定
  • フラグ: 20以上のツールを持つサーバー、シンプルなCLIコマンド(gh、git、npm、supabase、vercel)をラップするサーバー

CLAUDE.md (プロジェクト + ユーザーレベル)

  • CLAUDE.mdチェーンのファイルごとのトークンをカウント
  • フラグ: 合計300行超
フェーズ2: 分類

すべてのコンポーネントをバケットに分類します:

バケット基準アクション
常に必要CLAUDE.mdで参照されている、アクティブなコマンドをサポート、または現在のプロジェクトタイプに一致保持
時々必要ドメイン固有(例:言語パターン)、CLAUDE.mdで未参照オンデマンドアクティベーションを検討
めったに必要でないコマンド参照なし、コンテンツ重複、または明らかなプロジェクト一致なし削除または遅延ロード
フェーズ3: 問題の検出

以下の問題パターンを特定します:

  • 肥大化したエージェントdescription — フロントマターに30単語超のdescriptionはすべてのTaskツール呼び出しで読み込まれる
  • 重いエージェント — 200行超のファイルはすべてのスポーン時にTaskツールのコンテキストを膨らませる
  • 冗長なコンポーネント — エージェントロジックを複製するスキル、CLAUDE.mdを複製するルール
  • MCPの過剰サブスクリプション — 10以上のサーバー、または無料で利用できるCLIツールをラップするサーバー
  • CLAUDE.mdの肥大化 — 冗長な説明、古いセクション、ルールであるべき指示
フェーズ4: レポート

コンテキストバジェットレポートを生成します:

Context Budget Report
═══════════════════════════════════════

Total estimated overhead: ~XX,XXX tokens
Context model: Claude Sonnet (200K window)
Effective available context: ~XXX,XXX tokens (XX%)

Component Breakdown:
┌─────────────────┬────────┬───────────┐
│ Component       │ Count  │ Tokens    │
├─────────────────┼────────┼───────────┤
│ Agents          │ N      │ ~X,XXX    │
│ Skills          │ N      │ ~X,XXX    │
│ Rules           │ N      │ ~X,XXX    │
│ MCP tools       │ N      │ ~XX,XXX   │
│ CLAUDE.md       │ N      │ ~X,XXX    │
└─────────────────┴────────┴───────────┘

WARNING: Issues Found (N):
[ranked by token savings]

Top 3 Optimizations:
1. [action] → save ~X,XXX tokens
2. [action] → save ~X,XXX tokens
3. [action] → save ~X,XXX tokens

Potential savings: ~XX,XXX tokens (XX% of current overhead)

詳細モードでは、ファイルごとのトークン数、最も重いファイルの行ごとの内訳、重複するコンポーネント間の特定の冗長行、ツールごとのスキーマサイズ推定を含むMCPツールリストも出力します。

例

基本監査

User: /context-budget
Skill: Scans setup → 16 agents (12,400 tokens), 28 skills (6,200), 87 MCP tools (43,500), 2 CLAUDE.md (1,200)
       Flags: 3 heavy agents, 14 MCP servers (3 CLI-replaceable)
       Top saving: remove 3 MCP servers → -27,500 tokens (47% overhead reduction)

詳細モード

User: /context-budget --verbose
Skill: Full report + per-file breakdown showing planner.md (213 lines, 1,840 tokens),
       MCP tool list with per-tool sizes, duplicated rule lines side by side

拡張前の確認

User: I want to add 5 more MCP servers, do I have room?
Skill: Current overhead 33% → adding 5 servers (~50 tools) would add ~25,000 tokens → pushes to 45% overhead
       Recommendation: remove 2 CLI-replaceable servers first to stay under 40%

ベストプラクティス

  • トークン推定: 散文には単語数 × 1.3を、コードが多いファイルには文字数 / 4を使用
  • MCPが最大のレバー: 各ツールスキーマはおよそ500トークンかかります。30ツールのサーバーはスキル全部よりも多くかかります
  • エージェントdescriptionは常に読み込まれる: エージェントが呼び出されなくても、そのdescriptionフィールドはすべてのTaskツールのコンテキストに存在します
  • デバッグには詳細モード: 特定のファイルがオーバーヘッドを駆動していることを正確に特定する必要がある場合に使用し、通常の監査には使用しない
  • 変更後に監査: エージェント、スキル、またはMCPサーバーを追加した後に実行して、クリープを早期にキャッチ

© affaan-m, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in docs/ja-JP/skills/context-budget of affaan-m/ECC.

Open the folder on GitHubat commit 4eb71d9

Compare with similar skills

Context Budget next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Context Budget compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Context Budget this skillaffaan-m/ECC276k—~981Automated safety check: PassMIT
Context Mode Output Sandboxmksglu/context-mode26k—~4.1kAutomated safety check: PassCustom licence
Context Mode for Antigravity CLImksglu/context-mode26k—~850Automated safety check: PassCustom licence
Base HelpChristopherKahler/base292—~2.6kAutomated safety check: PassCustom licence
LemmalogJordyZomer/lemmalog329—~2.8kAutomated safety check: PassMIT
Cortex Mem MCPsopaco/cortex-mem313—~2.8kAutomated safety check: PassMIT

Similar skills

  • Context Mode Output Sandbox

    mksglu/context-mode

    Routes large command, file, API and browser output through context-mode tools so only the needed result enters the agent's context, instead of dumping it via Bash.

    26k GitHub stars~4.1k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Routing rules for using context-mode MCP tools in Antigravity CLI: sandboxed code runs, file analysis, indexed search and web fetches that keep large output out of the conversation.

    26k GitHub stars~850 tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Base Help

    ChristopherKahler/base

    Coach mode for the base CLI: teaches what to do and why, rather than just answering.

    292 GitHub stars~2.6k tokensUpdated 4 days ago
    Agent WorkflowsAuto-check passed
  • Lemmalog

    JordyZomer/lemmalog

    Externalize working memory and logical state into the lemmalog Datalog engine (MCP).

    329 GitHub stars~2.8k tokensUpdated 10 days ago
    Agent WorkflowsAuto-check passed
  • Cortex Mem MCP

    sopaco/cortex-mem

    Persistent memory enhancement for AI agents. An agent skill from sopaco/cortex-mem.

    313 GitHub stars~2.8k tokensUpdated 2 mo ago
    Agent WorkflowsAuto-check passed
  • MCP Code Search Tool Selection

    Context-Engine-AI/Context-Engine

    Rules for choosing Qdrant-Indexer semantic search over grep or file reads when exploring code, debugging or asking where and why questions.

    402 GitHub stars~1.3k tokensUpdated 3 mo ago
    Agent WorkflowsAuto-check passed

More from affaan-m/ECC

All 682 skills in this repo
  • Skill Stocktake

    affaan-m/ECC

    Audits your installed Claude skills and commands for quality, with a quick mode for recently changed skills and a full mode that evaluates all of them through subagents.

    277k GitHub starsUsed in 5 repos~3.1k tokens
    Auto-check passed
  • Ingests, indexes, searches, edits and monitors video, audio and live streams through the VideoDB Python SDK, returning stream links, clips and timestamps.

    277k GitHub starsUsed in 3 repos~3.5k tokens
    Auto-check: notes
  • Docs Governance

    affaan-m/ECC

    Route broad documentation-governance requests to existing ECC skills and run an opt-in, read-only audit of mapped documentation roles, links, ADR indexes, and evidence references.

    277k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Rules Distillation

    affaan-m/ECC

    Scans installed skills for principles that recur across them and proposes rule-file changes: append, revise, add a section, create a file or leave as covered.

    277k GitHub starsUsed in 2 repos~2.3k tokens
    Auto-check passed
  • Builds DRAFT counterparty agreements from one markdown template and a small JSON spec per party, with clauses picked by the party's role.

    277k GitHub stars~2.9k tokensUpdated today
    Auto-check passed
  • Set an ECC-specific frontend design direction for production UI work.

    277k GitHub starsUsed in 1 repo~2.2k tokens
    Auto-check passed

Categories

Questions about Context Budget

What does Context Budget do?

エージェント、スキル、MCPサーバー、ルールにわたってClaude Codeのコンテキストウィンドウ消費を監査します。肥大化、冗長なコンポーネントを特定し、優先順位付けされたトークン節約の推奨事項を生成します。. Context Budget is an agent skill from affaan-m/ECC.

When should I use Context Budget?

Context Budget fits situations like: tasks that involve Context engineering.

How do I install Context Budget in Claude Code?

Run `npx skills add affaan-m/ECC --skill context-budget -a claude-code`. Or copy the skill folder (docs/ja-JP/skills/context-budget in affaan-m/ECC) into .claude/skills/context-budget in your project. Claude Code loads it when a task matches its description.

How do I install Context Budget in Codex?

Run `npx skills add affaan-m/ECC --skill context-budget -a codex`. Or copy the skill folder (docs/ja-JP/skills/context-budget in affaan-m/ECC) into .agents/skills/context-budget in your project. Codex loads it when a task matches its description.

Can I use Context Budget in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add affaan-m/ECC --skill context-budget -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/context-budget, .gemini/skills/context-budget, .github/skills/context-budget and .opencode/skills/context-budget in your project.

What does Context Budget need to run?

SKILL.md names no scripts, command-line tools or credentials: Context Budget is instructions for the agent only.

Does Context Budget access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Context Budget safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Context Budget use?

Context Budget is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Context Budget use?

About 981 tokens (SKILL.md is roughly 3.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Context Budget?

Skills that share tags, products or a category with Context Budget: Context Mode Output Sandbox (mksglu/context-mode, 26k stars), Context Mode for Antigravity CLI (mksglu/context-mode, 26k stars), Base Help (ChristopherKahler/base, 292 stars) and Lemmalog (JordyZomer/lemmalog, 329 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Context Budget?

affaan-m (a GitHub user) maintains it in affaan-m/ECC, which has 276,111 GitHub stars. The repository holds 683 skills in this directory. The repository was last updated on October 10, 2026.

Source: affaan-m/ECC on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.