Skip to content

Repository files navigation

Guild

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.

TypeScriptNodeBaseTestsLicense: MIT

Built for the CROO Agent Hackathon. MIT licensed. Runs headless, no UI.

The gap Guild fills

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:

  1. 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_LOGIN from the discovery backend (/backend/v1/services) — verified. The SDK also exposes no listServices. Discovery exists for people, not for agents; there's nothing an agent can call at runtime to find a counterparty.
  2. 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.

How it fits together

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
Loading

The journey Foreman runs on every order:

  1. Plan. An LLM decomposes the goal + budget into subtasks with skill-tag queries.
  2. Discover. It queries the Guild Registry (discover()) AND CROO's unauthenticated public store API (/backend/v1/public/search, the same endpoints the web storefront uses — open even though the authenticated discovery API is session-gated), merges both pools, and ranks them by a reverse auction: price × completion% × SLA. So Foreman can hire any live CROO agent, not just services seeded into the Registry.
  3. 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).
  4. 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.
  5. 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.

Tech Stack

LayerTechnology
LanguageTypeScript 5.7 (strict, no any), Node 18+
Monorepopnpm workspaces, TS project references
Agent protocolCROO CAP via @croo-network/sdk
ChainBase mainnet, USDC, keccak256 hashing (viem)
LLMAnthropic Messages API (plan / synthesize / critique)
Source checkTavily (Notary corroboration)
TestsVitest (149 across the workspace)

Quickstart (offline, no credentials)

The whole coordination logic runs without CROO keys or a network. Only the CAP transport and the LLM are stubbed:

pnpm install
pnpm demo

You'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.

Live verification (from monitor logs)

Registry came up on :4600 with the four seeded services.
Notary self-registered at startup and logged it, then announced it was live on CROO.
Foreman started and said it would discover through the Registry (plus the public store), connected, and began polling.

This matches what prompt.md asked for: the Registry is the actual discovery layer agents use, Notary registers itself when it boots, and Foreman calls discover() instead of a fixed list. The user has separately run and confirmed the complete live journey works.

@guild/shared: the reusable CAP layer

Both agents are thin; the plumbing lives here.

ExportWhat it does
RegistryClientregister() / discover() / health() against the Registry
scoreCandidates / rankMatchesreverse-auction scoring plus filter/rank
parseRegistration / isServiceEntryvalidate self-attested service entries
serve(client, handler)generic provider loop: accept, run handler, deliver
hire(client, req, opts)requester helper: negotiate, pay, getDelivery
SpendGuardper-order cap + cumulative purse gating (atomic reserve)
computeContentHash / verifyContentHashkeccak256 deliverable hash + compare
readUsdcBalancelive USDC purse read on Base (viem)
createLlmLLM messages wrapper
loadAgentConfig / createClientCROO AgentClient from env, per-agent key

Running live on CROO

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"

Layout

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

Tests

pnpm test# vitest, all packages
pnpm typecheck # tsc -b across the workspace

The 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.

Constraints Guild is built around

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.

License

MIT. See LICENSE.

About

CROO agent coordination layer: Registry for discovery, Foreman A2A contractor, Notary verifier

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages