Inspiration

Shopping agents start every session with no memory. A shopper sends back three size M shirts because they run tight in the shoulders, and the next session recommends M again. PayPal knows the money came back. Nobody keeps why.

A refund says what happened to the money, not why it happened. We wanted the missing half: a memory that learns the reason behind each payment outcome, keeps it tied to the transaction, and hands it to whatever agent asks next.

What it does

Memento Emptor is middleware a merchant runs beside its PayPal app.

  • Evidence comes in on its own. PayPal's capture, refund and dispute webhooks reach the layer with no agent involved. Each delivery is verified with PayPal before anything is stored.
  • A payment outcome is not a cause. The layer keeps the outcome, the item and the reason apart. Dispute reason codes come from PayPal. A refund's reason comes from the shopper, classified by Jev. Only a matching reason moves a belief, so a parcel that never arrived never changes a size.
  • Agents recall before they recommend. Any agent calls the layer over MCP. Recall answers in a fixed order: the shopper's own correction, their own fit evidence, fit pooled across shoppers, then what they said in general. It never refuses, and every answer cites its evidence.
  • The shopper stays in charge. A correction wins at once, and the old belief stays on record. A second agent that never saw the conversation recalls first and honours it.
  • Right on day one. A shopper new to a brand gets the pool's answer: other buyers' classified returns already say the shirt runs small.
  • Two screens. Shoppers see and contest everything agents believe about them in an evidence ledger. The merchant sees why its products come back, by reason and size.

The layer never moves money. Orders, approval and double-buy protection stay in the agent, on the Agent Toolkit's orders tools.

How we built it

  • The layer is a Go service on Keel, exposing eleven MCP tools behind an authenticating edge. Agent keys are bound to the shoppers a seller serves, shopper link tokens reach only one shopper's ledger, and a merchant key reads only the pooled fit.
  • Per-shopper memory lives in Lambo, one graph session per shopper, keyed by a salted hash of the PayPal payer id. Sessions keep shoppers apart, so one shopper's beliefs never reach another's recall.
  • The pool lives in an Elastic fit index: one structured row per settled purchase, with a salted per-line shopper hash and no identity, free text or order detail. A product line reaches Earned when enough distinct shoppers agree in one direction.
  • The agents run on Astropods: a reference agent and a second agent with its own prompt. Their traces are the independent proof that each one recalled before recommending.
  • The screens are Svelte 5 apps on AG Grid: the evidence ledger and the merchant app.
  • Products come from Channel3, whose per-SKU fit labels tell the layer when a new shirt shares a cut with the ones the shopper returned.
  • Hosting is Render: one service for the edge, the layer, the ledger and the Lambo hub on a persistent disk, a second for the merchant app, and the public PayPal webhook endpoint.

What we learned

We ran a comparison before we finished, and it changed the product. Our first design gated beliefs: the layer refused to recommend until a belief was Earned. In round 1, the arm given our classified evidence without the gate scored 15 of 15, and the gated arm refused its way to 0 of 15. The evidence pipeline was right. The gate was wrong.

So we pivoted. Status became a label, never a gate. Recall stopped refusing. And we added the pool, so a shopper with no history still gets an answer.

Round 2 tested the pivot with four setups: no memory, PayPal history alone, Memento with the shopper's own memory only, and the full layer. On the new-to-brand case, only the full layer got the size right: 3 of 4 by the committed scores and 4 of 4 by hand. Every other setup got 0 of 4. Corrections carried to the next session and to another agent in both Memento setups. We wrote those cases and the pool is seeded, so this shows the mechanism, not real-world accuracy. We report counts, never percentages, and every run file is in the repository.

Challenges

  • Honest grading. Our extractor misread a few replies. We kept the committed scores as the measurement and published the hand reading beside them, never in place of them.
  • PayPal's sandbox. The webhook event simulator answered 404 on both sandbox hosts, so we drove real events. No API showed a sandbox merchant's home currency, and a currency refusal cost us a replacement account.
  • Many shoppers in one memory service. We proved one Lambo hub could host a session per shopper, and filed the gaps we found upstream.
  • Cold connections. The Elastic fit index answers in about 236 ms warm but took about 6.9 s cold, so recall keeps a warm connection and a generous timeout.
  • Keeping seeded data honest. Sandbox history has to be generated. Every seeded row carries a mark, and the ledger and merchant app show it.

Built With

Share this project:

Updates

Submission history