From ralph-parallel
This skill should be used when the user asks about "parallel execution", "dispatch tasks", "agent teams", "parallel ralph", "simultaneous tasks", "multi-agent", "file ownership", "worktree strategy", or needs guidance on running ralph-specum tasks in parallel across multiple Claude Code teammates.
npx claudepluginhub kavanaghpatrick/ralph-parallelThis skill uses the workspace's default tool permissions.
Guides users through dispatching ralph-specum spec tasks for parallel execution via Claude Code Agent Teams.
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Performs token-optimized structural code search using tree-sitter AST parsing to discover symbols, outline files, and unfold code without reading full files.
Guides users through dispatching ralph-specum spec tasks for parallel execution via Claude Code Agent Teams.
Ralph Parallel extends ralph-specum by enabling multiple spec tasks to execute simultaneously across Agent Teams teammates. Instead of sequential task-by-task execution, tasks are partitioned into non-conflicting groups and dispatched to separate teammates.
1. Create spec normally: /ralph-specum:start my-feature "goal"
2. Complete spec phases: research -> requirements -> design -> tasks
3. Dispatch for parallel: /ralph-parallel:dispatch
-> Analyzes tasks, partitions by file ownership, creates team, spawns teammates
-> Lead coordinates execution, runs verify checkpoints, handles serial tasks
4. Monitor progress: /ralph-parallel:status
5. Integrate results: /ralph-parallel:merge (worktree only; file-ownership auto-completes)
6. Handle remaining serial: /ralph-specum:implement (if any tasks remain)
| Command | Purpose | Key Flags |
|---|---|---|
/ralph-parallel:dispatch | Analyze tasks, partition, create team, orchestrate | --max-teammates N, --strategy, --dry-run, --abort, --reclaim |
/ralph-parallel:status | Show parallel execution progress | --json, --watch |
/ralph-parallel:merge | Integrate results / verify consistency | --abort, --continue |
Each teammate gets exclusive ownership of certain files. No merge needed -- teammates work in the same repo but on different files. The PreToolUse hook (file-ownership-guard.sh) enforces ownership at runtime by blocking writes to non-owned files.
Best for: Most projects. Simple, no merge complexity. Limitation: Tasks sharing files must be serialized.
Each teammate gets its own git worktree with a separate branch. Full file access but requires merge step via /ralph-parallel:merge.
Best for: Highly coupled codebases where tasks touch overlapping files. Limitation: Merge conflicts possible, requires explicit merge step.
Ralph Parallel reads tasks.md files generated by ralph-specum. The expected format:
## Phase 1: Description
- [ ] 1.1 [P] Task description
- **Files**: `src/api/auth.ts`, `src/models/user.ts`
- **Do**: Implementation steps
- **Done when**: Completion criteria
- **Verify**: `npm test -- --grep auth`
- **Commit**: `feat(auth): add login endpoint`
- [ ] 1.2 [VERIFY] Verify phase 1
- **Verify**: `npm test && npm run typecheck`
| Marker | Meaning |
|---|---|
[P] | Parallelizable -- can run simultaneously with other [P] tasks in same phase |
[VERIFY] | Checkpoint -- runs sequentially by the lead after all same-phase tasks complete |
Declare project quality commands at the top of tasks.md. These are used by quality gates and phase verification:
## Quality Commands
- **Build**: `cargo build`
- **Test**: `cargo test`
- **Lint**: `cargo clippy -- -D warnings`
- **Typecheck**: `tsc --noEmit`
Use N/A for commands that don't apply. Three formats are supported (bold markdown preferred):
- **Build**: \cmd`` (primary)- Build: cmd (bare dash)You can pre-define groups in tasks.md for direct control over partitioning:
### Group 1: api-layer [Phase 1]
**Files owned**: `src/api/auth.ts`, `src/api/middleware.ts`
- [ ] 1.1 [P] Add auth endpoint
- **Files**: `src/api/auth.ts`
- **Verify**: `npm test`
When pre-defined groups are present, the partitioner uses them directly instead of computing automatic partitions. This gives the task planner (human or ralph-specum) full control over parallelism.
The dispatch command follows these steps:
.current-specvalidate-tasks-format.py to check task formatparse-and-partition.py to build dependency graph and create groupsspecs/$specName/.dispatch-state.jsonTeamCreate + one TaskCreate per spec task (1:1 mapping)Task tool call per group, all in parallelmark-tasks-complete.py, shut down teammates, TeamDelete, set statusDispatch state is stored at specs/$specName/.dispatch-state.json:
{
"dispatchedAt": "2026-02-26T15:00:00Z",
"coordinatorSessionId": "$CLAUDE_SESSION_ID",
"strategy": "file-ownership",
"maxTeammates": 4,
"groups": [
{
"name": "api-layer",
"tasks": ["1.1", "1.2"],
"ownedFiles": ["src/api/auth.ts", "src/api/middleware.ts"],
"taskDetails": [...]
}
],
"serialTasks": [],
"verifyTasks": [{"id": "1.4", "phase": 1}],
"qualityCommands": {"build": "npm run build", "test": "npm test"},
"baselineSnapshot": {"testCount": 42, "capturedAt": "..."},
"status": "dispatched",
"completedGroups": []
}
(none) --> dispatched --> merged (file-ownership: auto on completion)
--> merging --> merged (worktree: via /merge)
--> stale (team lost mid-dispatch)
--> superseded (new dispatch for same spec)
--> aborted (via --abort)
Stale dispatches: Auto-detected on SessionStart when the team config is dead but dispatch isn't complete. The session-setup hook marks these as stale with a reason and timestamp. Users can re-dispatch or abort.
Every task completion triggers a quality gate via the TaskCompleted hook:
| Stage | Check | Frequency | Blocks On |
|---|---|---|---|
| 1 | Task's Verify command | Every task | Non-zero exit |
| 2 | Typecheck (qualityCommands.typecheck) | Every task | Non-zero exit |
| 3 | File existence (all Files listed) | Every task | Missing files |
| 4 | Build (qualityCommands.build) | Every 3rd task | Non-zero exit |
| 5 | Test suite + regression check | Every 2nd task | Failures or test count drop |
| 6 | Lint (qualityCommands.lint) | Every 3rd task | Non-zero exit |
Test regression detection: If baseline test count was captured at dispatch, the gate checks that current test count hasn't dropped below 90% of baseline (or below baseline-1 for small test suites). This prevents teammates from accidentally deleting tests.
Phase gates: When ALL tasks in Phase N complete, the lead runs the verify checkpoint task, then executes qualityCommands.build, qualityCommands.test, and qualityCommands.lint. Phase N+1 teammates only proceed after the gate passes.
| Hook | Event | Purpose |
|---|---|---|
session-setup.sh | SessionStart | Detect active dispatches, manage gc.auto, auto-reclaim coordinator session, auto-mark stale dispatches |
file-ownership-guard.sh | PreToolUse (Write/Edit) | Block writes outside owned files. Returns error message naming the violation. |
task-completed-gate.sh | TaskCompleted | 6-stage quality gate. Blocks task completion if any check fails. |
dispatch-coordinator.sh | Stop | Prevents coordinator from stopping mid-dispatch. Re-injects coordination context after compaction. |
merge-guard.sh | PreToolUse (Write|Edit) | Intercepts status="merged" writes, runs validate-pre-merge.py |
teammate-idle-gate.sh | TeammateIdle | Prevents teammates from going idle with uncompleted tasks, safety valve after N blocks |
On session start with active dispatch:
ralph-parallel: Active parallel dispatch for spec 'my-feature'
ralph-parallel: Status: 1/3 groups complete (file-ownership strategy)
ralph-parallel: Groups: api-layer, ui-components, data-models
ralph-parallel: Run /ralph-parallel:status to see progress
On file ownership violation:
FILE OWNERSHIP VIOLATION: You (api-layer) attempted to write 'src/models/User.ts'
Your owned files: src/api/auth.ts, src/api/middleware.ts
Message the lead if you need changes to this file.
On task quality gate failure:
QUALITY GATE FAILED for task 1.2 (1.2: Add auth endpoint)
Verify command failed (exit 1): npm test -- --grep auth
--- Output (last 50 lines) ---
[test output]
Fix the issues and mark the task complete again.
On coordinator trying to stop mid-dispatch:
You are coordinating a parallel dispatch for spec 'my-feature'.
STATUS: 1/3 groups complete
NEXT ACTIONS:
1. Check TaskList for teammate progress
2. If waiting for teammates: they may be idle -- check and send status messages
3. When all Phase N tasks done: run the verify checkpoint yourself
4. When all tasks done: run mark-tasks-complete.py, set status="merged", shut down teammates, TeamDelete
Teammates must append a Signed-off-by trailer to every commit for provenance tracking:
feat(auth): add login endpoint
Signed-off-by: api-layer
The trailer value is the group name (not git user info). Do NOT use git commit -s -- it produces the wrong format (user.name + user.email instead of group name). Append the trailer manually.
The verify-commit-provenance.py script audits commits against known group names after dispatch. It is a standalone audit script, not wired into any hooks.
Each teammate receives a generated prompt (via build-teammate-prompt.py) that includes:
Teammate execution loop per task:
[x] in tasks.mdAfter all tasks: message lead "Group [name] complete. All N tasks verified."
If no teammate message is received for 10+ minutes:
Never reassign tasks to yourself (the coordinator) -- that defeats parallel execution.
| Scenario | Action |
|---|---|
| Teammate crashes | Re-spawn with remaining tasks |
| Quality gate fails | Teammate receives error output, must fix and retry |
| File ownership violation | Write blocked, teammate told to message lead |
| Session restart mid-dispatch | session-setup.sh auto-reclaims coordinator, or use --reclaim |
| Team lost (stale dispatch) | Auto-marked stale on SessionStart. Re-dispatch or abort. |
| All tasks already complete | parse-and-partition.py exits with code 2 -- nothing to dispatch |
| Single task remaining | Exit code 3 -- use /ralph-specum:implement instead |
| Circular file dependencies | Offer worktree strategy or serialize overlapping tasks |
A spec "todo-api" with 4 tasks:
## Quality Commands
- **Build**: `npm run build`
- **Test**: `npm test`
## Phase 1
- [ ] 1.1 [P] Create Todo model Files: src/models/Todo.ts
- [ ] 1.2 [P] Create API handler Files: src/api/todos.ts
- [ ] 1.3 [P] Add validation middleware Files: src/api/middleware.ts
- [ ] 1.4 [VERIFY] Run full test suite
Dispatch partitions into 2 groups (all files are unique -- maximum parallelism):
Dispatch Plan for 'todo-api'
Strategy: file-ownership
Teams: 2 teammates + 1 lead
Group 1: backend (2 tasks)
Tasks: 1.1, 1.2
Files: src/models/Todo.ts, src/api/todos.ts
Group 2: middleware (1 task)
Tasks: 1.3
Files: src/api/middleware.ts
Verify checkpoints: 1.4
Serial tasks: none
Execution flow:
[P] markers in tasks.md to tag parallel-safe tasks[VERIFY] markers for checkpoint tasks that validate a phase/ralph-parallel:status -- don't wait blindly for messages--dry-run to preview the partition plan before dispatchingqualityCommands.dev is discovered but intentionally not executed by quality gates