sub-agents
Skill99 starsChanged 7 months agoMITView on GitHub
Run agent definitions as sub-agents. Use when the user names an agent or sub-agent to run, references an agent definition, or delegates a task to an agent.
7 other projects use a version of this, 2 of them edited.
Adopted by
Most recently taken up by
- blindlove200/sub-agents-skillsedited, first seen Nov 8, 2026
- parcadei/Continuous-Claudetheir own version, first seen Oct 17, 2026
- parcadei/Continuous-Claude-v2their own version, first seen Oct 8, 2026
- MeRezaRezaei/goal-driven-parallel-agentstheir own version, first seen Sep 20, 2026
- opencue/cuecardsedited, first seen Aug 17, 2026
- modal-projects/modal-auto-research-skillstheir own version, first seen Apr 14, 2026
Other versions7 projects use a version of this.
Word for word · 0
None found.
Edited · 2
- opencue/cuecards★ 1038% same
- blindlove200/sub-agents-skills★ 539% same
Wrote their own version · 5
- parcadei/Continuous-Claude★ 3.9ksame name
- parcadei/Continuous-Claude-v2★ 3.9ksame name
- parcadei/Continuous-Claude-v3★ 3.9ksame name
- modal-projects/modal-auto-research-skills★ 47same name
- MeRezaRezaei/goal-driven-parallel-agents★ 0same name
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.
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 3 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
3
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 16
[codex.md](references/codex.md): - Read before first execution from Codex.
- Very specific: line 18
Script Path: Use absolute path {SKILL_DIR}/scripts/run_subagent.py where {SKILL_DIR} is the directory containing this SKILL.md file.
- Distinctive: line 61
When the user provides an agent name, select it if it appears in the result.
- Distinctive: line 66
When the user leaves the agent selection open:
- Very specific: line 105
If execution fails because run-agent is missing, retry with --cli set to the current client's backend.
- Very specific: line 128
Place .md files in .agents/ directory:
“Common” is measured: kept by at least 6 in 10 of the 6 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
Sub-Agents - External CLI AI Task Delegation
Spawns external CLI AIs (codex, claude, cursor-agent, glm, kimi, grok, antigravity, gemini, opencode, command-code, mcode, pi) as isolated sub-agents with dedicated context.
Workflow: discover available definitions, select one from the user request, execute it, and handle the JSON response.
Resources
- run_subagent.py - Main execution script
- codex.md - Read before first execution from Codex; covers permissions and timeout
Script Path: Use absolute path {SKILL_DIR}/scripts/run_subagent.py where {SKILL_DIR} is the directory containing this SKILL.md file.
Interpreting User Requests
Extract parameters from user's natural language request:
| Parameter | Source |
--agent | Agent name from the user request or workflow selection |
--prompt | Task instruction part (excluding agent specification) |
--cwd | Current working directory (absolute path) |
--cli | Backend override explicitly requested by the user; otherwise omit |
--timeout | Timeout explicitly requested by the user, converted to milliseconds; otherwise omit (default: 600000) |
Example:
"Run code-reviewer on src/"
→ --agent code-reviewer --prompt "Review src/" --cwd $(pwd)
Important: Permission and Timeout
This script executes external CLIs that require elevated permissions.
Before first execution:
- Request elevated permissions via your CLI's tool parameters
- Set tool timeout to match
--timeoutargument (default: 600000ms)
For Codex CLI (most common permission issues): See references/codex.md for exact JSON parameter format.
Workflow
Step 1: List Available Agents
Always list agents first to discover available definitions:
{SKILL_DIR}/scripts/run_subagent.py --listOutput:
{"agents": [{"name": "code-reviewer", "description": "Reviews code..."}], "agents_dir": "/path/.agents"}When the user provides an agent name, select it if it appears in the result. If it is absent, report the available definitions and wait for a selection. When the result is empty, provide the Agent Definition Format below and wait for the user to add a definition.
When the user leaves the agent selection open:
| Available agents | Action |
| 0 | Report that no definitions are available, provide the Agent Definition Format below, and wait |
| 1 | Select it |
| 2+ | Show names and descriptions, then ask the user to select one |
Step 2: Execute Agent
{SKILL_DIR}/scripts/run_subagent.py \
--agent <name> \
--prompt "<task>" \
--cwd <absolute-path>Append --cli <backend> when the user specifies a backend. Append
--timeout <milliseconds> when the user specifies a timeout.
Step 3: Handle Response
Parse JSON output and check status field:
{"result": "...", "exit_code": 0, "status": "success", "cli": "claude"}By status:
| status | Meaning | Action |
success | Task completed | Use result directly |
partial | Timeout but has output | Review partial result, may need retry |
error | Execution failed | Check error and exit_code; retry after satisfying the reported requirement |
For configuration or credential errors, retry after the required external configuration has changed.
If execution fails because run-agent is missing, retry with --cli set to
the current client's backend.
By exit_code (when status is error):
| exit_code | Meaning | Resolution |
| 0 | Success | - |
| 124 | Timeout | Increase --timeout or simplify task |
| 127 | CLI not found | Install required CLI (claude, codex, etc.) |
| 1 | General error | Check error field in response |
Agent Definition Location
| Priority | Source | Path |
| 1 | Environment variable | $SUB_AGENTS_DIR |
| 2 | Default | {cwd}/.agents/ |
To customize: export SUB_AGENTS_DIR=/custom/path
Agent Definition Format
Place .md files in .agents/ directory:
---
run-agent: claude
model: sonnet
permission: safe-edit
---
# Agent Name
Brief description of agent's purpose.
## Task
What this agent does.
## Output Format
How results should be structured.run-agent supplies the backend. Pass --cli only as an explicit one-run
override; execution fails with a corrective error when neither is specified.
Frontmatter fields:
| Field | Values | Description |
run-agent | codex, claude, cursor-agent, glm, kimi, grok, antigravity, gemini, opencode, command-code, mcode, pi | Which CLI executes this agent |
model | Backend-specific model name (optional) | Model passed to the selected CLI; omit to use its configured default |
effort | Backend/model-specific reasoning level or OpenCode variant (optional) | Advanced: forwarded as an opaque value. Confirm support for the selected model before setting; omit to use its default. Unsupported on cursor-agent and gemini |
permission | read-only, safe-edit (default), yolo | read-only for investigation, safe-edit for workspace edits, or yolo to bypass approvals and sandboxing |
Backend-specific permission behavior:
mcode:read-onlyandsafe-editboth use--permission smart, which allows direct edits. A tool call thatsmartdenies leaves the run going, so the run can still returnsuccess.yolouses--permission full.pi:read-onlyenables onlyread,grep,find, andls, so the agent has no shell or MCP tools.safe-editandyoloboth enable Pi's default tools, includingbash,edit, andwrite.
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.

