ECC/commands
vazidmansuri005 0efd6ed914
feat(commands): add /context-budget optimizer command (#554)
* feat(commands): add /context-budget optimizer command

Adds a command that audits context window token consumption across
agents, skills, rules, MCP servers, and CLAUDE.md files.

Detects bloated agent descriptions, redundant components, MCP
over-subscription, and CLAUDE.md bloat. Produces a prioritized
report with specific token savings per optimization.

Directly relevant to #434 (agent descriptions too verbose, ~26k
tokens causing performance warnings).

* fix: address review feedback on context-budget command

- Add $ARGUMENTS to enable --verbose flag passthrough
- Fix MCP token estimate: 45 tools × ~500 tokens = ~22,500 (was ~2,200)
- Fix heavy agents example: all 3 now exceed 200-line threshold
- Fix description threshold: warning at >30 words, fail at >50 words
- Add Step 4 instructions (was empty)
- Fix audit cadence: "quarterly" → "regularly" + "monthly" consistently
- Fix Output Format heading level under Step 4
- Replace "Antigravity" with generic "harness versions"
- Recalculate total overhead to match corrected MCP numbers

* fix: correct MCP tool count and savings percentage in sample output

- Fix MCP tool count: table now shows 87 tools matching the issues
  section (was 45 in table vs 87 in issues)
- Fix savings percentage: 5,100 / 66,400 = 7.7% (was 20.6%)
- Recalculate total overhead and effective context to match

* fix: correct sample output arithmetic

- Fix total overhead: 66,400 → 66,100 to match component table sum
  (12,400 + 6,200 + 2,800 + 43,500 + 1,200 = 66,100)
- Fix MCP savings: ~1,500 → ~27,500 tokens (55 tools × 500 tokens/tool)
  to match the per-tool formula defined in Step 1
