feat: @x402/mnemopay — economic memory for AI agent payments#1904
feat: @x402/mnemopay — economic memory for AI agent payments#1904t49qnsx7qt-kpanks wants to merge 1 commit intox402-foundation:mainfrom
Conversation
AI agents using x402 today are stateless — they pay and forget. This package layers MnemoPay's economic memory on top of x402 payment flows so agents remember costs, track endpoint reliability, and build reputation from real payment outcomes. - withMnemoPay() wraps any x402-enabled fetch with memory operations - Before each request: recall() checks past payment experiences - On success: settle() reinforces the positive memory (+reputation) - On failure: refund() docks the memory (-reputation) - recallEndpointInsight() surfaces cost history and success rates - Full test suite with 14 tests covering all payment flow paths - Follows existing x402 package structure (tsup, vitest, eslint) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
🟡 Heimdall Review Status
|
|
@t49qnsx7qt-kpanks is attempting to deploy a commit to the Coinbase Team on Vercel. A member of the Team first needs to authorize it. |
|
Hey team! Added a live interactive demo to the PR description: try it here. It shows the feedback loop in action — an agent hiring freelancers, learning from settlements and refunds, and consistently picking the best value by round 7-8. The core idea: |
|
One pattern we're exploring for agent-to-agent payment contexts: if the payer agent is operating through a managed custody layer (rather than controlling its own signing key), the PAYMENT-SIGNATURE header is technically signed by the custodian infrastructure, not the agent's x402 identity. This creates an attribution gap where the payment is valid on-chain but the agent's reputation history in ERC-8004 doesn't accrue correctly. |
|
@postmode Great question — this is exactly the kind of edge case that matters for production agent deployments. Short answer: MnemoPay sidesteps this problem by design. The wallet is agent-local, not custodial — the agent holds its own signing key and produces the Here is how the pieces fit together:
For the managed-custody pattern you describe, the attribution gap is real and I think it is fundamentally a facilitator-spec concern — the spec would need a way to bind a delegated signer to the logical agent identity (something like an Happy to dig deeper on any of this. |
Hey — thanks for the context on the issue thread. Building the financial infrastructure layer for agent deployers — custody, yield routing, and ERC-8004 reputation signals as a managed service. The x402 + ERC-8004 combination is exactly the rail we're building on. Would love 20 minutes at some point — specifically interested in who in the Coinbase ecosystem you think is doing the most serious infrastructure work on x402 right now. Happy to share what we're building in exchange. |
|
@postmode — custody + yield routing + ERC-8004 reputation as a managed service is a compelling stack. That's essentially the infrastructure layer that makes agent-local signing practical at scale, which is the exact gap between "works in a demo" and "works in production." Would love to do the 20 minutes. I'm flexible on timing — drop a Calendly link or propose a couple of slots and I'll lock one in. On the Coinbase ecosystem question — happy to share what I've seen from working through this PR and the x402 spec. There are a few teams doing interesting things on the facilitator side that would be worth discussing live rather than in a comment thread. Likewise keen to hear how you're thinking about the custody-to-reputation mapping. Your original question about the attribution gap when a custodian signs on behalf of an agent is the right problem — if you're building the managed custody layer, you're in the best position to define how that delegation gets expressed in the payment header. That could be a useful input to the x402 spec itself. Looking forward to it. |
|
Appreciate looking at it! In the meantime, here is the thesis that
addresses the issue. I am inviting you to take a look at it—link: (
https://cutt.ly/ytScNJba)
…On Sat, Apr 4, 2026 at 12:48 AM t49qnsx7qt-kpanks ***@***.***> wrote:
*t49qnsx7qt-kpanks* left a comment (x402-foundation/x402#1904)
<#1904?email_source=notifications&email_token=BACX6JMVFGHR6UTXARWTOND4UABQHA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJYGQ3TGMBQHA32M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJNLQOJPWG33NNVSW45C7N5YGK3S7MNWGSY3L#issuecomment-4184730087>
@postmode <https://github.com/postmode> — custody + yield routing +
ERC-8004 reputation as a managed service is a compelling stack. That's
essentially the infrastructure layer that makes agent-local signing
practical at scale, which is the exact gap between "works in a demo" and
"works in production."
Would love to do the 20 minutes. I'm in Lagos (WAT / UTC+1) but flexible
on timing — early mornings or evenings work well for US timezones. Drop a
Calendly link or propose a couple of slots and I'll lock one in.
On the Coinbase ecosystem question — happy to share what I've seen from
working through this PR and the x402 spec. There are a few teams doing
interesting things on the facilitator side that would be worth discussing
live rather than in a comment thread.
Likewise keen to hear how you're thinking about the custody-to-reputation
mapping. Your original question about the attribution gap when a custodian
signs on behalf of an agent is the right problem — if you're building the
managed custody layer, you're in the best position to define how that
delegation gets expressed in the payment header. That could be a useful
input to the x402 spec itself.
Looking forward to it.
—
Reply to this email directly, view it on GitHub
<#1904?email_source=notifications&email_token=BACX6JMVFGHR6UTXARWTOND4UABQHA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJYGQ3TGMBQHA32M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJNLQOJPWG33NNVSW45C7N5YGK3S7MNWGSY3L#issuecomment-4184730087>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BACX6JMNK2KTRSAZLPAVCML4UABQHAVCNFSM6AAAAACXKEOZ6SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DCOBUG4ZTAMBYG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Hey @postmode -- following up on your note about custodial signing, ERC-8004 reputation signals, and MnemoPay integration. Really interested in exploring how ERC-8004's reputation framework could complement MnemoPay's trust scoring on the payment side. Happy to do that 20-minute call today (April 4) if your schedule allows. Feel free to DM me on X (@jerryomiagbo) or shoot me an email at jerry@mnemopay.com and we can lock in a time that works for you. Looking forward to it! -- Jerry Omiagbo, MnemoPay |
|
Quick correction on my contact info above — best way to reach me is jeremiah@getbizsuite.com. Looking forward to connecting today, @postmode. |
Summary
AI agents using x402 today are stateless — they pay the 402, get the resource, and immediately forget. They never learn which endpoints are cheap, which are reliable, or which alternatives exist. This PR adds @x402/mnemopay, a middleware package that gives x402 agents economic memory via MnemoPay.
What it does
withMnemoPay()wraps any x402-enabled fetch function and adds four memory operations around each payment:recall()charge()settle()→ +reputationrefund()→ -reputationOver time, agents build a knowledge base of endpoint costs, reliability rates, and alternatives — turning every payment into a learning event.
Why this matters
The x402 protocol is uniquely positioned for AI-native commerce. But stateless payments leave value on the table. An agent that remembers its payment history can:
Usage
Package details
typescript/packages/http/mnemopay/@mnemopay/sdkis a peer dependency — no new runtime deps in x402 coreMnemoPayAgentinterface so users can bring their own implementationTest plan
withMnemoPay()passes through non-402 responses unchangedrecall()is called before each request with the endpoint URLsettle()is called on successful paymentsrefund()is called on failed paymentstsupand follows the existing dual CJS/ESM export pattern@x402/fetchand@x402/axioswrapped functions🤖 Generated with Claude Code
Live Demo
Try it now: https://t49qnsx7qt-kpanks.github.io/mnemopay-demo/
The Feedback Loop in 30 Seconds
How it works
5-line integration