The coordination-and-trust layer for the CROO agent economy. Three pillars in one monorepo: a discovery Registry that agents can query, a general contractor (Foreman) that assembles a crew and delivers one synthesized result, and a verification oracle (Notary) that independently checks another agent's work before you trust it.
Built for the CROO Agent Hackathon. MIT licensed. Runs headless, no UI.
CROO's own docs name two structural holes in the agent economy, and the store bears them out. It is full of single-shot leaf agents (pay 0.10 USDC, get one report) with nothing connecting them:
- An agent can't find another agent. CROO's store has a search box and a
Navigator, but they're gated behind a human wallet-login session. An
autonomous agent holds only its SDK-key, and that key gets
401 NOT_LOGINfrom the discovery backend (/backend/v1/services) — verified. The SDK also exposes nolistServices. Discovery exists for people, not for agents; there's nothing an agent can call at runtime to find a counterparty. - There's no way to check a deliverable. CAP's only native proof is a keccak256 hash of the output. It proves what was delivered, not that it's correct, and delivery auto-settles with no quality arbitration.
Guild builds the missing pieces instead of assuming they exist. The Registry is the discovery layer (#1). Notary is the verification layer (#2). Foreman is the agent that ties them together, and the two agents are the live, on-chain proof that the Registry works.
flowchart LR
Buyer([Buyer]) -->|hire: goal + budget| Foreman
subgraph Guild
Foreman -->|discover by skill/price/SLA| Registry[(Guild Registry)]
Registry -->|ranked crew| Foreman
Foreman -->|subcontract in parallel| Workers[External CROO agents]
Workers -->|deliverable + hash| Foreman
Foreman -->|verify each| Notary
Notary -->|self-register| Registry
Notary -->|verdict + on-chain hash check| Foreman
end
Foreman -->|one synthesized dossier + receipts| Buyer
The journey Foreman runs on every order:
- Plan. An LLM decomposes the goal + budget into subtasks with skill-tag queries.
- Discover. It queries the Guild Registry (
discover()), which returns candidates ranked by a reverse auction:price × completion% × SLA. - Subcontract. It hires the winners in parallel over CAP (negotiate, pay, deliver), bounded by a spend guard with integer micro-USDC math (per-order cap plus a pre-flight purse check).
- Verify. Every sub-deliverable is routed through Notary. It recomputes the keccak256 hash against the on-chain anchor (a deterministic tamper gate that never asks an LLM), then runs an adversarial critique and source cross-check.
- Synthesize. One dossier, with a clickable Base tx for every subcontract.
A sub-order that can't be discovered, budgeted, or delivered within its SLA slice becomes a noted gap in the dossier. It never crashes the run. Foreman's own SLA is split across the worker leg, the sequential Notary leg, and a synthesis buffer, so it always clears its promise to the buyer.
| Layer | Technology |
|---|---|
| Language | TypeScript 5.7 (strict, no any), Node 18+ |
| Monorepo | pnpm workspaces, TS project references |
| Agent protocol | CROO CAP via @croo-network/sdk |
| Chain | Base mainnet, USDC, keccak256 hashing (viem) |
| LLM | Anthropic Messages API (plan / synthesize / critique) |
| Source check | Tavily (Notary corroboration) |
| Tests | Vitest (115 across the workspace) |
The whole coordination logic runs without CROO keys or a network. Only the CAP transport and the LLM are stubbed:
pnpm install
pnpm demoYou'll watch agents self-register, Foreman discover and hire a crew, Notary verify
each result (including a tamper case caught by the hash gate), and a dossier get
synthesized with receipts. See only the discovery layer with pnpm example:registry.
Both agents are thin; the plumbing lives here.
| Export | What it does |
|---|---|
RegistryClient |
register() / discover() / health() against the Registry |
scoreCandidates / rankMatches |
reverse-auction scoring plus filter/rank |
parseRegistration / isServiceEntry |
validate self-attested service entries |
serve(client, handler) |
generic provider loop: accept, run handler, deliver |
hire(client, req, opts) |
requester helper: negotiate, pay, getDelivery |
SpendGuard |
per-order cap + cumulative purse gating (atomic reserve) |
computeContentHash / verifyContentHash |
keccak256 deliverable hash + compare |
readUsdcBalance |
live USDC purse read on Base (viem) |
createLlm |
LLM messages wrapper |
loadAgentConfig / createClient |
CROO AgentClient from env, per-agent key |
Agent + service registration is Dashboard-only. See
scripts/register-services.md for the full
walk-through (create two agents, configure services, fund the AA wallets). Then:
cp .env.example .env # fill in SDK keys, service IDs, LLM key, REGISTRY_URL
pnpm registry # discovery service
pnpm notary # self-registers into the Registry, then serves
pnpm foreman # discovers its crew via the Registry, then serves
pnpm example:hire "Assess token XYZ for an investment memo"packages/
shared/ @guild/shared reusable CAP + discovery layer (client, provider, hire,
registry client, scoring, spend guard, hash, llm)
registry/ @guild/registry the discovery service: store + router + server + seed
foreman/ @guild/foreman plan -> orchestrate -> dossier
notary/ @guild/notary verify (hash gate + critique + sources) + handler
scripts/ demo.ts · register-services.md
examples/ query-registry.ts · hire-foreman.ts
pnpm test # vitest, all packages
pnpm typecheck # tsc -b across the workspaceThe suite covers the reverse-auction scoring, spend-guard math, the Notary tamper
case (mismatched hash to fail), Foreman's SLA-cascade math, and graceful
degradation when a sub-order times out.
CAP fixes prices at the service level before work (flat tiers, no cost-plus); SLAs are
at least 300s with auto-refund on timeout; delivery auto-settles with no dispute
(which is why Notary exists); registration is Dashboard-only; Base mainnet only
(USDC 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913), gas sponsored by the Paymaster.
MIT. See LICENSE.