Skip to content

Reduce subagent token usage across the forge skill chain#1

Open
anthonyespirat wants to merge 4 commits intomainfrom
forge-token-usage-improvements
Open

Reduce subagent token usage across the forge skill chain#1
anthonyespirat wants to merge 4 commits intomainfrom
forge-token-usage-improvements

Conversation

@anthonyespirat
Copy link
Copy Markdown
Owner

@anthonyespirat anthonyespirat commented Apr 18, 2026

Summary

Implements the token-usage improvements drafted in webapp/improvement.md (scratch notes, not tracked). Net: -49 lines, 4 files — and a much tighter per-dispatch context profile. The changes compound: every dispatch reads a shorter prompt, returns a shorter report, and defaults to a cheaper model unless the step actively asks for opus.

What changed

  • skills/subagent-execution/implementer-prompt.md (156 → 81 lines). Dropped the duplicated debugger / in-over-your-head / code-organization prose — the rules already live in skills/debugger/, so a one-line pointer is enough. Collapsed Forbidden to two bullets. Capped the report at 150 words and made the IF BLOCKED block conditional, so DONE reports stop dragging it back into the controller's context. Added an EXCERPTS-first instruction so the subagent skips redundant Reads when signatures are pasted inline. Removed the redundant Status meanings section — the controller's handling narrative in SKILL.md is the one that matters.
  • skills/subagent-execution/SKILL.md. Inverted the model default: sonnet is now the default, opus requires an explicit upgrade signal (3+ files across modules, design judgment, BLOCKED reasoning re-dispatch). Added a Mechanical steps — skip dispatch section so the controller can execute fully-specified [mechanical] steps directly instead of paying for a round-trip, and tracks them as DIRECT EXECUTIONS in the final report.
  • skills/writing-plans/SKILL.md. Added a [mechanical] step tag, a per-step EXCERPTS: block, and a ≤6-files-per-step budget. Extended the self-review with matching mechanical-audit and file-count-budget checks.
  • agents/codebase-explorer.md. Flipped caveman compression from optional to default-on. The report is consumed by writing-plans, not a human, so the ~50% token cut compounds across every downstream dispatch.

Expected impact (per 10-step run, estimated)

Change Savings
Trimmed implementer-prompt.md ~40–60k tokens
sonnet default + opus-on-signal ~30–40% on matching steps
Skip dispatch for [mechanical] steps 2–3 entire dispatches
150-word report cap, IF BLOCKED conditional ~10–15k tokens
EXCERPTS blocks cutting re-confirmation Reads ~5–10k tokens

anthonyespirat and others added 4 commits April 18, 2026 11:07
Implements the improvements drafted in webapp/improvement.md (not tracked).

- implementer-prompt.md: trim 156 → 81 lines. Drop the duplicated
  debugger / in-over-your-head / code-organization prose (the rules
  live in skills/debugger/). Collapse Forbidden to two bullets. Cap
  the report at 150 words and make IF BLOCKED conditional so DONE
  reports stop dragging it back into the controller's context. Add
  an EXCERPTS-first instruction so the subagent skips redundant
  Reads when signatures are pasted in. Delete the redundant Status
  meanings section — the controller's copy in SKILL.md is the one
  that matters.
- subagent-execution/SKILL.md: invert the model default. sonnet is
  now the default; opus requires an explicit upgrade signal. Add a
  "Mechanical steps — skip dispatch" section so the controller can
  execute fully-specified [mechanical] steps directly instead of
  paying for a round-trip, and track them as DIRECT EXECUTIONS in
  the final report.
- writing-plans/SKILL.md: add a [mechanical] tag, a per-step
  EXCERPTS block, and a ≤6-files-per-step budget. Extend the
  self-review with matching mechanical and file-count audits.
- codebase-explorer.md: flip caveman compression to default-on.
  The output is consumed by writing-plans, not a human, so the
  ~50% token cut compounds across every downstream dispatch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Surfaces the sonnet-default / opus-on-signal behavior from
subagent-execution as a top-level design principle, next to the
other cost-discipline bullets. Also nudges the short-report bound
down to 150 words to match the new implementer report cap.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant