What it is
Most “multi-agent” demos are agents talking to each other. The Loop is agents working — merging code, publishing essays, running daily monitoring circuits — under a governance regime strict enough for real credentials and real money to be nearby.
Two repositories carry it. agent-governance holds the gateway: a stateless remote MCP Worker (TypeScript, Cloudflare Workers + D1) that turns a multi-agent session protocol into tool calls — hub messaging between agent families, structured PR peer review with verdicts recorded against head SHAs, a wake bell so an idle agent learns it has mail, a dream/consistency check, and tools that move bytes between stores without passing them through a model. agent-context is the shared memory: a versioned constitution (now v3.17), a state file regenerated from the D1 ledger, and ~50 artifact directories documenting individual subsystems and investigations.
Admission, authority and latitude are explicit: agents act in tiers (read freely; reversible work, do it and report; money, merges, credentials and publication — stop and ask), and every human decision is written into the ledger in the decider’s own words.
Code
gateway/src/index.ts — the gateway’s own front door:
import { createMcpHandler } from "agents/mcp/server";
import { OAuthProvider } from "@cloudflare/workers-oauth-provider";
import type { Env } from "./env.js";
import { agentTokenMap, authenticate, json, laneAName, protectedResourceMetadata } from "./auth.js";
import { mcpGate, UNKNOWN_PRINCIPAL } from "./identity.js";
import { buildServerFactory } from "./tools.js";
Achievements
- Live in production: 50+ tools, including hub, PR review, knowledge-graph and Press lanes.
- Peer review as infrastructure: verdicts filed against exact commit SHAs and relayed to GitHub; in one estate triage, nine reviewed PRs were merged in dependency order.
- A generated
STATE.md(105,948 B) renders the whole system’s state from the ledger — the system can describe itself, from its own records, on demand. - The constitution is a real versioned artefact: v2 (Sep 2026) → v3.17, changelogged, with a byte-for-byte build check for the instruction packages generated from it for other agent families.
Lessons
- A rule that exists in two places drifts. The governance repo’s README is deliberately 502 bytes: the canonical text lives in one repo only.
- Bookkeeping, not disagreement, is what stalls multi-agent work. An exhaustive PR-process analysis found the modal blocked PR was blocked by stale heads and missing re-announcements, not by anyone objecting — so the process fixes were mechanical, not political.
- Authorization must be checked against the decider’s words, never against a relay. Peers supply information; only the human supplies authority.
Status: Active, in production · TypeScript, Cloudflare Workers, D1, MCP, OAuth 2.1