Agent skill

Context Budget

by ericrisco in ericrisco/rsc-harness

A skill your agent uses when a long-horizon task is filling the context window and you must decide what to keep, offload, drop, or hand off to a fresh window — when to compact, what the summary must…

MITAuto-check passedAgent Workflows

Install Context Budget

skills CLI
$ npx skills add ericrisco/rsc-harness --skill context-budget -a claude-code

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

GitHub CLI
$ gh skill install ericrisco/rsc-harness 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/ericrisco/rsc-harness.git skills-src && mkdir -p .claude/skills && cp -r skills-src/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
156
Token cost
~2.4k tokens
SKILL.md length
1,168 words
Files
4 (incl. references)
Skills in repo
229
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when a long-horizon task is filling the context window and you must decide what to keep, offload, drop, or hand off to a fresh window — when to compact, what the summary must…

  • A long-horizon task is filling the context window and you must decide what to keep
  • SKILL.md covers Read the gauge first, The four moves, Decision table: the window is… and Compaction, concretely, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Hand off to a fresh window — when to compact

What it does

Context Budget is an agent skill from ericrisco/rsc-harness. Use when a long-horizon task is filling the context window and you must decide what to keep, offload, drop, or hand off to a fresh window — when to compact, what the summary must preserve, and whether to isolate a read-heavy subtask in a subagent. NOT dollar spend or caps (that is cost-tracking), NOT finding context via embeddings (that is rag).

Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 5 other files, including reference files (for example `evals/README.md`, `evals/cases.yaml` and `references/handoff-and-compaction.md`).

It sits in Agent Workflows, covering Context engineering, LLM cost and token optimization and Embeddings. The repository describes itself as: Your agent invents things because it has no memory, and can't touch your database because it has no arms. rsc is the meta-harness that gives it both, plus the trade to know the… The licence is MIT.

When your agent uses it

  • A long-horizon task is filling the context window and you must decide what to keep
  • Hand off to a fresh window — when to compact
  • What the summary must preserve
  • Whether to isolate a read-heavy subtask in a subagent

Example prompts

  • “/context-budget”

What it can do on your machine

Read from SKILL.md and the folder at commit 92fde8f. 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 2.4k tokens when it runs, and up to ~3.3k if it reads all its reference files. Until then it costs about 91 tokens; SKILL.md has 1,168 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~91
When it runs · the whole SKILL.md, loaded when a task matches
~2.4k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.3k

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 ericrisco/rsc-harness at commit 92fde8f, republished under its MIT licence (© ericrisco). 1,168 words, ~2,389 tokens.

Download SKILL.mdSave it as .claude/skills/context-budget/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
context-budget
description
Use when a long-horizon task is filling the context window and you must decide what to keep, offload, drop, or hand off to a fresh window — when to compact, what the summary must preserve, and whether to isolate a read-heavy subtask in a subagent. NOT dollar spend or caps (that is cost-tracking), NOT finding context via embeddings (that is rag).
tags
context-window, token-budget, compaction, context-rot, long-running-agents, handoff, subagents
recommends
cost-tracking, rag, parallel, building-agents, harness
origin
risco

Context budget

The context window is RAM, not a hard drive. Full ≠ free: a window stuffed to 95% does not just cost more money, it reasons worse. Model performance degrades as input tokens grow — even well inside the stated limit, every token added depletes a finite attention budget (Chroma "Context Rot" research, accessed 2026-06-02). Your job on a long task is to keep the live window lean and externalise everything else, so the work can run for hours across many fresh windows without losing the thread.

The one rule: if you can reconstruct a thing from a file or from git, it does not belong resident in the window. Keep load-bearing-right-now; evict the rest. The cost of forgetting is one re-read; the cost of hoarding is silent quality rot on every turn that follows.

Neighbours, so you don't do their job here: pricing tokens, spend ledgers and hard $ caps are ../cost-tracking/SKILL.md — same words ("token budget"), different unit, dollars vs. attention. Finding the right context via embeddings/chunking is ../rag/SKILL.md; RAG is how you find context, this is how much you let live and when to evict. Prompt text, few-shot and output format are ../prompt-engineering/SKILL.md; the agent loop, tool schemas and provider adapters are ../building-agents/SKILL.md; partition-then-gather fan-out of independent work is ../parallel/SKILL.md (this skill uses subagents as a context-isolation tactic but does not own that discipline); the 01-TOOLS / 02-DOCS control plane is ../harness/SKILL.md.

