|
1 | 1 | # Architecture |
2 | 2 |
|
3 | | -QuantForge Phase 1 is a deterministic domain application arranged as inward-facing layers: |
| 3 | +QuantForge is a deterministic, offline research tribunal arranged as inward-facing layers: |
4 | 4 |
|
5 | | -1. `domain` owns immutable versioned contracts and constitution factories. |
6 | | -2. `serialization` owns canonical JSON, SHA-256 identity, defensive parsing, and export. |
7 | | -3. `evidence` owns the append-only ledger and typed claim graph. |
8 | | -4. `audit` owns the single-case append-only hash chain, hashed payloads, and full state replay. |
9 | | -5. `verdict` owns the pure conservative policy. |
| 5 | +1. `domain` owns immutable, versioned contracts and constitution factories. |
| 6 | +2. `serialization` owns canonical JSON, SHA-256 identity, defensive parsing, and atomic files. |
| 7 | +3. `evidence` owns the append-only ledger, typed claim graph, and bound engine bundles. |
| 8 | +4. `audit` owns the single-case append-only hash chain and semantic state replay. |
| 9 | +5. `verdict` owns the pure conservative eligibility policy. |
10 | 10 | 6. `roles` owns provider-neutral typed interfaces and authority checks. |
11 | 11 | 7. `workflow` owns the only legal sequential orchestration. |
12 | | -8. `adapters` contains package-owned mock roles and evidence only. |
13 | | -9. `cli` exposes offline demos and validators. |
| 12 | +8. `storage` owns a backend-neutral case-store contract, SQLite implementation, migrations, |
| 13 | + reconstruction, and deterministic package export. |
| 14 | +9. `engine` owns the narrow read-only adapter contract for the protected C++ release. |
| 15 | +10. `adapters` contains package-owned mock roles and synthetic evidence only. |
| 16 | +11. `cli` exposes bounded offline operations; it is not an arbitrary process or filesystem API. |
14 | 17 |
|
15 | | -The architecture deliberately uses an in-memory aggregate and canonical files. A database, graph |
16 | | -database, web framework, queue, vector store, and agent framework would add operational state without |
17 | | -evidence that Phase 1 needs it. |
| 18 | +## Authority boundary |
18 | 19 |
|
19 | | -External provider output can enter only through a future adapter that returns the same validated |
20 | | -domain models. Workflow state, evidence integrity, and verdict policy remain code-owned even when a |
21 | | -language model later proposes role findings. |
| 20 | +QuantForge owns workflow state, human approval, constitution locking, evidence admission, reviewer |
| 21 | +authority, audit replay, the claim graph, verdict eligibility, and Chair constraints. The protected |
| 22 | +`MrithunjoyB/cpp-event-driven-backtester` release `v1.0.0` remains the numerical authority for |
| 23 | +simulation, statistics, reconstruction artifacts, and engine-side validation. The adapter cannot |
| 24 | +let the engine change tribunal state or decide that its own output is evidence. |
22 | 25 |
|
23 | | -A case file is a deterministic snapshot, not independent proof of history. Governed restoration |
24 | | -requires the complete audit JSONL: replay validates every state, actor, action, payload, identity, |
25 | | -derived verdict input, and final snapshot. The CLI therefore requires both files for `case validate`. |
| 26 | +Raw engine files are untrusted. The adapter first validates the exact release and executable, |
| 27 | +stages a fixed public synthetic fixture into an isolated directory, executes fixed argument arrays, |
| 28 | +runs the release validator, inventories and hashes every output, and emits a bundle. QuantForge then |
| 29 | +checks the bundle against current durable case state in the same transaction that appends its |
| 30 | +workflow event and evidence materialization. |
| 31 | + |
| 32 | +## Durable and derived state |
| 33 | + |
| 34 | +The semantic audit chain is authoritative for case reconstruction. SQLite stores that chain plus |
| 35 | +referentially constrained materializations of the constitution, evidence, graph, reviewer outputs, |
| 36 | +verdict result, bundle inventory, and export lineage. Reconstruction replays the events and compares |
| 37 | +every materialization and hash; a snapshot is never trusted independently. See |
| 38 | +[Storage Model](STORAGE_MODEL.md) and [Migration Policy](MIGRATION_POLICY.md). |
| 39 | + |
| 40 | +SQLite is deliberately local and single-node. It provides transactions, WAL recovery, foreign keys, |
| 41 | +bounded busy waiting, and optimistic revisions, but not distributed consensus or an external trust |
| 42 | +anchor. A complete locally rehashed replacement remains detectable only when compared with a trusted |
| 43 | +external digest or signed/anchored publication. |
| 44 | + |
| 45 | +No live provider, market-data ingestion, broker, order, or trading component exists. A later |
| 46 | +provider adapter may propose typed role output, but code-owned workflow and evidence authority must |
| 47 | +remain unchanged. |
0 commit comments