/dual-haul:dual-loopfrom dual-haul
Orchestrates a per-turn race between two independent AI implementers (Claude + Codex) in isolated git worktrees, judges both against a goal check, and merges the winning diff. Use as the iteration phase of a dual-haul workflow.
Ships in dual-haul. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Phase 3 of dual-haul. The work you do on each /goal turn: race two
implementers, keep the better diff. You are the orchestrator — you judge and
merge, you do not implement the target yourself. Implementing it directly
throws away the entire reason for two racers.
RACER_CLAUDE, which must differ from your own ORCH_MODEL) and a Codex racer (model RACER_CODEX) each work in their own git worktree off the same base commit. They never see each other./goal evaluator reads to decide whether to continue.source ~/.claude/skills/dual-haul/reference/handoff.sh # or ~/.agents/...
Provides goal_race, goal_wait_race, goal_teardown, plus human-side
goal_watch/goal_status/goal_inject/goal_takeover. These encapsulate the
CLI-spawn hazards (see Hazards) — don't hand-roll the invocations.
Ask the user two things and write them to STATE.md:
RACER_CLAUDE) — must differ from ORCH_MODEL. The point is a different Claude perspective. Refuse a model equal to the orchestrator's and re-ask.RACER_CODEX) — the model Codex runs with.Empty values are allowed (each CLI uses its own default), but the Claude racer must still not silently match the orchestrator. Confirm both before racing.
Each /goal turn does exactly one round. ROUND in STATE.md is the counter.
.dualhaul/USER_NOTES.md has Status: unaddressed items, fold them into this round's brief, then mark them addressed..dualhaul/R<N>-brief.md: the improvement target and constraints (from GOAL.md/UNDERSTANDING.md) plus what the previous round fell short on (from R<N-1>.md). This is the shared instruction both racers get; keep it goal-focused, not solution-prescriptive — let them diverge.STATUS: RACING: R<N>, then goal_race <N>. It creates wt-claude/ + wt-codex/ off HEAD, embeds the brief, and spawns both racers detached on their chosen models.goal_wait_race <N> — in Claude Code via Bash run_in_background=true so the harness wakes you when both finish. The racers are nohup'd and invisible to the harness; without this you idle. Exit 3 = a racer likely died → inspect logs, treat that racer as a no-submission.git -C .dualhaul/wt-<name> diff <base>..HEAD --stat. Pick the winner by this rubric, in order:
GOAL.md respected.R<N>.md (template in ../dual-haul/reference/file-formats.md) with both attempts, both check outputs, and the verdict.git cherry-pick the racer branch, or git merge --squash dualhaul/r<N>-<winner> then commit). If neither passes, merge nothing and record why./goal evaluator judges. Note in R<N>.md what's still short of the goal.goal_teardown <N> (removes both worktrees, deletes their temp branches). Bump ROUND. Append a one-line R<N> entry to STATE.md's round log. Then end the turn — /goal decides whether to start another.You don't poll the goal yourself — /goal does. It clears automatically when
the evaluator sees the condition met in the transcript, and the next thing you
do is the dual-report phase. But hold and surface to the user (don't burn turns) when:
ROUND reaches ROUNDS (cap) without the goal clearing → stop, report partial, ask whether to raise the cap or accept.STATUS: BLOCKED, surface.After judging, print a 5–10 line digest before ending the turn so the user (and
the /goal evaluator) see progress:
**R3 race:** winner = codex
- claude: check FAILED (2 tests red), diff 3 files +40/-12
- codex: check PASSED, p95 38ms (goal <=40ms), diff 1 file +9/-3
- merged codex @ a1b2c3d; main-tree check: PASSED, p95 39ms
- still short: none — goal condition now holds
All handled by handoff.sh — listed so you don't reintroduce them.
| Hazard | Rule |
|---|---|
claude -p "<prompt>" <flags> (flags after prompt) | Hangs the CLI. Flags first; goal_race enforces it. |
claude --add-dir <dir> "<prompt>" (variadic eats prompt) | -- terminator before the prompt. Enforced. |
killall claude / pkill codex to recover | Kills the user's main session. Use goal_racer_status / goal_takeover (PID-scoped). |
| Two racers editing one tree | Corruption. Each gets its own worktree off the same base — never the main tree. |
| Keeping a diff you didn't check | A win must pass the stated check in its worktree AND on the main tree after merge. No check, no keep. |
| Racer model == orchestrator model | Defeats the second-perspective design. The gate refuses it. |
| Leaving worktrees behind | goal_teardown every round and on every abort path; git worktree prune. |
Idling after goal_race | Racers are nohup'd, invisible to the harness. Always follow with goal_wait_race (background in Claude Code). |
If re-invoked while STATUS: RACING: R<n>: run goal_status. If both
.dualhaul/wt-*/.dualhaul-done exist, judge now. If only logs are growing, the
race is live — goal_wait_race <n>, don't launch a second goal_race.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
6 skills in this plugin
/dual-goalPhase 2 of dual-haul. Turns .dualhaul/UNDERSTANDING.md into a /goal-ready completion condition — one measurable end state, a stated transcript-demonstrable check, the constraints that must hold, and a turn cap — written to .dualhaul/GOAL.md plus the literal /goal line for the user to run. Use after dual-understand, or standalone to craft a good /goal condition from a clear improvement target./dual-haulAuto-chaining orchestrator for goal-driven improvement. Understand what the user wants improved, forge a /goal completion condition, then race a different-model Claude against Codex (each in its own git worktree) round by round until the goal is met, summarize, and open a PR. Use when the user wants something existing measurably improved with two independent agents racing under a verifiable goal — not a one-shot edit./dual-reportPhase 4 of dual-haul. Fires once the /goal condition is met (the goal auto-clears) or the round cap is hit. Reports goal-vs-achieved with the final check numbers, which racer won each round and why, the net diff that was kept, and what's still open. Writes .dualhaul/SUMMARY.md. Use after dual-loop concludes a dual-haul run./dual-shipPhase 5 of dual-haul — the finishing move. Commits the kept improvement on a feature branch, opens a PR (body drawn from .dualhaul/SUMMARY.md), and tears down the dual-haul worktrees and state. Always confirms the branch name and PR body with the user before pushing. Use as the last phase of a dual-haul run, after dual-report./dual-understandPhase 1 of dual-haul. Improvement-focused brainstorming — assumes the user wants something existing made better, and digs for what's deficient now, what "better" means concretely, and the measurable success signal. Produces .dualhaul/UNDERSTANDING.md. Use as the first phase of a dual-haul run, or standalone when you need to sharpen a vague "make X better" into a verifiable target before setting a goal.npx claudepluginhub ccomkhj/skills --plugin dual-haulOther plugins' skills for the same job