Behavior-first observability for agent commerce. AFI captures x402 header flows, Locus payments, and Base transactions, then emits a portable evidence packet instead of identity claims.
Synthesis requires documenting the human↔agent collaboration process. We do this in CHANGELOG.md.
Rules:
- Every conversation with an agent working in this repo must be logged the same day.
- Every code or product decision must be recorded as a short, hackathon-facing journal entry.
- Do not include secrets, API keys, private hashes, or internal transaction IDs.
- Keep entries factual, high-level, and safe to publish.
npm install
cp .env.example .env
npm run dev:server
npm run dev:uiAFI_LOCUS_API_KEY(required for Locus)AFI_ETHERSCAN_API_KEY(required for Base enrichment)AFI_BASE_RPC_URL(optional if you add RPC enrichment later)AFI_EAS_BASE_URL(optional, defaults to Base EASScan GraphQL)AFI_EAS_SEPOLIA_URL(optional, defaults to Base Sepolia EASScan GraphQL)
Base enrichment uses Etherscan v2 when a key is present and falls back to Blockscout if not.
POST /api/ingest/x402— ingest a paid call (headers + tx hash + optionalurl/servicehints)GET /api/interactions— list interactionsGET /api/interactions/:id— raw interaction detailGET /api/interactions/:id/packet— canonical AFI portable packet exportGET /api/locus/status— Locus wallet statusPOST /api/locus/register— Locus registrationGET /api/locus/balance— Locus balancePOST /api/locus/send— send paymentGET /api/locus/transactions— Locus transactionsPOST /api/locus/ingest/transactions— ingest Locus transactions into AFIGET /api/locus/wrapped/md— wrapped API catalogPOST /api/locus/wrapped/:provider/:endpoint— wrapped API callPOST /api/locus/x402/:slug— Locus x402 callGET /api/locus/checkout/preflight/:sessionId— Locus checkout preflightPOST /api/locus/checkout/pay/:sessionId— Locus checkout payGET /api/locus/checkout/payments/:txId— Locus checkout payment statusGET /api/base/tx/:hash— Base transaction lookupGET /api/base/txs/:address— Base tx historyGET /api/base/transfers/:address— Base ERC-20 transfersGET /api/eas/attestations?address=...— EAS attestation lookupPOST /api/peac/receipt— PEAC receipt ingestionGET /api/metrics/agent/:wallet— agent metricsGET /api/metrics/counterparty/:id— counterparty metricsGET /api/models/wallet/:wallet— deterministic wallet behavior model (anomaly score, cluster, flags)
- Make a paid call with x402 headers captured (use
server/x402-client.ts). - POST the headers + tx hash (and optional PEAC receipt) to
/api/ingest/x402. - Ingest Locus transactions via
/api/locus/ingest/transactions. - Open the UI at
http://localhost:5173. - Inspect Agent Profile, Counterparty Profile, and Flow Explorer.
- Open an interaction and download the canonical packet JSON from the packet panel.
import { fetchWithX402Capture } from "./server/x402-client";
const { response, capture } = await fetchWithX402Capture("https://example.com/paid");
await fetch("http://localhost:8787/api/ingest/x402", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ headers: capture.headers, url: capture.url, txHash: "0x..." }),
});