본문으로 건너뛰기
Skillpedia
에이전트81k · #1558

nested-subagents

하는 일

이 스킬은 한 에이전트의 메모리에 다 담기 어려운 큰 문제를 위해 최대 다섯 단계 깊이의 하위 에이전트 트리를 만드는 방법을 안내합니다. 작업이 여러 층으로 나뉘는 복잡한 일을 맡기는 사람을 위한 스킬입니다.

사용하는 경우

  • ✓문제가 조사, 확장, 검증, 요약 같은 여러 층으로 나뉠 때.
  • ✓한 에이전트의 맥락에 중간 작업을 다 담을 수 없을 때.
  • ✓작업의 각 부분에 서로 다른 전문 역할이 필요할 때.

스킬 링크

https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-agent/skills/nested-subagents/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-agent/skills/nested-subagents/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 시장 조사를 여러 층으로 나눠, 하위 에이전트가 각 부분을 조사하고 검증한 뒤 요약하게 해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 먼저 작업 트리를 계획하는 조율자를 시작하고, 깊이 한도 안에서 자식 에이전트를 만들며, 자식 에이전트는 다시 자식을 만들 수 있습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Nested Sub-Agents

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.

When to use

  • The problem decomposes into nested layers (research → expand → verify → synthesize), each of which would otherwise pollute the parent's context.
  • A single agent's context window would not be enough to hold all the intermediate state.
  • The leaves of the tree are different 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.

Steps

  1. Invoke the coordinator — spawn 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>"
    })
    
  2. The coordinator decomposes first — it lays out the spawn tree via TodoWrite before any Task call. Inspect the tree before approving deep work.

  3. Children spawn children — any 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.

  4. Each level reports a summary — children return ~200-token structured summaries, not full transcripts. The whole point is to keep the parent's context clean.

  5. Tree shape is persisted — the 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.

Depth budget

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.

Benefits

  • Context isolation per level — top-level coordinator never sees inner chatter; leaf summaries climb back up.
  • Deeper delegation without re-summarization — eliminates the "summarize at level 1 to fit it all" anti-pattern that flat fan-out forces.
  • Tree-shaped cost attribution — parent_agent_id lineage gives accurate per-tree spend, not just flat per-agent.
  • Maps cleanly onto ruflo's existing orchestrators — ruflo-sparc:sparc-orchestrator (5 phases ≈ 5 levels), ruflo-goals:dossier-investigator (recursive entity expansion), v3-queen-coordinator (hierarchical-mesh top).

Anti-patterns (do NOT)

  • Pass Task to leaf agents. Leaves must not spawn. Add the leaf's subagent_type directly under the coordinator instead.
  • Wrap a Tier-1 codemod in a coordinator. Codemods (hooks_codemod) are depth-0 deterministic transforms — never put them inside a spawn tree.
  • Nest "for cleanliness". A premature nesting layer wastes latency and cost without saving context. If one agent can do the work, use one agent.
  • Return full transcripts from a child. That defeats the entire purpose of nesting. Children return structured summaries.

Related

  • Agent: ruflo-agent:nested-coordinator — the orchestrator
  • ADR-147 — design rationale and four-phase rollout
  • ADR-144 — authorization propagation shares the depth counter as AuthScope.delegationDepth
  • ADR-099 — dossier investigator (recursive parallel research) is the textbook deep use case
자주 묻는 질문

에이전트를 나란히 실행하지 않고 중첩하는 이유는 무엇인가요?

중첩은 속도보다 맥락 관리를 위한 것이라고 스킬은 설명합니다. 각 단계가 새 맥락 창을 가집니다.

얼마나 깊이 갈 수 있나요?

최대 다섯 단계까지입니다.

언제 건너뛰어야 하나요?

단순한 병렬 작업으로 충분하면 건너뛰라고 스킬은 설명합니다. 중첩은 시간이 더 걸리기 때문입니다.

상세 정보

작성자의 원본 설명

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

repo: ruvnet/ruflo

인기도

GitHub 스타
81k
순위
#1558
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