merge

A command for combining work completed by several coding agents into one project state. It can also continue or cancel a paused merge.

In plain words
What is it for?
Merging agent-team results, checking consistency, resolving a paused merge, or restoring the state before a dispatch.
Why use it?
Parallel work can leave separate changes, conflicts, or temporary workspaces that need checking before they become one result.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/kavanaghpatrick/ralph-parallel/merge
Clone the repo
git clone --depth 1 https://github.com/kavanaghpatrick/ralph-parallel
Per session 8 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,607 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00008 $0.01607
Opus 5 $0.00004 $0.00804
Sonnet 5 $0.00002 $0.00321
Haiku 4.5 $0.00001 $0.00161

Measured 2d ago against content hash ec86a7a5e4d5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

merge scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/ralph-parallel/commands/merge.md · 205 lines

How it starts

The opening of the file, as written. The whole thing — 205 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Merge

Integrates results from parallel Agent Teams execution back into a cohesive state.

Note: For file-ownership strategy, this command is optional — it performs a consistency check only. Dispatch handles the full lifecycle including cleanup. Merge is required only for worktree strategy.

Parse Arguments

From $ARGUMENTS, extract:

  • spec-name: Optional spec name (defaults to active spec)
  • --abort: Cancel merge, restore pre-dispatch state
  • --continue: Continue a merge that was paused for conflict resolution

Step 1: Load Dispatch State

1. Resolve spec (same logic as dispatch.md Step 1)
2. Read specs/$specName/.dispatch-state.json
   - Error if missing: "No dispatch state found. Run /ralph-parallel:dispatch first."
3. Validate status field:
   - "dispatched" → proceed with merge
   - "merged" → "Already merged. Nothing to do."
   - "superseded" → "This dispatch was superseded by a newer one. Nothing to merge."
   - "merging" + no --continue → "Merge in progress. Use --continue to resume or --abort to cancel."
   - "stale" → "This dispatch is stale (team lost at $staleSince). Run /ralph-parallel:dispatch to re-dispatch or /ralph-parallel:dispatch --abort to cancel."

Step 2: Verify Completion

Check that all dispatched groups have completed their work.

Completion Check:

1. FOR EACH group in dispatch state:
   a. Check tasks.md — are all group's tasks marked [x]?
   b. Check git log — are expected commits present?
   c. If worktree strategy: check worktree branch exists and has commits

2. Report status:
   - All complete → proceed to merge
   - Partial → show which groups are incomplete:
     "Group 'api-layer': 2/3 tasks complete (missing: 1.4)"
     "Group 'data-layer': not started"
   - Ask user: "Some groups incomplete. Merge anyway? (partial results)"

Step 3: File-Ownership Verification (Optional)

When strategy is file-ownership:

File-Ownership Verification (consistency check — dispatch already completed execution):

Since all teammates worked in the same directory with file ownership,
there's no git merge needed. Instead, verify consistency:

1. CHECK: All owned files were only modified by their assigned teammate
   - For each group's ownedFiles:
     - git log --oneline -- $file (check commit authors/messages)
     - Verify commits come from expected group
   - If file modified by wrong group: WARN "File $file was modified by
     group '$other' but owned by '$owner'"

2. CHECK: No merge conflicts in working tree
   - git status --porcelain
   - If uncommitted changes: WARN and list them

3. CHECK: Build verification
   a. Read qualityCommands from .dispatch-state.json
   b. Run qualityCommands.build (if available)
   c. Run qualityCommands.test (if available)
   d. Run qualityCommands.lint (if available)
   e. Collect pass/fail per command
   f. If ANY fail: report specific failures with output, do NOT mark as merged

4. UPDATE: Mark dispatch as merged
   - Update .dispatch-state.json: status = "merged"
   - Update tasks.md: ensure all completed tasks marked [x]
   - Update .progress.md with parallel execution summary
   - Note: session-setup.sh will detect "merged" status and restore
     gc.auto on the next session start

Read the full file on GitHub · 205 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 205 lines · 0 tokens per session scan A ec86a7a5e4d5

Subscribe to this mod's changes

merge is a command published in the GitHub repository kavanaghpatrick/ralph-parallel (7 stars, last pushed 5mo ago), licensed MIT. It adds 8 tokens to every session and 1,607 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.