# ADR-005 — Shared kernel, distinct persistence boundaries Status: proposed for approval; preservation of existing recovery is required. ## One implementation Use one internal Rust `apply(state, command) -> effects` financial kernel. - Research keeps state resident and applies events directly. Do **not** serialize, clone or rehydrate a full account snapshot per observation. - Paper loads the committed snapshot into private staged native state inside the existing SQL transaction, invokes the same kernel, persists snapshot/orders/fills/ordered journal effects atomically, commits, then publishes. Failed SQL work discards the staged state. - Snapshot encoding is a boundary operation, not the hot-loop algorithm. Exact per-effect views remain available where the existing recovery journal requires them; do not replace them with a final batch state. TS owns SQL custody, not independent accounting. No native/DB two-phase commit and no new event-sourcing framework. ## Decision durability Preserve [restore-before-each-step and intent transactions](../../../../apps/stock/orchestrator/src/execution/StrategyRecovery.ts#L151), [account locks and duplicate/conflict handling](../../../../apps/stock/orchestrator/src/execution/PostgresExecutionRepository.ts#L46), and existing failure tests. Paper strategy contexts use committed event views; never substitute a later account state. Restore RNG/decision cursors along with checkpoint state. All currently supported paper order policies must be preserved or a migration explicitly refused. F05 covers market/limit and DAY/GTC/IOC/FOK; do not silently drop IOC/FOK at cutover. ## Migration C06 contains unsafe legacy research/paper composition; it does not build a temporary second worker framework. F02 builds owner accounting once. S03 adopts the kernel and durable recovery without waiting for Sharpe/Sortino or web pages. S04 verifies paper feed/readiness. S06 retires competing active execution after those gates, retaining result readers/research algorithms. Compare financial transitions for the **same event and intent trace**. Research and paper receive different real-world prices/availability; identical P&L is not promised for different inputs. Broker fills remain future external facts to reconcile, not simulated orders that can be rejected after occurrence.