# swornly

> Deterministic, pay-per-call tools that AI agents pay for one call at a time over x402 (USDC on Base) or L402 (Lightning). Every answer comes back *sworn* - an HMAC-signed receipt you (or an auditor) can re-verify later. No accounts, no API keys: the agent just pays the 402 challenge.

swornly is a toll-booth of small, deterministic endpoints. A chat tool *narrates* a result; swornly *signs* it. Same input always yields the same output, byte-for-byte, and the receipt proves which input produced which verdict. Every paid path has an `/l402` sibling for the Lightning rail (e.g. `/dry-run/command/l402`).

## How to pay (x402)

The first call returns HTTP `402` with machine-readable payment requirements: a base64 `PAYMENT-REQUIRED` header (and JSON body) `{ x402Version: 2, resource: {url, description, mimeType}, accepts: [{ scheme, network (CAIP-2), amount (atomic), asset, payTo, maxTimeoutSeconds, extra }] }`. Sign an EIP-3009 `transferWithAuthorization` for the quoted amount and resubmit with the `PAYMENT-SIGNATURE` header (legacy `X-PAYMENT` still accepted). On success you get the result plus a signed `receipt`.

## How to pay (L402)

Call the `/l402` sibling. The first call returns `402` with a BOLT-11 invoice and a macaroon in `WWW-Authenticate: L402 ...`. Pay the invoice, then resubmit with `Authorization: L402 <macaroon>:<preimage>`.

## Tools

- [Markdown to PDF](https://swornly.luci.ws/convert): POST {markdown} -> styled PDF. $0.01/call.
- [Dry-run command oracle](https://swornly.luci.ws/dry-run/command): POST {command} -> is this shell/git command destructive + its blast radius, BEFORE you run it. $0.02/call.
- [MCP schema diff](https://swornly.luci.ws/diff/mcp-schema): POST {before, after} -> breaking vs non-breaking changes between two MCP tools/list. $0.01/call.
- [Tool-contract snapshot](https://swornly.luci.ws/snapshot/tool-contract): POST {tools_list} -> stable fingerprint of a tools/list for contract pinning + drift detection. $0.005/call.
- [Receipt verify](https://swornly.luci.ws/receipts/verify): POST {result, receipt} -> re-verify its HMAC signature. Free.

## Discovery

- [OpenAPI (JSON)](https://swornly.luci.ws/openapi.json): authoritative machine-readable contract.
- [x402 manifest](https://swornly.luci.ws/.well-known/x402): per-tool x402 payment descriptors.
- [Health](https://swornly.luci.ws/health) | [Stats](https://swornly.luci.ws/stats): liveness + public usage counters.

## Notes

Currently on Base Sepolia testnet (mainnet pending). The L402 rail uses a mock backend in this deployment - not for production.
