subagent-delegation
Skill0 starsChanged 41 days agoMITView on GitHub
Deciding when to hand work to an opencode subagent instead of doing it inline, picking which subagent to invoke, and writing the delegation so a fresh-context subagent can actually answer it. Covers the Task tool with `subagent_type` `explore`/`general`/`scout`, parallel units of work, `task_id` resume, `@mention` invocation, hidden agents, `permission.task` gating, and the `steps` limit that stops a runaway subagent. Use when work is independent enough to delegate, when a subagent came back with something useless, when the main thread is doing one thing while a parallel lookup is the obvious move, or when wiring a new subagent into a runtime. Not for writing the agents config itself (see opencode-config-authoring).
12 other projects use a version of this.
Adopted by
Most recently taken up by
- chrisbanes/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
- 0xUrsanomics/utopia-ostheir own version, first seen Nov 1, 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
- 0xUrsanomics/utopia-os★ 2same name
- p10ns11y/skills★ 2same name
- buildpad-ai/skills★ 1same 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 repository19 other files it gives its agents.
- api-doc-recallSkill
- assistant-runtime-architectureSkill
- code-disciplineSkill
- english-requestSkill
- github-repo-opsSkill
- git-safetySkill
- long-task-continuitySkill
- opencode-config-authoringSkill
- opencode-tool-outputSkill
- powershell-windowsSkill
- provider-reconnectSkill
- reference-booksSkill
- release-checklistSkill
- research-synthesisSkill
- self-improvementSkill
- skill-authoringSkill
- task-closureSkill
- test-first-fixSkill
- troubleshooting-treeSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 2 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 12 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Use this when there is a piece of work that can be walled off from the main thread long enough for a subagent to answer it, and you are …
- Very specific: line 27
Not for: adjusting the agent definitions themselves (see opencode-config-authoring), or checkpointing a long task so it survives a reset …
- Very specific: line 58
Do not send a general agent to count callers — explore is cheaper, cannot make changes, and has a narrower brief.
- Distinctive: line 81
When a subagent returns something off, find the gap in the prompt instead of retrying blindly or folding the work back inline.
- Very specific: line 102
If two agents can edit the same file, the result is merge conflict theatre.
“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
Handing a piece of work to a subagent is a transfer of context, not just a button. The subagent starts fresh: it does not see this conversation, it only knows what the delegation prompt carries. Nearly every useless subagent result is a delegation that assumed shared memory.
When to use this
Use this when there is a piece of work that can be walled off from the main thread long enough for a subagent to answer it, and you are choosing between doing it inline and delegating:
- Research that has a definite shape: "find every caller of X", "what versions of the SDK are installed".
- Parallel units of work that have no ordering constraint between them.
- A subagent just came back with something wrong and you need to see why it decoded the task differently.
- Wiring a new subagent into a runtime, or wondering why an existing one is not being invoked by the main agent.
Not for: adjusting the agent definitions themselves (see
opencode-config-authoring), or checkpointing a long task so it survives a
reset (see long-task-continuity).
Rules
Ordered by how often they go wrong.
1. A subagent does not know the conversation
It has none. Everything it needs must be in the delegation prompt: paths, patterns, the exact question, the format the answer must take. "Check that function I mentioned" is a prompt failure, not a subagent failure.
You can resume one subagent session by passing its task_id to the Task tool
again — the session continues with its previous messages and tool outputs. That
is the only channel by which a subagent's context survives: either it is
recreated with the prompt, or it is resumed with its own task_id. Otherwise
assume a clean slate.
2. Pick the smallest read-only subagent that can answer
Match the capabilities to the task, because capabilities are also a safety boundary:
| Need | subagent_type | Can it modify files? |
| Find files, search code, answer a question about the codebase | explore | no |
| Research external docs, inspect a dependency's source | scout | no |
| Multi-step work, execute units in parallel | general | yes (full tools) |
Do not send a general agent to count callers — explore is cheaper, cannot
make changes, and has a narrower brief. The converse error is worse: sending a
read-only agent to do the one thing it cannot, and getting back a refusal.
Specify the thoroughness you want when the task is open-ended ("quick" vs "very thorough"), and what to return — file paths, line numbers, a verdict, not a summary of its own process.
3. Delegate by telling it what "done" looks like
The subagent cannot ask "what did you mean?", so pre-answer its questions:
- The inputs, verbatim if they came from the user.
- The output contract: question → claim → evidence, or a table, or "X and Y".
- What it must NOT do (do not change files, keep it 300 lines, no new deps).
- How to verify its own work if verification exists (a command to run).
Tell it explicitly whether it is allowed to write code or must only research — a research subagent told "investigate" is fine; a general subagent told nothing may decide to "fix" what it was sent to describe.
4. A useless result is a re-delegation, not a blame
When a subagent returns something off, find the gap in the prompt instead of retrying blindly or folding the work back inline. The usual gaps:
- Ambiguous verb — "review" vs "rewrite vs "list".
- Missing context — it did not know why the shape matters.
- Missing return format — it summarized to comfort itself instead of answering.
- The wrong subtype — read-only agent asked for a write.
Re-delegate with the failure named: "you returned a summary; I need the exact
line numbers and the callers, in order." Re-run with the same task_id when
the continuation matters, or fresh when the misread was total.
5. An unbounded subagent is a bill without a receipt
A delegation with no limit can keep iterating until cost piles up. Put a cap
on the number of agentic steps (steps) when you configure the agent, and keep
the prompt bounded: one question, one deliverable. Parallel launches multiply
cost, so only parallelize what genuinely needs to be concurrent.
6. Keep the main thread the only writer
If two agents can edit the same file, the result is merge conflict theatre. A
subagent working on utils.ts while the main thread edits utils.ts is a bug
in your delegation, not in the tool. Wall off files per agent: if the work
touches what you are touching, do it inline or do it next, never both at once.
Reference
references/opencode-agents.md— the verified agent shape: built-in subagents, modes (subagent/primary/all),hidden,permission.taskglobs, and how a subagent inherits the invoking agent's model. Read when you reach forsubagent_typeoutside the built-ins.
The invisible_dots reference
The inspiration for this skill is the agent-per-VM model of feder-cr/invisible_dots: each Dot is a persistent agent with its own computer, memory and skills, and its own conversation. What opencode subagents take from that design is isolation — fresh context, walled-off state — with the difference that a Dot is durable and a subagent is a bounded unit of work. Read the parallel as: give every delegation the same self-sufficiency a Dot gets from its disk. If the subagent has not been told it, it does not know it.
Checklist
- The delegation prompt contains every input, the output contract, and the forbidden actions; nothing relies on "the conversation we were having"
- The smallest read-only subtype was chosen when read-only was enough
- The prompt says explicitly: research only, or code allowed
- A useless result was re-delegated with the gap named, or resumed via
task_idwhen continuity mattered stepscaps the work, and no two agents write the same file- The subagent was told what to return and how to verify itself
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.

