| 1 | --- |
| 2 | name: delegate |
| 3 | description: Strategic delegation for multi-step coding, research, or verification work. Use when a task can be split into parent reasoning plus focused sub-agent execution through the agent tool. |
| 4 | metadata: |
| 5 | short-description: Delegate focused work to sub-agents |
| 6 | --- |
| 7 | |
| 8 | # Delegate |
| 9 | |
| 10 | Use sub-agents when they can do focused work in parallel while the parent keeps architectural judgment, integration, and final verification. |
| 11 | |
| 12 | ## Keep vs Delegate |
| 13 | |
| 14 | Keep in the parent: |
| 15 | |
| 16 | - Understanding the user's actual request and constraints |
| 17 | - Architecture, security, product, and release-risk decisions |
| 18 | - Cross-module integration |
| 19 | - Final review, test interpretation, and user-facing summary |
| 20 | |
| 21 | Delegate to sub-agents: |
| 22 | |
| 23 | - Read-only exploration over a bounded file set |
| 24 | - Mechanical edits with a clear file ownership boundary |
| 25 | - Focused test or lint runs |
| 26 | - Boilerplate generation from an explicit spec |
| 27 | - Independent checks that can run while parent work continues |
| 28 | |
| 29 | Do not delegate tiny one-step tasks, ambiguous product decisions, destructive operations without a clear acceptance criterion, or final verification. |
| 30 | |
| 31 | ## Launch Focused Work |
| 32 | |
| 33 | Use `agent` for a focused child run. Launch independent children together so they can run in parallel. |
| 34 | |
| 35 | Prefer provider-neutral `model_strength` over hardcoded model ids. Children inherit the active model by default (`model_strength: "same"`), including `type: "scout"`, so pass `model_strength: "faster"` explicitly to get the cheaper same-family sibling for read-only exploration: |
| 36 | |
| 37 | ```json |
| 38 | { |
| 39 | "name": "config_audit", |
| 40 | "prompt": "Inspect crates/tui/src/config.rs and crates/tui/src/settings.rs for duplicate model-default logic. Return file/line findings only; do not edit files.", |
| 41 | "type": "scout", |
| 42 | "model_strength": "faster", |
| 43 | "cwd": "." |
| 44 | } |
| 45 | ``` |
| 46 | |
| 47 | For code changes, give the child a precise write boundary and tell it not to revert unrelated edits. Keep implementation children capable with `model_strength: "same"`: |
| 48 | |
| 49 | ```json |
| 50 | { |
| 51 | "name": "docs_patch", |
| 52 | "prompt": "Update only docs/configuration.md to document the new [statusline] keys. Match the surrounding style. Do not edit other files.", |
| 53 | "type": "builder", |
| 54 | "model_strength": "same", |
| 55 | "cwd": "." |
| 56 | } |
| 57 | ``` |
| 58 | |
| 59 | Use `fork_context: true` only when the child genuinely needs the current conversation prefix. Leave it omitted for fresh, narrower context. |
| 60 | |
| 61 | ## Evaluate and Verify |
| 62 | |
| 63 | Sub-agent outputs are self-reports. Re-check material claims before relying on them: |
| 64 | |
| 65 | - Read changed files directly. |
| 66 | - Run the relevant tests locally. |
| 67 | - Inspect unexpected diffs before committing. |
| 68 | - Verify externally visible or destructive claims against source data. |
| 69 | |
| 70 | ## Prompt Shape |
| 71 | |
| 72 | A good delegation prompt includes: |
| 73 | |
| 74 | - The exact task |
| 75 | - Files or modules owned by the child |
| 76 | - Files or behavior the child must not touch |
| 77 | - Expected output format |
| 78 | - Acceptance criteria |
| 79 | |
| 80 | Weak prompt: |
| 81 | |
| 82 | ```text |
| 83 | Fix the settings bug. |
| 84 | ``` |
| 85 | |
| 86 | Strong prompt: |
| 87 | |
| 88 | ```text |
| 89 | Own only crates/tui/src/settings.rs and its tests. Preserve existing config key names. Add a regression test showing that provider-specific API key changes do not restart DeepSeek onboarding. Return the changed paths and test command output. |
| 90 | ``` |
| 91 |