ワンクリックで
context-budget
Audit and optimize AI agent context window usage to reduce token overhead and improve response quality
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Audit and optimize AI agent context window usage to reduce token overhead and improve response quality
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Run one high-stakes decision through a council of 5 ephemeral advisor lenses that answer in parallel, peer-review each other anonymously, and get synthesised into a single verdict — agreements, clashes, blind spots, a recommendation, and the one thing to do first. Adapted from Karpathy's LLM Council. For genuine decisions with stakes and tradeoffs, not factual lookups or creation tasks.
PR-time dual-delta read of coverage/complexity/module-size/dependency-cycles vs. orphan-ref baseline; ratchet+absolute thresholds; LLM curation only on breach.
Shrink a SKILL.md without changing meaning — deterministic cleanup first, LLM rewrite only if the target isn't met. Test-file anchors preserved; frontmatter, headings, and code blocks never modified. Dry-run by default; --apply writes.
Capture insights, test hypotheses, and promote confirmed patterns to rules (adapted for multi-agent environments). Default mode is single- developer/session capture to knowledge/. Team mode aggregates recurring review feedback across the fleet into rule-promotion candidates — fleet-wide patterns promote to shared workspace rules, single-repo patterns stay local.
Create, update, and validate the team's Definition of Done (docs/definition- of-done.md). create/update scaffolds from a template and grills the manager for team items; validate walks a diff/PR against the checklist (met/unmet/not-applicable). Signal-only contract referencing existing enforcement (architect, security, audit-*, guardrails) — never gates a commit. Consumed by codereview.
Proactive cadence summary over a knowledge root — 'what changed / what needs you today' without being asked. Deterministic core (octopus briefing, over the octopus kr registry) computes the change-delta since a per-root watermark and composes octopus hygiene + synthesize; this skill narrates it, grounded to source nodes, on the cheapest tier.
| name | context-budget |
| description | Audit and optimize AI agent context window usage to reduce token overhead and improve response quality |
Categorize everything that loads into the agent's context:
| Category | Source | Always Loaded? |
|---|---|---|
| Instructions | CLAUDE.md, AGENTS.md | Yes |
| Rules | .claude/rules/**/*.md | Yes (per-session) |
| Skills | .claude/skills/**/SKILL.md | On activation |
| Agents/Roles | .claude/agents/*.md | On invocation |
| Commands | .claude/commands/*.md | On invocation |
| MCP configs | settings.json mcpServers | Yes |
| Project context | knowledge/ modules | Via roles |
Start with the deterministic harness — it measures the always-loaded baseline, the registry listing, and the core↔rules duplication, and prints a machine-readable summary:
scripts/context-budget.sh [repo-root]
The same script backs the CI ratchet tests/test_context_budget.sh, which fails
if the baseline or duplication regresses (ceilings ratchet down as optimizations
land). Run the script first; use the LLM audit below only for the semantic
targets (§3) the script cannot judge.
Estimate token count (rough: 1 token ~ 4 characters):
Look for:
Reduce always-loaded content:
Consolidate:
Restructure:
After auditing, produce a summary:
Context Budget Report
=====================
Total estimated tokens: X,XXX
- Rules (always loaded): X,XXX
- Skills (on demand): X,XXX
- Instructions (CLAUDE.md): X,XXX
- Other: X,XXX
Issues found: N
[HIGH] rules/common/patterns.md: 156 lines (threshold: 100)
[MED] Redundant security guidance in common/ and csharp/
[LOW] TODO placeholder in rules/python/architecture.md
Recommendations:
1. ...
2. ...