# Dual loop

> Dual loop is an open-source agent skill for developer tools. Runs a per-turn race between two coding agents and keeps the better diff. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/ccomkhj/skills/tree/main/dual-haul/skills/dual-loop
- **Repository:** https://github.com/ccomkhj/skills
- **GitHub stars:** 10
- **License:** MIT
- **Skill name:** dual-loop
- **Collection:** https://github.com/ccomkhj/skills
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-02

## About

Dual-loop is the iteration phase of the dual-haul workflow. On each goal turn it has two independent implementers, one Claude and one Codex, each work in a separate git worktree branched from the same base commit. The orchestrating agent then runs the goal's stated check in both worktrees, scores the results with an explicit rubric covering goal progress, correctness and diff size, and merges only the winning diff into the main tree. A round can keep nothing if both attempts fail the check.

The skill is mainly a process guide. It asks the user once, before the first round, which model each racer should use, and requires the Claude racer to differ from the orchestrator's model. It also covers the round log in STATE.md, folding in user notes, writing the round brief, and printing a short digest of each round in chat. Cleanup removes the worktrees after every round.

It relies on a companion handoff.sh helper from the dual-haul reference folder to spawn and wait on the racers, and assumes a git repository and the Claude and Codex command-line tools are available. It ships as a single SKILL.md with no bundled scripts.

## When your agent uses it

> Phase 3 of dual-haul — the per-turn race. Under an active /goal, each turn the orchestrator commissions two independent implementers (a Claude on a chosen model + Codex on a chosen model), each in its own git worktree off the current base commit, then judges both against the goal's stated check and merges the winning diff into the main tree. Use as the iteration phase of a dual-haul run; before round 1 it asks the user which model each racer uses.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/ccomkhj/skills/tree/HEAD/dual-haul/skills/dual-loop)
- [License: MIT](https://github.com/ccomkhj/skills/tree/HEAD/dual-haul/skills/dual-loop)

## Features

- **Two-racer race:** Runs a Claude implementer and a Codex implementer in isolated worktrees off the same commit each round.
- **Model selection gate:** Asks the user which model each racer uses once before round one and blocks a Claude racer matching the orchestrator.
- **Rubric-based judging:** Ranks attempts by goal-check progress, correctness, then diff quality before choosing a winner.
- **Verified merge:** Merges only the winning commits and re-runs the stated check on the main tree afterwards.
- **Round tracking and digest:** Keeps a round log in STATE.md and prints a short chat summary of each race for progress review.
- **Stop conditions:** Halts iteration at the round cap, after repeated empty rounds, or when a racer or worktree fails.

## Good for

- Race two coding agents on a performance fix and keep the version that passes the benchmark
- Iterate on a failing test suite by comparing a Claude attempt and a Codex attempt each round
- Run an improvement loop that merges only changes verified by a stated check
- Compare two model implementations of a refactor before committing to one

## Install

### Claude Code

This skill ships in the `dual-haul` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add ccomkhj/skills
/plugin install dual-haul@ccomkhj-skills
```

Or copy only this skill to `~/.claude/skills/dual-loop`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ccomkhj/skills.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/dual-loop &&
cp -R "$tmp/dual-haul/skills/dual-loop" ~/.claude/skills/dual-loop &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/dual-loop` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/dual-loop` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ccomkhj/skills.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/dual-loop &&
cp -R "$tmp/dual-haul/skills/dual-loop" ~/.agents/skills/dual-loop &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/dual-loop` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/dual-loop` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ccomkhj/skills.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/dual-loop &&
cp -R "$tmp/dual-haul/skills/dual-loop" ~/.cursor/skills/dual-loop &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/dual-loop` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/ccomkhj/skills.git --path dual-haul/skills/dual-loop
```

Or copy the folder to `~/.gemini/skills/dual-loop` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/dual-loop`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ccomkhj/skills.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/dual-loop &&
cp -R "$tmp/dual-haul/skills/dual-loop" ~/.copilot/skills/dual-loop &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/dual-loop` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/ccomkhj/skills.git
```

Then copy `skills/dual-haul/skills/dual-loop` into your agent's skills folder as `dual-loop`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does the skill need before Dual loop starts?

It needs an active /goal with a stated check, a dual-haul run, and the handoff.sh helper. Before round one it asks which model each racer should use.

### Can the Claude racer use the same model as the orchestrator?

No. The skill requires the Claude racer model to differ from the orchestrator model and refuses a match.

### Does the skill modify my main branch on every round?

Only the winning racer's commits are merged, and only when the goal's check passes in its worktree. If neither passes, nothing is merged.

### Does Dual loop run without a goal?

No. It is designed for the iteration phase of a dual-haul run under an active /goal.

### How do I install Dual loop in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/dual-loop to use it in all your projects, or to .claude/skills/dual-loop in one project. Or install the dual-haul plugin, which includes it: /plugin marketplace add ccomkhj/skills, then /plugin install dual-haul@ccomkhj-skills.

### Does Dual loop run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Dual loop?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Dual loop?

The closest alternatives to Dual loop are Dual haul, Dual report, Dueling autoresearch, Haul loop and Long haul.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Dual haul](https://ai-powered.com/skills/dual-haul): Dual haul is an open-source agent skill for developer tools.
- [Dual report](https://ai-powered.com/skills/dual-report): Dual report is an open-source agent skill for developer tools.
- [Dueling autoresearch](https://ai-powered.com/skills/dueling-autoresearch): Dueling autoresearch is an open-source agent skill for developer tools.
- [Haul loop](https://ai-powered.com/skills/haul-loop): Haul loop is an open-source agent skill for developer tools.
- [Long haul](https://ai-powered.com/skills/long-haul): Long haul is an open-source agent skill for developer tools.
- [Dual goal](https://ai-powered.com/skills/dual-goal): Dual goal is an open-source agent skill for developer tools.
- [Autonomous loops](https://ai-powered.com/skills/autonomous-loops): Autonomous loops is an open-source agent skill for developer tools.
- [Swarm](https://ai-powered.com/skills/swarm-michael-denyer): Swarm is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/dual-loop
