nested-subagents
यह क्या करती है
यह स्किल एजेंट को पाँच स्तर तक गहरे उप-एजेंटों का पेड़ बनाने में मार्गदर्शन देती है, बड़ी समस्याओं के लिए जो एक एजेंट की मेमोरी पर भारी पड़ें। यह उन लोगों के लिए है जिनके जटिल काम परतों में बँटते हैं।
कब इस्तेमाल करें
- ✓जब कोई समस्या परतों में बँटे, जैसे शोध, विस्तार, जाँच और सारांश।
- ✓जब एक एजेंट का संदर्भ सारे बीच के काम को न रख सके।
- ✓जब काम के अलग-अलग हिस्सों को अलग विशेष भूमिकाएँ चाहिए।
Skill का लिंक
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-agent/skills/nested-subagents/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“इस बाज़ार शोध को परतों में बाँटिए, जिसमें उप-एजेंट हर हिस्से पर शोध करें, जाँचें, और फिर सारांश दें।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट एक coordinator शुरू करता है, जो पहले कार्यों का पेड़ योजनाबद्ध करता है, फिर child एजेंट बनाता है, जो गहराई की सीमा के भीतर अपने child बना सकते हैं।
तकनीकी सामग्री (मूल 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-detectorat one leaf,testerat another).
Skip this skill when flat fan-out (Task × N in one message) suffices — nesting adds latency.
Steps
Invoke the coordinator — spawn
nested-coordinatoras 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>" })The coordinator decomposes first — it lays out the spawn tree via
TodoWritebefore anyTaskcall. Inspect the tree before approving deep work.Children spawn children — any
nested-coordinator(or any other agent whose YAML frontmatter declarestools: [..., Task]) can itself callTaskto spawn the next level. Leaf agents (withoutTaskin their tools list) cannot.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.
Tree shape is persisted — the
post-taskhook writesparent_agent_idanddepthto 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_idlineage 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
Taskto leaf agents. Leaves must not spawn. Add the leaf'ssubagent_typedirectly 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
अक्सर पूछे जाने वाले सवाल
साथ-साथ एजेंट चलाने की जगह nesting क्यों?
स्किल कहती है कि nesting संदर्भ संभालने के लिए है, गति के लिए नहीं, क्योंकि हर स्तर की संदर्भ विंडो नई होती है।
यह कितनी गहराई तक जा सकती है?
पाँच स्तर तक गहरा।
इसे कब छोड़ें?
स्किल कहती है कि जब समानांतर कार्यों का सरल समूह काफ़ी हो, तो इसे छोड़ दें, क्योंकि nesting में समय ज़्यादा लगता है।
जानकारी
लेखक का मूल विवरण
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
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
agent-adaptive-coordinator
81kआपके एजेंट को काम बदलने पर AI एजेंटों के समूह को बाँटने और फिर से संतुलित करने में मदद करती है, और काम के हिसाब से लेआउट चुनती है।
agent-agent
81kआपके एजेंट को बड़े लक्ष्य को क्रमबद्ध कार्यों की योजना में बदलना सिखाती है, और स्थिति बदलने पर योजना फिर से बनाना भी।
agent-agentic-payments
81kAI खरीदारी के लिए खर्च के आदेश मैनेज करने में मदद करती है, जिसमें खर्च की सीमा, समय अवधि, व्यापारी नियम और signed मंज़ूरियाँ शामिल हैं।
agent-analyze-code-quality
81kआपके एजेंट को कोड की गुणवत्ता जाँचने में मदद करती है, बिना फ़ाइलें बदले code smells, technical debt और refactoring के सुझाव खोजकर।
मिलती-जुलती skills
add-model-provider
394kयह आपके एजेंट को सुरक्षित कमांड से OpenClaw में नया AI मॉडल प्रोवाइडर जोड़ने, API कीज़ को सादे टेक्स्ट से बचाने और लाइव टेस्ट चलाने देती है।
acp-router
394kयह आपके एजेंट को OpenClaw के ज़रिए Claude Code या Cursor जैसे कोडिंग असिस्टेंट को काम भेजने देती है, ताकि काम उसी टूल में चले।
browser-automation
394kयह आपके एजेंट को लॉगिन, टैब और अटकी वेब पेज से उबरने समेत, वेबसाइट पर चरण-दर-चरण काम करना सिखाती है।