Architecture
Cortex is a Base-native protocol for agentic commerce: onchain identity, policy, intents, merchant discovery, payment terms, receipts, disputes, analytics, and machine-readable APIs.
System Shape
Agent / Smart Account
-> AgentRegistry + PolicyModule + PolicyAccount
-> IntentBook <-> SolverRegistry / Solver service
Merchant / Service Operator
-> CommerceRegistry
merchants, services, facilitators, quotes, receipts, fulfillment, trust signals, disputes
Attestors
-> AttestorRegistry + AttestationRegistry
All contract events
-> Indexer -> Postgres -> REST API / MCP / DashboardCore Flows
- Agent identity and policy — register an agent, configure spend limits, target/function allowlists, session keys, and signed payment budgets.
- Intent execution — sign an EIP-712 intent, inspect/select solver bids, and enforce selected solver, amounts, execution commitment, deadline, and optional attestations.
- Merchant discovery — register merchant, service, facilitator, metadata URI/hash, and service capability hash onchain.
- Quote commitment — bind merchant, service, agent, token, amount, payment rail, expiry, nonce, resource hash, terms hash, optional x402 payload hash, and fee terms.
- Receipt, fulfillment, and dispute — record settlement, result/resource hashes, fulfillment hashes, trust signals, and dispute resolution signals for analytics and reputation.
- Index and query — index events into Postgres and expose them through REST, MCP, and dashboard views.
Payment Rails
Wallet transfers
Native or ERC-20 payments governed by spend limits and allowlists.
Swaps
DEX/router calls governed by intent constraints, target policies, and token spend limits.
Facilitators
Delegated payment flows where a facilitator settles on behalf of an authorization.
x402
Web-native payment acceptance bound through x402PayloadHash when used.
Contract Architecture
| Contract | Purpose | Key Feature |
|---|---|---|
| AgentRegistry | Agent identity | Owner, metadata URI, pubkey, capabilities hash |
| PolicyModule | Policy enforcement | Spend limits, allowlists, signed payment policy, replay protection |
| PolicyAccount | Smart account | Policy-gated execution, session keys, guardian freeze |
| IntentBook | Intent lifecycle | EIP-712 intents, selected bids, solver fill enforcement |
| SolverRegistry | Solver discovery | Operator metadata, bond, fill quality counters |
| AttestorRegistry | Attestor discovery | Operator metadata and schema support |
| AttestationRegistry | Provenance | Schema-based attestations and revocation |
| CommerceRegistry | Agentic commerce | Merchants, services, facilitators, quotes, receipts, fulfillment, trust signals, disputes |
Indexed Data
| Table | Purpose |
|---|---|
| agents | Agent identity and owner lookups |
| intents | Intent state, constraints, and status |
| solver_bids | Bid market inspection |
| fills | Solver fills, result hashes, trace hashes |
| policies | Account spend, allowlist, and signed payment policy state |
| solvers | Solver metadata and performance metrics |
| attestors | Attestor metadata and counters |
| merchants | Merchant discovery and payout context |
| services | Service discovery and capability lookup |
| facilitators | Payment facilitator discovery |
| quotes | Canonical quote/payment terms and fee instrumentation |
| commerce_receipts | Settled commerce records and fulfillment hashes |
| disputes | Refund/dispute/reputation signals |
| trust_signals | Verification, risk, compliance, and fulfillment signals |
| tx_receipts | Human and machine transaction explanations |
API, MCP, and Dashboard
- REST API exposes indexed state for agents and frontends.
- MCP tools expose selected API functionality to model-driven agents.
- Dashboard reads commerce analytics, merchant/service discovery, receipts, and disputes.
- Analytics include volume, settled volume, payment rail mix, zero-fee protocol fields, dispute counts, trust signal counts, and facilitator/merchant/service leaderboards.
Technology Stack
Contracts: Solidity 0.8.24, Foundry, OpenZeppelin
Solver: TypeScript, viem, node-postgres
Indexer: TypeScript, viem, node-postgres
API: TypeScript, Express 4, node-postgres
Dashboard/docs: Next.js, React, Tailwind
Database: PostgreSQL 16
Local dev: Anvil, Docker Compose