Structured Data
Capability Metadata
| Field | Value |
|---|---|
| ID | CAP-017 |
| Version | v1.8 |
| Domain | Skill Pipeline |
| Status | Documented |
| Related | CAP-004, CAP-016, CAP-019, CAP-073, CAP-074, CAP-075 |
| Source | src/budget/token-budget.ts |
| Tiers | critical / standard / optional |
Configuration Reference
Budget profile YAML (per agent):
agent_name: executor
total_budget: 8000 # tokens
critical_allocation: 0.5 # 50% reserved for critical skills
standard_allocation: 0.35 # 35% for standard skills
optional_allocation: 0.15 # 15% for optional skills
Tier priority rules: critical skills load first, then standard, then optional. Any tier exceeding its allocation spills into the next tier's space only if that tier has remaining capacity.
Burst mode: set burst: true in the profile to temporarily expand budget by 20% for intensive phases.
Technical Specifications
Class: TokenBudget
// Budget profile type
interface BudgetProfile {
agent_name: string;
total_budget: number; // tokens
critical_allocation: number; // 0.0–1.0
standard_allocation: number; // 0.0–1.0
optional_allocation: number; // 0.0–1.0
burst?: boolean;
}
// Runtime budget state
class TokenBudget {
constructor(profile: BudgetProfile);
canFit(skill: Skill): boolean;
consume(skill: Skill): void;
remaining(tier: 'critical'|'standard'|'optional'): number;
toStatus(): BudgetStatus;
}
Overview
Token Budgets govern how context window space is allocated across skills within a GSD Skill Creator session. Each agent type can have a different budget profile — a planning agent that needs more analytical reasoning skills gets a higher allocation for those capabilities, while an executor agent focused on implementation patterns gets a different distribution. This per-agent differentiation ensures that context window space goes where it is most valuable for the work at hand.
Within a budget, skills are prioritized into three tiers: critical, standard, and optional. Critical skills load first, regardless of token count — these are the capabilities the agent absolutely cannot work without (e.g., security constraints, domain-critical patterns). Standard skills load if space permits after the critical tier is satisfied. Optional skills load only if the budget has remaining capacity after both critical and standard are accommodated.
The tier system is implemented as part of the Budget stage in the Skill Pipeline (CAP-016). The pipeline's Budget stage reads the active agent's profile from configuration and applies the tier allocation algorithm before handing off to the Load stage.
History
Token Budgets were introduced in v1.8 as a counterpart to the Skill Pipeline architecture. Before v1.8, GSD Skill Creator had a single global budget — a simple percentage of context (2–5%) applied uniformly regardless of agent type. This worked adequately when skill libraries were small, but caused problems as libraries grew: a planning agent and an executor agent would each load the same set of skills up to the same ceiling, even though their needs were entirely different.
The per-agent profile concept came from the observation that different agents in a GSD crew naturally needed different capability distributions. Planning agents needed more meta-skills (how to structure plans, how to estimate complexity). Executor agents needed more domain skills (how to write tests, how to handle auth, how to commit cleanly). A single global budget served neither well.
In v1.19, the Budget Inventory Model (CAP-073) extended the Token Budgets system with a LoadingProjection — a pre-flight calculation that separates the installed skill total from the actually loadable total given the current context size. This refinement substantially improved budget accuracy, particularly for agents working with large base prompts.
Key Concepts
Imagine packing a suitcase with a strict weight limit before a trip. You have three categories of items: things you absolutely must bring (medication, passport, phone charger), things you want to bring (clothes, shoes, books), and things that would be nice if there's room (snacks, extra gadgets, games).
You always pack the must-have items first. Then you add the want-to-haves until the suitcase is getting heavy. Only then do you consider the nice-to-haves, and only if the suitcase isn't full yet.
Token Budgets work exactly like this. Critical skills (your passport and medication) always load first, no matter what. Standard skills load next, if the context window has room. Optional skills only make it in if there's space remaining. And just like different trips need different packing strategies — a business trip versus a camping trip — different agent types get different budget profiles optimized for their specific needs.
Usage Examples
Example 1: Define a budget profile for an executor agent
# .claude/budgets/executor.yaml
agent_name: executor
total_budget: 8000
critical_allocation: 0.5 # 4000 tokens for critical skills
standard_allocation: 0.35 # 2800 tokens for standard skills
optional_allocation: 0.15 # 1200 tokens for optional skills
Example 2: Mark a skill's priority tier in its YAML frontmatter
# .claude/commands/my-domain-skill.md frontmatter
---
name: my-domain-skill
tier: critical # Always load this skill
triggers:
- domain-specific-keyword
---
Example 3: View budget consumption with /sc:status
# Inside a Claude Code session:
/sc:status
# Example output:
Budget profile: executor (8000 tokens)
Critical: 3200 / 4000 tokens used (6 skills)
Standard: 1800 / 2800 tokens used (4 skills)
Optional: 400 / 1200 tokens used (1 skill)
Total used: 5400 / 8000 tokens
Deferred: 2 skills (budget exhausted in standard tier)
Example 4: Enable burst mode for a large phase
# .claude/budgets/executor.yaml — temporary burst mode
agent_name: executor
total_budget: 8000
burst: true # Temporarily expands budget by 20% to 9600 tokens
critical_allocation: 0.5
standard_allocation: 0.35
optional_allocation: 0.15

