agentleFS
OneWave-AIOneWave-AI/claude-skills/context-budget/SKILL.md

context-budget

Skill378 starsChanged 52 days agoMITView on GitHub

Use when a coding session is burning context fast, output is drowning in noise, the model keeps forgetting earlier decisions, or the user asks to reduce tokens, stop the verbose narration, work in a huge repo, or make a long session survive. Covers what to read, what to summarize, what to write to disk, and when to start fresh.

  • Installs packages

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

7 rules. 0 are common, 7 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 50 edited versions we read keep these.

  • 7

    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:

    Treat the context window like a budget with a balance.

    line 12
  2. Distinctive:

    Do not re-read what you just wrote: If an edit succeeded, it succeeded.

    line 33
  3. Distinctive:

    Cut the narration: No preamble, no recap of what was just shown, no bulleted summary of a diff the user can see.

    line 35
  4. Distinctive:

    When a session bloats, it is almost always one of these:

    line 39
  5. Distinctive:

    When roughly two-thirds of the window is gone, stop adding and start consolidating:

    line 53
  6. Distinctive:

    Write the current state to a plan or handoff file on disk.

    line 55
  7. Distinctive:

    Follow imports from the entry point rather than crawling folders alphabetically.

    line 64

“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

Context is the scarcest resource in a long session. It gets spent on three things: files you read, output you generate, and narration nobody asked for. Only the first one is usually worth it.

Core Behavior

Treat the context window like a budget with a balance. Before any expensive action — reading a big file, running a chatty command, dumping a directory tree — ask what the cheapest way to get the same answer is.

Spend Rules

Read narrowly. sed -n '120,190p' file.ts beats reading a 2,000-line file to see one function. Grep for the symbol, then read the 40 lines around it. Read a whole file only when you are about to restructure it.

Search before reading. grep -rn "symbolName" --include="*.ts" costs a few hundred tokens and tells you which of forty files matters.

Silence the noisy commands. Pipe installs, builds, and test runs through a filter instead of dumping them whole:

npm test 2>&1 | tail -30
npm run build 2>&1 | grep -E "error|Error|warning" | head -20
npm install --silent 2>&1 | tail -5
git diff --stat            # not git diff, unless you need the hunks

A passing test suite needs one line of proof, not 400.

Write instead of remembering. Anything that must survive — a plan, a decision, a list of files to touch — goes in a file on disk. Files are re-readable at a cost you choose; context is not.

Do not re-read what you just wrote. If an edit succeeded, it succeeded. Re-reading to "verify" is pure spend.

Cut the narration. No preamble, no recap of what was just shown, no bulleted summary of a diff the user can see. Say what changed and what is next, in a line or two.

Where the Budget Actually Goes

When a session bloats, it is almost always one of these:

LeakFix
Whole-file reads for one functiongrep, then a line-ranged read
Full npm install / build logs| tail -n or grep for errors
Directory listings of node_modules, dist, .nextprune them in the find/ls
Re-reading files after editingtrust the edit result
Long explanations of finished workone line
Pasting a file back to show a small changeshow the diff hunk only
Repeating the plan every turnplan lives in a file

Compaction Points

When roughly two-thirds of the window is gone, stop adding and start consolidating:

  1. Write the current state to a plan or handoff file on disk.
  2. State the single next action.
  3. Tell the user a fresh session will be faster and more accurate than continuing.

A fresh session that reads a good plan file outperforms a stuffed session every time. Do not treat starting over as failure — it is the intended move.

Large Repos

  • Map before you dig: directory names and entry points first, implementation later.
  • Follow imports from the entry point rather than crawling folders alphabetically.
  • One subsystem at a time. Finish it, write down what you learned, move on.
  • Generated code, lockfiles, and snapshots are never worth reading. Exclude them by default.

What Not to Cut

Economy has a floor. Never skip:

  • Reading the actual code before changing it.
  • The error output when something failed — that is the one long dump worth having.
  • The user's own requirements, quoted.

Being cheap about the wrong thing produces confident, wrong work. The goal is fewer tokens, not less evidence.

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.