Skip to content
lamaz-devPublic

About

Everyone sells limits. Plafond proves them. Spending limits for AI agents, enforced by Kaspa covenants (testnet, open source).

Topics

Resources

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

343 Commits

Folders and files

Repository files navigation

Plafond

Everyone sells limits. Nobody proves them. Plafond does.

Plafond caps what your AI agents can spend, with a limit enforced by the Kaspa network (testnet today), within the vault's rules, even if an agent's key leaks. Your company will be able to produce an attestation of its maximum exposure, and its insurer or auditor can then check the cap by itself, without going through us.
Testnet only, not audited yet: do not use with real funds.

Tests Release License: ISC Network: testnet-10

Website · Download · Gateway · Run the demo · Roadmap · Security

Plafond

Spending limits for AI agents, enforced by Kaspa covenants. Plafond is French for "ceiling". The project was previously called kaspa-agent-vault.

Agents will only be trusted with money at scale if their financial exposure is measurable, verifiable and enforced by the network. Plafond answers one question at all times, in four figures:

Maximum loss now what could leave if every agent turned hostile this second
Maximum loss over 24 h the same, over the next 24 hours
Enforced by the network what the network itself enforces
Outside the limit what the network does not reach, said plainly

The budgets, vaults and payment modes underneath are the means; the maximum loss, enforced by the network, is the product (risk engine spec).

Our recommended path: agents pay vendors directly in KAS from their vault (in progress). In KAS, the cap is held by the network all the way to the vendor's payment; with a card, it stops at the top-up.

English · Français

Try it in 3 steps (testnet, no install)

  1. Download the file for your system from the latest release and unpack it.
  2. Run Plafond.bat (Windows) or ./plafond (Linux, macOS): the console opens in your browser, with a test account and two addresses.
  3. Get free test coins from the testnet-10 faucet on the treasury address, then Créer un budget (create a budget) and Tester l'agent (test the agent): an over-cap payment is sent to the network with the vault's real script and must be refused by the contract, then a small payment goes through (fixed in v0.9.6; earlier releases presented another script, see the correction).

Prefer the command line or want to build from source? See Build & Test and DEMO.md.

Status

  • ✅ testnet-10
  • ✅ stateless rule since core v0.7 (archived): 289 bytes, 5 parameters, one rule for the agent (wait in proportion to what you spend), enforced by the network's relative lock (contract)
  • ✅ lineage vault with a keyless refill airlock (what the tool creates now; tried on testnet-10, see the report): core v0.9.2 (550 bytes) and a 264-byte airlock address. The vault is a KIP-20 lineage of coins whose count is fixed at creation and can never grow, so the cap holds for the whole vault on any window, even under active attack; money sent to the airlock can only top up a coin of that lineage or go back to the return address, and a dust coin sent to the vault address can neither receive a deposit nor be spent by the agent. v0.9.2 adds a partial withdrawal: the owner takes part of a coin back to the return address without closing the vault, and the fees of that withdrawal are rate-limited like an agent payment, so a stolen owner key cannot burn the vault in fees; and whatever goes to the return address is a plain coin that carries no covenant id at all (core v0.9.2, airlock v0.2.1, proof, red-team notes: lineage, partial withdrawal, v0.9.2; core v0.9, v0.9.1 and airlock v0.2 archived unchanged; previous step without lineage: core v0.8, note)
  • ✅ return address: even with the owner's key, vault funds can only go back to the vault or to the return address chosen at creation (by default the owner's treasury; optionally a Ledger, multisig or custodian address), except at most C per coin, once, when a coin is frozen: the freeze fee margin can be sent to a third party instead of miners (F4)
  • ✅ loss bound: a vault created with k coins (1 to 4) loses at most k × (C + C·D/R) over any window of D DAA units (plus at most C per coin, once, if a coin is frozen), and about k × C·t/R since creation, capped at its capital, whatever the agent does; the per-coin step is also machine-checked by induction with an SMT solver (report); proven on paper and verified by tests against the real Kaspa script engine (proof v0.9, in French). Exact in KAS and in network blocks: in euros it moves with the KAS price, and the rate speeds up if the network produces more blocks per second (threat model R6)
  • ✅ one-page security summary for reviewers: spec/audit-summary.md
  • ✅ reproducible in one command: ./verify-proof.sh
  • ✅ automated CI on every push, long fuzzing campaign every week
  • ✅ enterprise gateway: one entry point for many agents, no owner key, API keys stored as fingerprints, persistent emergency stop, hash-chained audit log (GATEWAY.md)
  • ⚠️ automated adversarial reviews only; no independent human audit yet
  • ⚠️ no mainnet deployment; do not use with real funds

History: up to v0.5.1 the vault was a stateful token bucket with a KIP-20 lineage (v0.5.1 proof); the tool can still freeze such vaults. Security advisories: v0.4 rate-limit flaw, fixed in v0.5 · findings of the first adversarial review (automated), fixed in v0.5.1. Report vulnerabilities privately as described in SECURITY.md.

Overview

An agent pays for its services on its own (HTTP 402 / x402), but it cannot exceed the budget set by its owner: the limit is enforced by a covenant, so the network rejects an overspend even if the agent's keys and software are compromised.

How money moves (core v0.9.2 and deposit airlock v0.2.1):

