Cortex

Local Development

Run the entire Cortex agentic commerce protocol stack locally in under 5 minutes.

Prerequisites

  • Docker — for Anvil + Postgres containers
  • Foundryforge, cast, anvil
  • Node.js >= 18
  • PostgreSQL client toolspsql, pg_isready

Quick Start

make install   # first time only — installs all deps
make e2e       # starts infra, deploys, launches services, runs demo

Step-by-Step

1. Install Dependencies

make install

2. Start Infrastructure

Starts Anvil (local EVM on port 8545) and Postgres (port 5433) via Docker Compose.

make up

3. Deploy Contracts

Deploys AgentRegistry, IntentBook, and PolicyModule to Anvil. Writes addresses and keys to ops/.env.deployed.

make deploy

4. Start Services

Starts the indexer, solver, and API as background processes.

make services
  • Indexer — polls Anvil for contract events, writes to Postgres
  • Solver — watches for open intents, simulates and fills them
  • API — REST server on http://localhost:3000

Logs: ops/indexer.log, ops/solver.log, ops/api.log

5. Run the Demo

make demo

The demo:

  1. Registers an agent identity
  2. Sets spend limit and target allowlist policies
  3. Submits an EIP-712 signed swap intent
  4. Waits for the solver to fill the intent
  5. Queries all API endpoints and prints results

6. Tear Down

make down    # stop services + infra
make clean   # also remove volumes and generated files

Useful Commands

CommandDescription
make upStart Anvil + Postgres
make deployDeploy contracts
make servicesStart indexer/solver/API
make demoRun end-to-end demo
make downStop everything
make cleanFull cleanup
make logsTail all service logs
make e2eFull end-to-end in one shot

Ports

ServicePort
Anvil (RPC)8545
Postgres5433
REST API3000

Troubleshooting

  • Anvil not starting: Check if port 8545 is in use (lsof -i :8545).
  • Postgres connection refused: Ensure Docker is running and port 5433 is free.
  • Solver not filling intents: Check ops/solver.log. Needs valid INTENT_BOOK_ADDRESS.
  • API returns empty results: Indexer may need a few seconds to catch up. Check ops/indexer.log.