agentleFS
LIXIAO199115LIXIAO199115/skillrig/skills/context-budget/SKILL.md

context-budget

Skill0 starsChanged 25 days agoMITView on GitHub

Use when an agent session feels bloated, forgetful, slow, or expensive: too many skills, a giant AGENTS.md, large MCP tool schemas, repeated file reads, or long transcripts. Measures always-on versus activated context, then trims with progressive disclosure, packs, and retrieval instead of deleting useful knowledge.

57 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

Show its rules and text

We split this skill into the rules it gives an agent

20 rules. 0 are common, 15 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 53 edited versions we read keep these.

  • 15

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when:

    line 22
  2. Very specific:

    Every installed skill's name and description.

    line 70
  3. Very specific:

    Put the 80% path in SKILL.md.

    line 112
  4. Very specific:

    Put long tables, provider-specific notes, and edge cases in references/, linked with relative paths.

    line 113
  5. Very specific:

    Put deterministic work in scripts/ so the agent runs code instead of reading a long procedure.

    line 114
  6. Distinctive:

    Keep descriptions short and specific.

    line 133
  7. Distinctive:

    Remove servers you are not using from the session config.

    line 135
  8. Distinctive:

    Read the specific file, not the whole directory.

    line 143
  9. Distinctive:

    Use search to locate a symbol before opening files.

    line 144
  10. Distinctive:

    Start a new session for a new task.

    line 150
  11. Very specific:

    Keep a PROGRESS.md or task note with decisions, so a compacted session can recover.

    line 151
  12. Distinctive:

    Remove stale tool output and failed attempts from the working note.

    line 153
  13. Distinctive:

    Put the test command in a 20-line AGENTS.md.

    line 164
  14. Distinctive:

    Always-on drops below 1,500 tokens.

    line 165
  15. Distinctive:

    Do not delete a skill just to save tokens if it prevents a costly mistake.

    line 169
  16. Distinctive:

    Do not shorten a description until it stops routing.

    line 170
  17. Distinctive:

    Do not preload a large reference "just in case".

    line 171
  18. Distinctive:

    Do not keep every MCP server enabled for every session.

    line 172
  19. Distinctive:

    Do not rely on estimated token counts for billing decisions.

    line 173
  20. Distinctive:

    Do not use context trimming as a substitute for a clear task statement.

    line 174

“Common” is measured: kept by at least 6 in 10 of the 53 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

An agent has a fixed context window and a per-turn cost. Everything always-on competes with the task: skill names and descriptions, AGENTS.md, system rules, MCP tool schemas, and prior conversation. When the budget fills, the agent forgets instructions, skips steps, or starts summarizing the wrong thing.

The fix is not to delete knowledge. It is to move knowledge behind a reliable trigger.

When to use

Use this skill when:

  • A session gets slower or more expensive over time.
  • The agent ignores instructions that are present in AGENTS.md.
  • You have more than 20 skills installed.
  • MCP tools dominate the prompt.
  • A long task starts losing earlier decisions.
  • You are deciding whether to install another skill or pack.

Measure first

Estimate with four characters per token for English; CJK is closer to one token per character.

# Project instruction files
wc -c AGENTS.md CLAUDE.md 2>/dev/null
find . -maxdepth 3 -name 'SKILL.md' -print0 | xargs -0 wc -c

# Installed skills and token estimates
skillrig budget
skillrig list

skillrig budget reports:

  • alwaysOnTokens: name plus description, loaded on every turn.
  • activationTokens: body cost when the skill activates.
  • totalTokens: the sum.
  • Warnings when always-on metadata exceeds the configured threshold.

Rough budgets for a 200k-token model:

BucketComfortableTight
System and tool schemas< 10k> 25k
Skill metadata (all installed)< 2k> 5k
AGENTS.md< 1.5k> 4k
Task files read< 40k> 100k
Conversation history< 60k> 120k

These are heuristics, not hard limits. Measure your own sessions.

Workflow

1. Inventory always-on content