flowchart LR
    T["Owner treasury"] -->|"create: k coins (1 to 4), one KIP-20 lineage"| V["Vault<br/>coeur.sil"]
    A["Agent key"] -.->|signs| V
    V -->|"pay: at most C per spend,<br/>wait ceil(s × R / C) blocks"| P["Vendor"]
    D["Anyone<br/>(card service, custodian, wallet)"] -->|deposit| S["Deposit airlock<br/>sas.sil"]
    S -->|"keyless pour, only into the vault's lineage"| V
    V -->|"owner: freeze or partial withdrawal"| R["Return address<br/>(chosen at creation)"]
    S -->|"owner: send a deposit back"| R
Loading

Worst case over any window of D blocks: k × (C + C·D/R), plus at most C per coin once if a coin is frozen, even if the agent key and the owner key are both stolen.

The repository contains the vault contract, payment modes and a demo tool:

  • contracts/coeur.sil (core v0.9.2, current, 550 bytes): to spend s, a vault coin must be at least ceil(s × R / C) DAA units old, which the network checks itself (relative lock). No counter, no agent-supplied time. The vault is a KIP-20 lineage of k coins (1 to 4) fixed at creation: the vault is identified by its address and its lineage, never by the address alone (other coins can sit at the same address and are not part of it). Parameters: owner, agent, capacity C (cap per purchase), period R, return address. Agent: one payee per spend, single input. Owner: refill, partial withdrawal (fees at the contract's rate) or freeze, only to the vault or to the return address (freeze: at most C per coin, once, may go elsewhere, F4). Loss bound: k × (C + C·D/R) over any window D (proof).
  • contracts/sas.sil (deposit airlock v0.2.1, 264 bytes): a keyless deposit address that can only pour into its own vault lineage or go back to the return address (verification).
  • contracts/README.md: which contract is which. contracts/archive/: previous versions, kept for reference.
  • contracts/agent_budget.sil (AgentBudget v0.5.1, previous core): kept so existing vaults can be frozen.
  • contracts/delivery_escrow.sil (DeliveryEscrow v0.3): pay on delivery. The vendor claims with a verifier's Schnorr signature over blake2b(requestHash ‖ resultHash ‖ escrow outpoint), so one proof pays one escrow; without it, anyone can refund the owner after a relative timeout.
  • cli/: deploy, pay, escrow and a demo x402 vendor on testnet-10.

The x402 payment profile used by the vendor is specified in spec/kaspa-covenant-budget-v0.md (draft).

Build & Test

The toolchain is pinned in cli/rust-toolchain.toml.

cd cli
cargo test --release --locked

This runs the tool tests, including stateful property-based tests (proptest) that execute every transaction with kaspa-txscript and compare the result with a reference model. For a longer run:

FUZZ_CASES=5000 cargo test --release --locked coeur::

Contract tests run against the pinned SilverScript compiler:

git clone https://github.com/kaspanet/silverscript /tmp/silverscript
git -C /tmp/silverscript checkout 7eb04634bfbae5350c1808efc7e34c4efa7f93af
cp tests/*.rs contracts/*.sil /tmp/silverscript/silverscript-lang/tests/
cd /tmp/silverscript
cargo test --release -p silverscript-lang --test coeur_tests --test agent_budget_tests --test delivery_escrow_tests --test ardoise_tests

Reproducible bytecode

cd cli
cargo build --release --locked
./target/release/vault-cli empreintes | diff - ../contracts/EMPREINTES.txt

CI runs this check on every push.

Testnet-10

Commands are run by GitHub Actions from testnet/commande.txt and logged in testnet/journal.md. The log includes, among others:

  • payments above the per-payment cap (L83) and above the remaining budget (L104) rejected by script verification;
  • a forged delivery proof rejected (L292), an early refund rejected by the sequence lock (L312) and accepted after the timeout;
  • a 0.01 TKAS payment rejected with a storage mass of 1,000,055 grams, Kaspa's mass unit (L337), the value computed by cli/src/masse.rs. The smallest payment from a vault is about 0.02 KAS.

The CLI prints its messages in French.

Documentation

Related work

Several Kaspa projects work on the same problem: letting software pay on its own without holding the keys to everything. Plafond started on 18 Nov 2026, after most of them; it builds on their ideas and does not claim to be first.

  • PolicyVault (kenshido): policy-controlled vault for agents, on mainnet since Aug 2026.
  • SompiVault (elldeeone): covenant vault; Plafond reuses its pattern of counting refill time from the DAA score at which the network recorded the vault (OpTxInputDaaScore, threat model R34).
  • Kaspa x402 (elldeeone): the x402 payment binding for Kaspa. Plafond's profile extends it and its test vectors are reused under MIT (see PROVENANCE.md).
  • k402 / kx402 (Kali123411): x402-style payments on Kaspa.
  • Warda: spending controls for agents.

Plafond's focus: a worst case fixed when the vault is created and enforced by the covenant itself (a compromised agent and a dishonest merchant together cannot exceed it), with a written proof (spec/borne-de-perte-v0.9.md), a machine-checked part (spec/preuve-machine-v0.9.2.md), tests against the real script engine, and every source, test and fingerprint public. Corrections are welcome in an issue.

License

ISC, see LICENSE.

About

Everyone sells limits. Plafond proves them. Spending limits for AI agents, enforced by Kaspa covenants (testnet, open source).

Topics

Resources

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages