apps/web, apps/api, mobile) and framework-neutral domain packages (packages/*).
High-Level Topology
Monorepo Package Boundaries
The Six Architectural Invariants
Every code path in Sisera enforces six non-negotiable invariants:1. No Order Routes Without an Approved Risk Decision
1. No Order Routes Without an Approved Risk Decision
Both paper and live orders—whether initiated manually by a human, triggered by an armed policy, or proposed by an autonomous agent—must pass through
@sisera/risk. The risk engine loads portfolio state and mandate limits server-side; clients can never supply their own risk limits in a request payload.2. No Execution Uses a Stale, Delayed, or Degraded Quote
2. No Execution Uses a Stale, Delayed, or Degraded Quote
Every market quote carries explicit
source, observedAt, receivedAt, and quality metadata. If a reference feed (such as Pyth Core) or venue quote is stale or degraded, execution fails closed immediately.3. No LLM Response Is Directly Executable
3. No LLM Response Is Directly Executable
Language models are strictly confined to narrating corroborated evidence and translating natural-language user prompts into candidate policy structures. Only deterministically validated domain commands may enter the order state machine.
4. Agents Submit Proposals Only—Never Direct Venue Calls
4. Agents Submit Proposals Only—Never Direct Venue Calls
Autonomous agents run inside isolated evaluation contexts with hard capital, notional, and leverage caps. An agent never holds wallet keys or invokes a venue adapter directly; it emits a structured proposal that is evaluated by the policy and pre-trade risk engines.
5. Missing Live Data Never Falls Back to Synthetic Data
5. Missing Live Data Never Falls Back to Synthetic Data
When an upstream provider is unreachable or an asset lacks a verified reference price, Sisera returns an explicit
unavailable state and excludes unpriced positions from NAV rather than inventing or interpolating synthetic numbers.6. End-to-End Provenance & Append-Only Auditability
6. End-to-End Provenance & Append-Only Auditability
Every execution decision records the exact actor principal, manifest or policy hash, portfolio snapshot, quote provenance, and risk evaluation reasons in append-only PostgreSQL tables. Database triggers reject mutations to activated policies and enforce evidence requirements on agent promotions.
Advisory-Locked Background Scheduler
WhenSISERA_SCHEDULER_ENABLED=true (default), apps/api runs four coordinated background loops. Each loop acquires a PostgreSQL advisory lock, guaranteeing that even across horizontally scaled API instances, only a single leader executes each cycle: