Recourse

Provable fault for AI shopping agents: a fixed rule, a Kleros court, and a deposit that pays shops.

Recourse

Created At

ETHGlobal Mumbai

Project Description

Recourse: provable fault for AI shopping agents.

THE PROBLEM AI agents can now pay shops by themselves, over protocols like x402. But when an agent buys the wrong thing (the wrong size, colour or quantity), nobody can prove who got it wrong: the buyer, the agent or the shop. Today the shop usually takes the loss. That makes agent orders risky, so shops have little reason to accept orders from agents they have never met.

THE IDEA If every step of an order leaves a record nobody can change later, fault stops being a matter of opinion. Recourse makes the agent write down what it was told and what it did before any money moves. A fixed, published rule is applied to those records, and the side at fault pays from a deposit. A court is only the backstop. No AI model decides who pays: money moves only by the contracts' rules.

HOW IT WORKS

  1. Records before money. Before paying, the agent writes three records to a public Hedera Consensus Service topic: what the buyer asked for, what the agent showed the buyer, and what the buyer approved. After the payment settles, it records what it actually ordered, with the payment's transaction id. The shop records what it packed, and the buyer signs a record of what arrived. Each record puts a document's fingerprint (SHA-256 and IPFS CID) on the public topic, so anyone can check a document against it.
  2. Payment. The agent finds the shop in the ERC-8004 identity registry and pays over x402 on Hedera. Below its spending limit it pays by itself; above the limit, the order waits for the buyer's approval.
  3. Claim. If the wrong goods arrive, the shop files a claim on Hedera and escrows a small court fee.
  4. Pre-check. A rule-based pre-check compares the records attribute by attribute (brand, size, colour, quantity, price, merchant). It names the gap and the side at fault: the agent company, the shop, or neither (for example, when the buyer approved the change). The finding is signed, and the shop sees the records side by side in the web app.
  5. Contest window. The side that loses under the finding can contest (within 10 minutes in the demo). If nobody contests, the claim closes by itself. When the agent company is at fault, its deposit pays the shop for the goods plus handling, and the court fee is refunded. No court needed.
  6. Court as backstop. If the losing side contests, the claim travels over Chainlink CCIP from Hedera to Arbitrum Sepolia, where a Kleros court with human jurors rules on the records. The ruling travels back over CCIP andloser pays the court fee.7. Public docket. Every ruled case is written as a de-identified entry to a public docket on Arkiv. After 20 ruled cases, a pats 95% range. Nothing is ranked. WHY AGENT COMPANIES POST A DEPOSIShops check an agent company's deposit before they take its orders: no deposit, no orders. Inthe web app, new shops and agent r own wallets. An agent companysees what deposit it needs and gets a bonded mark once the deposit is posted. WHAT HAPPENED ON TESTNET - Six claims ran to the end.- Three found the agent company at fault and paid the shop from that company's deposit. Two othem closed by themselves within court.- Two went to Kleros. In dispute 212 the pre-check found nobody at fault, because the buyer'sstanding mandate had approved thested, and the jurors agreed withthe pre-check. In dispute 213 the agent company was found at fault and contested. The jurors ruled against it, the ruling cameosit paid the shop.
  • Both ruled cases are on Arkiv, and the docket page reads them in the browser.

DESIGNED, NOT BUILT YET Random sampling: at scale, only alaims (for example 25%, drawn with Hedera's PRNG) would go to court, and the docket would weight each sampled ruling by its draw chance, so sampling cannot make a Billing: the agent company would then be billed for the undrawn claims at its sampled fault rate. Today every contested claim goes to court, and nothing is bil

HONEST LIMITS Testnets only. Payouts use a mock USDC because Circle's testnet faucet did not deliver. For the demo, the agent was set to order he contracts' configuration is notlocked yet, so the deployer could still change settings that decide claims; the README lists these owner powers. All shop and ional.

How it's Made

Payments and records (Hedera testnet): the agent pays the shop over x402 (the exact scheme on hedera:testnet, in HBAR for the demo). Each order writes six records to one Hedera Consensus Service topic. Each message holds a document's IPFS CID and SHA-256, and a record counts only if the expected writer paid for the message.

Contracts (Solidity, Foundry): Re on Hedera hold claims, the court-fee escrow, agent-company deposits and payouts. RecourseCase on Arbitrum Sepolia opens Kleros v2 dispute in court 8 witht company at fault, shop at fault, neither). The contracts are verified on Sourcify.
Chainlink CCIP, both ways: a contested claim crosses from Hedera to Arbitrum, and the ruling crosses back. Every receive path reverts, so one bad message cannot block the lane. Anyone can resend a message, but resends are capped in number and spacing. The fault rule is a pure, determin ordered list of checks over six attributes (brand, size, colour, quantity, price, merchant), with no clock, randomness or network. A pre-check service runsd the web app can re-run it in the browser on the same records.
ERC-8004: shops and agent companies register in the identity registry, and the agent finds a shop's x402 endpoint from its regnew shop registers, and an agent company registers and posts its deposit, each from its own wallet.
Arkiv: the docket service writes each ruled case as a de-identified entity on Arkiv testnet, plus monthly counts per party. Thhe browser and computes faultrates with Wilson 95% intervals. The rate maths already accepts sampling weights, ready for random sampling. Services are TypeScript on Node (he x402 packages): shop, agent,pre-check, keeper (opens court cases, posts evidence, settles claims), status API and docket.The web app is React with Vite. Workarounds: Circle's testnet USDdeposits and payouts use a mock6-decimal USDC (mUSDC). Hedera's JSON-RPC relay was flaky, so operations fall back to direct Foundry cast calls with retries. filed once.

Most of the code was written by Cteam; docs/ai-use.md in the reposays what was generated and what people decided and reviewed.

background image mobile

Join the mailing list

Get the latest news and updates