Read the gauge first

Before you do anything, estimate utilisation: live input tokens ÷ the model's window limit. You cannot manage a budget you are not watching.

  • Compact early — around ~60% utilisation, not 80–95%. Most people only act when quality already broke at 80–95%; by then the rot already happened. Treat 60% as the line where you start reducing, not panicking (practitioner guidance on Claude Code /compact, accessed 2026-06-02).
  • Trust the symptoms as an earlier trigger than the number. You can feel rot before the gauge confirms it:
    • You re-read a file you already read this session.
    • You restate the plan or a decision you already made.
    • You contradict an earlier choice.
    • Tool results from ten turns ago are still sitting verbatim in the window.

Any one of those is a signal to act now, regardless of the percentage.

The four moves

Every context-engineering action is one of four moves (context-engineering surveys, accessed 2026-06-02). Pick by what is eating the window.

1. Offload — summarise a tool output or large read; store the full thing in a file or reference, keep only the distilled fact + a path. Why: raw bytes you might need later don't have to be resident now.

text
Bad:  <pastes the entire 4,000-line config file into the window to "have it">
Good: read it, keep the 30 relevant lines, leave a note:
      "full config at src/app/config.ts:1-4012; the load-bearing keys are X, Y, Z (lines 88-120)"

2. Reduce — compact or summarise stale history so the window carries the conclusions, not the journey. Why: the dead-end exploration that got you to a decision is not the decision.

text
Bad:  carry 2,000 lines of trial-and-error debugging transcript forward unchanged.
Good: compact to "tried A (failed: race condition), B (failed: types); C works — see commit a1b2c3d."

3. Retrieve — fetch a fact at runtime instead of pre-loading it. Why: most of what you might need, you won't; pull it when you actually need it. This is RAG's job — see ../rag/SKILL.md.

text
Bad:  load all 40 design-doc sections up front in case one is relevant.
Good: keep an index; fetch section 7 the moment the task touches auth.

4. Isolate — hand a read-heavy or independent subtask to a subagent with its own fresh window; take back only the answer. Why: a big read in a child window never pollutes the parent's. Subagents are the single most effective anti-rot pattern (Anthropic context-engineering guidance, accessed 2026-06-02).

text
Bad:  read 12 files into the main window to answer "which module owns retries?"
Good: spawn a subagent to scan them; it returns "retries live in lib/http/retry.ts:44" — that one line lands in the parent.

Decision table: the window is filling — what do I do?

