con un clic
rp-orchestrate-v2
// Plan, decompose, and delegate complex tasks across multiple agents using RepoPrompt MCP tools
// Plan, decompose, and delegate complex tasks across multiple agents using RepoPrompt MCP tools
Use for Codex multi_agent_v2 subagent orchestration: delegation decisions, spawn_agent prompts, custom agent_type roles, reasoning_effort choices, safe parallelism, wait/list/send/followup/close handling, commit discipline, receipts, and root-thread coordination.
Build with RepoPrompt MCP tools context builder plan → implement
Deep planning workflow using RepoPrompt MCP tools: map seams, draft, critique, polish — produces a ready-to-execute plan document
Deep investigation with RepoPrompt MCP tools: tools gather evidence, follow-up reasoning synthesizes selected context
Iterative performance optimization loop using RepoPrompt MCP tools: instrument with debug-only metrics, establish a baseline, then plan → delegate one optimize+harden cycle → re-measure → ask oracle for next plan, looping until the oracle is satisfied or the target metric is met
Export a ChatGPT-ready Question / Plan / Review prompt using RepoPrompt MCP tools
| name | rp-orchestrate-v2 |
| description | Plan, decompose, and delegate complex tasks across multiple agents using RepoPrompt MCP tools |
| repoprompt_managed | true |
| repoprompt_skills_version | 61 |
| repoprompt_variant | mcp |
Raw request: $ARGUMENTS
You are an orchestrator: plan, decompose, delegate. Implementation and deep context-gathering happen in sub-agents. Keep your own context lean for coordination.
Before any planning, bind to the target codebase using its working directory:
{"tool":"bind_context","args":{"op":"bind","working_dirs":["/absolute/path/to/project"]}}
This auto-resolves to the window containing your project. No need to list windows first.
If binding succeeds → proceed to Phase 1 If no match → the codebase isn't loaded. Find and open the workspace:
{"tool":"manage_workspaces","args":{"action":"list"}}
{"tool":"manage_workspaces","args":{"action":"switch","workspace":"<workspace_name>","open_in_new_window":true}}
Then retry the working_dirs bind.
Translate the user's prompt into the codebase's actual nouns — concrete modules, filenames, patterns — so builder can focus immediately instead of disambiguating. 1-2 navigation calls (tree or search) is usually enough.
Example:
NetworkService (HTTP wrapper) — see APIClient for the existing auth retry pattern."Shortcuts:
code_mapper agent with one specific question.Keep this light — builder handles the deep reading.
{"tool":"get_file_tree","args":{"type":"files","mode":"auto"}}
{"tool":"file_search","args":{"pattern":"<key term>","mode":"path"}}
Then:
{"tool":"context_builder","args":{
"instructions":"<contextualized task>",
"response_type":"plan",
"export_response":true
}}
If you can't disambiguate from a quick scan, dispatch a narrow code_mapper agent first:
{"tool":"spawn_agent","args":{
"task_name":"map_<area>",
"agent_type":"code_mapper",
"reasoning_effort":"low",
"fork_turns":"none",
"message":"Check <specific thing> -- report back briefly."
}}
code_mapper agents are cheap — spawn multiple in parallel for different areas, but keep each prompt narrow. They tend to overthink broad instructions.
Once you have a plan — whether generated via builder or provided by the user — you'll want sub-agents to see it. Use export_response:true to write any generated plan to a shareable file. This works on:
context_builder (with response_type: "plan", "question", or "review") — exports the generated responseoracle_send — exports any oracle response, including follow-ups to a context_builder chatFor user-provided plan files, you already have a path — just reference it in dispatch briefs.
The tool returns oracle_export_path and oracle_export_instruction. Include oracle_export_path inside the message you send on your next spawn_agent call. The oracle_export_instruction field is a ready-made sentence ("Read the Oracle export at <path> with read_file …") you can emit verbatim at the head of that message. The child agent opens the file with read_file. Do not ask child agents to continue your Oracle chat — they are in different tabs.
The export is a shared document. Sub-agents treat it as read-only context. As the orchestrator, you own this file — use it as a living checklist by updating it (via apply_edits) to mark items complete, note deferred work, or track progress across phases.
// Generate and export the plan in one call
{"tool":"context_builder","args":{
"instructions":"<task description>",
"response_type":"plan",
"export_response":true
}}
// Or export an oracle follow-up
{"tool":"oracle_send","args":{
"message":"Plan: <focused planning question>",
"mode":"plan",
"export_response":true
}}
// Then reference the export path in the child agent message
{"tool":"spawn_agent","args":{
"task_name":"orchestrate_goal",
"agent_type":"implementation_lead",
"reasoning_effort":"high",
"fork_turns":"none",
"message":"Read the plan at <plan path> with read_file first. Implement <work item>."
}}
Take the plan (from context_builder or a user-provided plan file) and break it into up to 5 discrete work items.
For each item, note:
Most tasks decompose into 2-3 items — that's the sweet spot. If you're reaching for 4-5, consider whether some items can be combined. If you're beyond 5, you're decomposing too finely — raise the abstraction level.
If the task naturally decomposes into 1 item, skip the orchestration overhead — just dispatch it directly. Don't create ceremony for simple work.
For multi-item work, dispatch a fresh agent per item. The plan file provides continuity — each agent reads it first, sees what's already done, and reasons with a clean context budget.
The pattern is a verify-then-dispatch-fresh loop:
file_search or read_file on key deliverables catches drift before it compounds.Do not fire-and-forget the full list. Catching drift early — before the next agent builds on a flawed foundation — is your value as the orchestrator.
// 1. Dispatch item 1 as a fresh agent
{"tool":"spawn_agent","args":{
"task_name":"orchestrate_item_1",
"agent_type":"implementation_lead",
"reasoning_effort":"high",
"fork_turns":"none",
"message":"Read the plan at <plan path> with read_file first. Your job is item 1: <brief>. Later items are handled separately."
}}
// 2. Agent completes — verify against the plan.
// Optionally spot-check a key file:
{"tool":"read_file","args":{"path":"<key file from item 1>"}}
// 3. Update the plan file to record progress:
{"tool":"apply_edits","args":{
"path":"<plan path>",
"search":"- [ ] Item 1:",
"replace":"- [x] Item 1:"
}}
// 4. Dispatch item 2 as a new fresh agent:
{"tool":"spawn_agent","args":{
"task_name":"orchestrate_item_2",
"agent_type":"implementation_lead",
"reasoning_effort":"high",
"fork_turns":"none",
"message":"Read the plan at <plan path> with read_file first. Item 1 is complete. Your job is item 2: <brief>."
}}
Sometimes it's better to keep a single agent alive and steer it through work. Consider steering when:
When steering, the loop is the same but step 5 becomes followup_task on the existing task name instead of a fresh dispatch:
{"tool":"followup_task","args":{
"target":"orchestrate_item_1",
"message":"Item 1 looks good. Moving on to item 2: <brief>. Refer back to the plan at <plan path> if needed."
}}
implementation_lead (reasoning_effort:"high") — Default for complex implementation, architectural decisions, and multi-file changes.implementation_engineer (reasoning_effort:"low") — Well-scoped execution when the goal and approach are already clear from the plan.code_mapper (reasoning_effort:"low") — Short reconnaissance only, already used in Phase 1 escalation.docs_researcher (reasoning_effort:"low") — External API/library/doc research.test_automator (reasoning_effort:"medium") — Focused test, benchmark, or verification work.browser_debugger (reasoning_effort:"medium") — Browser/UI runtime debugging.workflow_orchestrator (reasoning_effort:"xhigh") — Coordination-plan critique or cross-item workflow risk.Stick to these shipped agent_type labels. Do not use RepoPrompt role labels like pair, engineer, design, or explore in spawn_agent. Always pass the role's reasoning_effort, and use fork_turns:"none" because these agents are expected to read the needed context from the first message.
When in doubt, use implementation_lead with high reasoning. The tasks reaching this workflow are complex by nature. Use implementation_engineer only when the plan already makes the path obvious and the item just needs execution.
When questions arise during coordination, reason through them yourself. If you're uncertain, negotiate with the agent already working on the relevant task — it has the deepest context. Steer it with your thinking and work toward consensus rather than dictating a direction.
The agents you dispatch are fully capable — they have tools, they'll read AGENTS.md and project instructions, they can explore and reason. Your job is to orient them, not direct them.
Scope is your most important job. When you pass a plan export, the sub-agent can see the full plan — but it doesn't know which part is its responsibility unless you say so. Always be explicit about what it should do now and what it should leave alone. A few patterns:
message and tell the agent which part to focus on (e.g. "Read the plan at with read_file first. Your job is item 2 in the plan. Items 1 and 3 are handled separately.").You can always steer additional work later, or spin up a separate agent for the next item.
Include: The goal, relevant file paths/modules, and discoveries from planning that the agent wouldn't find on its own. If a separate user plan file exists, point to the relevant section. For small tasks, tell the agent to skip oracle review.
Don't include: Project conventions already in CLAUDE.md, step-by-step instructions, or code snippets the agent can read itself.
Pass forward discoveries, not instructions.
Two conversations, kept separate. You hold one conversation with the user (preferences, course corrections, meta-instructions about how you should behave) and a separate one with each peer agent (purely the technical task). When the user steers you, translate the actionable parts into the next brief — never forward their words verbatim, and never narrate what the user told you about your own conduct. If a brief you already dispatched carried that kind of commentary, cancel it and re-send clean.
If dispatching independent items as fresh agents concurrently, each agent's brief must mention the sibling:
"Another agent is concurrently working on in . Avoid modifying files in that area. If you find yourself blocked by or conflicting with that work, stop and report back rather than pushing through."
With multi_agent_v2, each spawn_agent starts an independent agent; no detach flag is needed.
Use wait_agent and list_agents to watch the batch and see which agent needs attention.
{"tool":"spawn_agent","args":{"task_name":"goal_a","agent_type":"implementation_lead","reasoning_effort":"high","fork_turns":"none","message":"<brief A>"}}
{"tool":"spawn_agent","args":{"task_name":"goal_b","agent_type":"implementation_lead","reasoning_effort":"high","fork_turns":"none","message":"<brief B>"}}
{"tool":"wait_agent","args":{"timeout_ms":60000}}
{"tool":"list_agents","args":{}}
Handle the finished agent, then wait again on the remaining agents. While waiting, summarize completed work or prepare the next brief — be a pipeline, not a sequential loop.
Agents persist after they finish — useful when you might revisit output, but they pile up over a multi-agent workflow. Once you've recorded what an agent produced, close it:
{"tool":"close_agent","args":{"target":"<task_name>"}}
Mapping/research agents are good to close right away — narrow reconnaissance, no follow-up value. Keep heavier agents if you might revisit them.
Plan and review exports generated during orchestration (via export_response:true on context_builder or oracle_send) accumulate under prompt-exports/ as files like oracle-plan-<date>-<slug>.md or oracle-review-<date>-<slug>.md. Once an export has been superseded by a newer plan, consumed by the sub-agent it was meant for, or otherwise made irrelevant by completed work, delete it so the folder reflects only live, in-progress plans. file_actions.delete requires a true absolute filesystem path, not the relative display path shown under prompt-exports/; use get_file_tree with type:"roots" if you need the loaded root's absolute path. When unsure, leave it.
{"tool":"file_actions","args":{"action":"delete","path":"/absolute/path/to/repo/prompt-exports/<stale-export>.md"}}
You own the plan. It's your job to ensure each phase respected it.
As each agent completes:
read_file or file_search on key deliverables costs little and catches drift before it compounds. If the plan said "add error handling to all three endpoints" and the agent only touched two, that's your catch. Mark the item as done (or note gaps) in the export file so you have a running record.{"tool":"followup_task","args":{
"target":"<task_name>",
"message":"The goal was X but Y appears to be missing. Please address that before wrapping up."
}}
After all items complete, give the user a final rollup:
| Operation | Tool call |
|---|---|
| Start a fresh agent | spawn_agent agent_type="<shipped_agent>" reasoning_effort="<effort>" fork_turns="none" message="..." |
| Steer an existing agent | followup_task target="<task_name>" message="..." |
| Wait for agents | wait_agent, then list_agents to inspect current status |
| Dismiss a completed agent | close_agent target="<task_name>" |
| Read plan/context | read_file, get_file_tree, file_search |
| Reason with oracle | oracle_send — requires file selection from context_builder |
wait_agent / list_agents periodically to keep them unblocked