> ## Documentation Index
> Fetch the complete documentation index at: https://docs.algovoi.co.uk/llms.txt
> Use this file to discover all available pages before exploring further.

# Decision chain (composition keystone)

> The open agentic payment lifecycle proven end to end: identity, authority, policy and the guardrail_ref decision compose into one recomputable chain.

The open lite packages each content-address one part of the lifecycle: [Agent Passport (lite)](https://docs.algovoi.co.uk/agent-passport-lite.md) the agent identity, [Payment Mandate (lite)](https://docs.algovoi.co.uk/payment-mandate-lite.md) the spend authority, [Policy Binding](https://docs.algovoi.co.uk/policy-binding.md) the policy in force, and [Spend Guardrail (lite)](https://docs.algovoi.co.uk/spend-guardrail-lite.md) the ALLOW or DENY decision that binds all three. [Cancellation Receipt (lite)](https://docs.algovoi.co.uk/cancellation-receipt-lite.md) and [Refund Receipt (lite)](https://docs.algovoi.co.uk/refund-receipt-lite.md) then close the lifecycle, and [Composite Trust Query (lite)](https://docs.algovoi.co.uk/composite-trust-query-lite.md) caps it with one verdict over the whole chain. The keystone proves they compose into **one recomputable chain**, end to end, at **8/8 links** byte-for-byte.

```
identity   passport_ref      binds as  agent_ref
authority  mandate_ref       binds as  mandate_ref
policy     policy_bound_ref  binds as  policy_bound_ref
   -> decision  guardrail_ref    = sha256: + SHA-256(JCS({ agent_ref, mandate_ref, policy_bound_ref, verdict }))
   -> close     cancellation_ref   closes the authority (binds the same mandate_ref)
   -> close     refund_ref         closes the payment after settlement (binds the ALLOW guardrail_ref)
   -> cap       trust_query_ref    one verdict over [passport, mandate, policy, guardrail(ALLOW)]
```

## What the keystone proves

For each of the three inputs, the proof does three things, offline:

1. **Recompute** the reference from its raw fields with RFC 8785 JCS + SHA-256.
2. Show it **equals the published output** of that input's own lite conformance set.
3. Show it is **exactly the reference the Spend Guardrail decision binds**.

Then it recomputes `guardrail_ref` from the three composed references plus the verdict and matches the published `spend_guardrail_lite_v1` reference **byte-for-byte, for both `ALLOW` and `DENY`**. Change any raw field and the affected reference, and every reference downstream of it, diverges, so a decision made for one agent, authority, or policy cannot be silently re-attributed to another.

The lifecycle links extend the same proof: `cancellation_ref` recomputes over the very `mandate_ref` the chain authorised, `refund_ref` over the ALLOW `guardrail_ref` it produced, and `trust_query_ref` over all four composed references in order, each matching its published lite set. So a cancellation, a refund, or a trust verdict cannot be re-pointed to a payment it did not concern.

It introduces **no new vectors and no new hashing primitive**. Every value it asserts is an existing published `expected_*` output. The keystone is the composition itself.

## The canonical chain

| Step | Reference | From raw inputs | Value |
| - | - | - | - |
| Identity | `passport_ref` | agent-001 / did:algo:issuer / payments / window | `sha256:b3594e33…` |
| Authority | `mandate_ref` | payer / cap 1000 / monthly / active | `sha256:a4f8cb5e…` |
| Policy | `policy_bound_ref` | policy P over a settlement subject | `sha256:aaee2091…` |
| Decision (ALLOW) | `guardrail_ref` | the three above + `ALLOW` | `sha256:2a444c62…` |
| Decision (DENY) | `guardrail_ref` | the three above + `DENY` | `sha256:792a5b43…` |
| Close authority | `cancellation_ref` | the ALLOW chain's `mandate_ref` + `USER_REQUESTED` | `sha256:9f2913d2…` |
| Close payment | `refund_ref` | the ALLOW `guardrail_ref` + `FULL` + `1000` | `sha256:1d32c8b9…` |
| Cap | `trust_query_ref` | all four composed refs (in order) + `TRUSTED` | `sha256:2ba78e79…` |

## Verify it yourself

The keystone is published in the public corpus,
[chopmob-cloud/algovoi-jcs-conformance-vectors](https://github.com/chopmob-cloud/algovoi-jcs-conformance-vectors/tree/main/composition/spend_decision_chain_v1),
with Python and Node runners. It is also part of the single-command corpus check (`composition/verify_corpus.py`).

```
pip install rfc8785 ; python verify_chain.py
node verify_chain.mjs
```

Both reproduce every value byte-for-byte, so Python and a Node reimplementation agree on the whole chain. No issuer call, no registry lookup, no AlgoVoi service: RFC 8785 JCS, SHA-256, and a JSON parser are the entire dependency.

## Relationship to the open substrate

The decision chain sits on top of the open [JCS Canonicalisation Substrate](https://docs.algovoi.co.uk/canonicalisation-substrate.md). Each link is one of the lite packages, all Apache-2.0 and content-addressed; the keystone adds no construction of its own. The commercial tiers add Falcon-1024 (post-quantum) signing and enforcement on each link, but the open chain already recomputes the same decision address offline. Additive over the frozen canonicalisation substrate, sole AlgoVoi authorship.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.