A validated kit of project subagents
Four subagents for the tiny-app sample (code-explorer, test-runner, reviewer, implementer) plus the test-runner's PreToolUse hook, and a validator that checks any agents folder against the documented frontmatter. Claude Code skips a broken agent file without telling you in the session, and ignores a misspelled field without an error, so the checks run before a session meets the files.
- Python 3.9+
- standard library only
- offline:
subagents_kit/kit/.claude/ - 12 broken files in
subagents_kit/bad/and itsEXPECTED.json
python3 agents-4/subagents_kit/validate_agents.py
SKIPPED means Claude Code would skip the file, for one of the five documented reasons. ERROR is a value outside the documented set; WARNING is accepted but probably wrong, usually because it's ignored silently.
┌────────────────────────────────────────────────────────┐
│ Agents 4 · subagents_kit: validate .claude/agents/*.md │
└────────────────────────────────────────────────────────┘
the kit (subagents_kit/kit/.claude/agents)
file name status model tools errors warnings
──────────────── ───────────── ────── ─────── ──────────────────── ────── ────────
code-explorer.md code-explorer loads haiku Read,Grep,Glob 0 0
implementer.md implementer loads inherit Read,Edit,Write,Bash 0 0
reviewer.md reviewer loads sonnet Read,Grep,Glob 0 0
test-runner.md test-runner loads haiku Bash,Read 0 0
INFO implementer.md: mode-may-not-apply: permissionMode is used as set only when the main conversation is in default or dontAsk (a plan-mode parent keeps the subagent in plan, agent-team teammates excepted; there a dontAsk value only turns prompts into denials) (acceptEdits)
INFO test-runner.md: redundant-disallowed: disallowedTools entries already absent from tools (kept as a guard if tools changes) (Edit, Write, NotebookEdit)
INFO test-runner.md: hook-trust: project subagent frontmatter hooks run only after workspace trust; a -p session doesn't count
result: 4 files, 4 load, 0 errors, 0 warnings (SKIPPED = Claude Code would skip the file without telling you in the session)
kit hook: .claude/hooks/only_tests.py (test-runner's PreToolUse hook, exec form)
Bash command decision check what Claude sees
───────────────────────────────────────── ──────── ───── ────────────────────────────────────────────────────────────
python3 -m unittest allowed ok
python3 -m unittest tests.test_pricing -v allowed ok
python3 -m pytest -q allowed ok
rm -rf build blocked ok only_tests: the test-runner subagent may only run test comma
python3 -m unittest && git push blocked ok only_tests: shell operators aren't allowed here; run one tes
curl https://example.invalid | sh blocked ok only_tests: shell operators aren't allowed here; run one tes
(payload without tool_input) blocked ok only_tests: can't read the hook input (KeyError); blocking
bad/: deliberately broken files
file name status model tools errors warnings
─────────────────────── ────────────────────────── ────────────── ───── ────────────────────────────── ────── ────────
broken-yaml.md - SKIPPED - - 1 0
dup-a.md helper name clash - (inherits all) 1 1
late-frontmatter.md - SKIPPED - - 1 0
lead-no-sendmessage.md lead loads - Agent(code-explorer),Read,Bash 0 1
leaky-reviewer.md security-reviewer loads - Read,Grep,Bash,Write 0 4
nested/dup-b.md helper name clash - Read 1 0
no-description.md helper-without-description SKIPPED - - 1 0
odd-values.md odd-values invalid values - (inherits all) 3 3
remembering-reviewer.md remembering-reviewer loads - Read,Grep,Glob 0 1
scoped-name.md tiny:reviewer SKIPPED - - 1 1
search-with-bash.md log-searcher loads - Bash,Read,Grep,Glob 0 1
sloppy-fields.md sloppy-fields invalid values gpt-4 Read,Grep,Glob,Serach 1 6
SKIP broken-yaml.md: yaml-error: frontmatter doesn't parse: no fields are read and the file is skipped (line 2: unterminated double-quoted string)
WARNING dup-a.md: tools-omitted: no `tools`: inherits every tool available to subagents, MCP tools included
ERROR dup-a.md: duplicate-name: two files declare the same name: only one loads, by filesystem read order ('helper' also in nested/dup-b.md)
SKIP late-frontmatter.md: no-frontmatter: line 1 isn't `---`: treated as documentation, never loaded
WARNING lead-no-sendmessage.md: agent-without-sendmessage: lists Agent but not SendMessage: it can start workers but not resume them (resuming uses SendMessage) (add SendMessage to tools)
WARNING leaky-reviewer.md: bypass-mode: bypassPermissions is never applied from a subagent file (v2.1.267+)
WARNING leaky-reviewer.md: read-only-writes: a review/explore role with tools that can change files (Bash, Write)
WARNING leaky-reviewer.md: grep-with-bash: on macOS, Linux and WSL a subagent that lists Bash doesn't get Grep or Glob; it searches with grep/find through Bash (drop Grep, or drop Bash to get them back; Windows keeps both)
WARNING leaky-reviewer.md: memory-enables-writes: memory turns on Read, Write and Edit automatically (no effect when auto memory is off) (memory: project adds Edit; the agent is a review/explore role; for a read-only agent, leave memory off or deny Edit outside its memory dir)
ERROR nested/dup-b.md: duplicate-name: two files declare the same name: only one loads, by filesystem read order ('helper' also in dup-a.md)
SKIP no-description.md: missing-description: `name` but no `description`: skipped (reason in the debug log)
ERROR odd-values.md: bad-max-turns: maxTurns must be a positive integer (0)
WARNING odd-values.md: duplicate-skill: skill listed twice (api-conventions)
ERROR odd-values.md: bad-isolation: isolation accepts only `worktree` (True)
ERROR odd-values.md: not-bool: not a boolean (true/false, yes/no, on/off, 1/0) (background: 'maybe')
WARNING odd-values.md: bad-cache-ttl: experimental.cacheTtl accepts 5m or 1h; other values are ignored (2h)
WARNING odd-values.md: tools-omitted: no `tools`: inherits every tool available to subagents, MCP tools included
WARNING remembering-reviewer.md: memory-enables-writes: memory turns on Read, Write and Edit automatically (no effect when auto memory is off) (memory: project adds Edit and Write; the agent had no write tools; for a read-only agent, leave memory off or deny Edit outside its memory dir)
SKIP scoped-name.md: name-colon: `:` is reserved for plugin-scoped identifiers: skipped (tiny:reviewer)
WARNING scoped-name.md: short-description: description too short to route on: say what it does and when to use it (34 characters)
WARNING search-with-bash.md: grep-with-bash: on macOS, Linux and WSL a subagent that lists Bash doesn't get Grep or Glob; it searches with grep/find through Bash (drop Grep, Glob, or drop Bash to get them back; Windows keeps both)
WARNING sloppy-fields.md: unknown-field: field not in the frontmatter table: ignored silently (max_turns (did you mean maxTurns?))
WARNING sloppy-fields.md: cache-ttl-top-level: write cacheTtl inside the experimental map, not at the top level (experimental: {cacheTtl: ...})
WARNING sloppy-fields.md: bad-model: not a documented model value (alias, full claude-* ID, or inherit) (gpt-4)
ERROR sloppy-fields.md: auto-compact-units: autoCompactWindow is a token count from 100000 to 1000000: write 200000, not 200k ('200k')
WARNING sloppy-fields.md: bad-color: color must be red, blue, green, yellow, purple, orange, pink or cyan (magenta)
WARNING sloppy-fields.md: bad-effort: effort must be low, medium, high, xhigh or max (extreme)
WARNING sloppy-fields.md: unknown-tool: not a built-in tool name, an mcp__ pattern or Agent(...) (tools: 'Serach')
bad/ vs EXPECTED.json
file expected codes result
─────────────────────── ────────────────────────────────────────────────────────────────────────────────────────────────────── ──────
broken-yaml.md yaml-error caught
dup-a.md duplicate-name, tools-omitted caught
late-frontmatter.md no-frontmatter caught
lead-no-sendmessage.md agent-without-sendmessage, agent-type-list caught
leaky-reviewer.md bypass-mode, read-only-writes, memory-enables-writes caught
nested/dup-b.md duplicate-name caught
no-description.md missing-description caught
odd-values.md bad-isolation, not-bool, bad-max-turns, duplicate-skill, bad-cache-ttl, tools-omitted caught
remembering-reviewer.md memory-enables-writes caught
scoped-name.md name-colon caught
search-with-bash.md grep-with-bash caught
sloppy-fields.md unknown-tool, bad-model, unknown-field, auto-compact-units, cache-ttl-top-level, bad-color, bad-effort caught
install
cp -r agents-4/subagents_kit/kit/.claude <repo>/ # agents + the test-runner hook script
chmod +x <repo>/.claude/hooks/only_tests.py
then: @"code-explorer (agent)" where is DISCOUNTS defined? or claude --agent code-explorer
session-only, no files: claude --agents "$(python3 agents-4/subagents_kit/validate_agents.py --emit-agents-json)"
- The implementer's
permissionMode: acceptEditsis used as set only under a Manual (default) ordontAskparent. A plan-mode parent keeps the subagent in plan (agent-team teammates excepted), where adontAskvalue only turns prompts into denials; anacceptEdits, auto or bypass parent imposes its own mode. - The test-runner's frontmatter hook allows only test commands and blocks the rest with exit 2, malformed input included, so it fails closed. It checks command strings; it can't see what a test file does when it runs.
- Four files would never load: unparseable YAML,
---not on line 1, nodescription, a:in the name. None of them shows up in the session. memoryturns on Read, Write and Edit by itself, so a "read-only" reviewer with memory can write.- On macOS, Linux and WSL a subagent that lists Bash doesn't get Grep or Glob back: it searches with
grepandfindthrough Bash. That's why the kit's Bash agents list neither. - Silent mistakes:
max_turnsis ignored as an unknown field, andautoCompactWindowwants a token count,200000, not200k.
Install the kit with cp -r agents-4/subagents_kit/kit/.claude <repo>/ and chmod +x <repo>/.claude/hooks/only_tests.py, as the output's last lines say. A project subagent's frontmatter hooks run only after you accept the workspace trust dialog for that folder, and a claude -p run never shows the dialog.
--emit-agents-jsonprints the four loadable agents as one JSON object forclaude --agents "$(…)", a session-only way to try them. It dropscolorandexperimental, which--agentsignores, and says so on stderr.- Check the kit as plugin subagents:
python3 agents-4/subagents_kit/validate_agents.py agents-4/subagents_kit/kit/.claude/agents --plugin --no-bad. Two new warnings: the implementer'spermissionModeand the test-runner'shooksdon't apply in a plugin. - Run the hook by hand:
rm -rf buildis refused on stderr with exit 2. Swap inpython3 -m unittestand it exits 0 with no output; pipe ingarbageinstead of JSON and it blocks that too.echo '{"hook_event_name":"PreToolUse","tool_name":"Bash","tool_input":{"command":"rm -rf build"}}' \ | python3 agents-4/subagents_kit/kit/.claude/hooks/only_tests.py; echo "exit=$?" - Break it, in a copy: give the read-only reviewer
memory: project. Onlyreviewer.mdgains a warning,memory-enables-writes; warnings don't change the exit code (0).mkdir /tmp/lab-kit && cp -R agents-4/subagents_kit/kit/.claude /tmp/lab-kit/ python3 -c 'import pathlib; p = pathlib.Path("/tmp/lab-kit/.claude/agents/reviewer.md") p.write_text(p.read_text().replace("effort: high\n", "effort: high\nmemory: project\n", 1))' python3 agents-4/subagents_kit/validate_agents.py /tmp/lab-kit --no-bad
- Names must be unique: when two files in one agents folder declare the same name, only one loads, by filesystem read order. Only
nameanddescriptionare required. Multi-word fields are camelCase (maxTurns,disallowedTools), and identity isname, not the filename. toolsis an allowlist: leave it out and the subagent inherits every tool available to subagents, MCP tools included.- A tool list can say less than it does:
memoryadds write tools, and Bash replaces Grep and Glob. - Frontmatter values can stop applying: the main conversation's mode decides whether
permissionModeis used at all, and plugin subagents ignorehooks,mcpServers,permissionModeandinitialPrompt.
Fan out to worktrees and read the merge report
Plan four tasks as branches, git worktrees and capped claude -p --output-format json --json-schema runs, then answer the question that matters afterwards: what can be merged, in which order, and where it conflicts. Worktrees stop runs from editing the same files on disk; they don't stop two tasks from wanting the same lines.
- Python 3.9+
- standard library only
- offline:
fixtures/fanout_replay.json(illustrative values) - git, for
--simulate
python3 agents-4/fanout_orchestrator.py
The default run is a dry run: it prints the plan and the exact commands, runs nothing, then builds the merge report from recorded result objects whose fields follow --output-format json.
┌─────────────────────────────────────────────────────────────────────┐
│ Agents 4 · fanout_orchestrator: parallel headless runs in worktrees │
└─────────────────────────────────────────────────────────────────────┘
plan
# task branch worktree files it may change
─ ────────────────────── ───────────────────────────── ─────────────────────────────── ─────────────────────────────────────────
1 case-insensitive-codes fanout/case-insensitive-codes $WT_BASE/case-insensitive-codes tinyapp/pricing.py, tests/test_pricing.py
2 receipt-item-count fanout/receipt-item-count $WT_BASE/receipt-item-count tinyapp/cli.py
3 cart-remove-qty fanout/cart-remove-qty $WT_BASE/cart-remove-qty tinyapp/cart.py, tests/test_cart.py
4 discount-docs fanout/discount-docs $WT_BASE/discount-docs README.md, tinyapp/pricing.py
workers: read-only planning: tools=Read,Grep,Glob --permission-mode dontAsk
caps: per task --max-turns 8 --max-budget-usd 0.25; total cap $1.00 for 4 tasks, 2 at a time
commands (dry run: nothing below has run)
REPO=<temp copy of common/samples/tiny-app, a git repo> WT_BASE=<temp dir outside the repo>
git -C "$REPO" worktree add -b fanout/case-insensitive-codes "$WT_BASE/case-insensitive-codes" main
git -C "$REPO" worktree add -b fanout/receipt-item-count "$WT_BASE/receipt-item-count" main
git -C "$REPO" worktree add -b fanout/cart-remove-qty "$WT_BASE/cart-remove-qty" main
git -C "$REPO" worktree add -b fanout/discount-docs "$WT_BASE/discount-docs" main
# per task, in its worktree (BRIEF = that task's brief; shown for case-insensitive-codes):
(cd "$WT_BASE/case-insensitive-codes" && claude -p "$BRIEF" --output-format json --max-turns 8 --max-budget-usd 0.25 --permission-mode dontAsk --tools Read,Grep,Glob --allowedTools Read,Grep,Glob --disallowedTools 'mcp__*' --strict-mcp-config --settings '{"disableAllHooks":true}' --no-session-persistence --json-schema '{"type":"object","properties":{"summary":{"type":"string"},"files":{"type":"array","items":{"type":"string"}},"tests":{"type":"string"},"risks":{"type":"array","items":{"type":"string"}}},"required":["summary","files"],"additionalProperties":false}')
# afterwards (git worktree add made these, so removing them is your step):
git -C "$REPO" worktree remove --force "$WT_BASE/<task>" # then: git -C "$REPO" branch -D fanout/<task>
brief for case-insensitive-codes
| Goal: Make discount codes case-insensitive in apply_discount().
| Files you may change: tinyapp/pricing.py, tests/test_pricing.py. Don't touch any other file.
| Done when: `python3 -m unittest` passes and a new test shows apply_discount(2000, 'welcome10') == 200.
| This is a planning run: don't edit anything. Read the code, then report the files a change would touch, how you'd test it, and the risks.
| Return the report as the structured output: summary, files, tests, risks.
replayed outcomes (agents-4/fixtures/fanout_replay.json: recorded result objects, illustrative values)
per-task outcome
task stop_reason terminal_reason subtype turns cost files changed mergeable tests in its worktree
────────────────────── ─────────── ─────────────── ─────────────── ───── ─────── ───────────────────────────────────────────────────── ───────── ─────────────────────────────────────
case-insensitive-codes tool_use completed success 7 $0.0391 tests/test_pricing.py +3/-0, tinyapp/pricing.py +2/-2 yes python3 -m unittest: Ran 14 tests, OK
receipt-item-count tool_use completed success 5 $0.0264 tinyapp/cli.py +1/-0 yes python3 -m unittest: Ran 13 tests, OK
cart-remove-qty tool_use max_turns error_max_turns 9 $0.0508 tinyapp/cart.py +1/-1 no -
discount-docs tool_use completed success 4 $0.0187 README.md +7/-0, tinyapp/pricing.py +1/-1 yes python3 -m unittest: Ran 13 tests, OK
cart-remove-qty: Reached maximum number of turns (8)
spent: $0.1350 total (client-side estimates from each result's total_cost_usd)
file overlap (shared files between tasks; · = none)
task A B C D
──────────────────────── ─ ─ ─ ─
A case-insensitive-codes - · · 1
B receipt-item-count · - · ·
C cart-remove-qty · · - ·
D discount-docs 1 · · -
A+D share tinyapp/pricing.py
suggested merge order
1. fanout/receipt-item-count (touches no file another task touches)
2. fanout/case-insensitive-codes (shares files with discount-docs: merge one, then rebase or re-run the other)
3. fanout/discount-docs (shares files with case-insensitive-codes: merge one, then rebase or re-run the other)
- fanout/cart-remove-qty not merged: error_max_turns; resume it or re-run with a higher cap
Next: --simulate proves the overlaps with real worktrees and trial merges; --real runs claude -p per task.
- The total cap comes first: four tasks at $0.25 each is the most the fan-out can spend, plus up to one response per run, because each budget is checked against a client-side estimate.
- Per task, one branch, one worktree and one capped, read-only
claude -pwhose--json-schemamakes the worker's report machine-readable. - Claude Code didn't create these worktrees, so neither
.worktreeincludenor any cleanup of its own applies:git worktree removeandgit branch -Dare your steps. stop_reasonistool_useon--json-schemaruns, which is expected: the structured answer arrives through a tool call.cart-remove-qtyhit its turn cap, so it isn't mergeable.- The overlap matrix predicts trouble before any merge: tasks A and D both touch
tinyapp/pricing.py. - The merge order puts the task that touches no shared file first, merges one of the overlapping pair before re-running or rebasing the other, and leaves out the capped run.
Now make it real without a model. --simulate builds a temp git copy of the sample, adds one real worktree per task, applies scripted edits in place of Claude, runs the tests in each worktree, then trial-merges into fanout/integration in a worktree of its own:
python3 agents-4/fanout_orchestrator.py --simulate
┌─────────────────────────────────────────────────────────────────────┐ │ Agents 4 · fanout_orchestrator: parallel headless runs in worktrees │ └─────────────────────────────────────────────────────────────────────┘ … simulated fan-out repo: $TMP/tiny-app worktrees: $TMP/worktrees per-task outcome task stop_reason terminal_reason subtype turns cost files changed mergeable tests in its worktree ────────────────────── ─────────── ─────────────── ─────────────── ───── ──── ───────────────────────────────────────────────────── ───────── ───────────────────── case-insensitive-codes - completed success - - tests/test_pricing.py +3/-0, tinyapp/pricing.py +2/-2 yes Ran 14 tests, OK receipt-item-count - completed success - - tinyapp/cli.py +1/-0 yes Ran 13 tests, OK cart-remove-qty - max_turns error_max_turns - - tinyapp/cart.py +1/-1 no - discount-docs - completed success - - README.md +7/-0, tinyapp/pricing.py +1/-1 yes Ran 13 tests, OK cart-remove-qty: (simulated) stopped at its turn cap before finishing; edits left uncommitted file overlap (shared files between tasks; · = none) task A B C D ──────────────────────── ─ ─ ─ ─ A case-insensitive-codes - · · 1 B receipt-item-count · - · · C cart-remove-qty · · - · D discount-docs 1 · · - A+D share tinyapp/pricing.py suggested merge order 1. fanout/receipt-item-count (touches no file another task touches) 2. fanout/case-insensitive-codes (shares files with discount-docs: merge one, then rebase or re-run the other) 3. fanout/discount-docs (shares files with case-insensitive-codes: merge one, then rebase or re-run the other) - fanout/cart-remove-qty not merged: error_max_turns; resume it or re-run with a higher cap trial merge into fanout/integration branch result conflicted files ────────────────────── ──────── ────────────────── receipt-item-count merged - case-insensitive-codes merged - discount-docs CONFLICT tinyapp/pricing.py tests on fanout/integration: Ran 14 tests, OK repo checkout unchanged: HEAD, its branch, `git status` and the diffs match the start (workers and the trial merge used their own worktrees) removed 5 worktrees; the temp repo is deleted at exit (LAB_KEEP_TMP=1 keeps it)
- Everything happens under a temp dir: the repo copy and every worktree.
- The files column is now each worktree's real diff, and the tests ran in each worktree.
- The overlap the matrix predicted is a real conflict: both tasks edit the same docstring line in
pricing.py. - The branches that did merge still pass the tests on the integration branch.
- The repo's own checkout is checked at the end: HEAD, branch, status and diffs match the start.
- Fan out a subset:
--only case-insensitive-codes --only discount-docs --simulatereproduces thepricing.pyconflict with two tasks, while--only case-insensitive-codes --only receipt-item-count --simulatemerges both cleanly. --jsonadds the replayed report as JSON after the tables, with the top-level keysoutcomes,overlaps,merge_orderandtrial_merge(empty in a dry run).LAB_KEEP_TMP=1 python3 agents-4/fanout_orchestrator.py --simulatekeeps the temp repo, with itsfanout/*branches andfanout/integration, so you can inspect them with git. The last line then ends withLAB_KEEP_TMP=1: the temp repo stays at <path>; delete that folder when you're done.
Fan out for real. It costs money: one capped claude -p per task in temp worktrees of a temp copy of tiny-app, at most --parallel at a time (default 2), with the total cap printed first. Workers are read-only by default (--tools Read,Grep,Glob, --permission-mode dontAsk): they plan and report the files they'd touch, so the files column reads "predicted footprint" and mergeable reads n/a (planning run).
python3 agents-4/fanout_orchestrator.py --real \
--max-turns 6 --max-budget-usd 0.10 --model haiku
python3 agents-4/fanout_orchestrator.py --real --allow-writes \
--parallel 2 --max-budget-usd 0.25
--allow-writes lets workers edit (acceptEdits; Read,Edit,Write,Grep,Glob, no Bash); the script commits each worktree and runs the same trial merge. --repo PATH fans out from your own repo, with worktrees and the trial merge in a temp dir; it checks your checkout is untouched (exit 1 if not) and prints cleanup commands instead of deleting your branches. Running several sessions at once multiplies token use. The course checked this path only with a stand-in claude script, so no real fan-out has been recorded.
- State the total cap before starting: tasks times
--max-budget-usd, plus about one response per run. - A worker that stopped at its cap isn't mergeable, whatever it changed. Gate each one on the result fields (
stop_reason, thenterminal_reason, thensubtype) and readstructured_output. - File overlap predicts conflicts; only a trial merge proves them.
- Worktrees are fresh checkouts, so gitignored files such as
.envare missing..worktreeincludeonly copies files into worktrees Claude Code creates (-w, subagent isolation). A script that runsgit worktree addmust copy.envitself, andgit worktree removeis your step either way.
Lint the brief you hand a subagent
A subagent starts with its own system prompt, the CLAUDE.md files, a git status snapshot, any preloaded skills and one string from you. Use a brief template (Goal, Context, Constraints, Out of scope, Deliverable, Done when, Budget, Escalate when) and a linter that catches what that string usually lacks: context leaks, vague words, unverifiable checks, missing paths and no write scope.
- Python 3.9+
- standard library only
- offline: 4 sample briefs in
agents-4/briefs/ - paths checked against tiny-app
python3 agents-4/delegation_brief.py
┌─────────────────────────────────────────────────────────┐ │ Agents 4 · delegation_brief: what a subagent can act on │ └─────────────────────────────────────────────────────────┘ paths checked against: tiny-app agents-4/briefs/bad_leaky.md score 0 (7 errors, 5 warnings, 2 info) WARNING missing-section: a template section is missing (the severity depends on the section): Constraints INFO missing-section: a template section is missing (the severity depends on the section): Out of scope INFO missing-section: a template section is missing (the severity depends on the section): Budget WARNING missing-section: a template section is missing (the severity depends on the section): Escalate when ERROR context-leak: refers to something only the parent conversation knows; the subagent gets just this prompt: 'as discussed' ERROR context-leak: refers to something only the parent conversation knows; the subagent gets just this prompt: 'earlier' ERROR context-leak: refers to something only the parent conversation knows; the subagent gets just this prompt: 'like before' ERROR context-leak: refers to something only the parent conversation knows; the subagent gets just this prompt: 'last run' ERROR context-leak: refers to something only the parent conversation knows; the subagent gets just this prompt: 'the file above' ERROR context-leak: refers to something only the parent conversation knows; the subagent gets just this prompt: 'the error we saw' ERROR context-leak: refers to something only the parent conversation knows; the subagent gets just this prompt: 'we found' WARNING path-not-found: a path in the brief doesn't exist in the repo: tinyapp/rounding.py (in tiny-app) WARNING no-output-format: the deliverable doesn't say what shape to return (report, list, table, JSON, ...): Fix it. WARNING no-write-scope: doesn't say whether the subagent may edit files, and which: say 'Read-only' or name the files it may edit agents-4/briefs/bad_vague.md score 3 (1 errors, 13 warnings, 2 info) WARNING missing-section: a template section is missing (the severity depends on the section): Constraints INFO missing-section: a template section is missing (the severity depends on the section): Out of scope ERROR missing-section: a template section is missing (the severity depends on the section): Deliverable INFO missing-section: a template section is missing (the severity depends on the section): Budget WARNING missing-section: a template section is missing (the severity depends on the section): Escalate when WARNING vague-goal: the goal names an activity, not an outcome: Improve the discount stuff and clean up pricing as needed, etc. WARNING vague-word: a word that hides a decision the subagent can't make for you: 'etc' WARNING vague-word: a word that hides a decision the subagent can't make for you: 'as needed' WARNING vague-word: a word that hides a decision the subagent can't make for you: 'properly' WARNING vague-word: a word that hides a decision the subagent can't make for you: 'stuff' WARNING vague-word: a word that hides a decision the subagent can't make for you: 'clean up' WARNING no-path: Context names no file or directory; the subagent has to search first: Context WARNING unverifiable-done: a done-when item nobody can check (no command, test, path or exact value): It works properly. WARNING unverifiable-done: a done-when item nobody can check (no command, test, path or exact value): The code looks good. WARNING no-write-scope: doesn't say whether the subagent may edit files, and which: say 'Read-only' or name the files it may edit WARNING too-thin: very short brief: the subagent will have to guess: 169 characters agents-4/briefs/good_case_insensitive.md score 100 (0 errors, 0 warnings, 0 info) agents-4/briefs/ok_readonly_review.md score 90 (0 errors, 1 warnings, 2 info) INFO missing-section: a template section is missing (the severity depends on the section): Out of scope INFO missing-section: a template section is missing (the severity depends on the section): Budget WARNING missing-section: a template section is missing (the severity depends on the section): Escalate when samples vs briefs/EXPECTED.json brief score result ──────────────────────── ───── ─────────── bad_leaky.md 0 as expected bad_vague.md 3 as expected good_case_insensitive.md 100 as expected ok_readonly_review.md 90 as expected
- Each of these points at a conversation the subagent never saw. "The only content you pass from parent to subagent is the Agent tool's prompt string" (SDK subagents).
- The brief names a file that doesn't exist, so the subagent's first turns go to searching for it.
- Without a write scope, the subagent has to guess whether it may edit, and which files.
- Each vague word hides a decision the subagent can't make for you.
- "It works properly" isn't a check anyone can run. Done-when items need a command, a test, a path or an exact value.
- The good sample scores 100: every section present, every path real, every check runnable.
The rules are regexes over the text, so treat a finding as a question to answer, not a verdict. To hand a rendered brief to the kit's implementer as a whole session, which costs money and belongs in a scratch git copy of the sample, never your own checkout, follow the capped command and cleanup steps in agents-4/README.md.
- Start a brief from the template:
python3 agents-4/delegation_brief.py --template > brief.mdprints the eight sections with a hint in each. --render agents-4/briefs/good_case_insensitive.mdprints the brief as the one prompt string the subagent gets, with headings as labels, after a size line on stderr (characters and a rough token estimate).- Break it: append one leaky sentence to the perfect brief. The score drops from 100 to 55 with three
context-leakerrors, and the exit code turns to 1:{ cat agents-4/briefs/good_case_insensitive.md; echo 'Fix the error we saw earlier.'; } > /tmp/lab-brief.md python3 agents-4/delegation_brief.py /tmp/lab-brief.md - Lint your own against your repo:
python3 agents-4/delegation_brief.py my_brief.md --repo ~/code/myrepo.
- Everything the subagent needs is in the brief: concrete paths, facts you established, decisions you made.
- The deliverable names its shape, because the parent reads only the subagent's final message.
- Done-when lists checks someone else can run, and the constraints say exactly which files may change.