nested-subagents
Fungsinya
Skill ini memandu agent membangun pohon sub-agent, hingga lima tingkat kedalamannya, untuk masalah besar yang akan membebani memori satu agent. Skill ini untuk Anda yang memiliki tugas kompleks yang terurai menjadi beberapa lapisan.
Kapan dipakai
- โSaat sebuah masalah terurai menjadi lapisan seperti riset, perluasan, pemeriksaan, dan ringkasan.
- โSaat konteks satu agent tidak akan muat menampung seluruh pekerjaan antara.
- โSaat bagian berbeda dari pekerjaan membutuhkan peran spesialis yang berbeda.
Link skill
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-agent/skills/nested-subagents/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
โPecah riset pasar ini menjadi beberapa lapisan, dengan sub-agent yang meneliti, memverifikasi, lalu merangkum tiap bagian.โ
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent memulai koordinator, yang pertama-tama merencanakan pohon tugas, lalu membuat agent anak yang bisa membuat anaknya sendiri dalam batas kedalaman.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
Pertanyaan umum
Mengapa memakai penyarangan dibanding menjalankan agent berdampingan?
Skill ini menyatakan penyarangan untuk mengelola konteks, bukan untuk kecepatan, karena tiap tingkat memiliki jendela konteks baru.
Seberapa dalam bisa sampai?
Hingga lima tingkat.
Kapan sebaiknya saya melewatinya?
Skill ini menyarankan untuk melewatinya jika sekumpulan tugas paralel sederhana sudah cukup, karena penyarangan menambah waktu.
Detail
Deskripsi asli dari pembuat
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
Popularitas
- Bintang GitHub
- 81k
- Peringkat
- #1558
- Lisensi
- MIT
- Diperbarui
- 2/11/2026
Komentar
- โฆ
Skill lain dari repositori ini
agent-adaptive-coordinator
81kMembantu agent Anda membagi dan menyeimbangkan kembali sekelompok agent AI saat beban kerja berubah, dengan memilih tata letak yang sesuai tugas.
agent-agent
81kMengajari agent Anda mengubah tujuan besar menjadi rencana tindakan yang berurutan, dan menyusun ulang rencana saat kondisi berubah.
agent-agentic-payments
81kMembantu agent Anda mengelola mandat belanja untuk belanja AI, dengan batas pengeluaran, jendela waktu, aturan merchant, dan persetujuan yang ditandatangani.
agent-analyze-code-quality
81kMembantu agent Anda meninjau kualitas kode, menemukan bau kode, utang teknis, dan ide refaktor tanpa mengubah berkas.
Skill serupa
add-model-provider
394kMemungkinkan agent Anda menghubungkan penyedia model AI baru ke OpenClaw dengan perintah pengaturan yang aman, menjaga kunci API tetap di luar teks biasa, dan menjalankan uji langsung.
acp-router
394kMembantu agent Anda mengirim tugas ke asisten pemrograman seperti Claude Code atau Cursor lewat OpenClaw, sehingga pekerjaan dijalankan di alat tersebut.
browser-automation
394kMengajari agent Anda mengendalikan halaman web langkah demi langkah, termasuk login, tab, dan pemulihan saat halaman berhenti merespons.