What the Treasury is
The Treasury is the single source of truth for money. It holds only real capital: what you deposit through Stripe plus what the agent actually earns through Stripe. It records every movement as a signed ledger entry, and it enforces hard caps that the agent cannot breach. The implementation issrc/lib/hermesco/treasury.ts.
startingCapital is 0. There is no seeded balance.
The hard caps
How a spend is decided
pending, approved, denied, executed, failed), the safety verdict and reason, the amount, the counterparty, and timestamps. The full shape is in domain types (Proposal in types.ts).
Earning is real or it is nothing
The agent earns by standing up a real Stripe product and payment link, then reconciling only what Stripe confirms was actually paid:Deposits
A deposit is real capital you add through Stripe Checkout. The deposit flow creates a Checkout session, and on return the session is confirmed and credited to the Treasury. Crediting is idempotent on the Stripe session id, so a refresh or a double return cannot double-count. See Deposit API.The ledger
Every movement is a signed entry:netProfitUsd is revenue minus expense. balanceUsd, depositsUsd, revenueUsd, expenseUsd, and spentTodayUsd are all derived from the ledger, never set by hand.