Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Spawn nested sub-agents (agents that spawn sub-agents, up to depth=5) via Claude Code's native Task tool — for context-managed deep delegation
.claude/skills/ruvnet-nested-subagents/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-03 | ✗→✓ | ▲ Improved | -6% | 0% |
| case-05 | ✗→✓ | ▲ Improved | -15% | 0% |
| case-08 | ✗→✓ | ▲ Improved | -25% | 0% |
| case-09 | ✗→✓ | ▲ Improved | -26% | 0% |
| case-10 | ✗→✓ | ▲ Improved | -13% | 0% |
Spawn a tree of sub-agents where each child can itself spawn children, up to 5 levels deep. The motivation is context management, not parallelism: each level gets a fresh context window so deep work doesn't blow the top-level agent's context budget.
subagent_types and need their own specialized prompts (e.g., pii-detector at one leaf, tester at another).Skip this skill when flat fan-out (Task × N in one message) suffices — nesting adds latency.
nested-coordinator as your top-level agent: Task({ subagent_type: "nested-coordinator", name: "root-coordinator", description: "Decompose and delegate <problem>", prompt: "<problem statement, with constraints and expected output shape>" })
TodoWrite before any Task call. Inspect the tree before approving deep work.nested-coordinator (or any other agent whose YAML frontmatter declares tools: [..., Task]) can itself call Task to spawn the next level. Leaf agents (without Task in their tools list) cannot.post-task hook writes parent_agent_id and depth to AgentDB on every spawn (ADR-147 P2). Query after the run for cost attribution and pattern learning.| Source | Limit | |---|---| | Anthropic API | 5 levels (announced 2026-06-09) | | Ruflo default (pre-task hook) | 4 levels — one-level guard band, configurable in claude-flow.config.json | | Strict-mode env var | CLAUDE_FLOW_STRICT_NESTING=true to enforce the ruflo cap |
The hook returns a typed NESTING_DEPTH_EXCEEDED error at the cap, with the full chain in the payload so the parent can decide to summarize, hand off, or abort.
parent_agent_id lineage gives accurate per-tree spend, not just flat per-agent.ruflo-sparc:sparc-orchestrator (5 phases ≈ 5 levels), ruflo-goals:dossier-investigator (recursive entity expansion), v3-queen-coordinator (hierarchical-mesh top).Task to leaf agents. Leaves must not spawn. Add the leaf's subagent_type directly under the coordinator instead.hooks_codemod) are depth-0 deterministic transforms — never put them inside a spawn tree.ruflo-agent:nested-coordinator — the orchestratorAuthScope.delegationDepth| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 17,677 | 23,488 | +33% | 1 | 1 | 0% | 2,459 | 2,906 | +18% | 0 | 0 | — |
case-02 | fail→fail | 27,122 | 13,055 | -52% | 1 | 1 | 0% | 4,709 | 1,632 | -65% | 0 | 0 | — |
case-03 | fail→pass | 21,484 | 16,425 | -24% | 1 | 1 | 0% | 4,801 | 4,518 | -6% | 0 | 0 | — |
case-04 | pass→pass | 13,137 | 6,330 | -52% | 1 | 1 | 0% | 2,333 | 2,134 | -9% | 0 | 0 | — |
case-05 | fail→pass | 13,067 | 4,365 | -67% | 1 | 1 | 0% | 2,105 | 1,793 | -15% | 0 | 0 | — |
case-06 | pass→pass | 7,913 | 3,259 | -59% | 1 | 1 | 0% | 1,305 | 1,547 | +19% | 0 | 0 | — |
case-07 | fail→fail | 55,791 | 4,180 | -93% | 1 | 1 | 0% | 766 | 1,314 | +72% | 0 | 0 | — |
case-08 | fail→pass | 8,688 | 1,585 | -82% | 1 | 1 | 0% | 1,682 | 1,255 | -25% | 0 | 0 | — |
case-09 | fail→pass | 8,791 | 2,860 | -67% | 1 | 1 | 0% | 1,686 | 1,250 | -26% | 0 | 0 | — |
case-10 | fail→pass | 7,470 | 1,387 | -81% | 1 | 1 | 0% | 1,377 | 1,199 | -13% | 0 | 0 | — |
case-11 | pass→pass | 14,943 | 6,436 | -57% | 1 | 1 | 0% | 2,674 | 2,249 | -16% | 0 | 0 | — |
case-12 | fail→pass | 29,358 | 2,017 | -93% | 1 | 1 | 0% | 2,842 | 1,307 | -54% | 0 | 0 | — |
case-13 | fail→pass | 8,499 | 1,490 | -82% | 1 | 1 | 0% | 1,399 | 1,219 | -13% | 0 | 0 | — |
case-14 | fail→pass | 12,508 | 1,160 | -91% | 1 | 1 | 0% | 2,170 | 1,162 | -46% | 0 | 0 | — |
case-15 | pass→pass | 8,955 | 3,702 | -59% | 1 | 1 | 0% | 1,671 | 1,649 | -1% | 0 | 0 | — |
case-20 | fail→pass | 10,837 | 2,243 | -79% | 1 | 1 | 0% | 1,925 | 1,368 | -29% | 0 | 0 | — |
case-16 | fail→pass | 12,115 | 1,433 | -88% | 1 | 1 | 0% | 2,163 | 1,229 | -43% | 0 | 0 | — |
case-17 | fail→pass | 7,896 | 1,369 | -83% | 1 | 1 | 0% | 1,532 | 1,209 | -21% | 0 | 0 | — |
case-18 | pass→pass | 12,648 | 6,277 | -50% | 1 | 1 | 0% | 2,172 | 2,033 | -6% | 0 | 0 | — |
case-19 | pass→pass | 12,381 | 5,163 | -58% | 1 | 1 | 0% | 2,290 | 1,938 | -15% | 0 | 0 | — |
case-21 | pass→pass | 7,084 | 2,934 | -59% | 1 | 1 | 0% | 1,191 | 1,460 | +23% | 0 | 0 | — |
case-22 | fail→pass | 11,865 | 5,502 | -54% | 1 | 1 | 0% | 1,143 | 2,063 | +80% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 21 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +55 percentage points is the difference between those two pass rates over the 21 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.