Give your agent an allowance. Get a receipt.
Your agent can book a flight, move money, or hit prod — in the demo. Then it goes nowhere near production, because the only thing standing between it and a mistake is a sentence in the prompt: "don't spend more than $5."
Your agent can book a flight, move money, or hit prod — in the demo. Then it goes nowhere near production, because the only thing standing between it and a mistake is a sentence in the prompt: "don't spend more than $5." That isn't a limit. It's a wish. The model can ignore it, a prompt injection can rewrite it, and when it goes wrong there's no record of what was actually allowed.
So agents stall at exactly the point where they'd be useful: the first time they touch something real.
I built the smallest thing that fixes the money part of this. You sign an allowance once, and any tool the agent calls is held to it — outside the agent, where the model can't argue with it.
One command
You grant an allowance: one tool, one recipient, a cap, a number of calls.
cleimesh allowance grant --max '$5.00' --tool pay --to demo --calls 5 \
--owner owner.key --agent agent.key.pub.json --out allowance.json
Then you wrap any MCP server with it — no changes to the agent:
claude mcp add payer -- cleimesh mcp wrap --allowance allowance.json \
--owner owner.key.pub.json --agent agent.key -- your-mcp-tool-server
The agent calls pay as it always would. What it gets back:
agent> pay demo $2.00 -> ok. spent $2.00 of $5.00.
agent> pay demo $2.00 -> ok. spent $4.00 of $5.00.
agent> pay demo $2.00 -> refused: over the $5.00 allowance.
agent> pay attacker $1.00 -> refused: payee not in the allowance.
Over the cap: refused. Wrong recipient: refused. And every call — allowed or refused — is written to an append-only receipt log: the tool, the arguments (hashed), and the signed allowance it was checked against. That's what you hand to whoever asks "what did it do?"
No setup, just to see it run:
cargo run -p cleimesh-allowance --example wow
Why "outside the agent" is the whole point
The allowance isn't a number the agent promises to respect. It's a signed token the agent can't forge or widen. The gate verifies the signature and the running total before the tool executes. A prompt injection that convinces the model to pay $500 to a new address changes nothing: the token still says $5 to demo, so the call is refused. You're not trusting the model to behave. You're bounding what its behavior can reach.
That distinction isn't academic. It's the difference between a control and a suggestion — and right now a lot of agent-payment code is on the suggestion side without meaning to be.
The part that made me build this
While wiring up agent payments, I checked a simple thing: when an agent approves a price in one step and signs the payment in another, does it actually sign what it approved?
I built a conformance harness — a seller that quotes one thing and asks the client to sign another — and decoded what each SDK actually puts its signature on. On the x402 payment protocol:
- vAPI Network (core 0.12.0) — 0/14. Binds its spend policy to the requirement it signs.
-
BlockRun ClawRouter (0.12.312) — 0/14. Enforces at
onBeforePaymentCreation. -
Coinbase AgentKit (
main, unreleased) — 6/14. It checks the earlier quote and then pays a fresh payment request. A 0.10 USDC quote on testnet can be signed as 0.90 USDC to a different address on mainnet — amount, payee, even the chain can differ from what was approved.
Nothing in the spec says that's wrong, which is the problem. "Show X, settle Y" passes review because each step looks fine on its own. The harness is public; add your SDK in one file and run it yourself:
github.com/cleitonaugusto/x402-conformance
The lesson I took from it: a spend limit has to be bound to the exact thing that gets signed, and enforced somewhere the agent can't reach. That's what the allowance does.
The receipt
Every decision the gateway makes is written to an append-only log: the tool, the arguments (hashed), the allowance it was checked against, and whether it was allowed or refused. The allowance itself is a signed token, and the running total is checked against it on every call, so the record is anchored to something the agent couldn't forge. When compliance or a teammate asks what the agent was permitted to do, you don't reconstruct it from memory or model logs. You replay the log against the token.
A bounded budget plus a verifiable record is the minimum an agent needs before you let it act on its own. It's also, oddly, most of what "autonomy" is missing.
Try it
The allowance engine is a small public Rust crate, cleimesh-allowance, built on signed attenuating tokens. The CLI wraps it; the example runs with no keys.
- Repo: github.com/cleitonaugusto/cleimesh
- Harness: github.com/cleitonaugusto/x402-conformance
Tell me which tool you'd put behind an allowance first — payments, a shell, a prod API. That's what decides what I build next.
Cleiton Augusto — GitHub · X · [email protected]
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.