haia-trace assembles the receipts, and the agent reads its
own verdict and stops spending.
Run it
1. The agent pays
Two paid calls. The first settles. The second is signed, sent, and never comes back with a settlement — the agent is left holding a payment it cannot account for. It records as it goes, to a run file it owns.
2. haia-trace build assembles the receipts
The agent has already exited. This step reads the evidence it left behind — one
Receipt per operation — and could just as well run on another machine.

op-2 is the point. A signed authorization left the agent and nothing came back
to say what became of it. The agent cannot tell a payment that never settled from
one that settled silently — so instead of guessing either way, the receipt names
the milestone that stayed open and records the fault it saw.
3. The agent acts on the verdict
completeness and missing are read by a machine, with no human in the loop.
The process exits non-zero, so the same file works unchanged as a CI gate.

The money and the sellers are simulated — there is no chain, no facilitator and
no wallet. Everything between the hook firing and the verdict is the shipped
code path: the
@x402/core client, its hooks, the recorder, the events on
disk, and the assembler. This example fakes the payment, never the trace.The same recorder in a full application
arc-nanopayments is a complete app — gasless USDC nanopayments on Arc, with an autonomous buyer agent, a Next.js seller and a dashboard. It traces both sides of the payment, and attaches to Circle’s@circle-fin/x402-batching rather than @x402/core: the
same one-line attach against another SDK’s hooks.
The buyer
agent.mts — the agent attaches to its GatewayClient and records as
arc-nanopayments-buyer.The seller
lib/x402.ts — the paywalled routes attach to the gateway middleware and
record as arc-nanopayments-seller.Next steps
Connect x402
The one-line attach, what gets recorded, and what never does.
What a Receipt is
Stages, evidence, missing, exceptions — the model behind the verdict.
See all three roles
The buyer’s, the seller’s and the facilitator’s view of one payment.
CLI reference
Every command, flag, and the
.trace/ layout.