Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
affaan-m avatar

Context Budget

  • 1.4k installs
  • 238k repo stars
  • Updated August 5, 2026
  • affaan-m/ecc

This is a copy of context-budget by affaan-m - installs and ranking accrue to the original listing.

context-budget is a Claude Code skill that audits token consumption across agents, skills, MCP servers, and rules to identify bloat and generate prioritized context savings recommendations.

About

context-budget is an ECC skill that analyzes token overhead for every component loaded in a Claude Code session and surfaces practical optimizations to reclaim context space. Phase one inventories agents/*.md, skills/*/SKILL.md, MCP servers, and rules, estimating tokens per file as word count times 1.3 while flagging agent files over 200 lines and frontmatter descriptions over 30 words as bloated. Developers invoke it when session performance drops, output quality degrades after adding many skills or MCP servers, or when running the /context-budget command. The skill answers how much headroom remains before adding more components. context-budget suits maintainers curating large Claude Code workspaces who need data-driven trimming instead of guessing which SKILL.md files to disable.

  • Scans agents/*.md, skills/*/SKILL.md, rules/**/*.md and MCP config in one pass
  • Flags oversized files: agents >200 lines, skills >400 lines, rules >100 lines
  • Detects duplicate skill copies and overlapping rule content to prevent double-counting
  • Produces prioritized token-savings recommendations with estimated headroom reclaimed
  • Powers the built-in /context-budget command

Context Budget by the numbers

  • 1,437 all-time installs (skills.sh)
  • +91 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/affaan-m/ecc --skill context-budget

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1.4k
repo stars238k
Last updatedAugust 5, 2026
Repositoryaffaan-m/ecc

How do you audit Claude Code context token usage?

Audit and reduce token bloat across agents, skills, MCP servers, and rules inside a Claude Code workspace.

Who is it for?

Claude Code workspace maintainers with many agents, skills, or MCP servers who need measured token audits before adding more components.

Skip if: Developers on agents without configurable skills, MCP servers, or rules who cannot trim loaded context components.

When should I use this skill?

Claude Code sessions slow down, quality drops after adding skills or MCP servers, or the user runs /context-budget to check headroom.

What you get

Component token inventory, bloat flags, and prioritized recommendations to reduce agents, skills, MCP, and rule overhead.

  • token inventory report
  • bloat flags
  • prioritized optimization recommendations

By the numbers

  • Flags agent files exceeding 200 lines as heavy
  • Flags frontmatter descriptions exceeding 30 words as bloated
  • Estimates tokens as word count multiplied by 1.3

Files

SKILL.mdMarkdownGitHub ↗

コンテキストバジェット

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コマンド(ghgitnpmsupabasevercel)をラップするサーバー

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サーバーを追加した後に実行して、クリープを早期にキャッチ

Related skills

How it compares

Use context-budget for measured workspace trimming; use agent-harness-construction when designing new tools rather than auditing existing load.

FAQ

What bloat thresholds does context-budget flag?

context-budget flags agent files over 200 lines and frontmatter descriptions over 30 words as bloated, estimating per-file tokens as word count times 1.3 across agents, skills, MCP servers, and rules.

When should developers run context-budget?

context-budget should run when Claude Code session performance or output quality drops after adding skills or MCP servers, when checking headroom before new components, or when executing the /context-budget command.

AI & Agent Buildingagentsautomation

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.