# Pattern: citation join (authorize ≠ settle) **Audience:** agent frameworks, governance specs, x402 merchants. **Status:** live on Vibes-Coded (2026-07). Neutral description — reuse freely (CC-BY-4.0 intent). ## Problem A signature over *agent identity* proves **who** signed, not **what** was authorized. Replay and “valid key, wrong action” bugs follow. Separately, a payment settle proves **money moved**, not that an upstream policy review approved the same artifact. Agents need both — and must be able to **join** them without trusting either party’s private session log. ## Pattern (two objects) | Object | Answers | Shape | |--------|---------|--------| | **Authorization citation** | What was approved? | Content-addressed `decision_ref` (hash over artifact + policy_version + verdict + source_class, or equivalent). | | **Settlement / action receipt** | What was paid or executed? | Signed receipt for the hop (agent_id, action, payload_digest, nonce, …). Optionally embeds/cites `decision_ref`. | **Do not merge** authorization fields into the settle blob. Keep them joinable by hash. ## Verifier rules 1. Recompute `decision_ref` from the claimed inputs → must match citation. 2. Verify settle receipt signature offline (published pubkey). 3. If receipt carries `decision_ref`, it **must be inside the signed preimage**. A signature that verifies only on the unbound tuple while JSON cites a `decision_ref` is a **citation-substitution reject**. 4. Reject identity-only signatures as sufficient for irreversible actions. 5. For **policy-gate** claims (`destructive-action-guard.*`, etc.), require `receipt_type=decision` bound in the preimage (`rt:decision`). Raw `action-receipt` mints are `rt:raw` and **cannot** use reserved `*-guard.` action names. That namespace lock is enforced **pre-auth** (HTTP 400 before any 402 challenge) so harnesses can probe it without spending USDC — including incomplete JSON bodies that only set `action`. **Enforcement note:** `valid === true` is necessary but not sufficient for decision-gated paths — assert `valid === true AND receipt_type === 'decision'` (from the verified preimage). `valid` does not substitute for the type check. 6. **`origin_mismatch` is three-state and only set when a signature matched a preimage.** Values: `true` (matched, wrong origin), `false` (matched, origin ok), `null` (no verified preimage). **Upgrade note:** use `origin_mismatch !== true` (not `=== false`) — `null` is falsy in JS but must not pass as “ok.” Check order: (1) `signature_valid` (crypto match over some candidate), (2) for policy-gate claims `receipt_type === 'decision'` from the verified preimage, (3) `origin_mismatch !== true`. Prefer the top-level `valid` flag for join decisions. **`valid` (compound gate — prefer this in conformance):** ```text valid = signature_valid AND NOT origin_mismatch AND NOT citation_substitution_rejected AND NOT replay ``` Present on **every** verify response (including legacy 6-field). Does not include payment, quota, or mint schema checks — offline crypto + join policy only. `receipt_type: null` alone does not fail `valid` when no decision origin was claimed. **Replay (verify-side):** in-memory per process, **1 hour** TTL on `(agent_id, nonce)`. Best-effort on a single node — **not** a shared cross-replica store. Conformance should use fresh nonces; “send twice → `replay: true`” only works with sticky routing / single instance. For strong uniqueness, callers keep their own store keyed by receipt id / nonce. **Numbering:** Rules 1–4 are citation/settle join. Rule 5 = namespace / `rt:decision` origin lock (mint + verify). Rule 6 = `origin_mismatch` three-state + check order. Earlier thread notes that said “rule 5” for the check-order assertion now map to **rule 6** (rule 5 was inserted for the namespace lock). **Verify is free:** `POST …/action-receipt/verify` and `GET …/public-key` are unpaid. A harness needs one funded mint (or any valid receipt bytes); substitution negatives then run against verify without further payment. Reserved-namespace rejects on raw mint are also free (400, no payment). **Namespace-lock probe (free):** `POST …/action-receipt` with body `{"action":"destructive-action-guard.allow"}` → HTTP 400 `error: reserved_decision_action` (works with incomplete bodies; full schema body yields the same error). Unpaid non-reserved incomplete bodies still get discovery **402**. **Legacy 6-field + wrapper `receipt_type=decision`:** A signature that verifies only on the unbound 6-field preimage while JSON claims `receipt_type=decision` → `signature_valid: true`, `receipt_type: null`, `receipt_type_claimed: "decision"`, `origin_mismatch: true`, `valid: false`. Claim without preimage binding is a mismatch, not a pass. ### Mint profile (external versioning) | Profile | Signed shape | How to recognize | |---------|--------------|------------------| | **`action-receipt-v1-rt`** (current production mint) | 7 fields: `…\|ts\|rt:raw` or `…\|ts\|rt:decision`; 8 with `\|decision_ref`; optional trailing `\|ref:` | Field 7 matches `rt:raw` or `rt:decision`; trailing field starts with `ref:` when set | | **Legacy citation-bound** (verify only) | 7 fields: `…\|ts\|decision_ref` (no `rt:`) | Field 7 is a citation hash, not `rt:*` | | **Legacy unbound** (verify only) | 6 fields | No 7th field | Current **mints** always use `action-receipt-v1-rt`. **Verify** still accepts legacy candidates so old receipts remain checkable. **Free production sample (no paid mint):** `GET https://vibes-coded.com/api/v1/outcomes/action-receipt/sample` `GET …/sample?with_citation=true` — same profile with a bound `decision_ref`. `GET …/sample?with_ref=true` — binds MarketNow mutual-demo `ref_f92d4211` (`ref_bound: true`). Then `POST …/verify` with the returned `receipt` object (+ `ref_code` when bound). ### Signature fields (`algorithm: HMAC-SHA256+Ed25519`) Every mint carries two independent signature fields over the **same** pipe-tuple preimage: | Field | Algorithm | Who can verify | Third-party role | |-------|-----------|----------------|------------------| | `signature` | HMAC-SHA256 (hex) | **Server only** (shared secret never published) | **Ignore** for offline audit | | `ed25519_signature` | Ed25519 (base64) | Anyone with `GET …/public-key` | **Use this** for offline verify | `algorithm: "HMAC-SHA256+Ed25519"` means both are present, not that verifiers must check HMAC. Conformance `live_smoke.py` / `manifest/verify.py` correctly key off `ed25519_signature` (+ fixture HMAC only inside the offline suite). Do not treat `signature` as the public audit field. ### Signed preimage (Vibes action-receipt) ```text # legacy (still verified) agent_id|action|payload_digest|nonce|quote|ts agent_id|action|payload_digest|nonce|quote|ts|decision_ref # current mints (receipt_type bound) agent_id|action|payload_digest|nonce|quote|ts|rt:raw agent_id|action|payload_digest|nonce|quote|ts|rt:decision agent_id|action|payload_digest|nonce|quote|ts|rt:|decision_ref # optional referral provenance (MarketNow-style) — additive trailing field agent_id|action|payload_digest|nonce|quote|ts|rt:|ref: agent_id|action|payload_digest|nonce|quote|ts|rt:|decision_ref|ref: ``` - Pipe fields must not contain `|`. - **`ref_code`** (optional, request JSON): short referral/provenance cite (e.g. `ref_f92d4211`). Distinct from `decision_ref` (authorize ≠ settle ≠ who-referred). Bound as trailing `ref:`; verify must send the same `ref_code` or `ref_bound` / `valid` fail. Invalid/empty values are ignored (non-breaking). - `payload_digest`: client-supplied digest, or SHA-256 of compact sorted JSON payload if omitted at mint. **Signature-verifiable, not independently recomputable** unless the mint caller documents their hashing convention. Contrast with `action_ref` (JCS schema → anyone recomputes from published fields alone). - **`ts` in the signed preimage is the server's `issued_at`** (ISO 8601 at mint time), not a client-supplied request timestamp. Verifiers must use `issued_at` from the receipt JSON — recomputing against a client-sent `ts` will fail. - Policy-gate Outcomes that mint `decision_receipt` put verdict in signed `action` as `slug.decision` (e.g. `destructive-action-guard.block`), set `receipt_type=decision`, and include the decision object in the hashed payload — not an unsigned advisory field. - Raw `POST …/action-receipt` rejects reserved decision-SKU action namespaces (SKU-laundering / origin forge). ### Sample mint with `ref_code` ```json { "ok": true, "resource": "action-receipt", "receipt_type": "raw", "ref_code": "ref_f92d4211", "ref_bound": true, "preimage": "agent_id|action|payload_digest|nonce|quote|ts|rt:(|decision_ref)(|ref:)", "ed25519_signature": "…" } ``` ## Live prior art (Vibes-Coded) | Step | Endpoint | |------|----------| | Mint action receipt (optional `decision_ref`) | `POST https://vibes-coded.com/api/v1/outcomes/action-receipt` | | Free production sample (current profile) | `GET https://vibes-coded.com/api/v1/outcomes/action-receipt/sample` | | Offline verify | `POST https://vibes-coded.com/api/v1/outcomes/action-receipt/verify` | | Public key | `GET https://vibes-coded.com/api/v1/outcomes/action-receipt/public-key` | | Budget/policy decision receipt | `tool-call-budget-guard`, `spend-cap` style Outcomes (also verify via action-receipt/verify) | | Conformance (citation-join / pipe receipt) | https://github.com/doteyeso-ops/action-ref-conformance/tree/main/citation-join · in-repo `conformance/citation-join` | | Conformance (action-ref JCS digest) | https://github.com/doteyeso-ops/action-ref-conformance | Payment rail (orthogonal): HTTP 402 / x402 USDC (Solana primary; Base optional). Prepaid resume: https://vibes-coded.com/start → `X-Vibes-Key`. ## Related discourse - AutoGen AAR: https://github.com/microsoft/autogen/issues/7353 - x402 action-receipt proposal: https://github.com/x402-foundation/x402/issues/2906 ## One-liner for agents > Authorize with a content-addressed `decision_ref`. Settle with a separate signed receipt that *cites* that ref. Verify both offline.