subagent-delegation
Skill2 starsChanged 24 days agoMITView on GitHub
Reach for the Task tool when work is independent, parallelizable, or context-heavy. Subagents run in isolated context windows. their research output comes back as a single summary, keeping the main thread lean. Use for: parallel research (2+ independent questions), inventory scans, deep dives that would blow context budget, anything where the main thread only needs the conclusion. Don't use for: trivial lookups, sequential dependencies, work that requires main-thread state, or tasks under ~3 steps.
- Deletes or force-pushes
12 other projects use a version of this.
Adopted by
Most recently taken up by
- chrisbanes/skillstheir own version, first seen Nov 8, 2026
- TrueImmortal82/open-code-skillstheir own version, first seen Nov 8, 2026
- rmkr/skillstheir own version, first seen Nov 5, 2026
- shinpr/codex-workflowstheir own version, first seen Nov 3, 2026
- PracticalSwan/agent-skillstheir own version, first seen Oct 19, 2026
- code-dimension/code-dimension-skillstheir own version, first seen Oct 17, 2026
Other versions12 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 12
- chrisbanes/skills★ 1.1ksame name
- toonight/get-shit-done-for-antigravity★ 952same name
- sammcj/agentic-coding★ 169same name
- shinpr/codex-workflows★ 39same name
- PracticalSwan/agent-skills★ 22same name
- shinpr/codex-subagent-playbook★ 8same name
- code-dimension/code-dimension-skills★ 3same name
- p10ns11y/skills★ 2same name
- buildpad-ai/skills★ 1same name
- lfake2320-collab/agentdesk★ 0same name
2 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository57 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- advisorSkill
- agent-dispatchSkill
- arenaSkill
- audit-pypi-model-packageSkill
- branching-workflowSkill
- code-reviewSkill
- criticSkill
- cron-child-oauth-auditSkill
- daily-forestSkill
- deep-researchSkill
- diagnose-cron-timeoutSkill
- dreamingSkill
- eod-summarySkill
- filingSkill
- forest-synthesisSkill
- goalsSkill
- graph-hygieneSkill
- ideaSkill
- inline-tagsSkill
- intel-analyzerSkill
- longformSkill
- loop-experimentSkill
- loop-librarySkill
- meta-memory-reviewSkill
- office-hoursSkill
- open-loopsSkill
- plan-ceo-reviewSkill
- plan-design-reviewSkill
- prdSkill
- progressive-disclosureSkill
- reality-feedback-createSkill
- reality-review-weeklySkill
- recallSkill
- reconcile-extractionSkill
- redactSkill
- repo-auditSkill
- research-digestSkill
- review-gateSkill
- run-long-job-detachedSkill
- saveSkill
- scopeSkill
- self-auditSkill
- shadow-test-local-classifierSkill
- signal-scorerSkill
- skill-auditSkill
- skill-chainingSkill
- spawn-agent-in-tenantSkill
- spawn-tenantSkill
- split-log-rows-by-session-kindSkill
- telegram-dump-routerSkill
- telegram-reply-toolSkill
- verify-stackSkill
- wave-planSkill
- weekly-retroSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 7 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 12 edited versions we read keep these.
7
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
Anything the user said "go investigate": if it's open-ended and needs web + grep + reads, it's probably a subagent job.
- Distinctive: line 28
Sequential dependencies: if step B needs step A's result to even START, running both in parallel wastes compute
- Distinctive: line 69
Locked: Every dispatch prompt ends with the JSON return template (see agent-protocols-v1.md).
- Distinctive: line 150
When a subagent returns, your job is NOT to relay its findings verbatim.
- Distinctive: line 157
Never say "the agent said X".
- Distinctive: line 163
Dedup check: before building new infra → subagent greps codebase + reads contingency plans + checks if we already have it.
- Distinctive: line 191
When in doubt, estimate the explore cost in main thread (how many reads / searches / web fetches): if it's >5 tool calls, delegate.
“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Subagent Delegation
When to reach for it
Trigger the Task tool when you observe ANY of:
- Parallel-independent work: 2+ questions that don't depend on each other's answers. Research in parallel = N-way speedup + N-way context isolation.
- Context-heavy exploration: "scan the whole codebase for X", "compare 10 libraries", "audit 30 files". the raw output would blow context budget even if the final answer is small.
- Research that ends in a single conclusion: the user only needs the verdict, not the transcript. Subagent summary comes back in ~300-800 words, vs 5-10K tokens of raw exploration.
- Security audits / dep checks / legitimacy scans: main thread stays clean while the agent does the grunt work.
- Anything the user said "go investigate": if it's open-ended and needs web + grep + reads, it's probably a subagent job.
When NOT to delegate
- Trivial lookups (single file read, known path): direct tool is cheaper
- Sequential dependencies: if step B needs step A's result to even START, running both in parallel wastes compute
- State mutations: file edits, git ops, commits. keep in main thread for visibility
- Tasks under ~3 steps: subagent overhead > savings
- User-facing decision threads: user wants to see your reasoning, not a hidden agent's
The explore-plan-execute pattern
2026 default for non-trivial work:
- Explore: subagent gathers facts (inventory, comparables, docs, options)
- Plan: main thread synthesizes the exploration into a concrete plan
- Execute: main thread does the edits (with direct tools)
Separation matters: the explore phase is read-heavy and disposable. The execute phase needs your judgment. Don't conflate.
Parallel vs sequential
Parallel (default for independent work): send multiple Agent tool calls in ONE message with run_in_background: true. They run concurrently. Notifications arrive as each finishes.
Agent 1: research library A security
Agent 2: research library B security
Agent 3: scan our codebase for current usageSequential (only when A→B→C is strict): fire one, wait for result, feed into next. Slower but unavoidable for dependent chains.
Prompt discipline
Subagents are amnesiac. They see nothing except the prompt you hand them. Brief them like a smart colleague who walked in cold:
- Goal: what outcome you want
- Context: what's relevant from the session (file paths, prior decisions, constraints)
- Boundaries: what NOT to do (don't edit files, don't install, read-only, etc.)
- Output format: structured sections, word limit, no fluff
- Return contract (mandatory): structured JSON matching the
subagent_return_v1schema. Seedocs/agent-protocols.mdSurface 2 for full schema. Append the dispatch prompt template at the end of every brief. - Anti-slop: include "no em-dashes, no AI-slop wordlist (leverage/delve/navigate/holistic/seamless/foster/streamlin/unleash), no AI-cliche openers". subagents don't inherit CLAUDE.md (per your anti-slop brief).
Terse command-style prompts produce shallow work. Over-briefed prompts burn tokens. Aim for 150-400 words, precise.
Return contract (subagent_return_v1)
Locked. Every dispatch prompt ends with the JSON return template (see agent-protocols-v1.md). Required fields: summary / exit_status / files_changed / verification_hints / findings / recommendations / context_used / budget_actual.
Why the contract matters: trust-but-verify. Subagent's summary describes INTENT; parent must verify actual diff matches output before reporting "done." Without structured return, parent can't programmatically check claims. With it: parser → verifier → confidence verdict.
Verification helper: scripts/eval/verify_subagent_diff.py. takes claimed files_changed list + dispatch timestamp, reports verified / missing-claimed / unexpected-modifications. Run before reporting task completion to user.
Worktree isolation for code-modifying dispatches
Lifted from a Kanban-tool audit. concept-only, no install.
When a subagent is doing code-modifying work (writes/edits to repo files, not just research), wrap the dispatch in a fresh git worktree so the main working tree stays clean until the parent verifies the diff. Research-only dispatches (read tool calls, web fetches, summary returns) skip this entirely.
When worktree-wrap applies
✅ Subagent will Write / Edit / Bash-with-redirection on repo files ✅ Parallel subagents both touching the same repo (worktrees give per-dispatch isolation) ✅ Risky refactor where you want a clean rollback if the diff is wrong ❌ Pure research / audit / comparison (no file writes) ❌ Subagent runs in a different repo / external service / sandbox ❌ Single-file edits the parent could just do directly
4-step pattern
# 1. Parent creates worktree on a throwaway branch off current HEAD
DISPATCH_ID=$(date +%Y%m%d-%H%M%S)-$(openssl rand -hex 2)
git worktree add "sandbox/worktrees/$DISPATCH_ID" -b "subagent/$DISPATCH_ID"
# 2. Brief includes the worktree path. Subagent is told to operate ONLY there.
# Add to the dispatch prompt:
# "Working directory: sandbox/worktrees/<DISPATCH_ID>. Do not write outside this path."
# 3. After subagent returns subagent_return_v1.1, parent verifies the diff.
# scripts/eval/verify_subagent_diff.py uses time-based scope (--since + --claimed). Combine with
# --scope pointing at the worktree dir for containment-aware checks.
DISPATCH_START_ISO="<ISO timestamp captured before step 1>"
python3 scripts/eval/verify_subagent_diff.py \
--since "$DISPATCH_START_ISO" \
--claimed <files from subagent_return_v1.1.files_changed[].path> \
--scope "sandbox/worktrees/$DISPATCH_ID"
# 4a. SUCCESS PATH. merge back to main, remove worktree
# (If subagent_return_v1.1.exit_status == "success" AND verify passed AND
# verification_hints.expected_test passes when run.)
cd sandbox/worktrees/$DISPATCH_ID && git add -A && git commit -m "subagent: <one-liner>"
cd - && git merge --ff-only "subagent/$DISPATCH_ID"
git worktree remove "sandbox/worktrees/$DISPATCH_ID"
git branch -D "subagent/$DISPATCH_ID"
# 4b. FAILURE PATH. archive for postmortem, discard from main
# (If exit_status != "success" OR verify reports unexpected modifications.)
mkdir -p sandbox/archive/failed-worktrees/$DISPATCH_ID
cp -r sandbox/worktrees/$DISPATCH_ID/* sandbox/archive/failed-worktrees/$DISPATCH_ID/
git worktree remove --force sandbox/worktrees/$DISPATCH_ID
git branch -D "subagent/$DISPATCH_ID"Brief addition
In the dispatch prompt, after the standard sections, add:
WORKTREE: sandbox/worktrees/<DISPATCH_ID>
- All file writes MUST be under this path. Do NOT write to the main repo tree elsewhere.
- Your <files_changed> entries in the return contract should be ABSOLUTE paths under the worktree.
- If you need to read files outside the worktree (e.g., reference docs in memory/), Read them but never Write.What this contains
- Blast radius: a runaway subagent that writes wrong files corrupts only the worktree, not the main tree.
git worktree remove --forceis faster + safer thangit reset --hard. - Parallel safety: 2+ subagents on the same repo can't collide on shared files.
- Audit trail: failed dispatches archive to
sandbox/archive/failed-worktrees/for postmortem instead of disappearing. - Verification loop: pairs cleanly with
scripts/eval/verify_subagent_diff.py. verify before merge, not after.
Cost
Worktree creation is ~50-200ms. Cleanup is similar. Net overhead per code-modifying dispatch: <1s. Worth it for any non-trivial multi-file write.
Result handling
When a subagent returns, your job is NOT to relay its findings verbatim. The user doesn't see the agent's raw output. just your synthesis. So:
- Absorb the report: extract the 3-5 facts that matter
- Synthesize in your own voice: what does this mean for the user's task?
- Make the decision: "based on this, I recommend X" or "we should not proceed because Y"
- Cite specifics: file paths, line numbers, version numbers the agent found
Never say "the agent said X". you said X. You own the judgment.
Common patterns
Security audit: new lib / repo / MCP → subagent does the github stars + last commit + contributor check + CVE scan + dep tree read. Returns "PROCEED / CAUTION / HARD-NO" verdict. You make the install call.
Dedup check: before building new infra → subagent greps codebase + reads contingency plans + checks if we already have it. Returns "duplicates X at path Y" or "net new, safe to build."
Comparison research: "should we use A or B" → subagent builds comparison matrix. You make the pick.
Inventory scan: "what's in memory/" "how many skills do we have" → subagent counts + categorizes + flags rot. You synthesize the diagnosis.
Test harness: "does feature X work?" → subagent builds minimal repro + runs it + reports pass/fail. You decide if the result is good enough to ship.
Anti-patterns
❌ Don't chain subagents for sequential work. A→B→C in 3 subagents = 3× the latency of just doing it yourself.
❌ Don't delegate understanding. Never write "based on the research, implement it." Synthesis is yours.
❌ Don't spawn agents for single-file reads that you could do in one Read call.
❌ Don't run subagents in a loop. That's a cron job, not a subagent pattern.
❌ Don't skip the run_in_background: true flag when you have other work to do while the agent works. Blocking waits are wasted cycles.
Budget reality check
Each subagent is ~5-20K tokens of compute. Weigh that against the alternative:
- Quick exploratory question: direct Glob/Grep is cheaper
- Deep research across 10+ sources: subagent wins every time
- Single decision that requires wide fact-finding: subagent wins
- Parallel N-way work: subagent wins N×
When in doubt, estimate the explore cost in main thread (how many reads / searches / web fetches): if it's >5 tool calls, delegate.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

