一键导入
parallel-dispatch-dag
// Constructs, validates, and traverses a Directed Acyclic Graph (DAG) from scope cards for safe level-based parallel dispatch. Determines execution order via topological sort. Detects cycles and invalid dependencies.
// Constructs, validates, and traverses a Directed Acyclic Graph (DAG) from scope cards for safe level-based parallel dispatch. Determines execution order via topological sort. Detects cycles and invalid dependencies.
Session bootstrap + workflows for Pathfinder semantic navigation tools. Covers: discovery protocol, tool chaining patterns (explore, impact, audit, debug), search optimization, LSP degraded mode, and error recovery.
Playwright browser automation via MCP. Covers E2E testing, UI review, web scraping, screenshot capture, and general browser interaction. MCP-first — CLI is fallback only.
Safe command execution: input sanitization, timeout handling, output capture, error propagation. For spawning processes, shell commands, system calls.
Git conventions: conventional commits, branch naming, PR hygiene, release tagging.
Structured incident workflow: severity classification, triage, diagnosis, mitigation, postmortem, and prevention. Template-driven with blameless review.
Decomposes broad tasks into MECE, parallelizable sub-tasks with explicit scope cards. Core skill for intra-domain parallel dispatch. Produces scope cards consumed by parallel-dispatch-dag, parallel-dispatch-ownership, and parallel-dispatch-merge skills.
| name | parallel-dispatch-dag |
| description | Constructs, validates, and traverses a Directed Acyclic Graph (DAG) from scope cards for safe level-based parallel dispatch. Determines execution order via topological sort. Detects cycles and invalid dependencies. |
Build a DAG from scope cards. Topological sort into levels. Dispatch all nodes at the same level in parallel.
parallel-dispatch-decompositionEach scope card becomes a node in the DAG:
@<agent-type>[<scope>]write (modifies files) or read (read-only analysis)Each "Blocked By" or "Hard Dependencies" entry in a scope card becomes a directed edge:
Group nodes into levels based on their depth in the dependency graph:
All nodes at the same level are independent of each other and can be dispatched in parallel.
1. Initialize in-degree count for each node
2. Enqueue all nodes with in-degree = 0 → Level 0
3. For each node in current level:
a. Remove its outgoing edges (decrement in-degree of dependents)
b. If any dependent's in-degree reaches 0 → add to next level
4. Repeat until all nodes assigned
5. If unassigned nodes remain → cycle detected → ABORT
Present the execution plan as a leveled dispatch table:
## Execution DAG
### Level 0 (no dependencies — dispatch in parallel)
| Node | Agent | Scope | Type | Deliverables |
|------|-------|-------|------|-------------|
| 1 | @scout | [auth] | read | Auth pattern research |
| 2 | @scout | [tasks] | read | Task engine research |
| 3 | @scout | [infra] | read | Infrastructure research |
### Level 1 (depends on Level 0 — dispatch after Level 0 completes)
| Node | Agent | Scope | Type | Blocked By | Deliverables |
|------|-------|-------|------|-----------|-------------|
| 4 | @architect | [api-contracts] | write | 1, 2 | API contract definitions |
| 5 | @architect | [data-model] | write | 1, 2, 3 | Data model design |
### Level 2 (depends on Level 1 — dispatch after Level 1 completes)
| Node | Agent | Scope | Type | Blocked By | Deliverables |
|------|-------|-------|------|-----------|-------------|
| 6 | @backend-engineer | [auth] | write | 4 | Auth feature implementation |
| 7 | @backend-engineer | [tasks] | write | 4, 5 | Task feature implementation |
| 8 | @frontend-engineer | [auth-ui] | write | 4 | Auth UI components |
| 9 | @frontend-engineer | [task-ui] | write | 4, 5 | Task UI components |
### Level 3 (depends on Level 2 — dispatch after Level 2 completes + merges)
| Node | Agent | Scope | Type | Blocked By | Deliverables |
|------|-------|-------|------|-----------|-------------|
| 10 | @backend-engineer | [integration] | write | 6, 7 | Router wiring, app entry |
| 11 | @frontend-engineer | [integration] | write | 8, 9 | Route registration, app shell |
Run these checks before dispatching any level:
parallel-dispatch-ownership)If topological sort leaves unassigned nodes:
parallel-dispatch-decomposition for re-clusteringFor each level in order:
1. Validate all nodes at this level (pre-dispatch checks)
2. Create git worktrees for all write-nodes at this level
3. Dispatch all nodes at this level in parallel
4. Wait for all nodes to complete
5. If any node fails:
a. Retry once with clarified context (per Circuit Breaker in orchestrate command)
b. If still fails → assess downstream impact
c. If failure changes scope → re-decompose affected sub-tree only
d. If failure blocks downstream → STOP, escalate
6. Merge completed write-node branches (per parallel-dispatch-merge)
7. Run quality gates (per Code Completion Mandate)
8. Proceed to next level
The DAG spans multiple phases. Standard phase ordering per orchestrate.toml Composition Rules:
Feature pipeline:
SCOUT → DESIGN → PRE-MORTEM (optional) → BUILD ∥ TEST → REVIEW → REMEDIATE → VERIFY → DOCUMENT
Standalone pipelines:
OPTIMIZE: After BUILD (or standalone)
REFACTOR: After REVIEW or SCOUT
INCIDENT: Standalone (production issues) → REMEDIATE → REVIEW → VERIFY → DOCUMENT
PRE-MORTEM: After DESIGN (standalone risk assessment via Template L)
Phase ordering rules (from orchestrate.toml):
Within each phase, levels are determined by intra-phase dependencies. Between phases, the entire preceding phase must complete before the next phase starts.
Exception: SCOUT and DESIGN within the same phase can interleave if specific scout findings feed specific design decisions (model as explicit edges).
If a node fails and changes the scope of downstream work:
invalidatedparallel-dispatch-decomposition on the invalidated sub-tree onlyAfter each level completes, write-node branches must be merged before the next level starts. This is the merge point. The parallel-dispatch-merge skill handles the merge protocol.
Read-only nodes do not produce branches — they produce documents/findings that are passed as context to downstream nodes.