context-budget
Skill1 starsChanged 7 months agoMITView on GitHub
Report estimated context window utilization and flag when approaching the compaction threshold
54 other projects use a version of this.
Adopted by
Most recently taken up by
- Rojios/everything-claude-codetheir own version, first seen Nov 8, 2026
- cveralyon/axel-setuptheir own version, first seen Nov 8, 2026
- ahmadvahidi/skill-atlastheir own version, first seen Nov 8, 2026
- zedarvates/frugal-skillstheir own version, first seen Nov 8, 2026
- pankaj-mahaur/Agent-Daemontheir own version, first seen Nov 6, 2026
- coco-research/cocotheir own version, first seen Nov 1, 2026
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.
TironFoxSkillagent-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
TironFoxSkillopenclaw-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
loulanyueSkillnuxt4-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
renepfSkillorch-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-labsSkilltoken-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
loulanyueSkillsanta-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
Other versions54 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 54
- misskey-dev/misskey★ 11ksame name
- poshan0126/dotclaude★ 871same name
- coco-research/coco★ 797same name
- OneWave-AI/claude-skills★ 378same name
- loulanyue/awesome-claude-notes★ 272same name
- Fmarzochi/EGC★ 61same name
- felvieira/claude-skills-fv★ 27same name
- Fadi88/one-man-startup★ 16same name
- tellmefrankie/ai-investment-skills★ 14same name
- woxiangyangzhimao/skills★ 14same name
44 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository206 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- project-healthSkill
- skill-validatorSkill
- accessibilitySkill
- agent-debugSkill
- agent-evaluateSkill
- ai-governanceSkill
- ai-system-reviewSkill
- api-docs-generateSkill
- api-examplesSkill
- api-mockSkill
- api-test-generateSkill
- api-validateSkill
- architecture-diagramSkill
- ask-mattSkill
- assumption-mapSkill
- boilerplateSkill
- brainstormSkill
- branch-finishSkill
- briefingSkill
- browser-testing-with-devtoolsSkill
- bundle-analyzeSkill
- cache-strategySkill
- canarySkill
- carefulSkill
- cavemanSkill
- changelog-autoSkill
- chaos-testSkill
- ci-setupSkill
- ci-sweepSkill
- cleanprojectSkill
- click-path-auditSkill
- codebase-designSkill
- code-review-checklistSkill
- code-tourSkill
- commitSkill
- completion-verifySkill
- complexity-reduceSkill
- component-librarySkill
- config-cleanupSkill
- config-generateSkill
- conflict-resolveSkill
- container-optimizeSkill
- context-engineeringSkill
- context-restoreSkill
- context-saveSkill
- continuous-learningSkill
- contributingSkill
- cost-trackSkill
- councilSkill
- create-todosSkill
- cross-modal-reviewSkill
- database-connectSkill
- db-diagramSkill
- ddd-modelSkill
- debug-root-causeSkill
- debug-sessionSkill
- debug-systematicSkill
- decision-logSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 50 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 53
Add an overhead estimate for conversation history: prompt the user to confirm if the session has been long (>30 turns) — add 20k tokens per …
- Distinctive: line 92
When status is WATCH or above, suggest specific actions:
- Distinctive: line 127
Early exit: If all measured contributors total < 10k tokens (well under threshold), reports "OK — ample context remaining" in one line and …
- Very specific: line 151
No
.claude/directory: All internal contributions show 0. - Distinctive: line 157
Read-only. No writes except to the cache file.
“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.
Files
Context Budget
Report how much of the current context window is estimated to be consumed, identify the largest contributors, and recommend actions when approaching the compaction threshold. Run this before starting a long task or when responses feel slow or truncated.
Usage
/context-budget # Current utilization snapshot
/context-budget --verbose # Show per-contributor breakdown
/context-budget --compact # Recommend what to compact or saveBehavior
Phase 1: Measure loaded content
Collect byte sizes of all content that contributes to context:
# CLAUDE.md files (auto-loaded)
find . -name "CLAUDE.md" -not -path "*/node_modules/*" | xargs wc -c 2>/dev/null | tail -1
# Active session file
[ -f ".claude/sessions/.current-session" ] && \
wc -c < "$(cat .claude/sessions/.current-session)" 2>/dev/null || echo 0
# Auto-loaded rules
find .claude/rules -name "*.md" 2>/dev/null | xargs wc -c 2>/dev/null | tail -1
# Agent memory files loaded this session
find .claude/agent-memory -name "MEMORY.md" 2>/dev/null | xargs wc -c 2>/dev/null | tail -1
# This project's memory index
[ -f ".claude/memory/MEMORY.md" ] && wc -c < ".claude/memory/MEMORY.md" || echo 0Phase 2: Estimate token counts
Convert bytes to tokens using the ~4 chars/token heuristic for English prose:
TOTAL_BYTES=$(( CLAUDE_MD_BYTES + SESSION_BYTES + RULES_BYTES + MEMORY_BYTES ))
ESTIMATED_TOKENS=$(( TOTAL_BYTES / 4 ))Add an overhead estimate for conversation history: prompt the user to confirm if the session has been long (>30 turns) — add 20k tokens per 30 turns as an approximation.
Phase 3: Map to model context windows
| Model | Context Window | Compaction Threshold (80%) |
| Haiku 4.5 | 200k tokens | 160k tokens |
| Sonnet 4.6 | 200k tokens | 160k tokens |
| Opus 4.8 | 200k tokens | 160k tokens |
Assume Sonnet 4.6 (200k) unless the user specifies otherwise.
Phase 4: Display utilization
Context Budget — 2026-06-04 (model: Sonnet 4.6, 200k window)
Contributor Est. Tokens % of Window
───────────────────────────────────────────────
CLAUDE.md (3 files) 3,200 1.6%
Auto-loaded rules 1,800 0.9%
Active session 2,400 1.2%
Agent memory 600 0.3%
Conversation history ~24,000 12.0% (est. ~30 turns)
───────────────────────────────────────────────
Total estimated 32,000 16.0%
Status: OK — 84% remaining (~168k tokens free)
Compaction threshold: 160k tokens (80%)Status levels:
OK— below 60% utilizedWATCH— 60–80% utilized; consider/context-savebefore long tasksCOMPACT SOON— 80–90% utilized; run/context-savenowCRITICAL— above 90%; Claude Code will auto-compact on next response
Phase 5: Recommendations (with --compact flag)
When status is WATCH or above, suggest specific actions:
Recommendations to free context:
1. /context-save — checkpoint WIP to .claude/wip/ before compaction
2. Start a new conversation after saving — context resets to baseline (~8k tokens)
3. If session file is large (>50k chars), run /session-end to archive it
Largest reducible contributors:
- Conversation history: 24,000 tokens — only reducible by starting a new session
- Active session file: 2,400 tokens — archive with /session-end if work is donePhase 6: Pick the compaction point (with --compact flag)
Auto-compaction fires at an arbitrary moment, often mid-task. Recommend a manual /compact <focus> at the next phase boundary instead:
| Transition | Compact? | Why |
| Research → Planning | Yes | Research is bulky; the plan is the distilled output |
| Planning → Implementation | Yes | Once the plan is written to a file |
| Implementation → Testing | Maybe | Keep if tests reference recent edits |
| Debugging → Next feature | Yes | Debug traces pollute unrelated work |
| After a failed approach | Yes | Clear dead-end reasoning before retrying |
| Mid-implementation | No | Losing paths, names, and partial state is costly |
Write before compacting. Files, CLAUDE.md, memory files, and git state survive compaction. Reasoning, file contents read earlier, and verbally stated preferences do not, and a todo list may not exist on newer Claude Code versions. Save the plan and open decisions to a file (or /context-save) first, then run /compact Focus on <next step>.
Token Optimization
Expected range: 200–500 tokens (initial), 100–200 tokens (subsequent calls)
Caching: Stores last measurement in .claude/cache/context-budget/snapshot.json with a 5-minute TTL. Subsequent calls within the TTL return cached values instantly.
Early exit: If all measured contributors total < 10k tokens (well under threshold), reports "OK — ample context remaining" in one line and exits.
Patterns used: Bash for system queries, early exit, progressive disclosure (--verbose for full breakdown, default shows summary only).
Examples
Healthy session:
/context-budget
→ Total estimated: 18,000 tokens (9% of 200k)
Status: OK — 91% remainingApproaching limit:
/context-budget --compact
→ Total estimated: 152,000 tokens (76% of 200k)
Status: WATCH — consider /context-save before starting a long task
[recommendations shown]Edge Cases
- No active session: Session contribution shows 0; other contributors still measured.
- No
.claude/directory: All internal contributions show 0; only conversation history estimate is shown. - User on Opus with extended thinking: Context consumption is higher; recommend reducing threshold to 70% manually.
- Long conversations (100+ turns): Heuristic may underestimate; note this limitation in output.
Safety
Read-only. No writes except to the cache file. No network calls.
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
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.

