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

# Treasury OS

> Programmable budgets, routing, and receipts for agent spending.

## Overview

The Treasury OS ("Neobank") is the planned financial layer that lets agents hold
budgets, route payments across rails, and produce verifiable receipts. It is
built to answer: who paid, why, under which policy, using which rail, and with
what cryptographic proof.

## Goals

* Enforce budgets at multiple scopes (org -> repo -> issue)
* Route payments across Lightning, Cashu, Taproot Assets, and on-chain
* Provide deterministic, auditable receipts for every spend
* Make agent spending safe enough for enterprise procurement

## Core Components

* **TreasuryRouter**: policy engine that selects rail, asset, limits, and
  approvals based on context and budget state
* **Budgets**: hierarchical caps with approval workflows and override rules
* **Receipts**: structured records with policy, rate, rail, and proof metadata
* **Quotes**: prepared payment intents with idempotency, expiry, and reservation
* **Reconciliation**: background repair for pending/expired quotes and failures

## Payment Flow (Conceptual)

1. Agent requests a payment with context (goal, task, repo, issue).
2. TreasuryRouter checks org/repo/issue budgets and approval rules.
3. Router selects the rail and asset (e.g., BTC\_LN vs USD\_CASHU(mint)).
4. A quote is created and funds are reserved.
5. Payment is executed and verified.
6. A receipt is emitted with policy and provenance details.

## Receipts (What Gets Logged)

Typical receipt fields include:

* Amount denominated vs amount settled
* Exchange rate and quote reference (if FX was required)
* Rail and AssetId (e.g., BTC\_LN, USD\_CASHU(mint\_url))
* Policy rule that authorized the spend
* Session and trajectory references for traceability

## Guardrails and Safety

* Deterministic budget checks and approval gates
* Idempotent quotes to survive retries and crashes
* Reconciliation loops to resolve pending payments
* Receipt trails for audit and compliance

## How It Connects to Autopilot

Autopilot becomes a steady buyer of verifiable work (tests, embeddings,
indexing). The Treasury OS enforces spend limits and produces receipts that
link each payment to a concrete run outcome.

## Status

Planned (see OpenAgents SYNTHESIS.md for the long-term roadmap).
