Skip to content

Commit 7a4c2e4

Browse files
authored
Clarify sub-skill progressive disclosure in token/cost optimization guidance (#39227)
1 parent 3ca39c2 commit 7a4c2e4

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

.github/aw/token-optimization.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Apply these in order — each check can halve costs:
1414
- [ ] **gh-proxy**: Set `tools.github.mode: gh-proxy` — skips Docker MCP server startup and extra tool definitions
1515
- [ ] **cli-proxy**: Mount additional MCP servers as CLIs via `cli-proxy: true` — agent pipes output through `jq` before it enters context
1616
- [ ] **Sub-agents**: Delegate repetitive per-item tasks to `model: small` sub-agents (~10–20× cheaper)
17+
- [ ] **Sub-skills**: Keep the main prompt as a short execution plan; move detailed playbooks/output layouts into `## skill:` blocks the agent invokes only when needed
1718
- [ ] **Prompt size**: Strip redundant instructions, examples, and pleasantries from the prompt body
1819
- [ ] **Dynamic context**: Inject only required fields — `${{ github.event.issue.number }}` not the full event payload
1920
- [ ] **Pull context on demand**: query logs/data only after a hypothesis forms; avoid preloading large raw dumps into the initial prompt
@@ -264,6 +265,16 @@ Nothing else.
264265

265266
**Why this saves tokens:** sub-agents run on the cheap `small` model; the main agent only reads compact `{"number":…, "category":…}` JSON; sub-agent dispatches can run in parallel.
266267

268+
### Pair sub-agents with sub-skills (progressive disclosure)
269+
270+
Use sub-skills as progressive disclosure for instruction-heavy tasks:
271+
272+
- Keep the main prompt short and plan-like (what to do, in what order).
273+
- Put verbose instructions (report layout, rubric details, long formatting constraints) into `## skill:` blocks.
274+
- Invoke those skills only at the moment they are needed (for example, when producing final output), so early planning/execution turns stay lean.
275+
276+
This pattern lowers ambient context and usually improves both latency and AIC by delaying expensive instruction payloads until the final phase.
277+
267278
**Sub-agent model aliases:**
268279

269280
| Alias | Use when |

docs/src/content/docs/reference/cost-management.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,15 @@ See [Inline Sub-Agents](/gh-aw/reference/inline-sub-agents/) for the full syntax
476476

477477
### Use Inline Skills to Reduce Context
478478

479-
Move large instruction blocks out of the main prompt body using inline skills. At runtime, each `## skill:` block is extracted and written to engine-specific skill locations — the agent can invoke the skill on demand instead of receiving the guidance upfront, keeping the ambient context slim:
479+
Move large instruction blocks out of the main prompt body using inline skills. At runtime, each `## skill:` block is extracted and written to engine-specific skill locations — the agent can invoke the skill on demand instead of receiving the guidance upfront, keeping the ambient context slim.
480+
481+
Treat the main prompt as an execution plan and sub-skills as deferred detail:
482+
483+
- Main prompt: concise plan, sequencing, and decision points.
484+
- Sub-skills: verbose checklists, report templates/layout rules, and domain rubrics.
485+
- Invoke sub-skills only when needed (for example, at final report generation), not at startup.
486+
487+
This progressive-disclosure pattern keeps early turns focused and reduces per-run token overhead:
480488

481489
```aw wrap
482490
engine:

0 commit comments

Comments
 (0)