Multi-agent protocol

Many agents.
One source of truth.

Gearbox is a scaffold for multi-agent collaboration projects — AGENTS.md as the single source of truth, decision records, and a CI hard gate. So Claude Code, Z Code, Cursor, or any coding agent can take turns in the same repo without stepping on each other.

MIT · Zero runtime deps · Tool-agnostic

The film

The whole idea,
in seventy-one seconds.

Same story this page tells, told in one take. Read on, or watch it — your call.

71 sec · English narration · sound on

The problem

The second agent
starts blind.

By the time another agent picks up the repo, everything the last one worked out is gone. The chat window it lived in doesn't survive the session — and the repo was never told.

A lone pixel-art agent in a lit doorway, three blank slabs on the ground in front of it
One agent, one doorway, three versions of the rules
Rules ×3

The same rule copied into CLAUDE.md, a README, and a comment. Copies drift; three versions disagree and nobody notices.

Why → ∅

A trade-off gets weighed carefully, then evaporates. The next shift re-litigates it, or quietly undoes it.

Mid-task swap

An agent hands off halfway through a change. Half-applied edits, no gate, no record of what "done" was supposed to mean.

The shift protocol

Handoffs with nothing
left to guesswork.

One agent works at a time. The repo — git history, issues, PRs — is the only shared memory between shifts. Every shift follows the same loop:

01

Sync, then read

Fetch and fast-forward, read recent commits, then find the open handoff issue — the previous shift's memory lives there.

02

Claim & work

Claim a frontier task, see it through start to finish. Small commits that spell out the why. Non-trivial changes go through a branch + PR.

03

Gate green

A hard gate — your own test/typecheck/lint command — must pass before shift-end. CI runs the same commands. Red means no merge.

04

Hand off

Open a handoff issue with a five-part memory: done, blocked, next, closures, and the rationale behind every non-default decision.

Architecture

Five files. Zero dependencies.

Plain Markdown and one Node script — nothing to install in your runtime, nothing that rots.

AGENTS.md

The single source of truth. Every agent reads it — rules live here and only here, never duplicated.

CLAUDE.md

An empty shell: one @AGENTS.md line. Tool-specific entry points stay pointers, not forks.

CONTEXT.md

Domain glossary. Keeps different agents from understanding the same business term differently.

docs/adr/

Architectural decision records — one decision per file. Protocol ADRs ship alongside, tool-managed.

ci.yml

The hard gate. The one constraint that doesn't depend on agent self-discipline.

.gearbox-version

Protocol version stamp, written and read by tooling. Downstream repos self-check and backfill upstream updates.

Deliberately no HANDOFF.md — progress and handoffs run through GitHub Issues and PRs: append-only, timestamped, never goes stale.

Three pixel-art agents standing before a single lit monolith in a dark cavern
One file every agent reads — AGENTS.md

Guardrails

Agents can change the rules.
Within rules.

The protocol repairs and extends itself — but changes are tiered, and humans keep an after-the-fact veto.

Tiered authorization

L1Hard rules, the gate, the tiering itself — an agent may only merge after the maintainer explicitly agrees, verified against their GitHub account.

L2Working-agreement refinements — agents merge autonomously. Every protocol change still needs an issue, an ADR, and a green PR.

Three roles for issues

Task — an actionable thing to do. Memory — the shift-end handoff comment. Protocol gap — a question the repo can't answer.

Hit a gap? Opening an issue is mandatory — silent judgment calls are not allowed. That's the protocol's self-repair loop.

Memory that doesn't decay

Five-part handoff format: what's done, what's blocked, what's next, what closed — and the rationale behind every non-default decision, including what would overturn it.

Parallel lanes

Multi-human repos run parallel shifts: a lane = one shift plus its claimed tasks. Claims are visible and timestamped; protocol changes serialize at merge time.

A pixel-art archive wall of glowing record slabs
Decisions become ADRs, terms become CONTEXT.md
Two pixel-art agents passing a glowing object between shifts
No handoff file — the handoff is an issue

The hard gate

Red never merges.

Your own command — vitest, tsc, lint, whatever the project already runs. AGENTS.md names it, CI runs the same line. It's the one rule that doesn't depend on an agent's good intentions.

Shift-end rule #1: the gate is all-green, or the shift isn't over.

Tooling

One command to start.
One to stay in sync.

  • npx gearbox-agents install

    Lay down the full scaffold — placeholders, gate, ADR provenance, hash stamps. Zero config.

  • npx gearbox-agents version

    Check which upstream protocol version and ADRs this repo is synced to.

  • npx gearbox-agents update

    Backfill missing upstream ADRs into a review-ready branch. Pull-triggered — no upstream registry of forks needed.

  • npx gearbox-agents prune

    Branch hygiene: merged branches, stale refs, leftover worktrees. Dry-run by default, never force-deletes.

Validated in practice

Six rounds of dogfooding.
Honest about the limits.

The protocol ran four rounds of multi-agent validation in a real repo, then two more maintaining itself — every mechanism that emerged landed as an ADR.

49Protocol ADRs
6Dogfood rounds
0Runtime deps
1000+npm downloads

What held up

  • Zero-verbal handoffs — three shifts of collaboration with nothing left to guesswork
  • The self-repair loop: find a gap, open an issue, fold it into the protocol
  • The protocol catching its own violations — and its own overreach — without anyone pointing the way
  • Async L1 approval running end-to-end, verified against a GitHub account

What's unvalidated

  • Scale: n=1 user, two agents, a toy-sized codebase
  • An all-green gate ≠ correct — inherent to regression-style guarantees
  • L1 while the maintainer is offline — the bottleneck is accepted, never yet felt
  • Ceremony cost in high-frequency, small-task settings

Give your agents
a working agreement.