- Home
- Skills
- Agents & Orchestration
- Two-Agent Loop
Two-Agent Loop
A plan-delegate-verify loop for coding agents: one agent orchestrates, a second implements one small task per branch, and the test suite decides when each task is done.
$5
Works with the AI Agents you already use
Two-Agent Loop
Example session with this skill installed
Use the two-agent loop to build a small to-do REST API with TypeScript, Express, Zod and Vitest. Tasks are stored in memory. Start by writing PLAN.md with small tasks, each with a goal, files and a definition of done, and wait for my approval before delegating anything.
- Read your context and instructions
- Compiled the two-agent loop
Summary
Excerpt from a real run of this loop, published as the open-source example in the Harness repository (https://github.com/andresListorti/harness). Claude Code orchestrated, Codex implemented, and the tests decided. The full example finished 10 of 10 tasks with 109 passing tests and no task escalated to a human. It is an excerpt of the repo's own run log, not a live transcript.
The plan (first tasks)
| Task | Files | Definition of done | Status |
|---|---|---|---|
| project-setup | package.json, tsconfig.json, src/app.ts, src/server.ts, tests/health.test.ts | GET /health returns 200 with { "status": "ok" }; importing createApp does not open a port | Done |
| task-validation | src/validation.ts, tests/validation.test.ts | Valid input accepted and title trimmed; empty, whitespace-only, too-long and non-string titles rejected; unknown fields rejected | Done |
| task-store | src/store.ts, tests/store.test.ts | Unique IDs, timestamps, insertion order, unknown IDs handled, isolated instances | Done |
Every definition of done also required the full test suite and the type checker to pass, run by the orchestrator.
What the verification step caught (task 1, branch task/project-setup)
| Codex attempts | 2 |
| Result | Done |
Attempt 1: The worker wrote the scaffold, GET /health and two tests. It could not install dependencies (its sandbox has no network) and used "latest" tags in package.json. After the orchestrator installed dependencies, the tests passed (2 tests) and the type checker was clean.
- Orchestrator review: The orchestrator sent back one fix: pin the dependency versions.
Attempt 2: The worker replaced every "latest" with a caret range of the installed version, editing only package.json.
- Final check by the orchestrator: a clean npm ci, then the tests (2 passed) and the type checker (no errors).
Next tasks in the same run
- task-validation: 1 attempt, 48 tests passing
- task-store: 1 attempt, 55 tests passing
- create-task: 1 attempt, 62 tests passing
- list-and-get-tasks: 1 attempt, 79 tests passing
- edit-task: 1 attempt, 93 tests passing
- complete-task: 1 attempt, 97 tests passing
Next steps
- Approve the plan and let the loop continue with the next pending task.
- After a large feature, run an independent review before any push.
Connects securely to your tools. The creator never sees your data.
About this skill
A development loop for coding agents with two roles and one referee. One agent plans and orchestrates, a second agent implements a single small task on its own branch, and the test suite and type checker decide when the task is done.
The orchestrator re-runs the checks itself instead of trusting a "done" report. If a check fails, the exact error goes back to the worker. If the same task fails twice, the loop stops and asks a human. Progress is tracked in a PLAN.md board with Pending, In progress and Done sections.
What it does
- Splits a feature into small tasks, each with a goal, the files involved and a definition of done
- Creates one branch per task, so a failed attempt never reaches main
- Briefs the worker with only what that task needs
- Verifies every attempt by running the tests and the type checker, and reviewing the diff
- Merges passing tasks with a merge commit and records the result
How it works
- Plan: write PLAN.md and get the human's approval.
- Branch: create task/<short-name> for the next task.
- Brief: give the worker the goal, the files and the definition of done.
- Verify: run the checks yourself and review the diff.
- Retry or escalate: send the error back; after two failures, ask the human.
- Merge: merge to main and move the task to Done.
- Repeat until nothing is pending.
Requirements
Git, a test runner and a type checker for your language, and a second coding agent to act as the worker (a different model family from the orchestrator works best). It manages PLAN.md in your local filesystem.
Known limitations
It adds overhead, so for a change of a few lines it is faster to do it directly. It needs a working test suite to act as the referee, and it never pushes unless you explicitly say so.
Source
Open source reference implementation (MIT): https://github.com/andresListorti/harness
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Agents & Orchestration.
Adds overhead; not for small changes. Requires a working test suite and type checker. Orchestrator must handle environment/dependency management.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 3 days ago
- Software
Git