Two-Agent Loop

    1

    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

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    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)

    TaskFilesDefinition of doneStatus
    project-setuppackage.json, tsconfig.json, src/app.ts, src/server.ts, tests/health.test.tsGET /health returns 200 with { "status": "ok" }; importing createApp does not open a portDone
    task-validationsrc/validation.ts, tests/validation.test.tsValid input accepted and title trimmed; empty, whitespace-only, too-long and non-string titles rejected; unknown fields rejectedDone
    task-storesrc/store.ts, tests/store.test.tsUnique IDs, timestamps, insertion order, unknown IDs handled, isolated instancesDone

    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 attempts2
    ResultDone

    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.
    package.json, tsconfig.json

    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

    1. Plan: write PLAN.md and get the human's approval.
    2. Branch: create task/<short-name> for the next task.
    3. Brief: give the worker the goal, the files and the definition of done.
    4. Verify: run the checks yourself and review the diff.
    5. Retry or escalate: send the error back; after two failures, ask the human.
    6. Merge: merge to main and move the task to Done.
    7. 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

    Adds overhead; not for small changes. Requires a working test suite and type checker. Orchestrator must handle environment/dependency management.

    How to use

    1. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    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

    Requires

    Git

    Permissions

    Terminal / Shell
    Write Files
    Read Files
    Listed3 days ago

    What's inside

    Frequently Asked Questions

    This skill solves the "hallucination loop" where an agent incorrectly confirms its own buggy code. By separating the Planner from the Worker and requiring a test suite to validate the result, it ensures code is only merged when it actually works, not just when the agent says it does.

    The skill is framework-agnostic but requires your environment to have Git installed and a functional test runner (like Pytest, Jest, or Vitest). It works best with LLMs that support tool-use, as it needs to interact with your local filesystem to manage the PLAN.md state and run shell commands.

    While highly effective for complex features, this skill adds overhead due to the planning and branching phases. We recommend using it for multi-file features or refactoring tasks where accuracy is more important than speed, rather than for simple one-line fixes.

    Yes, the skill is designed to work with your existing test infrastructure. It triggers your configured test commands after the Worker agent completes a task, using the exit codes to determine whether to merge the code or send it back for a retry.

    New in Agents & Orchestration