Hi everyone, Lamaz here, an independent builder working on covenant applications on Kaspa.
The problem
AI agents increasingly pay for APIs on their own (x402). Today their spending limits live in software: an app setting, a policy server, an API key. If the agent is prompt-injected or its key leaks, that limit can be bypassed. Plafond moves the limit into a SilverScript covenant, so the network itself rejects an overspend.
The philosophy: bound the worst case, keep the contract small
- We don’t try to make the agent safe, we make its worst case known. Prompt injection, bugs and leaked keys will happen. The useful question is how much they can cost. Plafond answers it with a number fixed when the vault is created, and the network enforces it.
- The covenant only guarantees the bound. It doesn’t try to decide who the agent pays: allowlists, intent checks and vendor rules live in the tooling, where they are easy to change. The contract stays tiny, readable in a few minutes, with a half-page proof.
- No trusted third party. No server, no guardian, no watchtower to run. If the owner’s key is stolen, the funds can still only go back to the return address.
- Self-custody. Keys stay on the owner’s machine; nothing is held by us.
How it works (core v0.7, 289 bytes, stateless)
- Rate limit from the relative lock. To spend
s, the vault coin must be at leastceil(s × R / C)DAA units old. No counter, no agent-supplied time, no lineage: the address is the vault.Cis the cap per purchase,Rthe period. - A worst case you can compute. Total loss over time
tis bounded byC × t / R, capped at the capital, whatever the agent does. Proven on paper and checked againstkaspa-txscriptwith property-based tests and a weekly fuzzing run. - Return address. The owner can freeze, withdraw or refill, but only to the vault itself or to a return address fixed at creation (treasury, Ledger, multisig).
- Single input, one payee per spend. The smallest payment is about 0.02 KAS because of KIP-9 storage mass, which the tool computes before signing.
What runs on testnet-10
- Deploy, pay, freeze, refill, recover, with every run logged by CI
- Race tests: two conflicting spends submitted at the same time over two RPC connections
- A real x402 payment: a vault funds an agent wallet that pays the public kaspa-x402
exactdemo, which settled on chain - A pay-on-delivery escrow (vendor claims with a verifier’s signature, otherwise refund after a relative timeout)
- A local console with a trial mode: vault and return addresses in one click, no password
Open questions, feedback very welcome
- Are there DAA score edge cases where the relative lock is looser than
ceil(s × R / C)suggests? - The return-only rule matches output
ito inputi. Any pitfalls with KIP-9 mass when freezing many coins in one transaction? - Would it be useful to bind the mandate (
C,R, return address) to the covenant with KCC-23 metadata, so wallets and explorers can show an agent’s worst case? - Partial releases: the agent spends small amounts while the rest stays locked. Is anyone else working on this pattern for agent treasuries?
Repo (ISC): GitHub - lamaz-dev/plafond: Give your AI agents a budget, not your whole treasury. Covenant-enforced spending limits on Kaspa. · GitHub
Not audited, testnet-10 only. Attacks on testnet are welcome; please report vulnerabilities privately through the repo’s Security tab.