Your first task, start to finish
You will create a small project with one failing test, give AgentDuo a test gate, and let the two agents plan, fix, check and review the bug. It takes a few minutes and a handful of agent calls on your accounts.
On this page
Before you begin
- Claude Code and Codex installed and signed in, and AgentDuo installed: the desktop app,
duoor the VS Code extension. - Node.js and Git on your machine: the project’s test runs with
node --test, and the pipeline needs a Git repository.
Create the project
The project has a function that formats seconds as “1h 02m 05s”, and a bug: for an hour or more it counts every minute since the start. Create these three files in a new folder named duo-first-task, with any editor:
package.json
{
"name": "duo-first-task",
"version": "1.0.0",
"private": true,
"type": "module",
"scripts": {
"test": "node --test"
}
}src/duration.js
// Formats a number of seconds for a progress line: "7s", "4m 09s", "1h 02m 05s".
export function formatDuration(totalSeconds) {
const hours = Math.floor(totalSeconds / 3600);
const minutes = Math.floor(totalSeconds / 60);
const seconds = totalSeconds % 60;
const pad = (n) => String(n).padStart(2, "0");
if (hours > 0) return `${hours}h ${pad(minutes)}m ${pad(seconds)}s`;
if (minutes > 0) return `${minutes}m ${pad(seconds)}s`;
return `${seconds}s`;
}test/duration.test.js
import assert from "node:assert/strict";
import { test } from "node:test";
import { formatDuration } from "../src/duration.js";
test("seconds only", () => {
assert.equal(formatDuration(7), "7s");
});
test("minutes and seconds", () => {
assert.equal(formatDuration(249), "4m 09s");
});
test("hours, minutes and seconds", () => {
assert.equal(formatDuration(3725), "1h 02m 05s");
});Then the AgentDuo configuration, with one gate: AgentDuo runs npm test after every implementation round and shows the result to the reviewer.
.agentduo/config.yaml
# .agentduo/config.yaml for the first-task tutorial.
# agentduo runs this gate after every implementation round and shows its result to the code reviewer.
gates:
- name: tests
command: "npm test"
required: trueOn macOS, Linux, WSL or Git Bash, this script creates all four files at once:
Terminal (POSIX shell)
mkdir -p duo-first-task/src duo-first-task/test duo-first-task/.agentduo
cd duo-first-task
cat > package.json <<'EOF'
{
"name": "duo-first-task",
"version": "1.0.0",
"private": true,
"type": "module",
"scripts": {
"test": "node --test"
}
}
EOF
cat > src/duration.js <<'EOF'
// Formats a number of seconds for a progress line: "7s", "4m 09s", "1h 02m 05s".
export function formatDuration(totalSeconds) {
const hours = Math.floor(totalSeconds / 3600);
const minutes = Math.floor(totalSeconds / 60);
const seconds = totalSeconds % 60;
const pad = (n) => String(n).padStart(2, "0");
if (hours > 0) return `${hours}h ${pad(minutes)}m ${pad(seconds)}s`;
if (minutes > 0) return `${minutes}m ${pad(seconds)}s`;
return `${seconds}s`;
}
EOF
cat > test/duration.test.js <<'EOF'
import assert from "node:assert/strict";
import { test } from "node:test";
import { formatDuration } from "../src/duration.js";
test("seconds only", () => {
assert.equal(formatDuration(7), "7s");
});
test("minutes and seconds", () => {
assert.equal(formatDuration(249), "4m 09s");
});
test("hours, minutes and seconds", () => {
assert.equal(formatDuration(3725), "1h 02m 05s");
});
EOF
cat > .agentduo/config.yaml <<'EOF'
# .agentduo/config.yaml for the first-task tutorial.
# agentduo runs this gate after every implementation round and shows its result to the code reviewer.
gates:
- name: tests
command: "npm test"
required: true
EOFStart a Git repository
In the duo-first-task folder (the same commands work in PowerShell):
Terminal
git init
git add .
git commit -m "Start: formatDuration with a failing test"If Git asks who you are, set git config user.name "Your Name" and git config user.email "you@example.com", then commit again.
See the test fail
Terminal
npm testTwo tests pass and one fails. Among the output:
Output (excerpt)
✖ hours, minutes and seconds
+ '1h 62m 05s'
- '1h 02m 05s'
ℹ tests 3
ℹ pass 2
ℹ fail 1With the terminal command, duo doctor now also lists the gate: gate 'tests': npm test.
Run the pipeline
The implementer has to edit a file. To let it do so without a prompt for each edit, switch Claude’s mode to Edit automatically first. If you keep Manual, answer each permission prompt with Allow once.
Terminal
Open the chat in the project folder, switch the mode, and give the task:
Terminal, then the chat
duo /mode acceptEdits /pipeline Fix formatDuration in src/duration.js: for an hour or more it shows the wrong minutes (3725 seconds gives 1h 62m 05s instead of 1h 02m 05s). Keep the output format, and make npm test pass.Or, without the chat, in one command:
duo --accept-edits "Fix formatDuration in src/duration.js: for an hour or more it shows the wrong minutes (3725 seconds gives 1h 62m 05s instead of 1h 02m 05s). Keep the output format, and make npm test pass."Desktop app
Choose Open project… and pick
duo-first-task. Set the permission mode under the input to Edit automatically, choose Pipeline in the recipient menu (or type/pipelinebefore the task), and send the task above.VS Code
Open the folder, open the chat, pick Edit automatically on the mode chip and Pipeline on the recipient chip, and send the task.
What happens
The steps appear one by one, each with the agent working on it and what it hands to the next. The exact text differs from run to run; the sequence is:
PLAN
Codex reads the project and writes a plan: the goal, the steps, the acceptance criteria (the three tests pass, the format is kept) and the risks.
PLAN_REVIEW
Claude Code checks the plan against the code. If it requests changes, Codex revises it.
PLAN_FINALIZE
Codex signs off the final plan.
IMPLEMENT
Claude Code changes
src/duration.jsand reports what it did.VERIFY
AgentDuo runs
npm test. If the gate fails, the work goes back to Claude Code before any review.CODE_REVIEW
Codex reviews the diff with the gate result. It approves, or sends findings back for another round.
The run ends with DONE when Codex approves, no blocking finding is left and the gate passes. If it stops to ask you instead, see Decisions, stop and resume.
Review the result
AgentDuo changed the working tree and committed nothing. Look at the change:
Terminal
git diff
npm testExpect a change to the minutes line, something like:
git diff (excerpt)
- const minutes = Math.floor(totalSeconds / 60);
+ const minutes = Math.floor((totalSeconds % 3600) / 60);and ℹ pass 3, ℹ fail 0 from the tests. The agents may write the fix differently; the tests are what must hold.
- In the chat,
/diffshows what the run changed and/planits final plan. In the desktop app and VS Code, open Changes and Plan. duo statusshows the run’s steps and cost;duo listlists the workspace’s runs. Each run’sreport.mdis in.agentduo/runs/<run-id>/.
Try stopping and resuming
Run the task again on a fresh copy (or another small task), and press Esc (or Stop) while a step is running. The step ends and the run keeps its state. Then:
duo
/resumere-runs the stopped step. After you close the chat, duo resume in the same folder continues the latest run, and the desktop app lists it under Resumable runs. /resume <note> adds a note for the agents.
Commit the fix
When the diff looks right, commit it yourself. Run data under .agentduo/runs/ has its own .gitignore, so it stays out of the commit.
Terminal
git add -A
git commit -m "Fix minutes in formatDuration"Tip
Use your own project next. Add your test command as a gate, start with a small task, and keep Manual mode until you know which tools you want Claude to use without asking. Permissions shows how to allow them.