원클릭으로
dispatching-parallel-agents
Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Use when you have a spec or requirements for a multi-step task, before touching code
Use when auditing a Rust codebase, module, or workspace and wanting cross-model consensus on findings, a false-positive-filtered consolidated report, and a reproducible audit trail in git
Find deepening opportunities in a codebase, informed by the domain language in CONTEXT.md and the decisions in docs/adr/. Use when the user wants to improve architecture, find refactoring opportunities, consolidate tightly-coupled modules, or make a codebase more testable and AI-navigable.
Use after writing or modifying code to simplify and refine it for clarity, consistency, and maintainability without changing functionality. Triggers after any implementation work in the current session.
Dynamic performance measurement for Rust projects — profiling, load testing, benchmarking, and analysis of existing observability data (traces, metrics, logs). Use when you need measured impact, not inference. Requires either a runnable binary + load generator, or existing production telemetry. For static code-level analysis without measurement, use rust-perf.
Static performance audit for Rust projects — analyzes code for allocation, async, database, data-structure, and compile-time anti-patterns without requiring a running system. Use when reviewing code for performance issues before or instead of load testing. For runtime profiling and load-test analysis, use rust-perf-measure.
| name | dispatching-parallel-agents |
| description | Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies |
Delegate independent tasks to specialized subagents running concurrently, using the @tintinweb/pi-subagents extension and its Agent(), get_subagent_result(), and steer_subagent() tools.
Why parallel: Independent tasks don't need to be sequential. Run them simultaneously, get results faster, keep each agent focused on a narrow scope.
Core principle: Launch background agents with Agent({ run_in_background: true }), then collect results with get_subagent_result(). A persistent widget shows spinners, status icons, and live progress for all running agents.
Use when:
Don't use when:
isolation: "worktree" if needed)Group tasks by file scope:
src/auth/ only -> independentsrc/payments/ only -> independentsrc/config.ts (shared) -> sequential dependencyLaunch all independent tasks as background agents, then wait for each result:
# Launch all agents in the background
Agent({ subagent_type: "worker", prompt: "Fix 3 failing tests in src/auth.test.ts: [paste test names + errors]", description: "fix auth tests", run_in_background: true })
Agent({ subagent_type: "worker", prompt: "Fix 3 failing tests in src/payments.test.ts: [paste test names + errors]", description: "fix payment tests", run_in_background: true })
Agent({ subagent_type: "worker", prompt: "Fix 3 failing tests in src/notifications.test.ts: [paste test names + errors]", description: "fix notification tests", run_in_background: true })
# Collect results (use agent_id returned by each Agent() call)
get_subagent_result({ agent_id: "<id-from-agent-1>", wait: true })
get_subagent_result({ agent_id: "<id-from-agent-2>", wait: true })
get_subagent_result({ agent_id: "<id-from-agent-3>", wait: true })
The persistent widget shows spinners and status icons for all running agents. Results are collected as each agent finishes.
When tasks need to pass output forward, run agents sequentially in the foreground. Each call blocks and returns a result you feed into the next prompt:
# Step 1: Scout gathers context (foreground, blocks until done)
result_1 = Agent({ subagent_type: "scout", prompt: "Find all authentication code and summarize", description: "auth recon" })
# Step 2: Planner uses scout's output
result_2 = Agent({ subagent_type: "planner", prompt: "Based on this recon: <result_1 text> — create an implementation plan", description: "auth plan" })
# Step 3: Worker executes the plan
Agent({ subagent_type: "worker", prompt: "Execute this plan: <result_2 text>", description: "auth implementation" })
Each foreground Agent() call returns its result directly. Pass the result text as context into the next prompt.
Agent({ subagent_type: "worker", prompt: "Fix the race condition in src/queue.ts", description: "fix queue race condition" })
If a running agent goes off-track, redirect it without aborting:
steer_subagent({ agent_id: "<id>", message: "Stop refactoring — focus only on the failing test. The error is in line 42." })
When parallel tasks might touch overlapping files, use worktree isolation:
Agent({ subagent_type: "worker", prompt: "Refactor auth module", description: "auth refactor", isolation: "worktree", run_in_background: true })
Good parallel tasks are:
Fix the 3 failing tests in src/agents/agent-tool-abort.test.ts:
1. "should abort tool with partial output" - expects 'interrupted at' in message
2. "should handle mixed completed and aborted tools" - fast tool aborted instead of completed
3. "should properly track pendingToolCount" - expects 3 results but gets 0
These are timing/race condition issues. Your task:
1. Read the test file and understand what each test verifies
2. Identify root cause — timing or actual bugs?
3. Fix by replacing arbitrary timeouts with event-based waiting
4. Do NOT just increase timeouts
Return: Summary of root cause and what you fixed.
These are always available, no setup needed:
| Type | Purpose | Tools |
|---|---|---|
general-purpose | Full-capability agent, mirrors parent's tool access | all parent tools |
Explore | Lightweight read-only exploration (haiku model) | read, grep, find, ls |
Plan | Read-only planning and analysis | read, grep, find, ls |
These require .md definition files installed by the user (in .pi/agents/ or user-level agents directory). They are not available unless set up:
| Type | Purpose | Tools |
|---|---|---|
worker | General-purpose implementation | all default |
scout | Fast codebase recon, returns compressed context | read, grep, find, ls, bash |
planner | Creates implementation plans | read, grep, find, ls |
reviewer | Code review (read-only) | read, grep, find, ls, bash |
If you use a custom type that isn't installed, the agent will fail. Fall back to general-purpose if unsure.
The @tintinweb/pi-subagents extension provides a persistent widget showing all agent activity:
Use get_subagent_result({ agent_id: "<id>", wait: true }) to block until a specific agent finishes and retrieve its full output.
/agents -> Settings in the pi TUIX Parallel tasks that edit the same file -> merge conflicts, corrupted output
OK Verify file scope is disjoint before dispatching, or use isolation: "worktree"
X Too broad: "Fix all the tests" -> agent gets lost OK Specific: "Fix auth.test.ts" -> focused scope
X No context: "Fix the race condition" -> agent doesn't know where OK Context: Paste the error messages and test names
X No constraints: Agent might refactor everything OK Constraints: "Do NOT change production code" or "Fix tests only"
X Vague output: "Fix it" -> you don't know what changed OK Specific: "Return summary of root cause and changes"
X Forgetting to collect results: Launching background agents but never calling get_subagent_result()
OK Always collect: Call get_subagent_result({ agent_id: "...", wait: true }) for each background agent
X Using custom agent types without setup: worker, scout, etc. need .md files installed
OK Fall back to general-purpose if custom agents aren't configured