Add plugin

From worldliberty/agentpay-sdk · View interactive version

Add plugin is an AI agent skill from the GitHub repository worldliberty/agentpay-sdk. Use this skill when the user wants to add a new payment feature family to AgentPay (a new merchant protocol, chain flow, or paid-API integration) or generalize an existing one. Features live in the unprivileged payments service (`crates/agentpay-paymentd/src/features/<family>`), are exposed through

How to use this skill

Skill file

Add A Payments Feature Family

Use this skill for tasks like "add support for merchant protocol X" or "add a new chain flow".

Ground Truth

holds no keys, and does all network I/O. The client (client/) only parses flags, calls the

service through the generated types, and renders output.

docs/daemon-api.md. It is a public, versioned contract (API 1.x): new methods, optional fields,

and new error kinds are minor additions; anything else is a major change.

spending limits, and manual approvals apply. Never sign in paymentd, never add a key, and never

call signer admin methods from paymentd.

Layout

| Piece | Location |

|---|---|

| Wire types and docs | crates/agentpay-api/src/payments/<family>.rs, variants in payments/mod.rs |

| Fixtures | crates/agentpay-api/fixtures/payments/<family>/<Method>.{request,response}.json |

| Spec | a #### <Method> entry under "Payments methods" in docs/daemon-api.md |

| Handler | crates/agentpay-paymentd/src/features/<family>.rs or features/<family>/ |

| Route | one arm in crates/agentpay-paymentd/src/dispatch.rs |

| Chain access | a ChainProvider under crates/agentpay-paymentd/src/chains/ |

| Paid HTTP helpers | features/http.rs (merchant client), features/payer.rs (Payer) |

| Client command | client/src/commands/<group>.ts, wording in client/src/copy/ |

Reference implementations: features/x402/ (paid HTTP with a structured EIP-3009 signature),

features/mpp/ (charges, sessions, persisted state), features/evm/ (transactions, nonces,

manual-approval resume), features/solana/.

Deterministic Workflow

  1. Read "Adding a paymentd method" and "Manual approval in payment flows" in docs/daemon-api.md,

then the closest reference family above.

  1. Define the wire types, request and response variants, and error kinds in agentpay-api, with

rustdoc covering access, auth, units, side effects, idempotency, and errors.

  1. Add request and response fixtures, register them in src/tests/payments.rs, and add the spec

entry with the fixtures verbatim.

  1. Run cargo xtask gen-api to regenerate docs/api/schema.json and client/src/generated/.
  2. Implement the handler under features/<family>; route it with one arm in dispatch.rs.
  3. If the feature needs a new signed action, add it to agentpay-domain and agentpay-policy

first, so the signer daemon can reconstruct and policy-check it from structured fields. Never ask

the signer daemon to sign an opaque hash.

  1. Add the client command (--json output, exit codes 0/1/2/3/4, all text in copy/).
  2. Update skills/agentpay-sdk (SKILL.md and references) with the new command.
  3. Verify (below).

Implementation Rules

leaves the process.

flow cannot be resumed, as for x402 and MPP.

or environment variables; wipe them after use with zeroize.

x402-types and mpp do) rather than reimplementing the protocol.

Testing Rule

policies) and ScriptedSigner; use mock RPC servers and the scripted merchant in

features/http/merchant.rs. Never hit live third-party services in tests.

guarantee for rejected inputs.

fixtures.

Verify

just lint     # fmt, clippy -D warnings, file length, no JavaScript, gen-api --check, API docs
just test
just client-test && just client-lint
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.