context-budget
Skill0 starsChanged 23 days agoMITView on GitHub
Optimize token usage and context window discipline. Reduce costs and improve response quality through smart context management.
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 repository32 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- api-designSkill
- arch-constraint-guardSkill
- backend-patternsSkill
- clean-architectureSkill
- codebase-mappingSkill
- cqrsSkill
- ddd-architectureSkill
- debug-flowSkill
- dependency-auditSkill
- django-patternsSkill
- django-tddSkill
- event-driven-architectureSkill
- fd-codenavSkill
- fd-mapSkill
- frontend-patternSkill
- git-releaseSkill
- git-workflowSkill
- golang-patternsSkill
- hexagonal-architectureSkill
- java-patternsSkill
- layered-architectureSkill
- performance-profilingSkill
- postgres-patternsSkill
- python-patternsSkill
- refactor-guideSkill
- research-firstSkill
- rust-patternsSkill
- saga-architectureSkill
- security-scanSkill
- tdd-workflowSkill
- test-gap-detectorSkill
The file
We split this skill into the rules it gives an agent
9 rules. 0 are common, 6 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 50 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Treat context window as a finite resource.
- Distinctive: line 46
Treat 80% of the window as your practical maximum.
- Distinctive: line 83
Not every task needs the strongest model.
- Distinctive: line 100
Do not escalate a cheap task to an expensive model.
- Very specific: line 144
Use /flowdeck:fd-checkpoint after a batch of edits, then /flowdeck:fd-resume to continue.
- Very specific: line 185
Use stages array to gate loading
- Distinctive: line 187
Keep rules under 150 lines when possible
- Very specific: line 215
Use the blast-radius procedure in fd-codenav to find natural split points — it reveals which dependents are independent
- Distinctive: line 219
Run this monthly or when context feels heavy:
“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
<fd> is this project's FlowDeck directory, the one fd-state path prints (~/.fd-plan/<project>/, or <project>/.fd-plan/ when the storage setting is project).
Context Budget Skill
Treat context window as a finite resource. Every token loaded — files, rules, tool outputs, conversation history — consumes budget. Optimizing context improves speed, cuts costs, and prevents mid-session truncation.
When to Activate
Activate when:
- A session exceeds 50K tokens or feels sluggish
- You are about to load large files, MCP tools, or heavy rulesets
- You want to audit and slim down your FlowDeck setup
- You are designing new skills, agents, or workflows
Core Principles
- Load less, get more — context quality beats context quantity
- Measure before optimizing — know your current burn rate
- Batch over chat — accumulate work, run checks once
- Right-size the model — light tasks do not need the strongest model
Why Context Budget Matters
| Factor | Impact |
| Context window limit | Hard cap — exceed it and early conversation is lost |
| Cost per token | More context = more input tokens = higher bill |
| Response latency | Large context increases time-to-first-token |
| Attention degradation | Models perform worse on content near the middle of long context |
Hard Limits (Examples)
| Model | Context Window |
| Claude 3.5 Haiku | 200K tokens |
| Claude 3.5 Sonnet | 200K tokens |
| GPT-4o | 128K tokens |
| GPT-4o mini | 128K tokens |
Treat 80% of the window as your practical maximum. Beyond that, truncation risk rises sharply.
Skill Size Audit
Oversized skills waste context on every activation. Audit yours regularly.
Thresholds
| Metric | Warning | Critical |
| Lines per SKILL.md | > 300 | > 400 |
| Words in description | > 25 | > 30 |
| Files loaded per task | > 5 | > 10 |
| Rules active at once | > 8 | > 12 |
How to Audit
# Count lines in all skills
find src/skills -name "SKILL.md" -exec wc -l {} + | sort -n
# Flag skills over 300 lines
find src/skills -name "SKILL.md" -exec sh -c 'lines=$(wc -l < "$1"); [ "$lines" -gt 300 ] && echo "$lines $1"' _ {} \;
# Check description word counts
grep -r "^description:" src/skills/ | awk '{print NF, $0}' | sort -nRemediation
- Split oversized skills — extract sub-topics into separate skills
- Shorten descriptions — under 25 words is ideal; under 30 is required
- Use stage-gated rules — load heavy rules only in
executeorverifystages - Defer heavy context — load
<fd>/architecture.mdonly when needed
Model Routing Strategy
Not every task needs the strongest model. Route by complexity.
| Task Type | Example | Model Tier |
| Simple edit | Fix typo, rename variable | Fast / Small |
| Code review | Lint, style check | Fast / Small |
| Research | Look up API docs | Fast / Small |
| Feature implementation | Multi-file change | Strong / Large |
| Debug | Root cause analysis | Strong / Large |
| Architecture design | New module design | Strong / Large |
Routing by cost
- cheap: structural lookups, listings and summaries go to the read-only
Exploresubagent (or a forked skill withmodel: haiku, likefd-map) - standard: implementation and test work stays in the main conversation
- expensive: design decisions, debugging and security review run on the strongest model
Do not escalate a cheap task to an expensive model.
Prefer CLI Tools Over MCPs
MCP servers add context overhead: schema discovery, tool definitions, and response envelopes. Native CLI tools are leaner.
| Use Case | Heavy MCP | Lean Alternative |
| Git operations | GitHub MCP | git, gh CLI |
| AWS queries | AWS MCP | aws CLI |
| Kubernetes checks | K8s MCP | kubectl |
| File search | File-system MCP | find, rg |
| Database query | DB MCP | psql, mysql CLI |
When MCPs Are Worth It
- Complex multi-step operations (e.g., create PR + add reviewers + set labels)
- Operations requiring authentication tokens you do not have locally
- Structured data return that CLI would require parsing
Accumulator + Batch Pattern
Chatty sessions burn context fast. Accumulate edits, then run checks once.
Anti-Pattern: Chatty Loop
Edit file A → run test → fix error → edit file B → run test → fix error → edit file C → run testEach test run consumes output tokens. Three runs = 3x test output in context.
Preferred: Batch + Single Check
Edit file A
Edit file B
Edit file C
Run tests once
Fix all errorsIn FlowDeck
Use /flowdeck:fd-checkpoint after a batch of edits, then /flowdeck:fd-resume to continue. This preserves your work without carrying full error output forward indefinitely.
Strategic Context Clearing
Long sessions accumulate noise: failed attempts, dead-ends, large tool outputs. Clear context before it degrades quality.
When to Checkpoint
| Signal | Action |
| Session > 1 hour | /flowdeck:fd-checkpoint |
| Tokens > 50K | /flowdeck:fd-checkpoint |
| Multiple failed attempts | /flowdeck:fd-checkpoint and reassess |
| Task complete, new task next | /flowdeck:fd-checkpoint |
Resume Pattern
1. `/flowdeck:fd-checkpoint` — save current state to STATE.md
2. Start fresh session
3. `/flowdeck:fd-resume` — load checkpoint.json, STATE.md, plan.md, active context
4. Continue with clean contextThis is cheaper than carrying 80K tokens of conversation history.
Rule Loading Optimization
FlowDeck uses stage-gated rules. Only rules matching the current stage are loaded.
| Stage | Typical Rules Loaded |
discuss | Behavioral, lightweight |
plan | Planning, architecture |
execute | Coding standards, language patterns, security |
verify | Testing, security, linting |
fix-bug | Debug, testing |
Keep Rules Focused
- One concern per rule file
- Use
stagesarray to gate loading - Set
always_on: falsefor heavy rules - Keep rules under 150 lines when possible
Audit with:
# Find rules loaded in every stage (always_on = true)
grep -r "always_on: true" src/rules/
# Find oversized rules
find src/rules -name "*.md" -exec sh -c 'lines=$(wc -l < "$1"); [ "$lines" -gt 200 ] && echo "$lines $1"' _ {} \;Code Modularity Benefits
Smaller files = less context per task. A 400-line file forces the model to hold the entire file in working memory. Four 100-line files let the model focus on one at a time.
| File Size | Context Impact |
| < 200 lines | Minimal — load on demand |
| 200-400 lines | Moderate — acceptable for core files |
| 400-800 lines | Heavy — consider splitting |
| > 800 lines | Critical — split immediately |
Splitting Guidance
- One responsibility per file
- Extract utilities to
utils/orhelpers/ - Extract types to
types.ts - Use the blast-radius procedure in
fd-codenavto find natural split points — it reveals which dependents are independent
Self-Audit Checklist
Run this monthly or when context feels heavy:
Skills
- No SKILL.md exceeds 400 lines
- No skill description exceeds 30 words
- Unused skills removed from
.claude/skills/
Rules
- No rule file exceeds 200 lines
- Heavy rules are stage-gated (
always_on: false) - No redundant rules (same topic, different files)
Workflows
- Tasks are batched before verification runs
/flowdeck:fd-checkpointused at natural boundaries- Model routing respects task complexity
Codebase
- No source file exceeds 800 lines
- Core modules are under 400 lines
- Large files have clear split candidates via the
fd-codenavblast-radius procedure
Session Hygiene
- MCP tools used only when CLI is insufficient
- Large outputs (logs, diffs) are summarized, not pasted raw
- Failed attempts are checkpointed, not retried endlessly
Quick Wins
- Truncate diffs —
git diff | head -50instead of full diff - Summarize logs —
tail -20instead of full log file - Use LSP document symbols — find symbols without reading entire files
- Load rules on demand —
load-rulesinstead of pre-loading everything - Split before you grow — when a file hits 400 lines, plan the split
Related Skills
plan-task— break work into right-sized chunksperformance-profiling— measure before optimizingcontext-load— load only the context you need
References
/flowdeck:fd-checkpoint— save session state, clear context/flowdeck:fd-resume— restore from checkpointload-rules— stage-gated rule loading- LSP document symbols — symbol search without full-file reads
- the
fd-codenavblast-radius procedure — find split points in large files - LSP references and call hierarchy — a symbol's callers and callees
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.