What is eating the windowMoveConcrete action
Bloated tool output / a giant pasted file or logOffloadDistil to the load-bearing lines, write the full thing to a file, keep a path:line note.
Stale early history, dead-end explorationReduce/compact now (you're at ~60%, not 95%) with preserve instructions; keep decisions, drop the journey.
A fact you need is simply not in the windowRetrieveFetch it on demand via ../rag/SKILL.md; don't pre-load "just in case".
A read-heavy or independent subtaskIsolateSpawn a subagent (fresh window) via ../parallel/SKILL.md; take back only the answer, never the transcript.
The whole task won't fit any single windowHand offWrite a progress file (below) so a fresh window resumes in one read.
Show full SKILL.md (499 more words)Show less

Compaction, concretely

Manual (/compact). Do it early and tell it what to keep. A bare /compact will happily drop the file paths and decisions you needed.

text
/compact keep: the migration plan, every file path touched, the three decisions
(use Drizzle, keep the legacy table read-only, cut over Friday), and the open TODOs.
drop: the exploratory diffs and the debugging transcript.

Server-side (beta). The API can compact for you: beta header compact-2026-01-12, edit type compact_20260112, default trigger at input_tokens = 150,000 (min 50,000), pause_after_compaction defaults false. The API drops all blocks before the compaction block and continues from the <summary> — and you must append the whole response (including the compaction block) to subsequent requests (Claude API "Compaction" docs, accessed 2026-06-02). The exact contract and the append rule are version-specific and rot fastest, so they live in references/handoff-and-compaction.md — read it before you wire this up.

A good summary preserves decisions, file paths, open TODOs, and gotchas/constraints. A good summary drops raw logs, dead-end exploration, and redundant restatements. If the summary can't resume the task, it failed.

Surviving a fresh window (handoff discipline)

When the task is bigger than one window, the win is making a fresh window resume the work in a single read. The long-running harness pattern (Anthropic, "Effective harnesses for long-running agents", published 2025-11-26, accessed 2026-06-02) is: an initializer session sets up the work, then each coding session works one unit at a time and leaves a structured update — a progress log (e.g. claude-progress.txt) plus git history plus a structured feature list — so the next window reconstructs state without you re-explaining it.

Write the handoff before you run out of room, not after quality already cratered. The template (Goal / Done / In-progress / Next / Gotchas / Key paths) and a good-vs-bad summary checklist are in references/handoff-and-compaction.md.

Budget allocation heuristic

A starting split for a production agent's window — a heuristic, not a law (context-engineering production guidance, accessed 2026-06-02). Tune to your task; the point is to leave headroom and trigger reduction well before 100%.

SliceRough share
System / instructions~10–15%
Tool definitions & results~15–20%
Knowledge / RAG injections~30–40%
Working headroom (kept clear)the rest — defend it

Anti-patterns

Anti-patternWhy it rotsDo instead
Read the whole repo into context "to be safe"Thousands of irrelevant tokens degrade every later turnRead the files the task touches; leave path notes for the rest
Compact only at 95% when things breakThe rot already happened; you're summarising damaged reasoningCompact at ~60%, before quality drops
Let tool results pile up verbatimStale outputs from 10 turns ago still taxing attentionOffload to a file, keep the distilled fact + path
Re-explain the plan every turnBurns the same tokens repeatedly and invites driftState it once; keep it in the progress file, reference it
Paste a subagent's full transcript back into the parentDefeats the entire point of isolation — the child's bloat lands in the parentTake back only the answer/artifact, never the transcript
Treat the window as infinite because the model "has 1M"Context rot scales with tokens regardless of the limitBudget against attention, not the advertised ceiling
Carry dead-end exploration forwardThe journey isn't the decision; it's pure noiseReduce to the conclusion + the commit that proves it

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

Files

SKILL.md and 3 other files (references) in skills/context-budget of ericrisco/rsc-harness.

  • SKILL.md
  • evals/README.md
  • evals/cases.yaml
  • references/handoff-and-compaction.md

Open the folder on GitHubat commit 92fde8f

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 skillericrisco/rsc-harness156—~2.4kAutomated safety check: PassMIT
Context DoctorjzOcb/context-doctor119—~642Automated safety check: PassMIT
Caveman Learn Token FixesJuliusBrussee/caveman110k—~2.8kAutomated safety check: PassApache-2.0
OmniRoute Context CLIdiegosouzapw/OmniRoute74k—~1.2kAutomated safety check: PassMIT
Subagent Brief DisciplineLichAmnesia/lich-skills234—~1.6kAutomated safety check: PassMIT
Compact Guidejh941213/my-cc-harness126—~621Automated safety check: PassNone

Similar skills

  • Context Doctor

    jzOcb/context-doctor

    Visualize and diagnose OpenClaw context window usage. An agent skill from jzOcb/context-doctor.

    119 GitHub stars~642 tokensUpdated 6 mo ago
    Agent WorkflowsAuto-check passed
  • Caveman Learn Token Fixes

    JuliusBrussee/caveman

    Acts on a Caveman learn report: reviews ranked token sinks, applies cost-lowering edits one at a time with your consent, and reports what each fix returned.

    110k GitHub stars~2.8k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • OmniRoute Context CLI

    diegosouzapw/OmniRoute

    Manage context engineering configurations, RTK filter sets, and conversation sessions from the CLI. Apply context-relay settings and inspect active context…

    74k GitHub stars~1.2k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed
  • Subagent Brief Discipline

    LichAmnesia/lich-skills

    Checks every subagent prompt before spawning, swapping pasted files and context for paths and short summaries and trimming the brief, to avoid multiplied token cost.

    234 GitHub stars~1.6k tokensUpdated 4 mo ago
    Agent WorkflowsAuto-check passed
  • Compact Guide

    jh941213/my-cc-harness

    Context window management and token optimization guide. An agent skill from jh941213/my-cc-harness.

    126 GitHub stars~621 tokensUpdated 2 mo ago
    Agent WorkflowsAuto-check passed
  • Omh Context Budget Review

    rlaope/oh-my-hermes

    [omh] Context window or token budget at risk: plan compact context, token/cost budgets, summarization checkpoints, and overflow recovery before long agent work.

    3.2k GitHub stars~2k tokensUpdated today
    Agent WorkflowsAuto-check passed

More from ericrisco/rsc-harness

All 229 skills in this repo
  • Ab Testing

    ericrisco/rsc-harness

    A skill your agent uses when designing or analyzing a controlled experiment — falsifiable hypothesis, sample size from an MDE, reading significance/CI/power, CUPED, or rescuing tests that won't go…

    156 GitHub stars~2.4k tokensUpdated yesterday
    Auto-check passed
  • Accessibility

    ericrisco/rsc-harness

    A skill your agent uses when making a web UI conform to WCAG 2.2 Level AA — axe-core or Lighthouse a11y violations, keyboard operability, focus management, ARIA roles/names/live regions, contrast…

    156 GitHub stars~3.4k tokensUpdated yesterday
    Auto-check passed
  • Ads

    ericrisco/rsc-harness

    A skill your agent uses when running or fixing paid acquisition on Google or Meta — campaign structure (Performance Max, Demand Gen, Search, Advantage+), platform-fit creative, budget/scaling rules…

    156 GitHub stars~2.2k tokensUpdated yesterday
    Auto-check passed
  • Agent Eval

    ericrisco/rsc-harness

    A skill your agent uses when measuring whether an LLM or agent system actually got better and gating merges on it: golden sets, fixing an inflated LLM-as-judge, scoring RAG (faithfulness, contextual…

    156 GitHub stars~3.2k tokensUpdated yesterday
    Auto-check passed
  • AI Media

    ericrisco/rsc-harness

    A skill your agent uses when a creative goal must become a finished media file: pick and order generative-media models per modality — AI voiceover, image-to-video clips, score — then glue them with…

    156 GitHub stars~3.3k tokensUpdated yesterday
    Auto-check passed
  • Analytics

    ericrisco/rsc-harness

    A skill your agent uses when instrumenting product or web analytics — GA4/PostHog SDK wiring, event taxonomy, funnels, double-counted events, consent gating, PII scrubbing.

    156 GitHub stars~2.8k tokensUpdated yesterday
    Auto-check passed

Questions about Context Budget

What does Context Budget do?

A skill your agent uses when a long-horizon task is filling the context window and you must decide what to keep, offload, drop, or hand off to a fresh window — when to compact, what the summary must…. Context Budget is an agent skill from ericrisco/rsc-harness. Use when a long-horizon task is filling the context window and you must decide what to keep, offload, drop, or hand off to a fresh window — when to compact, what the summary must preserve, and whether to isolate a read-heavy subtask in a subagent.

When should I use Context Budget?

Context Budget fits situations like: A long-horizon task is filling the context window and you must decide what to keep; hand off to a fresh window — when to compact; what the summary must preserve; whether to isolate a read-heavy subtask in a subagent.

How do I install Context Budget in Claude Code?

Run `npx skills add ericrisco/rsc-harness --skill context-budget -a claude-code`. Or copy the skill folder (skills/context-budget in ericrisco/rsc-harness) 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 ericrisco/rsc-harness --skill context-budget -a codex`. Or copy the skill folder (skills/context-budget in ericrisco/rsc-harness) 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 ericrisco/rsc-harness --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 2.4k tokens (SKILL.md is roughly 9.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 878 tokens, read only when the agent opens those files.

What are the alternatives to Context Budget?

Skills that share tags, products or a category with Context Budget: Context Doctor (jzOcb/context-doctor, 119 stars), Caveman Learn Token Fixes (JuliusBrussee/caveman, 110k stars), OmniRoute Context CLI (diegosouzapw/OmniRoute, 74k stars) and Subagent Brief Discipline (LichAmnesia/lich-skills, 234 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Context Budget?

ericrisco (a GitHub user) maintains it in ericrisco/rsc-harness, which has 156 GitHub stars. The repository holds 229 skills in this directory. The repository was last updated on October 6, 2026.

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