agentleFS
cveralyoncveralyon/axel-setup/skills/context-budget/SKILL.md

context-budget

Skill4 starsChanged 5 months agoMITView on GitHub

Audits Claude Code context consumption across agents, skills, commands, hooks, MCP servers, and the CLAUDE.md/MEMORY chain. Identifies bloat and redundancy, then produces prioritized token-savings recommendations. Backs the /context-budget command.

54 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use agent-payment-x402, openclaw-persona-forge and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • TironFoxSkill

    agent-payment-x402

    Add x402 payment execution to AI agents — per-task budgets, spending controls, and non-custodial wallets via MCP tools. Use when agents need to pay for APIs, services, or other agents.

    Also in 6 projects that use this

  • TironFoxSkill

    openclaw-persona-forge

    为 OpenClaw AI Agent 锻造完整的龙虾灵魂方案。根据用户偏好或随机抽卡, 输出身份定位、灵魂描述(SOUL.md)、角色化底线规则、名字和头像生图提示词。 如当前环境提供已审核的生图 skill,可自动生成统一风格头像图片。 当用户需要创建、设计或定制 OpenClaw 龙虾灵魂时使用。 不适用于:微调已有 SOUL.md、非 OpenClaw 平台的角色设计、纯工具型无性格 Agent。 触发词:龙虾灵魂、虾魂、OpenClaw 灵魂、养虾灵魂、龙虾角色、龙虾定位、 龙虾剧本杀角色、龙虾游戏角色、龙虾 NPC、龙虾性格、龙虾背景故事、 lobster soul、lobster character、抽卡、随机龙虾、龙虾 SOUL、gacha。

    Also in 5 projects that use this

  • loulanyueSkill

    nuxt4-patterns

    Nuxt 4 app patterns for hydration safety, performance, route rules, lazy loading, and SSR-safe data fetching with useFetch and useAsyncData.

    Also in 9 projects that use this

  • renepfSkill

    orch-pipeline

    Shared orchestration engine for the orch-* skill family. Defines the gated Research-Plan-TDD-Review-Commit pipeline, the size classifier, the agent map, and the two human gates that the orch-* operation skills delegate to. Not usually invoked directly.

    Also in 4 projects that use this

  • Exploration-labsSkill

    token-budget-advisor

    Proactive token budget assessment and task chunking strategy. Use this skill when queries involve multiple large file uploads, requests for comprehensive multi-document analysis, complex multi-step workflows with heavy research (10+ tool calls), phrases like "complete analysis", "full audit", "thorough review", "deep dive", or tasks combining extensive research with large output artifacts. This skill helps assess token consumption risk early and recommend chunking strategies before beginning work.

    Also in 11 projects that use this

  • loulanyueSkill

    santa-method

    Multi-agent adversarial verification with convergence loop. Two independent review agents must both pass before output ships.

    Also in 8 projects that use this

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 50 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before adding more agents, skills, or MCP servers: check headroom first.

    line 15

“Common” is measured: kept by at least 6 in 10 of the 50 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Context Budget

Estimate the token overhead of everything loaded into a Claude Code session and surface concrete ways to reclaim context space. Adapted from ECC's context-budget for a single-runtime (Claude Code) setup on a large Opus window.

When to Use

  • The setup has grown (many agents, hooks, skills, MCP servers) and you want the real load cost.
  • Output quality degrades, or the context monitor fires earlier than expected.
  • Before adding more agents, skills, or MCP servers: check headroom first.
  • Running the /context-budget command (this skill backs it).

How It Works

Token estimation: prose uses words × 1.3, code or JSON uses chars / 4.

Phase 1 — Inventory

Scan each source and estimate tokens.

  • Agents (~/.claude/agents/*.md): tokens per file. Flag files over 200 lines (heavy) and a description over 30 words (it loads into every Task tool invocation, even for agents never spawned).
  • Skills (~/.claude/skills/*/SKILL.md): tokens per SKILL.md. Flag over 400 lines.
  • Commands (~/.claude/commands/*.md): tokens per file. Flag stale or duplicated entries.
  • Hooks (~/.claude/hooks/ plus the wiring in settings.json): count active hooks. Flag heavy or overlapping ones.
  • MCP servers (active MCP config): count servers and total tools. Estimate ~500 tokens per tool schema. Flag servers over 20 tools, and servers that wrap a CLI already available for free (gh, git, vercel, supabase).
  • CLAUDE.md and memory chain (~/CLAUDE.md, ~/.claude/memory/MEMORY.md, any project CLAUDE.md): tokens per file. Flag a combined total over 400 lines, or a MEMORY index that carries detail instead of one-line pointers.

Note on RTK: it compresses Bash OUTPUT at runtime. It does not reduce the LOAD cost of this setup. Measure the load cost (the files above), not RTK-filtered command output.

Phase 2 — Classify

BucketCriteriaAction
Always neededReferenced in CLAUDE.md, backs an active command, or matches current workKeep
Sometimes neededDomain-specific, not referenced in CLAUDE.mdOn-demand or lazy-load
Rarely neededNo reference, overlapping content, no project matchRemove or archive

Phase 3 — Detect Issues

  • Bloated agent descriptions (over 30 words): present in every Task tool context.
  • Heavy agents (over 200 lines): inflate Task context on every spawn.
  • Redundant components: skills that duplicate agent logic, memory entries that duplicate CLAUDE.md rules.
  • MCP over-subscription: many servers, or servers wrapping free CLI tools.
  • CLAUDE.md or MEMORY bloat: verbose sections, stale rules, MEMORY entries carrying detail instead of a one-line hook.

Phase 4 — Report

Context Budget Report
═══════════════════════════════════════
Window: Opus (1M tokens)
Total estimated setup overhead: ~XX,XXX tokens (XX% of 1M)
Effective working context: ~XXX,XXX tokens

Component Breakdown:
┌───────────────┬───────┬──────────┐
│ Component     │ Count │ Tokens   │
├───────────────┼───────┼──────────┤
│ Agents        │ N     │ ~X,XXX   │
│ Skills        │ N     │ ~X,XXX   │
│ Commands      │ N     │ ~X,XXX   │
│ Hooks         │ N     │ ~X,XXX   │
│ MCP tools     │ N     │ ~XX,XXX  │
│ CLAUDE+memory │ N     │ ~X,XXX   │
└───────────────┴───────┴──────────┘

Top 3 Optimizations (ranked by savings):
1. [action] → ~X,XXX tokens
2. [action] → ~X,XXX tokens
3. [action] → ~X,XXX tokens

In verbose mode, add per-file token counts, the heaviest files line-counted, and the MCP tool list with per-tool schema estimates.

Best Practices

  • MCP is usually the biggest lever. One 30-tool server can cost more than every skill combined.
  • Agent descriptions load always, even for agents never invoked. Keep them tight.
  • On a 1M window the absolute overhead matters less than redundancy and menu noise. Prioritize removing stale or duplicated surface over shaving raw tokens.
  • Re-audit after adding any agent, skill, or MCP server to catch creep early.
  • Pairs with the harness-optimizer agent, which consumes this report as its baseline.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.