Always-on:

  • Every installed skill's name and description.
  • AGENTS.md, CLAUDE.md, and equivalent project rules.
  • MCP tool names, descriptions, and JSON schemas.
  • System prompt and tool definitions.

Not always-on:

  • Skill bodies, until activated.
  • references/ files, until read.
  • Source files, until opened.

2. Find the biggest line item

Usually one of:

  • An AGENTS.md that became an architecture document.
  • Forty skills with long descriptions.
  • An MCP server exposing fifty tools with verbose schemas.
  • A transcript that keeps re-reading the same files.

Fix the largest first.

3. Trim skill metadata

A description only needs to route. Move examples, tables, and history into the body or references/.

Before:

description: A comprehensive skill covering database migrations, including PostgreSQL, MySQL, SQLite, schema design, indexing, backfills, rollbacks, zero-downtime deploys, lock analysis, and a large collection of examples from production systems...

After:

description: Use when reviewing a production database migration: column changes, index creation, backfills, locking, rollback, and online rollout. Does not cover schema design or query tuning.

The second routes better and costs a fraction of the tokens.

4. Use progressive disclosure

  • Put the 80% path in SKILL.md.
  • Put long tables, provider-specific notes, and edge cases in references/, linked with relative paths.
  • Put deterministic work in scripts/ so the agent runs code instead of reading a long procedure.

A skill with a 60-line body and three reference files is cheaper than a 600-line body, and often more reliable because the agent reads only what the task needs.

5. Use packs, not bulk installs

A pack installs a coherent set for a workflow. Five focused skills for the current project beat thirty general skills installed globally.

skillrig install pack/codex-starter --scope project

Project scope keeps unrelated work out of the session.

6. Manage MCP surface

Each MCP tool adds a name, description, and schema. A server with fifty tools can cost more than the task itself.

  • Expose the smallest useful set of tools.
  • Keep descriptions short and specific.
  • Split a large server into a core server and an optional one.
  • Remove servers you are not using from the session config.

7. Keep AGENTS.md short

AGENTS.md should contain commands, conventions, and prohibitions that the agent cannot infer. Move architecture to docs/ and link it. A 60-line file that is read every turn beats a 600-line file that is skimmed.

8. Retrieve instead of preloading

  • Read the specific file, not the whole directory.
  • Use search to locate a symbol before opening files.
  • Summarize a long document once and keep the summary, not the full text.
  • Re-read a file only when it changed; avoid pasting the same content twice.

9. Reset or compact deliberately

  • Start a new session for a new task.
  • Keep a PROGRESS.md or task note with decisions, so a compacted session can recover.
  • Summarize before a long pause, not after the context is already full.
  • Remove stale tool output and failed attempts from the working note.

Examples

A team installs 45 skills globally. Always-on metadata reaches 6,000 tokens before the task starts, and the agent starts ignoring the project's test command.

Fix:

  1. skillrig budget identifies the ten longest descriptions.
  2. Move 30 skills to project scope or a pack.
  3. Shorten descriptions to one routing sentence plus a boundary.
  4. Put the test command in a 20-line AGENTS.md.
  5. Always-on drops below 1,500 tokens; the agent follows the test command again.

Guardrails

  • Do not delete a skill just to save tokens if it prevents a costly mistake. Move it to project scope or a pack.
  • Do not shorten a description until it stops routing. Test activation after editing.
  • Do not preload a large reference "just in case".
  • Do not keep every MCP server enabled for every session.
  • Do not rely on estimated token counts for billing decisions. Measure with the provider.
  • Do not use context trimming as a substitute for a clear task statement.

Verification checklist

  • Always-on token estimate recorded before and after.
  • Largest contributor identified.
  • Skill descriptions tested for activation after edits.
  • Long content moved to references/ or scripts/.
  • Global versus project scope reviewed.
  • MCP tool surface reviewed.
  • AGENTS.md under the target size.
  • A fresh session follows the key instructions.
  • Task recovery note exists for long work.

References

  • references/context-checklist.md contains measurement commands and trimming recipes by content type.

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.