- Reorder optimizations by savings (MCP removal is now #1)
- Fix total savings and percentage (31,100 / 66,100 = 47.0%)

* fix: distinguish always-on vs on-demand agent overhead

Agent descriptions are always loaded into Task tool routing context,
but the full agent body is only loaded when invoked. The audit now
measures both: description-only tokens as always-on overhead and
full-file tokens as worst-case overhead. This resolves the
contradiction between Step 1 (counting full files) and Tip 1 (saying
only descriptions are loaded per session).

* fix: simplify agent accounting and resolve inconsistencies

- Revert to single agent overhead metric (full file tokens) — simpler
  and matches what the report actually displays
- Add back 200-line threshold for heavy agents in Step 1
- Fix heavy agents action to match issue type (split/trim, not
  description-only)
- Remove .agents/skills/ scan path (doesn't exist in ECC repo)
- Consolidate description threshold to single 30-word check

* fix: add model assumption and verbose mode activation

- Step 4: assume 200K context window by default (Claude has no way to
  introspect its model at runtime)
- Step 4: add explicit instruction to check $ARGUMENTS for --verbose
  flag and include additional output when present

* fix: handle .agents/skills/ duplicates in skill scan

Skills scan now checks .agents/skills/ for Codex harness copies and
skips identical duplicates to avoid double-counting overhead.

* fix: add savings estimate to heavy agents action for consistency

* feat(skills): add context-budget backing skill, slim command to delegator

* fix: use structurally detectable classification criteria instead of session frequency

---------

Co-authored-by: vazidmansuri005 <vazidmansuri005@users.noreply.github.com>
2026-03-20 00:20:23 -07:00
..
aside.md feat: add /aside command (#407) 2026-03-12 23:52:46 -07:00
build-fix.md Revert "feat(ecc): prune plugin 43→12 items, promote 7 rules to .claude/rules/ (#245)" 2026-02-20 01:11:30 -08:00
checkpoint.md Revert "feat(ecc): prune plugin 43→12 items, promote 7 rules to .claude/rules/ (#245)" 2026-02-20 01:11:30 -08:00
claw.md feat: deliver v1.8.0 harness reliability and parity updates 2026-03-04 14:48:06 -08:00
code-review.md Revert "feat(ecc): prune plugin 43→12 items, promote 7 rules to .claude/rules/ (#245)" 2026-02-20 01:11:30 -08:00
context-budget.md feat(commands): add /context-budget optimizer command (#554) 2026-03-20 00:20:23 -07:00
cpp-build.md feat: add C++ language support and hook tests (#539) 2026-03-16 14:31:49 -07:00
cpp-review.md feat: add C++ language support and hook tests (#539) 2026-03-16 14:31:49 -07:00
cpp-test.md feat: add C++ language support and hook tests (#539) 2026-03-16 14:31:49 -07:00
devfleet.md Add Claude DevFleet multi-agent orchestration skill (#505) 2026-03-16 13:35:50 -07:00
docs.md feat(commands): add /docs; feat(mcp-configs): document Context7 (#530) 2026-03-16 13:35:05 -07:00
e2e.md fix: harden hook portability and plugin docs 2026-03-09 22:49:43 -07:00
eval.md feat: package as Claude Code plugin with marketplace distribution 2026-01-22 04:16:49 -08:00
evolve.md feat: project-scoped instinct isolation 2026-03-01 12:07:13 -08:00
go-build.md Revert "feat(ecc): prune plugin 43→12 items, promote 7 rules to .claude/rules/ (#245)" 2026-02-20 01:11:30 -08:00
go-review.md Revert "feat(ecc): prune plugin 43→12 items, promote 7 rules to .claude/rules/ (#245)" 2026-02-20 01:11:30 -08:00
go-test.md Revert "feat(ecc): prune plugin 43→12 items, promote 7 rules to .claude/rules/ (#245)" 2026-02-20 01:11:30 -08:00
gradle-build.md feat: add Kotlin, Android, and KMP rules, agent, skills, and command 2026-03-10 20:53:39 -07:00
harness-audit.md fix(harness-audit): make scoring deterministic with scripted rubric (#524) 2026-03-16 13:34:30 -07:00
instinct-export.md feat: project-scoped instinct isolation 2026-03-01 12:07:13 -08:00
instinct-import.md feat: project-scoped instinct isolation 2026-03-01 12:07:13 -08:00
instinct-status.md feat: project-scoped instinct isolation 2026-03-01 12:07:13 -08:00
kotlin-build.md fix: align kotlin diagnostics and heading hierarchy 2026-03-12 23:53:23 -07:00
kotlin-review.md feat: add kotlin commands and skill pack 2026-03-10 21:25:52 -07:00
kotlin-test.md feat: add kotlin commands and skill pack 2026-03-10 21:25:52 -07:00
learn-eval.md docs: clarify learn-eval verdict flow 2026-03-10 20:14:19 -07:00
learn.md Revert "feat(ecc): prune plugin 43→12 items, promote 7 rules to .claude/rules/ (#245)" 2026-02-20 01:11:30 -08:00
loop-start.md feat: deliver v1.8.0 harness reliability and parity updates 2026-03-04 14:48:06 -08:00
loop-status.md feat: deliver v1.8.0 harness reliability and parity updates 2026-03-04 14:48:06 -08:00
model-route.md feat: deliver v1.8.0 harness reliability and parity updates 2026-03-04 14:48:06 -08:00
multi-backend.md fix(commands): make ace-tool MCP optional in multi-* commands with built-in fallbacks 2026-03-04 14:49:53 -08:00
multi-execute.md fix(commands): make ace-tool MCP optional in multi-* commands with built-in fallbacks 2026-03-04 14:49:53 -08:00
multi-frontend.md fix(commands): make ace-tool MCP optional in multi-* commands with built-in fallbacks 2026-03-04 14:49:53 -08:00
multi-plan.md fix(commands): make ace-tool MCP optional in multi-* commands with built-in fallbacks 2026-03-04 14:49:53 -08:00
multi-workflow.md feat: add orchestration workflows and harness skills 2026-03-12 14:49:05 -07:00
orchestrate.md fix: refresh orchestration follow-up after #414 (#430) 2026-03-16 14:29:28 -07:00
plan.md fix: harden hook portability and plugin docs 2026-03-09 22:49:43 -07:00
pm2.md Revert "feat(ecc): prune plugin 43→12 items, promote 7 rules to .claude/rules/ (#245)" 2026-02-20 01:11:30 -08:00
projects.md fix: resolve CI failures on main — lint, hooks validator, and test alignment 2026-03-02 22:15:46 -08:00
promote.md fix: resolve CI failures on main — lint, hooks validator, and test alignment 2026-03-02 22:15:46 -08:00
prompt-optimize.md feat(skills): add prompt-optimizer skill and /prompt-optimize command (#418) 2026-03-12 23:40:02 -07:00
python-review.md Revert "feat(ecc): prune plugin 43→12 items, promote 7 rules to .claude/rules/ (#245)" 2026-02-20 01:11:30 -08:00
quality-gate.md feat: deliver v1.8.0 harness reliability and parity updates 2026-03-04 14:48:06 -08:00
refactor-clean.md Revert "feat(ecc): prune plugin 43→12 items, promote 7 rules to .claude/rules/ (#245)" 2026-02-20 01:11:30 -08:00
resume-session.md docs: align session commands with session manager 2026-03-10 20:24:15 -07:00
rust-build.md feat(agents): add Rust language support (#523) 2026-03-16 13:34:25 -07:00
rust-review.md feat(agents): add Rust language support (#523) 2026-03-16 13:34:25 -07:00
rust-test.md feat(agents): add Rust language support (#523) 2026-03-16 13:34:25 -07:00
save-session.md docs: align session commands with session manager 2026-03-10 20:24:15 -07:00
sessions.md fix: refresh orchestration follow-up after #414 (#430) 2026-03-16 14:29:28 -07:00
setup-pm.md Revert "feat(ecc): prune plugin 43→12 items, promote 7 rules to .claude/rules/ (#245)" 2026-02-20 01:11:30 -08:00
skill-create.md feat: add skill-create and continuous-learning-v2 commands 2026-01-27 04:01:06 -08:00
skill-health.md feat(design): skill health dashboard mockup (#518) 2026-03-16 14:01:41 -07:00
tdd.md fix: harden hook portability and plugin docs 2026-03-09 22:49:43 -07:00
test-coverage.md docs: enhance 5 thin commands and add Rust API example 2026-02-12 15:38:27 -08:00
update-codemaps.md Revert "feat(ecc): prune plugin 43→12 items, promote 7 rules to .claude/rules/ (#245)" 2026-02-20 01:11:30 -08:00
update-docs.md Revert "feat(ecc): prune plugin 43→12 items, promote 7 rules to .claude/rules/ (#245)" 2026-02-20 01:11:30 -08:00
verify.md feat: package as Claude Code plugin with marketplace distribution 2026-01-22 04:16:49 -08:00