Multi-Agent Development workflow

MAD Workflow

A coordinator turns your idea into a spec and small task cards. Workers build them in parallel, each in its own worktree, on Claude, Codex or OpenCode. You decide at four gates; in between, the agents work on their own.

Quick install

Needs Node.js 18.17+, git, and Orca to run the workers. The same command works on macOS, Linux and Windows.

npm install -g mad-workflow
SystemGet Node.js and git first
macOSbrew install node git
LinuxYour package manager, e.g. sudo apt install nodejs npm git, or nodejs.org
Windowswinget install OpenJS.NodeJS.LTS and winget install Git.Git

From source: clone github.com/gottipx/mad-workflow, then cd package and npm run install-local.

Get started

cd ~/Workspace/my-app
mad init                 # sets up MAD in this folder
AgentStart MAD with
Claude Code/mad
Codex$mad, or ask "start MAD"
OpenCodeask "start MAD"

The agent you start MAD in becomes the coordinator. Start it inside Orca, so Orca can wake it when workers report, and pick a high-end model first: it stays the same for the whole run.

mad models lists the agents installed on your machine and the models each offers. mad update refreshes MAD's own files in a project and keeps all of yours.

How it works

You decide Coordinator Workers
flowchart TD
  idea([Your idea]) --> plan["PLAN
configure, grill product,
grill stack"] plan --> g1{{"GATE 1
spec + stack"}} g1 --> setup["SET UP
keys, toolsets,
playbooks, task cards"] setup --> g2{{"GATE 2
playbooks + cards"}} g2 --> build["BUILD, wave by wave
workers build, review,
merge, integration check"] build -. question .-> g3{{"GATE 3
you answer"}} g3 -. answer .-> build build --> g4{{"GATE 4
use the preview app"}} g4 -- changes --> setup g4 -- approved --> ship(["SHIP
PR, CI deploys, retro"]) classDef human fill:#fdba74,stroke:#c2410c,color:#1b2230 classDef lead fill:#a5b4fc,stroke:#3b5bdb,color:#1b2230 classDef worker fill:#86efac,stroke:#15803d,color:#1b2230 class idea,g1,g2,g3,g4 human class plan,setup,ship lead class build worker

1. Plan

  • Pick models per role and limits
  • Grill the product → SPEC.md
  • Grill the stack and toolchain → STACK.md
Gate 1

2. Set up

  • You: accounts, logins, keys
  • Set up and check every tool
  • Write playbooks and task cards
Gate 2

3. Build

  • Wave 0: architect lays contracts
  • Each wave: workers build, reviewer checks, coordinator merges
  • Integration check and preview after every wave
Gate 3 when needed

4. Ship

  • You use the preview app
  • PR to main; CI deploys production
  • Retro: lessons go into rules and playbooks
Gate 4

What you decide

Every gate comes as a short summary with the 3-5 points the coordinator is least sure about, so you review the risky parts first.

WhenYou decide
StartAgent, model and effort per role, parallel workers, review policy, app folder. Saved in mad/config/mad.yaml.
Gate 1What to build and with which stack
Gate 2The rules (playbooks) and how the work is split (task cards). The most important gate.
Gate 3Worker questions the spec doesn't answer, tasks that failed review twice, and commands that failed 3 times
Gate 4Whether the app is right. Approval opens the PR; CI deploys after you merge.

Each role can run on a different agent. MAD offers only the models mad models finds on your machine.

coordinator: { agent: claude, model: claude-opus-5-5, effort: high }      # the session you started MAD in

roles:
  architect: { agent: claude,   model: claude-opus-5-5,         effort: medium }  # mistakes spread: strong model
  developer: { agent: opencode, model: deepseek/deepseek-v4-pro }                 # most of the work: drives cost
  reviewer:  { agent: codex,    model: gpt-6.1-sol,             effort: low }     # another provider: second opinion
limits:
  max_parallel_workers: 3
  max_fix_rounds: 2
review: risky        # reviewer only for risk: high cards (contracts, login, data, deploy); or always / never

Building blocks

Every worker gets one message, built by a script: role + rules + playbooks + task card. Nothing else.

BlockWhat it isWhere
RolesThe job: architect lays contracts, developer builds one card, reviewer checks high-risk cards and never fixesmad/roles/
RulesProject-wide rules for every workermad/AGENTS.md
Agent playbooksRules for one area (web, backend, deploy): tools, boundaries, traps, proof of done, when to askmad/playbooks/
Task cardsOne small task for one worker: files it owns, what to read, when it's done. Status is tracked in Orca.mad/tasks/
ToolsetsThe tools and MCP servers a worker actually has. Enforced by config; playbooks are only guidance..mcp.json, agent configs
OrcaStarts workers in their own worktrees, carries questions and reports, wakes the coordinatorOrca app and orca CLI

A task card

---
id: AUTH-1
title: Login API
role: developer
playbooks: [backend]
wave: 1
risk: high
needs: [AUTH-0]
owns: [app/api/auth/*, app/db/migrations/002_users.sql]
---
## Context  (read only these)
- app/contracts/auth.ts
## Done when
- POST /login returns a session; a wrong password returns 401
- Tests pass (paste output)

Project layout

.claude/skills/mad/  .agents/skills/mad/    the skill (Claude Code + OpenCode, Codex)
AGENTS.md                                  short pointer to the skill
mad/
  config/mad.yaml  SPEC.md  STACK.md  AGENTS.md  MAP.md  RUN.md
  roles/  playbooks/  tasks/  dispatch/  kit/
app/                                       the software only

Safety and cost

Keys

  • CLI logins live in your user folder; project keys in .env, never committed
  • Agents get dev projects only. Production keys live only in CI.
  • Smallest scope; read-only where possible
  • Never in playbooks, cards or chat

Tokens

  • Cheaper models for developers and reviewers
  • Cards list exactly which files to read
  • mad/MAP.md replaces exploring the repo
  • Reviewers start from the diff
  • Tests run once at the end, not after every edit
  • A command that fails 3 times becomes a question
  • A separate reviewer only for high-risk cards
  • Limits on parallel workers and fix rounds

Quality

  • Contracts first, so parallel work fits together
  • No two cards in a wave own the same file
  • Proof instead of claims; a separate reviewer for high-risk cards
  • Integration check after every wave
  • Pinned toolchain (mise or pixi) in every worktree

Good to know