From 4f60b0842ab7d6f911667d314ca01e222877119c Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:24:21 -0700 Subject: [PATCH 01/63] docs: synchronize economy plan index --- core/docs/plans/README.md | 44 ++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/core/docs/plans/README.md b/core/docs/plans/README.md index 6d9deb9..1dd1af6 100644 --- a/core/docs/plans/README.md +++ b/core/docs/plans/README.md @@ -49,21 +49,21 @@ Every `NN-.md` has the same 10 sections: | G1 | Stress-loop contract | Cross-cut | C1/C2 | — | _wave 2_ | | G2 | Governance | Cross-cut | DESIGN-FIRST (C2) | TBD | _wave 2_ | | G3 | Defense model | Cross-cut | emergent | — | _wave 2_ | -| M0 | Economy organ hub (stomach) | Economy | DESIGN-FIRST | TBD | [M0](M0-economy-organ-hub.md) | -| M1 | Marketplace (multi-trader harness) | Economy | DESIGN-FIRST | TBD | [M1](M1-marketplace.md) | -| M2 | Data feeds (market data pipeline) | Economy | DESIGN-FIRST | TBD | [M2](M2-data-feeds.md) | -| M3 | Sims hub (market prediction) | Economy | DESIGN-FIRST | TBD | [M3](M3-sims-hub.md) | -| M3a | Statistical & quantitative sims | Economy/Sims | DESIGN-FIRST | TBD | [M3a](M3a-statistical-sims.md) | -| M3b | Sociological & population sims | Economy/Sims | DESIGN-FIRST | TBD | [M3b](M3b-sociological-sims.md) | -| M3c | AMM & liquidity pool sims | Economy/Sims | DESIGN-FIRST | TBD | [M3c](M3c-amm-liquidity-sims.md) | -| M3d | MEV & adversarial extraction sims | Economy/Sims | DESIGN-FIRST | TBD | [M3d](M3d-mev-adversarial-sims.md) | -| M3e | Tokenomics & macro-state sims | Economy/Sims | DESIGN-FIRST | TBD | [M3e](M3e-tokenomics-macro-sims.md) | -| M3f | Consensus & staking game sims | Economy/Sims | DESIGN-FIRST | TBD | [M3f](M3f-consensus-staking-sims.md) | -| M3g | Market microstructure sims | Economy/Sims | DESIGN-FIRST | TBD | [M3g](M3g-market-microstructure-sims.md) | -| M4 | Wallets (sovereign custody) | Economy | DESIGN-FIRST | TBD | [M4](M4-wallets.md) | -| M5 | Traders (AI actors) | Economy | DESIGN-FIRST | TBD | [M5](M5-traders.md) | -| M6 | Conductor (supervisory AI) | Economy | DESIGN-FIRST | TBD | [M6](M6-conductor.md) | -| M7 | SAE monitor (trader surveillance) | Economy | DESIGN-FIRST | TBD | [M7](M7-sae-monitor.md) | +| M0 | Economy organ hub (stomach) | Economy | EXECUTABLE SCAFFOLD | Tcl 8.6 | [M0](M0-economy-organ-hub.md) | +| M1 | Marketplace (multi-trader harness) | Economy | EXECUTABLE SIMULATION | Tcl 8.6 | [M1](M1-marketplace.md) | +| M2 | Data feeds (market data pipeline) | Economy | EXECUTABLE BUFFER/FEED CORE | Tcl 8.6 | [M2](M2-data-feeds.md) | +| M3 | Sims hub (market prediction) | Economy | MIXED: 4 V1 BRIDGES + 3 NATIVE KERNELS | Tcl + native runtimes | [M3](M3-sims-hub.md) | +| M3a | Statistical & quantitative sims | Economy/Sims | V1 IMPLEMENTED + WIRED | R | [M3a](M3a-statistical-sims.md) | +| M3b | Sociological & population sims | Economy/Sims | V1 IMPLEMENTED + WIRED | ECLiPSe Prolog | [M3b](M3b-sociological-sims.md) | +| M3c | AMM & liquidity pool sims | Economy/Sims | V1 IMPLEMENTED + WIRED | Solidity / Foundry | [M3c](M3c-amm-liquidity-sims.md) | +| M3d | MEV & adversarial extraction sims | Economy/Sims | NATIVE KERNEL | Fortran 2018 | [M3d](M3d-mev-adversarial-sims.md) | +| M3e | Tokenomics & macro-state sims | Economy/Sims | V1 IMPLEMENTED + WIRED | Fortran 2018 | [M3e](M3e-tokenomics-macro-sims.md) | +| M3f | Consensus & staking game sims | Economy/Sims | NATIVE KERNEL | ECLiPSe Prolog | [M3f](M3f-consensus-staking-sims.md) | +| M3g | Market microstructure sims | Economy/Sims | NATIVE KERNEL | Fortran 2018 | [M3g](M3g-market-microstructure-sims.md) | +| M4 | Wallets (sovereign custody) | Economy | PARTIAL: BINDING + LIMITS ONLY | Tcl 8.6 | [M4](M4-wallets.md) | +| M5 | Traders (AI actors) | Economy | PARTIAL: REGISTRY + PAUSE STATE | Tcl 8.6 | [M5](M5-traders.md) | +| M6 | Conductor (supervisory AI) | Economy | EXECUTABLE SUPERVISION SCAFFOLD | Tcl 8.6 | [M6](M6-conductor.md) | +| M7 | SAE monitor (trader surveillance) | Economy | PARTIAL: LOGGING + ALERT ENVELOPES | Tcl 8.6 | [M7](M7-sae-monitor.md) | ## Integration DAG (who feeds whom) ``` @@ -79,13 +79,19 @@ SAE [F2] watches Subagents [F3]; stress-loop [G1]: F2 → A7 (EthInt) → stres Storage: INVARIANT [E1] / VARIANT [E2] / RAG+cross-store [E3] sit behind D1. Medium [D2] = the perfusion bus (unnamed). Economy (stomach — independent, scoped autonomy): Marketplace [M1] ← Traders [M5] (bound to Wallets [M4]) submit actions; law script + Conductor [M6] veto gate execution. - Data Feeds [M2] ↔ Sims [M3: M3a stat, M3b socio, M3c AMM, M3d MEV, M3e tokenomics, M3f consensus, M3g microstructure]. - SAE [M7] monitors all Trader tool calls → alerts Conductor [M6]. Tax → Verschwörern Veregeister wallets (stub). - Stomach [M0] ↔ organism via Ichor; reward signals TBD. + Data Feeds [M2] → Sims [M3]. Runtime bridges are live for M3a stat, M3b socio, M3c AMM, + and M3e tokenomics; M3d MEV, M3f consensus, and M3g microstructure are native kernels + registered in the hub but not yet process-bridged into automatic query/publish paths. + SAE [M7] records Marketplace-level Trader calls → alert envelopes → Conductor [M6]. + Tax is staged only; no wallet transfer occurs. + Stomach [M0] has an Ada-bound secretion contract; the Pony↔Tcl runtime bridge to Ichor is open. ``` ## Build waves - **Wave 0** — this README + **C1** (priority). - **Wave 1 (buildable-now)** — A1–A8, B1–B3, C2–C4, D1, D3. -- **Wave 2 (design-first)** — D2, E1–E3, F1–F3, G1–G3, M0–M7 (+ M3a–M3g sim sub-specs). +- **Wave 2 (design-first)** — D2, E1–E3, F1–F3, G1–G3. +- **Economy track (active implementation)** — M0–M7 plus M3a–M3g. M3a/M3b/M3c/M3e have V1 + native runtime bridges; M3d/M3f/M3g remain native kernel implementations; M4/M5/M7 remain + partial by design because custody, agent inference, and SAE inference are not implemented. Each spec is independent; review as they land. From 776bfe1e97a3de83dca7393c72829598f0ab0c19 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:24:48 -0700 Subject: [PATCH 02/63] docs: align M3 hub with actual runtime wiring --- core/docs/plans/M3-sims-hub.md | 153 +++++++++++++++++---------------- 1 file changed, 81 insertions(+), 72 deletions(-) diff --git a/core/docs/plans/M3-sims-hub.md b/core/docs/plans/M3-sims-hub.md index 2b323fe..805d7b4 100644 --- a/core/docs/plans/M3-sims-hub.md +++ b/core/docs/plans/M3-sims-hub.md @@ -12,72 +12,75 @@ The academic foundations span AMM mechanism design [1,2], MEV game theory [3,4,5 tokenomics via SDEs [6,7], and evolutionary consensus games [8–11]. ## 2. Status / certainty -EXECUTABLE KERNEL SET. `core/src/economy/sims/` now contains all seven native engine -trees (M3a–M3g), a seven-engine registry, and a live Tcl event-loop scheduler for all six -horizons at the specified 90:1-or-faster ratios. The hub still validates/publishes bounded -predictions. Advanced model layers called out in the individual sub-specs remain incremental -work; the simulator family is no longer absent. Role C3; kernel implementation C2. -Mathematical foundations C4; live-market parameterization C1. +MIXED · EXECUTABLE HUB + FOUR V1 RUNTIME BRIDGES + THREE NATIVE KERNELS. +`core/src/economy/sims/` contains all seven native engine trees, a seven-engine registry, the +bounded-prediction hub, and a live Tcl event-loop clock for all six horizons. M3a, M3b, M3c, +and M3e are wired end-to-end from normalized M2 history through their native runtimes into the +M3 hub and Marketplace. M3d, M3f, and M3g are tested native kernels but do not yet have equivalent +Tcl process/query bridges. The scheduler currently advances horizon clocks; it does **not** spawn +all seven engines or republish every prediction automatically. Role C3; hub/runtime implementation +C3; live-market parameterization remains data-dependent. ## 3. Language & location -**Tcl** · `src/economy/sims/`. The hub is a syntax-agnostic coordinator: Tcl manages -lifecycle, tick-advancement, and query routing for sub-sims in their native runtimes via -stdin/stdout JSON — **Fortran** (M3d, M3e, M3g), **Prolog** (M3b, M3f), **R** (M3a), -**Solidity** (M3c). Tcl imposes no type system or paradigm on the -sub-processes it orchestrates. +**Tcl 8.6** · `core/src/economy/sims/`. The hub is syntax-agnostic, but V1 does not force one +wire protocol on every native engine. Current bridges are deliberately native: +- **M3a / R:** Tcl invokes the R engine and publishes typed bounded results. +- **M3b / ECLiPSe Prolog:** Tcl submits native ECLiPSe goals and parses bounded results. +- **M3c / Solidity:** Tcl uses a read-only ABI against an ephemeral/local EVM query contract in CI. +- **M3e / Fortran:** Tcl writes normalized numeric history to `tokenomics_query` over stdin and + parses its single bounded result line. +- **M3d / Fortran, M3f / ECLiPSe, M3g / Fortran:** native kernels exist; runtime bridges remain open. ## 4. Does / does-not -- **Does:** tick-advance continuously at **90:1** (90 simulated seconds = 1 wall-second) - across **six concurrent time horizons** — tick/hourly, daily, weekly, monthly, annual, and - 5-year forecast windows; every tick advances every sim; maintain populations of Pops whose - behaviors emerge from the sim's mathematical model; ingest live data from Data Feeds (M2) - for calibration; transform raw sim data into bounded predictions and publish them continuously - to the Marketplace via M2; produce outputs with **explicit upper/lower bounds** on every - prediction value. - | Horizon | Window | Tick step | Effective ratio | Wall time for window | - |---------|--------|-----------|-----------------|---------------------| - | Tick–hourly | Next 1–60 min | 1s | 90:1 | ~40s | - | Daily | Next 24h | 24s | 2,160:1 | ~40s | - | Weekly | Next 7d | ~3 min | 15,120:1 | ~40s | - | Monthly | Next 30d | 12 min | 64,800:1 | ~40s | - | Annual | Next 365d | ~2.5 hr | ~788,000:1 | ~40s | - | 5-year | Next 1825d | 12 hr | ~3,942,000:1 | ~40s | -- **Does-not:** trade (Traders/Marketplace do); make decisions for traders (it informs, they - decide); enforce laws (Marketplace does); supervise behavior (Conductor/SAE do); receive - trader queries (traders query the Marketplace); skip ticks; run slower than 90:1. +- **Implemented now:** maintain the canonical seven-engine registry; run the six-horizon wall→sim + clock at 90:1 or faster; validate every published prediction against the common bounded schema; + retain the latest prediction per sim type; expose those predictions to Traders only through + Marketplace; calibrate and query M3a/M3b/M3c/M3e from M2 histories using native runtimes. +- **Target runtime behavior:** continuously refresh native simulations on their own cadences and + publish fresh bounded predictions without a Trader query triggering computation. The horizon + clock needed for that loop exists, but the automatic per-engine dispatch/refresh loop is not yet + implemented. +- **Does-not:** trade; make Trader decisions; enforce Marketplace law; supervise Trader behavior; + bypass M1, M4, M6, M7, or D1; treat registered source presence as proof that a native engine is + runtime-wired. + + | Horizon | Window | Clock ratio | + |---------|--------|-------------| + | Tick–hourly | Next 1–60 min | 90:1 | + | Daily | Next 24h | 2,160:1 | + | Weekly | Next 7d | 15,120:1 | + | Monthly | Next 30d | 64,800:1 | + | Annual | Next 365d | ~788,000:1 | + | 5-year | Next 1825d | ~3,942,000:1 | ## 5. Interface contract -- `publish(sim_type: SimType, prediction: BoundedPrediction)` — the hub continuously transforms - raw sim data into predictions and publishes them to the Marketplace via M2 Data Feeds. This is - a constant stream, not on-demand. Traders query predictions from the Marketplace (M1), not from - the sim hub. - `SimType` ∈ { `statistical`, `sociological`, `amm_liquidity`, `mev_adversarial`, - `tokenomics_macro`, `consensus_staking`, `market_microstructure` } (M3a–M3g). +- `publish(sim_type, BoundedPrediction)` validates and stores the latest bounded result for one + of `statistical`, `sociological`, `amm_liquidity`, `mev_adversarial`, + `tokenomics_macro`, `consensus_staking`, or `market_microstructure`. - `BoundedPrediction { value, lower_bound, upper_bound, confidence, correctness, certainty, - time_horizon, sim_type, timestamp, token_ticker, recent_shift }`. - Every output is bounded — no point estimates without uncertainty ranges. - Three quality metrics, each ∈ [0.00, 10.00]: - **confidence** — how sure the model is of this prediction; - **correctness** — how accurate the model has been historically (scored against literal - market values from M2); - **certainty** — how stable the estimate is across perturbations. - **token_ticker** — which asset this prediction concerns (e.g. `"ETH"`, `"BTC"`). - **recent_shift** — literal observed market movement (ground truth from M2, not sim output). - Same M2 source feeds calibration and `correctness` scoring. - Gain rates print as `lower - value - upper / 10.00` - (e.g. `2.31 - 4.44 - 7.11 / 10.00 gain over next 30 days`); - the denominator aids legibility — gain is not capped at 10.00. - Example: `{ value: 7.2, lower_bound: 5.8, upper_bound: 8.9, confidence: 7.30, - correctness: 8.10, certainty: 6.50, time_horizon: "4h", sim_type: "amm_liquidity", - token_ticker: "ETH", recent_shift: -0.023 }`. -- `status(sim_type?) -> { running, pop_count, last_calibration, data_freshness }` — health check. -- `calibrate(sim_type, feed_data: [NormalizedDatum])` — Data Feeds (M2) pushes live data for - model recalibration. + time_horizon, sim_type, timestamp, token_ticker, recent_shift, ...metadata }`. + Every hub-facing numeric result obeys `lower_bound ≤ value ≤ upper_bound`; each quality metric + is in `[0,10]`. Native engines may preserve extra metadata such as M3b population state, + M3c range/routing detail, or M3e yield-allocation weights. +- `Marketplace.predictions(trader_id, sim_type)` is the Trader-facing read path. Traders never + receive the raw hub object or native runtime handle. +- Current calibrated facade methods on `::stomach::Economy`: + `statistical_from_feed_type`, `sociological_from_feed`, `amm_from_feed`, and + `tokenomics_from_feed`. +- Registry presence and horizon-clock state are operational metadata; neither implies automatic + native execution. -## 6. Dependencies & stubs -- M2 Data Feeds — calibration data source; *stub:* canned market data. -- M1 Marketplace — prediction consumer (via M2); *stub:* print predictions. -- M3a–M3g sub-specs — individual sim implementations; *stub:* each returns fixed predictions. +## 6. Dependencies & runtime state +- **M2 Data Feeds:** implemented in-memory normalized history + explicit backpressure. External + WebSocket/RSS/on-chain adapters remain open. +- **M1 Marketplace:** implemented prediction-consumer facade; holds no native sim handles. +- **M3a:** V1 native R bridge wired and CI-verified. +- **M3b:** V1 native ECLiPSe bridge wired and CI-verified. +- **M3c:** V1 native Solidity/read-only EVM bridge wired and CI-verified. +- **M3d:** strict-Fortran kernel/tests present; Tcl query bridge open. +- **M3e:** V1 native Fortran query bridge wired and CI-verified. +- **M3f:** ECLiPSe kernel/tests present; Tcl query bridge open. +- **M3g:** strict-Fortran kernel/tests present; Tcl query bridge open. ## 7. Invariants / laws - **L1 (C5):** sims are **always running** — they are not invoked on demand. Traders query @@ -97,21 +100,27 @@ sub-processes it orchestrates. - **L6 (C3):** Pops are **simulation constructs, not AI actors** — they follow mathematical rules within the sim. Traders (M5) are the AI actors. -## 8. Build steps -1. Define `BoundedPrediction` shape (value, bounds, confidence/correctness/certainty). -2. Build the sim runner (lifecycle management for always-on sims). -3. Wire M2 Data Feeds → calibration pipeline. -4. Implement sub-specs M3a–M3g as they land. -5. Wire continuous prediction publishing → M2 → Marketplace. +## 8. Build status +1. **Done:** common `BoundedPrediction` validation and latest-result storage. +2. **Done:** seven-engine registry and six-horizon live scheduler. +3. **Done for M3a/M3b/M3c/M3e:** M2 history → native calibration/query → M3 publish. +4. **Kernel done, bridge open for M3d/M3f/M3g:** add the same process/query boundary. +5. **Open:** scheduler-driven automatic refresh/publish loop independent of Trader queries. +6. **Open:** persistent calibration/history storage beyond the in-session M2 buffers. ## 9. Tests -Always-on: sim running after init without external trigger. Bounded output: every prediction has -lower ≤ value ≤ upper. Three metrics: confidence, correctness, certainty all present in every -output. Publishing: predictions flow continuously to Marketplace via M2. Independence: one sim's -failure doesn't affect others. Calibration: new data updates model state. +- `tclsh core/src/economy/sims/tests/hub_runtime.test` verifies the registry and six-horizon clock. +- `tclsh core/src/economy/tests/stomach.test` verifies bounded publication and Marketplace reads + inside the M0 facade. +- Dedicated CI verifies the native + M2→native→Hub boundaries for M3a, M3b, M3c, and M3e. +- M3d and M3g compile/test under strict Fortran flags; M3f has native ECLiPSe tests. +- A future automatic-refresh test must prove predictions update without a Trader-triggered query; + that claim is intentionally not made by the current suite. ## 10. Open items -- Pop lifecycle (birth/death/mutation within sims, or fixed populations?). -- Cross-sim aggregation (do traders query individual sims, or is there a meta-prediction layer?). -- Calibration frequency per sim type. -- Computational budget per sim (how much CPU/GPU each can consume). +- Native runtime/query bridges for M3d, M3f, and M3g. +- Scheduler-driven automatic engine refresh and bounded republishing. +- Per-sim calibration cadence and failure/degraded-state policy. +- Cross-sim aggregation or meta-prediction, if added at all. +- Persistent history/calibration state beyond the in-session M2 buffer. +- Explicit CPU/GPU budgets and admission/backpressure for expensive native queries. From 77115846a7de18c75a20abdd6294622f6bda1ff3 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:25:18 -0700 Subject: [PATCH 03/63] docs: update M0 to current executable boundary --- core/docs/plans/M0-economy-organ-hub.md | 63 +++++++++++++++---------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/core/docs/plans/M0-economy-organ-hub.md b/core/docs/plans/M0-economy-organ-hub.md index ec554a4..1d4dd4b 100644 --- a/core/docs/plans/M0-economy-organ-hub.md +++ b/core/docs/plans/M0-economy-organ-hub.md @@ -12,36 +12,43 @@ organism are TBD and out of scope. Brain for permission to trade. ## 2. Status / certainty -SCAFFOLD · EXECUTABLE. The existing Ichor `Stomach` primitive now has a dedicated -M0–M7 simulation scaffold under `core/src/economy/`. M0 composes the component facades and -emits Ada-bound secretion metadata; external execution and the Pony↔Tcl runtime bridge remain -separate integration work. Role C4; scaffold implementation C2. +EXECUTABLE OUTER-ORGAN SCAFFOLD. `core/src/economy/` composes M1–M7, exposes normalized +feed/history surfaces, runs the M3 horizon clock, wires M3a/M3b/M3c/M3e through native runtimes, +stages tax receipts without moving value, and emits Ada-bound secretion metadata. M3d/M3f/M3g +remain native kernels without equivalent Tcl query bridges. Live custody, signing/broadcasting, +AI Trader inference, Conductor inference, SAE inference, and the Pony↔Tcl Ichor bridge remain +open. Role C4; scaffold/runtime implementation C3. ## 3. Language & location -**Tcl 8.6 scaffold** · `core/src/economy/`. M0 orchestration is Tcl and preserves the -existing polyglot plan for later component engines. Pony remains the Ichor-facing transport layer; -the runtime bridge between Ichor and this scaffold is still open. +**Tcl 8.6 orchestration** · `core/src/economy/`, with native M3 engines in R, ECLiPSe Prolog, +Solidity/Foundry, and Fortran 2018. Pony remains the Ichor-facing outer transport layer; the +runtime bridge between the Tcl economy facade and Ichor is still open. ## 4. Does / does-not -- **Does:** host crypto/NFT trading via the Marketplace (M1); run always-on market prediction - Sims (M3) fed by live Data Feeds (M2); manage sovereign-custody Wallets (M4); supervise - Traders (M5) via a Conductor (M6); guard against anomalies via SAE monitor (M7); collect taxes - on trader income and stub transfer to Verschwörern Veregeister wallets; maintain a **ledger of - economy-related memories and patterns** (trade history, learned market patterns, calibration - state). -- **Does-not:** consult the organism's Brain for trade decisions (scoped autonomy); route around - Ada for organism-bound messages (S1); store **organism** memories (E*) — economy-specific - memories stay local; act as the organism's conscience (that's Eth-Int / A6). +- **Implemented now:** compose M1–M7; accept normalized M2 data; expose bounded M3 predictions + through Marketplace; enforce deterministic Marketplace admission, wallet binding/limits, + Conductor pause/veto state, SAE call logging/alerts, and simulation-only execution; stage tax + receipts; emit an Ada-bound `organ_secretion` summary. +- **Native M3 integration now:** M3a statistical, M3b sociological, M3c AMM/liquidity, and M3e + tokenomics/macro have tested M2→native-runtime→Hub paths. M3d/M3f/M3g are registered native + kernels but are not yet facade-queryable. +- **Does not currently:** hold private keys; sign or broadcast transactions; move tax value; + autonomously run AI Trader/Conductor/SAE inference; continuously invoke every native sim from + the scheduler; bypass Ada; or join the inner brain bus. +- **Target architecture:** scoped economic autonomy remains the design goal, but future live-money + behavior must still pass M1 law, M4 brakes, M6 supervision, M7 observation, and D1 at the + organism boundary. ## 5. Interface contract - **Ichor interface (outbound):** `Envelope(Stomach, AdaBorder, OrganSecretion, payload)` — market state summaries, prediction digests, and tax receipts cross Ada to reach the inner brain. - **Ichor interface (inbound):** organism directives arrive via Ichor (e.g. risk posture changes, budget adjustments from A2 energy). -- **Internal wiring:** Marketplace (M1) ↔ Data Feeds (M2) ↔ Sims (M3). Wallets (M4) bind to - Traders (M5). Conductor (M6) supervises Traders (M5). SAE (M7) acts as an independent - antivirus / guarddog / alarm bell — monitors via Ichor-routed messages and alerts M6. - All trader actions route through Marketplace. +- **Internal wiring:** Marketplace (M1) owns the action and prediction-read boundary. M2 stores + normalized histories consumed by M3 native bridges. Wallets (M4) currently provide identity + binding and exposure brakes only. Conductor (M6) owns veto/pause state. SAE (M7) records + Marketplace-level tool calls and constructs alerts for M6. All Trader actions route through + Marketplace. - **Tax stub:** `transfer_tax(amount, source_wallet, dest_wallet) -> receipt` — automation hook for Verschwörern Veregeister internal wallet-to-wallet transfer. **Out of scope** — stub only. @@ -63,10 +70,12 @@ the runtime bridge between Ichor and this scaffold is still open. SAE surveillance (M7), and wallet-level limits (M4) each independently constrain risk. ## 8. Build steps -1. Build sub-components (M1–M7) individually — each with defined success criteria and ablative tests. -2. Extend the existing `Stomach` primitive in Ichor to carry the hub facade. -3. Define internal wiring topology and connect tested sub-components. -4. Implement tax stub and Verschwörern Veregeister transfer last. +1. **Done:** executable M1–M7 Tcl scaffold and contract tests. +2. **Done:** M3 registry/scheduler plus native runtime bridges for M3a/M3b/M3c/M3e. +3. **Done:** simulation-only tax receipt staging. +4. **Open:** runtime bridge between the economy facade and Pony/Ichor. +5. **Open:** M3d/M3f/M3g query bridges and scheduler-driven automatic refresh. +6. **Open by design:** live custody/signing/broadcast, Trader/Conductor inference, SAE inference. ## 9. Tests Executable contract suite: `tclsh core/src/economy/tests/stomach.test`. The current 17 @@ -79,5 +88,7 @@ integration test. ## 10. Open items - Reward signal protocol from economy organ to organism (TBD, out of scope). -- Internal communication bus (reuse Ichor internally? separate actor topology?). -- Language choices per sub-component. +- Pony↔Tcl process/FFI boundary for the outer-organ facade. +- Automatic M3 engine scheduling/refresh and failure isolation. +- Persistent economy state beyond the current in-session Tcl objects. +- Ratified M4 custody design before any signer or broadcaster exists. From d46581f23e7b49aa2c05a53149e444b425018ac3 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:25:28 -0700 Subject: [PATCH 04/63] docs: separate M1 simulation from future live execution --- core/docs/plans/M1-marketplace.md | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/core/docs/plans/M1-marketplace.md b/core/docs/plans/M1-marketplace.md index 167bd86..82fb855 100644 --- a/core/docs/plans/M1-marketplace.md +++ b/core/docs/plans/M1-marketplace.md @@ -12,17 +12,20 @@ action ingress, deterministic admission ordering, supervisor veto, monitor loggi simulation-only execution. The full law-script loader remains open. Role C4; scaffold C2. ## 3. Language & location -TBD · `src/economy/marketplace/`. Needs to interface with blockchain APIs (RPC/REST), wallet -signing (M4), and the Conductor (M6). Deterministic law script must be auditable and non-Turing -(no unbounded loops — it's a constitution, not a program). +**Tcl 8.6** · `core/src/economy/marketplace.tcl`. The implemented surface is deterministic, +simulation-only, and has no RPC, signer, key, approval, or broadcaster. A future live execution +adapter may be added only after M4 custody is ratified and must remain downstream of the same +auditable admission ordering. ## 4. Does / does-not -- **Does:** receive trade requests from Traders (M5); validate against the deterministic law - script (scoped invariants); check Conductor veto (M6); verify trader-wallet binding (no wallet - = no access); execute approved actions on-chain via the bound wallet's API; record all actions - for SAE (M7) monitoring; collect tax on realized income → Verschwörern Veregeister stub (M0). -- **Does-not:** decide *what* to trade (Traders decide); predict markets (Sims do); hold keys - (Wallets do); supervise behavior (Conductor + SAE do). +- **Does now:** receive `MarketAction` requests; record every submission for M7; reject paused + Traders; require exact M4 Trader↔wallet binding; apply deterministic action/chain/notional law; + apply M4 exposure limits independently; consult M6 veto only after deterministic law passes; + return a deterministic simulated `simtx-*` receipt for admitted actions; expose the latest M3 + prediction for a Trader. +- **Does not now:** contact a chain, sign, broadcast, hold keys, move assets, or collect real tax. +- **Does not conceptually:** decide what to trade; predict markets; supervise Traders; or let M6 + legalize an action rejected by deterministic law. ## 5. Interface contract - `submit_action(trader_id, action: MarketAction, wallet_id) -> { succeeded | failed }`. @@ -30,9 +33,10 @@ signing (M4), and the Conductor (M6). Deterministic law script must be auditable (M6) for upstream output. Immune system is a separate organ (out of scope here). `MarketAction` ∈ { `buy`, `sell`, `mint`, `provide_liquidity`, `withdraw_liquidity`, `claim_rewards`, … }. - `query_predictions(sim_type: SimType) -> [BoundedPrediction]` — traders read per-sim-type - predictions through the Marketplace. Predictions are published continuously by the sim hub - (M3) via M2 Data Feeds. The Marketplace holds the latest predictions from each sim type. - Traders see individual sim results (not aggregated) and decide how to weight them. + predictions through the Marketplace. The hub stores the latest published result per sim type. + M3a/M3b/M3c/M3e currently publish when their calibrated facade query runs; a scheduler-driven + continuous refresh loop is still open. Traders see individual sim results and decide how to + weight them. - `law_check(action: MarketAction) -> { pass | violation(rule_id, reason) }` — deterministic, pure function. The law script is loaded at startup and **immutable at runtime** (mirrors S3 / the COBOL vault pattern). From 91841cd96cf73d02c7735157be6896bf60b2e584 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:25:31 -0700 Subject: [PATCH 05/63] docs: align M2 with actual feed buffer --- core/docs/plans/M2-data-feeds.md | 33 +++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/core/docs/plans/M2-data-feeds.md b/core/docs/plans/M2-data-feeds.md index ac36679..e8da27c 100644 --- a/core/docs/plans/M2-data-feeds.md +++ b/core/docs/plans/M2-data-feeds.md @@ -12,25 +12,28 @@ and explicit backpressure without silent drop. External stream adapters remain o scaffold C2. ## 3. Language & location -TBD · `src/economy/feeds/`. Needs async I/O for streaming data (WebSockets, SSE, RSS polling). -Pony actors are a natural fit (async, backpressure-aware). +**Tcl 8.6 core buffer** · `core/src/economy/feeds.tcl`. V1 provides normalized in-session +history and explicit capacity backpressure. External WebSocket/SSE/RSS/RPC adapters, subscriptions, +and persistent storage remain separate ingress work. ## 4. Does / does-not -- **Does:** ingest live market data from external sources (RSS, price APIs, DEX subgraphs, - on-chain event logs); normalize heterogeneous data into a common internal format; distribute - to Sims (M3) for prediction and to Traders (M5) for decision-making; ingest Marketplace (M1) - execution data (fills, portfolio state) and feed it back into Sims for calibration; maintain - time-series history within session (ring buffer). -- **Does-not:** predict (Sims do); trade (Marketplace does); filter or editorialize data — it - delivers raw, normalized feeds. Interpretation is the consumer's job. +- **Does now:** accept already-normalized `NormalizedDatum` records; validate confidence; + retain ordered per-feed in-session history up to a configured capacity; return explicit + `backpressure` instead of silently evicting or dropping data; expose history to native M3 + bridges. Current calibrated consumers use `price_tick`, `rss_news`, `dex_pool_state`, and + `on_chain_event`. +- **Does not now:** open external streams, poll APIs, persist history, maintain subscriptions, + transform heterogeneous provider payloads, or synthesize execution fills. +- **Does not conceptually:** predict or trade; interpretation belongs to consumers. ## 5. Interface contract -- `subscribe(feed_type: FeedType, consumer_id) -> subscription_handle`. - `FeedType` ∈ { `price_tick`, `rss_news`, `on_chain_event`, `dex_pool_state`, `execution_fill`, - `portfolio_state` }. -- `publish(feed_type, data_point: NormalizedDatum)` — internal; sources push into the pipeline. -- `query_history(feed_type, time_range) -> [NormalizedDatum]` — sims and traders can pull - historical data within the session window. +- Implemented: `publish(feed_type, source, timestamp, payload, confidence)`. +- Implemented: `history(feed_type) -> [NormalizedDatum]`. +- Planned, not implemented: source adapters, subscriptions, time-range queries, persistence, and + provider-specific normalization. +- `FeedType` remains open-ended; the economy currently exercises `price_tick`, `rss_news`, + `on_chain_event`, and `dex_pool_state`, with `execution_fill` / `portfolio_state` + reserved for later execution feedback. - `NormalizedDatum { feed_type, source, timestamp, payload, confidence }` — common shape. `confidence` ∈ [0.0, 10.0] — data source reliability per position produced (exchange-reported price = high; RSS sentiment = lower). Sims produce even finer-grained confidence. From db095f0c87386f8fcd64d8d4024365a6cc97e054 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:26:01 -0700 Subject: [PATCH 06/63] docs: make M4 keyless scaffold explicit --- core/docs/plans/M4-wallets.md | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/core/docs/plans/M4-wallets.md b/core/docs/plans/M4-wallets.md index f85b545..527076a 100644 --- a/core/docs/plans/M4-wallets.md +++ b/core/docs/plans/M4-wallets.md @@ -13,24 +13,29 @@ independent exposure limits for the simulation scaffold. Custody/signing impleme open. Role C4; scaffold C2. ## 3. Language & location -TBD · `src/economy/wallets/`. Needs cryptographic key management (secp256k1 for EVM, ed25519 for -Solana, etc.) +**Tcl 8.6 brake/binding scaffold** · `core/src/economy/wallets.tcl`. V1 contains no key +material or cryptography. A future custody implementation will require ratified storage/rotation +semantics before any secp256k1/ed25519 signer is introduced. ## 4. Does / does-not -- **Does:** generate and store private keys locally (never transmitted); sign transactions on - behalf of the bound trader; enforce per-wallet spending limits (daily, per-transaction); - track wallet balance and transaction history; collect tax on realized income and stage for - transfer to Verschwörern Veregeister wallets; bind 1:1 to a Trader (M5). -- **Does-not:** decide what to trade (Trader decides); route to chain (Marketplace does); - hold keys for the organism's other wallets (Verschwörern Veregeister are separate); delegate - custody to any third party — ever. +- **Does now:** enforce permanent 1:1 Trader↔wallet identity binding; reject cross-Trader wallet + use; enforce per-action and cumulative session exposure limits; record simulated admitted + notional for brake accounting. +- **Does not now:** generate, store, import, derive, rotate, or expose private keys; sign + transactions; query balances; broadcast; maintain chain transaction history; or transfer tax. +- **Target invariant:** if live custody is later implemented, it remains sovereign/local and + cannot delegate custody to a third party. ## 5. Interface contract -- `sign(wallet_id, tx: UnsignedTransaction) -> SignedTransaction` — signs with the wallet's key. - Only the bound trader can request signing. -- `balance(wallet_id) -> { chain, assets: [{ token, amount }] }`. -- `spending_check(wallet_id)`. -- taxes are out of scope +Implemented Tcl surface: +- `bind(wallet_id, trader_id, daily_limit, per_action_limit)`. +- `binding_for(trader_id)` and `binding_matches(trader_id, wallet_id)`. +- `spending_check(wallet_id, action)` — independent exposure brake. +- `record_spend(wallet_id, notional)` — simulation accounting only. +- `count()`. + +Future custody surface such as `sign`, `balance`, key generation/import, and transaction +history is intentionally **not implemented** and must not be inferred from the component name. ## 6. Dependencies & stubs - M5 Traders — 1:1 binding; *stub:* canned trader ID. From 650fd4b1cd400cf7b84807f6248020efddbf9ba0 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:26:07 -0700 Subject: [PATCH 07/63] docs: replace M5 placeholder interface with actual scaffold --- core/docs/plans/M5-traders.md | 38 +++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/core/docs/plans/M5-traders.md b/core/docs/plans/M5-traders.md index 5dea4b7..ed49041 100644 --- a/core/docs/plans/M5-traders.md +++ b/core/docs/plans/M5-traders.md @@ -10,28 +10,36 @@ specialization labels, and mechanical pause/resume state. Trader inference remai Role C3; scaffold C2. ## 3. Language & location -TBD · `src/economy/traders/`. Traders are AI agents.All use the same `MarketAction` interface through the Marketplace regardless of implementation. Traders are the agentic entities, the determininistic bots are subservient to them. +**Tcl 8.6 identity/state scaffold** · `core/src/economy/traders.tcl`. The implemented object is +not an AI inference runtime: it registers Trader identity/specialization and maintains mechanical +pause state. Future Trader cognition may be implemented separately, but every implementation must +still use the same Marketplace-only `MarketAction` surface. Deterministic helper bots remain +subservient to Traders rather than becoming independent market actors. ## 4. Does / does-not -- **Does:** read sim predictions from the Marketplace (M1) (bounded, multi-domain, per-sim-type); - formulate trade decisions based on predictions + market state + specialization; submit - `MarketAction` requests to the Marketplace (M1) only bound wallet (M4); operate with **scoped - autonomy** — trades within law/budget constraints don't need Brain or Conductor approval; manage lower level bot goals. -- **Does-not:** execute on-chain directly (Marketplace does); hold keys (Wallet does); supervise - other traders (Conductor does); modify the law script (immutable — M1-L2); bypass the - Marketplace (M1-L1) - this must be due to literal lack of surface. +- **Does now:** register unique Trader IDs with specialization labels; expose existence/count; + enter and leave mechanical pause state under M6 control. +- **Future Trader runtime:** read bounded predictions through Marketplace, formulate actions from + specialization + market state, and submit `MarketAction` through M1 using its bound M4 wallet. +- **Does not:** execute on-chain directly; hold keys; supervise other Traders; modify Marketplace + law; bypass Marketplace; or currently perform AI inference. ## 5. Interface contract - -- [somehow this was a literal mess] +Implemented Tcl registry/state surface: +- `register(trader_id, specialization)`. +- `exists(trader_id)`. +- `pause(trader_id)`, `resume(trader_id)`, `is_paused(trader_id)`. +- `count()`, `paused_count()`. +The future AI Trader layer must produce Marketplace `MarketAction` requests and consume +Marketplace predictions; no native model/inference interface is implemented in V1. ## 6. Dependencies & stubs -- M1 Marketplace — trade verification; *stub:* none, must make marketplace first. -- M1 Marketplace — predictions (from sims via M2) and action submission; *stub:* see above -- M4 Wallet — bound 1:1; *stub:* see above -- M6 Conductor — supervision; *stub:* ... need i state -- M7 SAE — Out of scope +- M1 Marketplace — implemented action/prediction boundary. +- M4 Wallets — implemented 1:1 binding + exposure brakes; custody/signing absent. +- M6 Conductor — implemented mechanical pause/veto supervision; specialist inference absent. +- M7 SAE — implemented Marketplace-level logging/alert envelopes; SAE inference absent. +- AI Trader inference runtime — open. ## 7. Invariants / laws - **L1 (C5):** **all trades go through the Marketplace** — a trader cannot interact with From 203227ec7e4217b129ddd4febd97db221b0f5c00 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:26:13 -0700 Subject: [PATCH 08/63] docs: align M6 with deterministic supervision scaffold --- core/docs/plans/M6-conductor.md | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/core/docs/plans/M6-conductor.md b/core/docs/plans/M6-conductor.md index ea2a73f..c7e5a4c 100644 --- a/core/docs/plans/M6-conductor.md +++ b/core/docs/plans/M6-conductor.md @@ -13,19 +13,18 @@ pause/resume, alert intake, and an in-memory decision log. Specialist inference audit storage remain open. Role C4; scaffold C2. ## 3. Language & location -TBD · `src/economy/conductor/`. The Conductor is an AI actor — likely a fine-tuned LLM with -specialist training in market risk, trader behavior analysis, and anomaly response. The -inference wrapper sits alongside the Marketplace. +**Tcl 8.6 supervision scaffold** · `core/src/economy/conductor.tcl`. V1 is deterministic state +and audit behavior only: veto-next, pause/resume, SAE alert intake, and decision logging. +Specialist-trained inference is a future layer, not part of the current executable surface. ## 4. Does / does-not -- **Does:** receive SAE (M7) anomaly reports on trader behavior; **pause** a flagged trader's - actions to investigate; **veto** a Marketplace action if investigation reveals risk; **resume** - a cleared trader; review Marketplace actions pre-execution when the law check passes (M1-L4: - veto is checked after law, before execution); maintain an audit log of all veto/pause/resume - decisions. -- **Does-not:** trade (Traders do); execute on-chain (Marketplace does); modify the law script - (immutable — M1-L2); detect anomalies directly (SAE does — the Conductor *responds* to SAE - reports, it doesn't watch raw data); consult the organism's Brain. +- **Does now:** stage a one-shot veto reason per Trader; mechanically pause/resume Traders; + receive M7 alert envelopes; automatically pause on configured severe alerts; append decisions + to an in-memory log; expose veto state to M1 only after deterministic Marketplace law passes. +- **Does not now:** perform AI investigation, infer market risk, persist its audit log, or call a + specialist model. +- **Does not conceptually:** trade, legalize an M1-rejected action, detect anomalies directly, + modify Marketplace law, or consult the organism's Brain for trade-level decisions. ## 5. Interface contract - `veto_check(action: MarketAction, trader_id) -> { approved | vetoed(reason) }` — called by From 4eb8e5185529d29fcd179a3f7c4a31ffb15281bc Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:26:18 -0700 Subject: [PATCH 09/63] docs: separate M7 logging from future SAE inference --- core/docs/plans/M7-sae-monitor.md | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/core/docs/plans/M7-sae-monitor.md b/core/docs/plans/M7-sae-monitor.md index 05a40e9..15318f0 100644 --- a/core/docs/plans/M7-sae-monitor.md +++ b/core/docs/plans/M7-sae-monitor.md @@ -17,18 +17,27 @@ F2 still provides the architectural pattern: watch traders, never the Conductor. scaffold C2. ## 3. Language & location -TBD · `src/economy/sae/`. ML interpretability (sparse autoencoder over trader action embeddings). -Shares the architectural pattern with F2 but is a separate instance scoped to the economy organ. +**Tcl 8.6 observation scaffold** · `core/src/economy/sae.tcl`. V1 records Marketplace tool-call +events and constructs typed alert envelopes for M6. Sparse-autoencoder embeddings, inference, +training, learned anomaly thresholds, and model persistence remain future work. ## 4. Does / does-not -- **Does:** intercept and log **every trader action at the Marketplace level** — the Marketplace - is the only interface traders can act through, so monitoring it captures everything; embed trader - action sequences; run SAE anomaly detection over action embeddings; flag suspicious patterns - (unusual trading frequency, outsized positions, repeated failed actions); report alerts to the Conductor (M6) with evidence; format alerts **identically to Brain messages** (same structure, same signatures). -- **Does-not:** block actions directly (Conductor decides); watch the Conductor (the stomach's "homunculus" — echoes F2-L1); correct trader behavior (detection only — F2-L2: no closed elimination loop); trade or access wallets. +- **Does now:** record every Marketplace submission at the single action ingress; preserve Trader, + tool, payload/result metadata in the monitor log; construct `SAEAlert` envelopes with Trader, + alert type, evidence, severity, and timestamp for M6. +- **Does not now:** embed actions, run a sparse autoencoder, learn anomaly thresholds, or infer + suspiciousness autonomously. +- **Does not conceptually:** block actions directly, watch the Conductor, correct Trader behavior, + trade, or access wallets. Enforcement remains M6/M1/M4. ## 5. Interface contract +Implemented Tcl surface: +- `record_tool_call(trader_id, tool, payload, result, timestamp)` — append observation. +- `alert(trader_id, alert_type, evidence, severity, timestamp) -> SAEAlert`. +- `log()` — current in-memory observations. +Future SAE inference may consume the same observation log, but V1 alerts are explicitly created +by callers/tests rather than autonomously inferred by a trained sparse autoencoder. ## 6. Dependencies & stubs - From 95675dba089588e9da0bf2c009f6a8d54c72f650 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:27:07 -0700 Subject: [PATCH 10/63] docs: close M3e V1 build and verification checklist --- core/docs/plans/M3e-tokenomics-macro-sims.md | 49 +++++++++++++------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/core/docs/plans/M3e-tokenomics-macro-sims.md b/core/docs/plans/M3e-tokenomics-macro-sims.md index 9e63a22..59ab5d6 100644 --- a/core/docs/plans/M3e-tokenomics-macro-sims.md +++ b/core/docs/plans/M3e-tokenomics-macro-sims.md @@ -105,24 +105,39 @@ across the heaviest numerical sims. - **L5 (C4):** DeXposure contagion is **directional** — protocol A's exposure to protocol B is not symmetric. The exposure matrix $E_{ij}$ is not assumed symmetric. -## 8. Build steps -1. Implement Euler-Maruyama SDE solver for a simple token model (supply + staking). -2. Define the state vector $X_t$ and drift/diffusion functions for a reference token. -3. Add stock-flow accounting (verify conservation). -4. Implement kinked lending rate model (Aave-style) with liquidation cascade simulation. -5. Implement DeXposure credit propagation network with VAR impulse responses. -6. Implement composable yield optimizer (risk-adjusted return maximization). -7. Wire M2 on-chain data → state estimation / calibration. -8. Add monetary policy events (halving, burn) as drift discontinuities. +## 8. Build status +1. **Done:** Euler–Maruyama SDE solver and moment-law characterization. +2. **Done:** conserved aggregate token state with circulating/staked/locked/burned/minted stocks. +3. **Done:** discrete halving/emission and burn policy flows. +4. **Done:** kinked lending curve plus iterative liquidation cascade simulation. +5. **Done:** directional exposure propagation and VAR impulse-response kernels. +6. **Done:** exact constrained quadratic yield optimizer with active-set/KKT solution. +7. **Done:** M2 `on_chain_event` → native Kalman state estimation/calibration. +8. **Done:** ten bounded prediction types → Tcl runner → M3 hub → Marketplace. +9. **Future fidelity:** explicit multi-protocol graph ingestion, multi-token correlated state, and + protocol-specific lending curves. -## 9. Tests -SDE: sample paths have correct mean (matches drift) and variance (matches diffusion). Stock-flow: -conservation holds across all time steps. Halving: supply growth rate drops at halving event. -Lending: rate curve exhibits kink at $U_{\text{opt}}$; liquidation cascades triggered when -collateral ratio breached. DeXposure: shock to protocol A propagates to protocol B through shared -collateral; isolated protocols unaffected. Yield: optimizer rebalances toward highest risk-adjusted -APY. Calibration: state estimate converges to observed data. Bounds: SDE confidence bands cover -realized paths on backtest. Speed: sim tick-advances at 90:1. +## 9. Verification +Dedicated `M3e Tokenomics CI` compiles both native binaries with +`gfortran -std=f2018 -Wall -Wextra -Werror -pedantic`. + +Native tests cover: +- Euler–Maruyama mean and variance laws. +- stock-flow conservation and token-state transitions. +- halving discontinuities. +- kinked lending behavior. +- multi-hop liquidation contagion with isolated-protocol control. +- directional VAR impulse propagation. +- yield-allocation normalization and KKT stationarity. +- Kalman convergence and uncertainty reduction. + +The Tcl boundary suite covers runner availability, M2 `on_chain_event` → Fortran → M3 +publication, all ten prediction types satisfying hub bounds/quality ranges, and explicit failure +on insufficient history. The current final-head contract is `4 passed / 0 failed`. + +Backtest coverage calibration of forecast intervals against long external histories remains a +future empirical-validation task; V1 verifies structural bounds rather than claiming calibrated +frequentist coverage. ## 10. V1 decisions and future extensions - **Token universe:** V1 is token-agnostic. M2 chooses the ticker and supplies its policy/state From 6bc45e8dc8b64f307dda5a750a77f08aac22c7e6 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:27:13 -0700 Subject: [PATCH 11/63] docs: add economy runtime truth table --- core/src/economy/README.md | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/core/src/economy/README.md b/core/src/economy/README.md index e00254d..da38f9d 100644 --- a/core/src/economy/README.md +++ b/core/src/economy/README.md @@ -1,6 +1,8 @@ # Economy organ — M0 stomach -Executable scaffold for M0–M7. The stomach is an OUTER organ: its only organism-facing product is an Ada-bound `organ_secretion`; it never joins the inner bus. +Executable M0–M7 economy scaffold. The stomach is an OUTER organ: its organism-facing contract is +an Ada-bound `organ_secretion`; it never joins the inner bus. Native simulation runtime is +currently end-to-end for M3a/M3b/M3c/M3e and kernel-only for M3d/M3f/M3g. ## Implemented now @@ -23,16 +25,40 @@ tclsh core/src/economy/tests/stomach.test Expected: `Total 17 Passed 17 ... Failed 0` once the current branch is checked out. -The simulator family also has its own polyglot driver: +The simulator family also has its own polyglot native-test driver. This verifies locally +available native kernels; it does not imply that every engine has a Tcl query bridge: ```sh tclsh core/src/economy/sims/run_tests.tcl ``` -It executes Tcl + every native suite whose runtime is installed. Use `--strict` to make missing R/ECLiPSe/Foundry runtimes a failure rather than an explicit skip. +It executes hub/runtime tests plus every native suite whose runtime is installed. Use `--strict` +to make missing external runtimes a failure rather than an explicit skip. Dedicated GitHub +Actions workflows additionally verify the M2→native→Hub integration boundaries for M3a, M3b, +M3c, and M3e. M3d/M3f/M3g still need equivalent facade/query bridges. ## Public scaffold API `::stomach::Economy` exposes `register_trader`, `bind_wallet`, `submit_action`, `feed_publish`, `feed_history`, `sim_publish`, `query_predictions`, `statistical_runner_available`, `statistical_query`, `statistical_from_feed`, `amm_runner_available`, `amm_from_feed`, `sociological_runner_available`, `sociological_from_feed`, `tokenomics_runner_available`, `tokenomics_from_feed`, `sim_engines`, `sim_engine_status`, `sim_horizons`, `sim_running`, `sim_advance`, `conductor_veto_next`, `conductor_pause`, `conductor_resume`, `sae_alert`, `tax_event`, and `secretion`. -`secretion` returns the envelope-compatible metadata `source stomach`, `destination ada_border`, `provenance organ_secretion`. The runtime Pony↔Tcl bridge is still an integration task; no code may shortcut D1 while that bridge is built. +`secretion` returns envelope-compatible metadata `source stomach`, `destination ada_border`, +`provenance organ_secretion`. This is a contract/staging surface today: the Pony↔Tcl runtime +bridge is still an integration task. No code may shortcut D1 while that bridge is built. + +## Runtime truth table + +| Surface | Current state | +|---|---| +| M3a statistical | V1 native R bridge, M2 calibrated, Hub published | +| M3b sociological | V1 native ECLiPSe bridge, persistent populations, Hub published | +| M3c AMM/liquidity | V1 read-only Solidity bridge, M2 calibrated, Hub published | +| M3d MEV/adversarial | native Fortran kernel/tests; facade bridge open | +| M3e tokenomics/macro | V1 native Fortran query bridge, Kalman calibrated, Hub published | +| M3f consensus/staking | native ECLiPSe kernel/tests; facade bridge open | +| M3g microstructure | native Fortran kernel/tests; facade bridge open | +| M4 custody/signing | absent; binding + exposure brakes only | +| M5 Trader inference | absent; identity/specialization/pause state only | +| M6 Conductor inference | absent; deterministic veto/pause/alert handling only | +| M7 SAE inference | absent; Marketplace logging + alert envelopes only | +| live chain broadcast | deliberately absent | +| Pony↔Tcl Ichor bridge | open | From e826296238e364deec111d297a57acd671659fa6 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:27:18 -0700 Subject: [PATCH 12/63] docs: distinguish native sims from wired runtime bridges --- core/src/economy/sims/README.md | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/core/src/economy/sims/README.md b/core/src/economy/sims/README.md index 0d59d7e..8168097 100644 --- a/core/src/economy/sims/README.md +++ b/core/src/economy/sims/README.md @@ -1,18 +1,23 @@ # M3 simulator family -Seven native simulator engines live here behind the Tcl M3 hub. +Seven native simulator engines live here behind the Tcl M3 hub. **Native source presence is not +the same thing as runtime integration.** The current state is: -| ID | Engine | Native language | Implemented kernel | -|---|---|---|---| -| M3a | statistical | R | V1 complete: GBM/Merton/Heston, CF option calibration, GARCH, HMM/Viterbi, fitted rough vol, DCC+t-copula, Bayesian+ARIMA, VaR/ES, empirical scoring, 7 typed predictions, price+DEX-pool calibration | -| M3b | sociological | ECLiPSe Prolog | V1 complete: 5 archetypes, replicator + UCB learning, adaptive HK, complex contagion, HJB/FP MFG, pump/dump ABM, 9 bounded predictions, persistent populations, empirical scoring | -| M3c | AMM/liquidity | Solidity + Foundry | V1 complete: x*y=k, IL/slippage, concentrated positions, LP/JIT strategies, backrun/sandwich pops, two-pool routing, 5 bounded predictions, price+pool calibration | -| M3d | MEV/adversarial | Fortran 2018 | all-pay PGA, block knapsack, cross-chain path comparison, sandwich score | -| M3e | tokenomics/macro | Fortran 2018 | V1 complete: conserved token state, Euler-Maruyama, Kalman calibration, halving/burn policy, kinked lending, liquidation cascades, directional VAR contagion, exact yield optimizer, 10 bounded predictions | -| M3f | consensus/staking | ECLiPSe Prolog | honesty replicator, validator Markov transitions, incentive threshold, liveness | -| M3g | microstructure | Fortran 2018 | depth/slippage, spread, Almgren-Chriss schedule, arb decay, impact fit | +| ID | Engine | Native language | Native implementation | Tcl/M3 runtime bridge | +|---|---|---|---|---| +| M3a | statistical | R | V1 complete: GBM/Merton/Heston, CF calibration, GARCH, HMM/Viterbi, rough vol, DCC+t-copula, Bayesian+ARIMA, VaR/ES, 7 predictions | **wired + CI verified** | +| M3b | sociological | ECLiPSe Prolog | V1 complete: 5 archetypes, UCB/replicator, adaptive HK, contagion, HJB/FP MFG, pump/dump, 9 predictions | **wired + CI verified** | +| M3c | AMM/liquidity | Solidity + Foundry | V1 complete: x*y=k, concentrated positions, LP/JIT, backrun/sandwich, 2-pool routing, 5 predictions | **wired + CI verified** | +| M3d | MEV/adversarial | Fortran 2018 | PGA, block knapsack, cross-chain paths, sandwich scoring | **open** | +| M3e | tokenomics/macro | Fortran 2018 | V1 complete: conserved state, SDE, Kalman, policy, lending/cascade, VAR contagion, exact yield optimizer, 10 predictions | **wired + CI verified** | +| M3f | consensus/staking | ECLiPSe Prolog | honesty replicator, validator Markov transitions, incentive threshold, liveness | **open** | +| M3g | microstructure | Fortran 2018 | depth/slippage, spread, Almgren-Chriss schedule, arb decay, impact fit | **open** | -`registry.tcl` is the canonical engine inventory. `scheduler.tcl` is the live six-horizon wall→sim clock. It starts at 90 simulated seconds per wall second for tick/hourly and accelerates the longer horizons according to the M3 spec. +`registry.tcl` is the canonical engine inventory. `scheduler.tcl` is the live six-horizon +wall→sim clock. It starts at 90 simulated seconds per wall second for tick/hourly and accelerates +longer horizons according to the M3 spec. The clock does **not yet dispatch every native engine**: +M3a/M3b/M3c/M3e execute when their calibrated facade query is called; scheduler-driven automatic +refresh is still an M3 hub task. Run all locally available native tests: From 11fb58d37a047de4c143dd647be395d806d37c55 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:27:42 -0700 Subject: [PATCH 13/63] docs: harden economy contributor runtime boundaries --- core/src/economy/AGENTS.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/core/src/economy/AGENTS.md b/core/src/economy/AGENTS.md index 5b1aa16..913d522 100644 --- a/core/src/economy/AGENTS.md +++ b/core/src/economy/AGENTS.md @@ -10,13 +10,26 @@ Local guide for `core/src/economy`. The design source of truth is `core/docs/pla - M4 wallet brakes are independent of M1/M6. Keep 1:1 trader↔wallet binding literal. - M7 observes and reports. Enforcement belongs to M6/M1/M4, not the monitor. - Live key custody and chain broadcast are intentionally absent until the M4 key-storage specification is ratified. Do not smuggle them in as convenience helpers. +- Registry/source presence is **not** runtime wiring. M3a/M3b/M3c/M3e have tested native query + bridges; M3d/M3f/M3g do not yet. +- The M3 horizon clock is live, but it does not yet dispatch/refresh all native engines + automatically. Do not document or code-review it as continuous native execution until that loop + exists and has an explicit test. +- M5 identity state is not Trader inference, M6 veto state is not Conductor inference, and M7 + logging is not SAE inference. Keep those boundaries literal. ## Build/test -Tcl 8.6, standard library only: +Tcl 8.6 orchestration, plus native simulator runtimes: ```sh tclsh core/src/economy/tests/stomach.test +tclsh core/src/economy/sims/tests/hub_runtime.test +tclsh core/src/economy/sims/run_tests.tcl ``` -Use test-first changes. Keep `stomach.tcl` as composition/facade; put component behavior in the M1–M7 module that owns it. +Dedicated CI owns the end-to-end native boundary for M3a, M3b, M3c, and M3e. Fortran kernels are +compiled under `-std=f2018 -Wall -Wextra -Werror -pedantic`. + +Use test-first changes for behavior. Keep `stomach.tcl` as composition/facade; put component +behavior in the M1–M7 module or M3 native runner that owns it. From 88ed8b86128cd01214996c0097dab79fd00fdd1c Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:27:45 -0700 Subject: [PATCH 14/63] docs: update bus topology for current economy runtime --- core/docs/bus-topology.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core/docs/bus-topology.md b/core/docs/bus-topology.md index d65a725..1b7ff75 100644 --- a/core/docs/bus-topology.md +++ b/core/docs/bus-topology.md @@ -10,8 +10,8 @@ External (world: user / network) ▼ outer bus — ICHOR (Pony) ┌─────────────────────────────────────────────────────────┐ │ OUTER ORGANS │ -│ • stomach / economy organ (small-model operated; │ -│ digests external input → context) │ +│ • stomach / economy organ (Tcl/polyglot outer organ; │ +│ M3 native sims + deterministic brakes) │ │ • microagents │ │ • SAE (sparse autoencoder) │ │ • MoRAG = GoDAGRAG │ @@ -59,6 +59,9 @@ not shared modules. | tool-schema store (mini-rag reads this) — *COBOL store #2* | COBOL | decided | | COBOL invariant laws / E1 (the law vault, separate) | COBOL | given | | drive-box (A1) | R | existing | +| stomach/economy orchestration (M0–M7) | Tcl 8.6 | executable scaffold | +| M3a / M3b / M3c / M3e native sim bridges | R / ECLiPSe / Solidity / Fortran | V1 wired | +| M3d / M3f / M3g native sim kernels | Fortran / ECLiPSe / Fortran | kernels; bridge open | | MoRAG / GoDAGRAG (outer) | Haskell or Crystal | open | | Hermes | OpenHermes agent (external model) | given | @@ -85,5 +88,7 @@ blocking in a protected action), **tasks = workers** that call into the organs - **MoRAG / GoDAGRAG language** (Haskell vs Crystal vs other). - Each outer organ's hand-off shape to Ada. - ~~The stomach/economy organ's exact placement + which small model runs it.~~ - **→ placed:** M-series (M0–M7) in `docs/plans/`. Outer organ on Ichor; data feeds via M2 (Data Feeds). - See M0 (hub), M6 (Conductor — orchestration, provenance chain, S1/S2 compliance). + **→ placed:** M-series (M0–M7) in `docs/plans/`. Outer-organ contract targets Ichor; internal + orchestration lives in `core/src/economy/`. M3a/M3b/M3c/M3e are runtime-wired; M3d/M3f/M3g + are native kernels. The actual Pony↔Tcl economy/Ichor runtime bridge is still open. + See M0 (hub) and M6 (supervision). From 49662e647abe8ff5f36ce904647f86764307a607 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:27:49 -0700 Subject: [PATCH 15/63] docs: distinguish Ichor stomach smoke from M0 runtime --- core/src/ichor/README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/src/ichor/README.md b/core/src/ichor/README.md index c886cbd..02746dd 100644 --- a/core/src/ichor/README.md +++ b/core/src/ichor/README.md @@ -24,8 +24,10 @@ the `Barrier` first (**L2**); every envelope carries **provenance** (**L3**). - `broker.pony` — the outer `Broker` (register + route; forces Ada-bound traffic through the barrier). - `organ.pony` — `OrganReceiver` interface + a `StubOrgan` for tests. -- `main.pony` — smoke wiring: stomach digests → inbound to Ada (admitted); raw - external → Ada (rejected); outer organ→organ (direct). +- `main.pony` — **transport smoke stub**, not the executable economy runtime: stomach-shaped + test traffic → Ada (admitted); raw external → Ada (rejected); outer organ→organ (direct). + The real M0 Tcl/polyglot economy facade lives under `core/src/economy/` and is not yet bridged + into this Pony process. - `ichor_ada_shim.c` — **STUB** C/Fortran seam to the Ada border (not yet wired). ## Build / run @@ -40,5 +42,6 @@ is ephemeral; toolchain is per-session, reinstalled by the SessionStart hook). ## Status Provisional **outer-bus** scaffold — compiles and runs. The `Barrier` is a **stand-in**, not the real safety screen; the real screen is Ada `Trust_Guard` -+ the E1 invariant laws, reached over the seam (transport TBD — IPC vs in-proc -is an open decision). Nothing here reaches the inner brain directly. ++ the E1 invariant laws. Two runtime seams remain explicit: Pony↔Ada for the real D1 screen, and +Pony↔Tcl for the executable M0 economy facade. IPC vs in-process/FFI transport is still open. +Nothing here reaches the inner brain directly. From 3a6f23a6baf78603f79dd664e3d9387590d25efd Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:27:55 -0700 Subject: [PATCH 16/63] docs: refresh economy entry in docmap --- docmap.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docmap.yaml b/docmap.yaml index 3d72890..8295918 100644 --- a/docmap.yaml +++ b/docmap.yaml @@ -41,9 +41,9 @@ organs: build: "src/endocrine/run_tests.sh ; src/endocrine/etr/run_etr_tests.sh" - path: core/src/economy agents_md: core/src/economy/AGENTS.md - lang: tcl - role: M0 stomach/economy organ scaffold — M1–M7 simulation and Ada-bound secretion - build: "tclsh core/src/economy/tests/stomach.test" + lang: [tcl, r, eclipse_prolog, solidity, fortran] + role: M0 stomach/economy outer-organ scaffold — M1–M7; M3a/b/c/e runtime-wired; M3d/f/g native kernels; Ada-bound secretion contract + build: "tclsh core/src/economy/tests/stomach.test ; tclsh core/src/economy/sims/tests/hub_runtime.test ; tclsh core/src/economy/sims/run_tests.tcl" - path: core agents_md: core/AGENTS.md lang: [ada, cobol] From 534a1b0e23d99dc72a11178e709a29dbc66762d1 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:28:29 -0700 Subject: [PATCH 17/63] docs: normalize economy implementation paths --- core/docs/plans/M3a-statistical-sims.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/docs/plans/M3a-statistical-sims.md b/core/docs/plans/M3a-statistical-sims.md index 14ef920..001cd8a 100644 --- a/core/docs/plans/M3a-statistical-sims.md +++ b/core/docs/plans/M3a-statistical-sims.md @@ -22,7 +22,7 @@ the boundary integration suite are green. Core methods C4/C5; implementation C3; parameterization remains data-dependent rather than hardcoded. ## 3. Language & location -**R 4.x** (apt `r-base-core`) · `src/economy/sims/statistical/`. Vital CRAN packages only: +**R 4.x** (apt `r-base-core`) · `core/src/economy/sims/statistical/`. Vital CRAN packages only: `HiddenMarkov` (Viterbi filter, forward-backward, Baum-Welch), `rugarch` (univariate GARCH volatility — GJR/EGARCH families, ML fitting), `rmgarch` (DCC-GARCH cross-asset correlation). Everything else is hand-rolled with base R primitives (`optim`, `fft`, `arima`, matrix ops): From 900f0cdff9d8e76b9d7e8ec5d45363ad71d238de Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:28:33 -0700 Subject: [PATCH 18/63] docs: normalize economy implementation paths --- core/docs/plans/M3b-sociological-sims.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/docs/plans/M3b-sociological-sims.md b/core/docs/plans/M3b-sociological-sims.md index 5618a40..4a19b46 100644 --- a/core/docs/plans/M3b-sociological-sims.md +++ b/core/docs/plans/M3b-sociological-sims.md @@ -23,7 +23,7 @@ both the ECLiPSe kernel and M2→M3b→Hub boundary. Foundations C4/C5; implemen population parameterization remains evidence-driven rather than hardcoded to literal persons. ## 3. Language & location -**ECLiPSe Prolog 7.2** · `src/economy/sims/sociological/`. Libraries: **ic** (interval +**ECLiPSe Prolog 7.2** · `core/src/economy/sims/sociological/`. Libraries: **ic** (interval constraints — bounds propagation for BoundedPrediction ranges), **eplex** (LP/MIP via COIN-OR CLP/CBC — Nash equilibrium computation). Game-theoretic equilibria, replicator dynamics, and strategy evolution are naturally expressed as logical relations over population states; Nash From d1aad6034698664c87be7140775040cc48997d67 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:28:37 -0700 Subject: [PATCH 19/63] docs: normalize economy implementation paths --- core/docs/plans/M3c-amm-liquidity-sims.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/docs/plans/M3c-amm-liquidity-sims.md b/core/docs/plans/M3c-amm-liquidity-sims.md index 4091cf7..3d0e79f 100644 --- a/core/docs/plans/M3c-amm-liquidity-sims.md +++ b/core/docs/plans/M3c-amm-liquidity-sims.md @@ -19,7 +19,7 @@ boundary on an ephemeral local Anvil instance. Mathematical foundations C5; impl live-market parameterization remains data-dependent. ## 3. Language & location -**Solidity** + **Foundry** (forge, anvil) · `src/economy/sims/amm/`. Foundry is hosted +**Solidity** + **Foundry** (forge, anvil) · `core/src/economy/sims/amm/`. Foundry is hosted separately from the session container — not a session-start install. M3c's output enters the system through Hub like every other sim, same `BoundedPrediction` schema, same M2 path. On-chain-equivalent fixed-point arithmetic reproduces the exact invariant calculations DEXs From 98a4e5641f9430bb0e79e44f40ad121377ad3a6a Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:28:40 -0700 Subject: [PATCH 20/63] docs: normalize economy implementation paths --- core/docs/plans/M3d-mev-adversarial-sims.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/docs/plans/M3d-mev-adversarial-sims.md b/core/docs/plans/M3d-mev-adversarial-sims.md index b4f1548..fbbf53c 100644 --- a/core/docs/plans/M3d-mev-adversarial-sims.md +++ b/core/docs/plans/M3d-mev-adversarial-sims.md @@ -20,7 +20,7 @@ under strict gfortran flags. WENO/Kolokoltsov and DSMFG bilevel solvers remain i Core game/knapsack foundations C4; implementation C2; parameterization C1. ## 3. Language & location -**Fortran 2018** (gfortran) · `src/economy/sims/mev/`. Build: **fpm**. Dependencies: **OpenBLAS** +**Fortran 2018** (gfortran) · `core/src/economy/sims/mev/`. Build: **fpm**. Dependencies: **OpenBLAS** (LAPACK/BLAS via native Fortran interfaces). Hand-rolled: Box-Muller RNG, WENO stencils, SDE solvers, knapsack, JSON I/O against fixed schemas. Dense numerical loops for PDE solvers (WENO shock-capturing), knapsack combinatorics, and continuous-time auction modeling at the throughput From 37959b6780f5fb8fdfbdb0a5f8be445b1fb67a68 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:28:47 -0700 Subject: [PATCH 21/63] docs: normalize economy implementation paths --- core/docs/plans/M3e-tokenomics-macro-sims.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/docs/plans/M3e-tokenomics-macro-sims.md b/core/docs/plans/M3e-tokenomics-macro-sims.md index 59ab5d6..69cdc74 100644 --- a/core/docs/plans/M3e-tokenomics-macro-sims.md +++ b/core/docs/plans/M3e-tokenomics-macro-sims.md @@ -25,7 +25,7 @@ verifies the numerical kernel and the M2→Fortran→Hub boundary. Foundations C C3; live-token parameterization remains data-driven. ## 3. Language & location -**Fortran 2018** (gfortran) · `src/economy/sims/tokenomics/`. Build: **fpm**. Dependencies: +**Fortran 2018** (gfortran) · `core/src/economy/sims/tokenomics/`. Build: **fpm**. Dependencies: **OpenBLAS** (LAPACK/BLAS via native Fortran interfaces). Hand-rolled: Box-Muller RNG, SDE solvers, JSON I/O against fixed schemas. SDE solvers (Euler-Maruyama, Milstein), state-space estimation, and VAR impulse responses are dense matrix-heavy loops where Fortran's array From 08b26b7a8db9b49e12b488489af73ccc523c521a Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:28:51 -0700 Subject: [PATCH 22/63] docs: normalize economy implementation paths --- core/docs/plans/M3f-consensus-staking-sims.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/docs/plans/M3f-consensus-staking-sims.md b/core/docs/plans/M3f-consensus-staking-sims.md index af6a387..3ce92bc 100644 --- a/core/docs/plans/M3f-consensus-staking-sims.md +++ b/core/docs/plans/M3f-consensus-staking-sims.md @@ -15,7 +15,7 @@ Native tests live beside the engine. The large-population HJB/Fokker-Planck MFG incremental. Foundations C4; implementation C2; protocol parameterization C1. ## 3. Language & location -**ECLiPSe Prolog 7.2** · `src/economy/sims/consensus/`. Libraries: **ic** (interval +**ECLiPSe Prolog 7.2** · `core/src/economy/sims/consensus/`. Libraries: **ic** (interval constraints), **eplex** (LP/MIP via COIN-OR CLP/CBC — Nash equilibrium via linear programming). Markov chain transition rules, Nash equilibrium search, and replicator dynamics are constraint-satisfaction problems over validator populations; Prolog's backtracking search finds From 8243d3a9bf37285d480d007f0d22d1a43edb6d90 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:28:53 -0700 Subject: [PATCH 23/63] docs: normalize economy implementation paths --- core/docs/plans/M3g-market-microstructure-sims.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/docs/plans/M3g-market-microstructure-sims.md b/core/docs/plans/M3g-market-microstructure-sims.md index b3a7c98..0404d64 100644 --- a/core/docs/plans/M3g-market-microstructure-sims.md +++ b/core/docs/plans/M3g-market-microstructure-sims.md @@ -17,7 +17,7 @@ under strict gfortran flags. Full order-event simulation and venue adapters rema Microstructure C4; Almgren-Chriss C5; implementation C2; DEX-specific calibration C1/C2. ## 3. Language & location -**Fortran 2018** (gfortran) · `src/economy/sims/microstructure/`. Build: **fpm**. Dependencies: +**Fortran 2018** (gfortran) · `core/src/economy/sims/microstructure/`. Build: **fpm**. Dependencies: **OpenBLAS** (LAPACK/BLAS via native Fortran interfaces). Hand-rolled: Riccati ODE solver, order-book state arrays, JSON I/O against fixed schemas. Almgren-Chriss optimal execution is a dense ODE (Riccati equations) — Fortran's home turf; LAPACK is native, array intrinsics map From 3532ee024b4f6b6996dd8a909141f4e88df325c8 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:30:18 -0700 Subject: [PATCH 24/63] docs: finish M1 implemented-vs-target contract --- core/docs/plans/M1-marketplace.md | 69 ++++++++++++++++--------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/core/docs/plans/M1-marketplace.md b/core/docs/plans/M1-marketplace.md index 82fb855..bce3b60 100644 --- a/core/docs/plans/M1-marketplace.md +++ b/core/docs/plans/M1-marketplace.md @@ -37,29 +37,30 @@ auditable admission ordering. M3a/M3b/M3c/M3e currently publish when their calibrated facade query runs; a scheduler-driven continuous refresh loop is still open. Traders see individual sim results and decide how to weight them. -- `law_check(action: MarketAction) -> { pass | violation(rule_id, reason) }` — deterministic, - pure function. The law script is loaded at startup and **immutable at runtime** (mirrors S3 / - the COBOL vault pattern). -- `veto_check(action: MarketAction, trader_id) -> { approved | vetoed(reason) }` — calls M6 - Conductor. -- `execute(action: MarketAction, wallet_id) -> { tx_hash | error }` — on-chain execution via - wallet API. -- `tax_event(trader_id, income_amount) -> receipt` — triggers tax collection. +- Implemented deterministic gate: required fields, action allowlist, chain allowlist, and numeric + notional validation. The full startup-loaded S-expression constitution is **designed but not + implemented**; see `M1-law-script-design.md`. +- Implemented M4 brake: exact Trader↔wallet binding plus exposure checks. +- Implemented M6 gate: one-shot veto is consumed only after deterministic law and wallet checks. +- Implemented execution result: `{ status succeeded execution simulated tx_id simtx-* }`. +- Implemented M7 observation: every submission is logged before admission checks. +- Tax staging exists on M0 as `tax_event`; Marketplace does not currently calculate realized + income or move value. -## 6. Dependencies & stubs -- M4 Wallets — signing + execution; *stub:* "if finished, would sign and broadcast tx [details]". -- M5 Traders — action source; *stub:* "if finished, would submit [action] for [asset] at [price]". -- M6 Conductor — veto authority; *stub:* "if finished, would evaluate [action] against risk policy; approving". -- M7 SAE — action log consumer; *stub:* "if finished, would analyze [action] for behavioral anomalies". -- Blockchain RPCs — on-chain execution; *stub:* "if finished, would execute [action] on [chain], returning tx_hash". +## 6. Dependencies & runtime state +- M4 Wallets — implemented binding + exposure brakes; no signer/custody. +- M5 Traders — registry/state exists; AI action generation is open. +- M6 Conductor — implemented deterministic veto/pause surface; AI judgment is open. +- M7 SAE — implemented logging + caller-created alert envelopes; SAE inference is open. +- M3 Sims — latest prediction reads are implemented through Marketplace. +- Blockchain RPC/signing/broadcast — deliberately absent. ## 7. Invariants / laws - **L1 (C5):** **all market actions route through the Marketplace** — no direct on-chain execution by any trader. This is the economy organ's S1. -- **L2 (C5):** the **deterministic law script is immutable at runtime** — loaded at startup, - never modified by traders, conductor, or sims. Changes require a restart with a new script - version **and a pair of signatures from the operator and the Homunculus**. Mirrors the COBOL - vault (S3). +- **L2 (C5 target):** the future startup-loaded deterministic law script is immutable at runtime + and dual-signed. **Current implementation note:** V1 uses hardcoded deterministic allowlists and + field/notional validation; the signed fixed-combinator evaluator is still open. - **L3 (C4):** **no wallet, no access** — a trader without a bound wallet cannot submit actions. The Marketplace enforces this before any other check. - **L4 (C4):** **veto is checked after law, before execution** — law violations are rejected @@ -67,23 +68,23 @@ auditable admission ordering. - **L5 (C4):** **every action is logged** — SAE (M7) receives a record of every submitted action (including rejected ones) for behavioral analysis. -## 8. Build steps -1. Define `MarketAction` types and the law script format. -2. Implement the law checker (deterministic, pure, non-Turing). -3. Wire veto check to M6 Conductor. -4. Wire execution to M4 Wallet API. -5. Wire action logging to M7 SAE. -6. Implement tax collection on realized income. +## 8. Build status +1. **Done:** `MarketAction` validation and deterministic hardcoded gate. +2. **Done:** M4 binding/exposure brake before execution. +3. **Done:** M6 veto ordering after deterministic law. +4. **Done:** M7 logging for pass/fail submissions. +5. **Done:** simulation-only execution receipts. +6. **Designed, not implemented:** signed fixed-combinator S-expression constitution. +7. **Open by design:** signer/RPC/broadcast execution and realized-income tax calculation. ## 9. Tests -Law enforcement: known violations rejected; valid actions pass. Veto: conductor veto blocks -execution. Wallet binding: walletless trader rejected. Logging: every action (pass + fail) logged. -Tax: income event triggers tax stub. Immutability: law script cannot be modified at runtime. +The M0 contract suite verifies walletless rejection, wrong-wallet rejection, deterministic law +rejection, law-before-veto ordering, valid simulation-only execution, per-action/session brakes, +pass/fail M7 logging, pause/resume, and staged tax receipts. There is no live-chain execution test +because no live-chain execution surface exists. ## 10. Open items -- The law script language/format (DSL? declarative rules? S-expressions?). -- Which blockchain protocols/RPCs to support initially. -- Position limits, drawdown stops, and other risk parameters — live in the law script or in the - Conductor's judgment? -- Tax rate / calculation method (fixed %, tiered, per-asset?). -- Non-Turing law script design — to discuss (format, expressiveness, bounds). +- Implement the already-decided fixed-combinator S-expression evaluator and signature checks. +- Ratify M4 custody before choosing or exposing any chain execution adapter. +- Position/drawdown rules that belong in deterministic law versus M6 judgment. +- Realized-income accounting and tax calculation/transfer policy. From aa16d5c3e9714b28c8059335b3e5ac2d04b956cb Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:30:24 -0700 Subject: [PATCH 25/63] docs: finish M2 current-runtime checklist --- core/docs/plans/M2-data-feeds.md | 49 ++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/core/docs/plans/M2-data-feeds.md b/core/docs/plans/M2-data-feeds.md index e8da27c..fc86aa3 100644 --- a/core/docs/plans/M2-data-feeds.md +++ b/core/docs/plans/M2-data-feeds.md @@ -38,38 +38,43 @@ and persistent storage remain separate ingress work. `confidence` ∈ [0.0, 10.0] — data source reliability per position produced (exchange-reported price = high; RSS sentiment = lower). Sims produce even finer-grained confidence. -## 6. Dependencies & stubs -- External data sources (price APIs, RSS, RPC nodes) — *stub:* canned market data replay. -- M1 Marketplace — execution data source (fills, positions); *stub:* canned fills. -- M3 Sims — primary consumer; *stub:* print data points. -- M5 Traders — secondary consumer; *stub:* print data points. +## 6. Dependencies & runtime state +- External data adapters — open; callers/tests currently provide normalized data directly. +- M1 Marketplace execution feedback — open; live fills/portfolio state do not exist yet. +- M3a/M3b/M3c/M3e — active history consumers through their Tcl runners. +- M3d/M3f/M3g — native kernels exist; no feed-query bridge yet. +- M5 Traders — no direct feed-reader facade is currently exposed. ## 7. Invariants / laws - **L1 (C4):** data feeds are **raw and unnormalized in meaning** — the pipeline normalizes *format* (schema, timestamps, units) but never interprets, filters, or editorialize content. -- **L2 (C4):** **bidirectional flow** — external data flows in (market → sims/traders), and - internal execution data flows back (marketplace → sims). Both directions use the same - `NormalizedDatum` shape. +- **L2 (C4 target):** **bidirectional flow** — external observations and internal execution + feedback use the same normalized datum shape. **Current implementation:** normalized ingress + to history is live; execution-fill/portfolio feedback is reserved because execution is + simulation-only and no feedback adapter exists yet. - **L3 (C3):** **backpressure, not drop** — if a consumer is slow, buffer up to a cap, then apply backpressure to the source. Never silently drop data points. - **L4 (C3):** every datum carries a **source and timestamp** — consumers can always trace where data came from and when. -## 8. Build steps -1. Define `NormalizedDatum` and `FeedType` shapes. -2. Implement the pub/sub pipeline (subscribe, publish, distribute). -3. Wire external source adapters (start with one price API + one RSS feed). -4. Wire M1 execution data feedback loop. -5. Implement session-scoped time-series history (ring buffer). +## 8. Build status +1. **Done:** normalized datum storage shape. +2. **Done:** per-feed ordered in-session history. +3. **Done:** explicit capacity backpressure with no silent eviction. +4. **Done:** M3a/M3b/M3c/M3e calibrated history consumers. +5. **Open:** external source adapters and provider normalization. +6. **Open:** subscriptions/fan-out, time-range queries, persistence, and execution feedback. ## 9. Tests -Normalization: heterogeneous inputs produce uniform `NormalizedDatum` output. Pub/sub: subscriber -receives published data. History: query returns correct time range. Backpressure: slow consumer -does not cause data loss. Bidirectional: marketplace fills reach sims via the feed. +The M0 suite verifies accepted publishes, capacity backpressure, preserved buffered history, and +source/timestamp/confidence retention. Dedicated M3 integration suites prove real consumers for +`price_tick`, `rss_news`, `dex_pool_state`, and `on_chain_event`. Subscription, provider +normalization, persistence, and execution-feedback tests do not exist because those surfaces are +not implemented. ## 10. Open items -- Which price APIs / RSS sources to support initially (CoinGecko? DeFiLlama? specific DEX - subgraphs?). -- History buffer size / eviction policy. -- Whether feeds need authentication / rate limiting management. -- Latency requirements (how fresh must data be for each consumer type?). +- External source/adaptor set and credentials/rate-limit handling. +- Per-feed capacity and persistence policy beyond the current configured in-session cap. +- Subscription/fan-out semantics if push delivery is added. +- Freshness/latency contracts per consumer. +- Execution-fill / portfolio-state feedback once a real execution layer exists. From 517037bf1a6ef68aec70f15b6db27cff4d43d0c3 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:30:28 -0700 Subject: [PATCH 26/63] docs: finish M4 current-vs-custody boundary --- core/docs/plans/M4-wallets.md | 49 ++++++++++++++++------------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/core/docs/plans/M4-wallets.md b/core/docs/plans/M4-wallets.md index 527076a..8c5079d 100644 --- a/core/docs/plans/M4-wallets.md +++ b/core/docs/plans/M4-wallets.md @@ -37,40 +37,37 @@ Implemented Tcl surface: Future custody surface such as `sign`, `balance`, key generation/import, and transaction history is intentionally **not implemented** and must not be inferred from the component name. -## 6. Dependencies & stubs -- M5 Traders — 1:1 binding; *stub:* canned trader ID. -- M1 Marketplace — signing requests come through marketplace only; *stub:* direct sign call. -- Blockchain nodes — balance queries and tx broadcast; *stub:* simulated chain state. -- Verschwörern Veregeister wallets — tax destination; *stub:* log transfer. +## 6. Dependencies & runtime state +- M5 Traders — implemented identity registry for 1:1 binding. +- M1 Marketplace — implemented caller of binding/exposure checks. +- Blockchain nodes / signing libraries — absent. +- Tax destination wallets — no transfer surface; M0 only stages receipt metadata. ## 7. Invariants / laws -- **L1 (C5):** **sovereign custody only** — private keys are generated locally, stored locally, - and **never leave the wallet**. No custodial service, no exchange deposit, no trust with external - parties. Our keys, our coins. +- **L1 (C5 target):** **sovereign custody only** if custody is implemented. V1 contains no keys at + all, which is stronger than accidentally introducing an unratified custody path. - **L2 (C5):** **1:1 trader binding** — each wallet is bound to exactly one trader. A trader cannot use another trader's wallet. The Marketplace enforces this. -- **L3 (C4):** **signing requires Marketplace confirmation** — a wallet will not sign a transaction - that didn't receive direct authorization from Marketpakce (M1-L1). No direct signing API for traders. +- **L3 (C4 target):** future signing requires Marketplace confirmation. V1 has no signing API for + Marketplace or Traders. - **L4 (C4):** **spending limits are wallet-level** — independent of Conductor or Marketplace limits. Defense in depth: even if other rules fail, the wallet itself caps exposure. -- **L5 (C4):** **tax collection is automatic** — realized income triggers tax staging. The trader - cannot opt out. OUT OF SCOPE +- **L5 (C4 target/out of scope):** realized-income tax policy may trigger staging/transfer later. + V1 only exposes an M0 receipt-staging hook; M4 performs no tax action. -## 8. Build steps -1. Implement key generation and secure storage. -2. Implement transaction signing for one chain. -3. Implement trader binding and Marketplace-only signing enforcement. -4. Implement algorithmic limits. +## 8. Build status +1. **Done:** permanent 1:1 Trader↔wallet binding. +2. **Done:** per-action and cumulative session exposure brakes. +3. **Done:** Marketplace-only use of the implemented wallet scaffold. +4. **Open by design:** key generation/storage, signing, balances, chain adapters, rotation/backup. ## 9. Tests -Custody: private key never appears in any response, messages, or log. -Binding: wrong trader cannot sign. -Trade limits: over-limit transaction rejects; risk :: reward ratio below-limit rejects. -Tax: out of scope. -Multi-chain: every chain produces valid signatures. +Current tests verify walletless rejection, wrong-Trader binding rejection, independent per-action +and cumulative exposure limits, and simulated spend accounting. There are intentionally no +signature/multi-chain custody tests because no key/signing implementation exists. ## 10. Open items -- Key storage format. -- Which chains to support initially. (all of them) -- Spending limit configuration (correction: This is algorithmic and hardcoded.) -- Key rotation / backup strategy. +- Ratified key storage, backup, recovery, and rotation design. +- Chain/signature support only after custody is ratified. +- Persistent time-window semantics for the currently session-cumulative exposure limit. +- Balance/transaction-history model if live custody is introduced. From aa875c55d9bead4c04b2f0cbd3f26d657501814b Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:31:00 -0700 Subject: [PATCH 27/63] docs: finish M5 scaffold and open inference work --- core/docs/plans/M5-traders.md | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/core/docs/plans/M5-traders.md b/core/docs/plans/M5-traders.md index ed49041..73ff0a0 100644 --- a/core/docs/plans/M5-traders.md +++ b/core/docs/plans/M5-traders.md @@ -45,20 +45,28 @@ Marketplace predictions; no native model/inference interface is implemented in V - **L1 (C5):** **all trades go through the Marketplace** — a trader cannot interact with any chain or protocol except via Marketplace (M1). Enforced by architecture (no direct RPC access), not just policy. - **L3 (C4):** **wallet binding is permanent** — a trader's wallet cannot be reassigned to another trader at any time. -- **L4 (C4):** **Conductor can pause** — a paused trader cannot submit actions, query sims, or read feeds until resumed by the Conductor (M6). This is mechanical. +- **L4 (C4):** **Conductor can pause** — a paused Trader cannot submit Marketplace actions or + query Marketplace predictions until resumed by M6. M2 does not currently expose a direct + Trader feed-read facade. - **L5 (C3):** trader specialization constrains strategy but not the interface — all traders use the same vocabulary regardless of specialization. -## 8. Build steps -1. Make the real build order. +## 8. Build status +1. **Done:** unique Trader registry + specialization labels. +2. **Done:** mechanical pause/resume state owned by M6. +3. **Done:** M1 rejects paused Traders and M1 prediction reads reject paused Traders. +4. **Done:** M4 enforces permanent wallet binding independently. +5. **Open:** AI inference/action-generation runtime and specialization-specific decision logic. +6. **Open:** any lower-level deterministic helper-bot framework subordinate to Traders. ## 9. Tests -Marketplace-only: trader cannot call chain RPC directly. -Wallet binding: trader uses only its bound wallet. -Pause: paused trader does not change state. -Specialization: different specializations produce different action patterns on identical market state. +Current tests verify identity existence, wallet binding through M1, pause blocking action +submission, resume restoring submission, and Marketplace-only prediction access. There is no test +for specialization-dependent action patterns because Trader inference is not implemented. ## 10. Open items -- Trader architecture -- Number of concurrent traders and resource allocation per trader. -- Specialization catalog (which types, and how do they differ in strategy?). -- Inter-trader coordination (necessary for high end maneuvers including rugpulls) \ No newline at end of file +- Trader inference architecture and model/runtime choice. +- Number of concurrent Traders and resource allocation. +- Specialization catalog and training/conditioning semantics. +- Safe coordination semantics between Traders, if any; no direct execution bypass may emerge + from coordination. +- Helper-bot interfaces that remain deterministic and subordinate to the owning Trader. \ No newline at end of file From a0bb4f8a8de6c0d4c0404a86fb643dd2d1f49c99 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:31:03 -0700 Subject: [PATCH 28/63] docs: finish M6 deterministic-vs-inference boundary --- core/docs/plans/M6-conductor.md | 52 ++++++++++++++++----------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/core/docs/plans/M6-conductor.md b/core/docs/plans/M6-conductor.md index c7e5a4c..2206131 100644 --- a/core/docs/plans/M6-conductor.md +++ b/core/docs/plans/M6-conductor.md @@ -38,10 +38,12 @@ Specialist-trained inference is a future layer, not part of the current executab the same shape it would report to the Brain. This means the Conductor can be swapped for Brain oversight without protocol changes (though the stomach normally operates autonomously). -## 6. Dependencies & stubs -- M7 SAE — anomaly reports; *stub:* no alerts (all clear). -- M1 Marketplace — veto check integration; *stub:* always-approve. -- M5 Traders — pause/resume control; *stub:* print pause/resume. +## 6. Dependencies & runtime state +- M7 SAE — implemented typed alert envelopes; autonomous SAE detection remains open. +- M1 Marketplace — implemented one-shot veto consumption after law + wallet checks. +- M5 Traders — implemented pause/resume state target. +- Specialist Conductor inference runtime — open. +- Persistent audit store — open; V1 log is in-memory. ## 7. Invariants / laws - **L1 (C5):** the Conductor **can veto, but cannot trade** — it has no wallet, no Marketplace @@ -51,30 +53,28 @@ Specialist-trained inference is a future layer, not part of the current executab are rejected before reaching the Conductor — M1-L4). - **L3 (C4):** **pause is reversible** — a paused trader can always be resumed after investigation. Pause is a breaker, not a sentence (echoes A2-L3). -- **L4 (C4):** every Conductor decision is **logged** — vetoes, pauses, resumes, dismissals. - The audit log is append-only (echoes M1-L2 / S3). -- **L5 (C4):** SAE alert format and Brain message format are **structurally identical** — same - fields, same signatures. The Conductor processes them the same way the Brain would. +- **L4 (C4):** every V1 Conductor decision is appended to the current in-memory log. Persistent, + tamper-evident audit storage is a future requirement and is not implied by the current list. +- **L5 (C4 target):** SAE and Brain oversight should converge on a compatible alert/message + contract. V1 implements the SAE alert fields used by M6; cryptographic Brain-signature + equivalence is not implemented or verified here. -## 8. Build steps -1. Define the Conductor's LLM decision model (specialist-trained; rules are enforced by the - Marketplace law script and wallet spending limits — the Conductor applies judgment). -2. Wire SAE alert intake (M7 → M6). -3. Wire Marketplace veto check (M1 → M6 → approve/veto). -4. Implement trader pause/investigate/resume flow. -5. Implement append-only decision log. +## 8. Build status +1. **Done:** M7 alert intake and severity-based pause/dismiss behavior. +2. **Done:** M1 one-shot veto integration after deterministic law. +3. **Done:** Trader pause/resume control. +4. **Done:** in-memory decision log for veto/pause/resume/dismiss. +5. **Open:** specialist Conductor inference/investigation. +6. **Open:** persistent/tamper-evident audit storage and any escalation protocol. ## 9. Tests -Veto: flagged action is vetoed; unflagged action approved. Pause: paused trader cannot submit -actions. Resume: cleared trader resumes normal operation. No trading: Conductor cannot submit -`MarketAction`. Law supremacy: Conductor cannot override a law violation (never reaches -Conductor). Audit: every decision appears in the log. Alert format: SAE alert parses identically -to Brain message structure. +Current tests verify veto, law-before-veto ordering, severe-alert pause, low-severity dismissal +path, pause blocking M1 actions/prediction reads, resume, and decision logging. There is no +specialist-inference or Brain-signature compatibility test because those layers do not exist. ## 10. Open items -- Conductor AI model selection and training data (what does "specialist training" look like?). -- Veto criteria beyond SAE alerts (does the Conductor have independent judgment, or only - responds to SAE reports?). -- Escalation path — if the Conductor is uncertain, does it escalate to the organism's Brain? - Or is the stomach fully autonomous? (Current design: fully autonomous.) -- Multiple Conductors for redundancy? +- Specialist Conductor model/runtime and training/evaluation protocol. +- Judgment inputs beyond explicit M7 alerts. +- Persistent audit semantics. +- Escalation policy, if any, to the organism's Brain while preserving scoped stomach autonomy. +- Redundancy/multiple-Conductor design, if needed. From d7b6ac8261fcb7b8a99607ae077a8cb6c4b6de76 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:31:10 -0700 Subject: [PATCH 29/63] docs: finish M7 observation-vs-SAE boundary --- core/docs/plans/M7-sae-monitor.md | 41 ++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/core/docs/plans/M7-sae-monitor.md b/core/docs/plans/M7-sae-monitor.md index 15318f0..f847c19 100644 --- a/core/docs/plans/M7-sae-monitor.md +++ b/core/docs/plans/M7-sae-monitor.md @@ -39,23 +39,40 @@ Implemented Tcl surface: Future SAE inference may consume the same observation log, but V1 alerts are explicitly created by callers/tests rather than autonomously inferred by a trained sparse autoencoder. -## 6. Dependencies & stubs -- +## 6. Dependencies & runtime state +- M1 Marketplace — implemented observation point for action submissions and prediction queries. +- M6 Conductor — implemented alert consumer. +- Trader-action embedding model / trained SAE — absent. +- Persistent observation store — absent; V1 log is in-memory. ## 7. Invariants / laws -- **L1 (C5):** the SAE watches everyone in the orgab. -- **L2 (C5):** **every tool call is logged** — no trader action escapes monitoring. This is enforced architecturally (tool call interception), not by policy. +- **L1 (C5 scope):** M7 watches Trader activity at the stomach's Marketplace boundary; it does + not watch the Conductor or unrelated organism processes. +- **L2 (C5 within current surface):** every Marketplace submission and Marketplace prediction + query is logged. Future Trader tools must either route through an instrumented boundary or add + equivalent M7 observation before this can truthfully extend to "every tool call." - **L3 (C4):** **detection only, no enforcement** — the SAE reports to the Conductor; it never blocks, pauses, or modifies trader actions itself. Echoes F2-L2 (no closed elimination loop). -- **L4 (C4):** **alert format = Brain message format** — structurally identical, same signatures. This is not coincidental; it ensures the Conductor can be supervised by the Brain using the same protocol if the organism ever needs to override stomach autonomy. -- **L5 (C3):** the SAE model is **trained on normal trader behavior** — anomalies are deviations from the learned normal, not violations of predefined rules (those are the law script's job in M1). +- **L4 (C4 target):** M7 alert structure should remain compatible with any future Brain oversight + protocol. V1 implements the shared semantic fields, not cryptographic signature equivalence. +- **L5 (C3 target):** a future SAE model should learn normal Trader behavior and detect deviations + rather than duplicate M1 law. No trained SAE exists in V1. -## 8. Build steps -1. Implement action interception at the Marketplace level (M1). -2. Define the action embedding scheme (how tool calls are vectorized). -3. Train the SAE on normal trader behavior (bootstrapped from simulated trading). -4. Implement anomaly scoring and alert threshold. -5. Wire alerts to Conductor (M6) in Brain-compatible message format. +## 8. Build status +1. **Done:** Marketplace-level action/prediction-query logging. +2. **Done:** typed `SAEAlert` envelope with bounded severity. +3. **Done:** alert delivery path into M6. +4. **Open:** action embedding scheme. +5. **Open:** SAE training/inference, learned anomaly scoring, and thresholds. +6. **Open:** persistent observation/model state. ## 9. Tests +Current M0 tests verify pass/fail Marketplace submissions are logged, severe caller-created alerts +reach M6 and pause the target Trader, and severity is bounded. There is no learned-anomaly test +because no SAE inference exists. ## 10. Open items +- Action-sequence embedding representation. +- SAE architecture/training data and evaluation protocol. +- Learned anomaly threshold calibration. +- Persistent observation/model storage. +- Instrumentation contract for any future Trader tools outside the current Marketplace methods. From 82bbfe49210be190c69937751ddaf9d1b70b0931 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:31:26 -0700 Subject: [PATCH 30/63] docs: label M1 law format as selected but unimplemented --- core/docs/plans/M1-law-script-design.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/docs/plans/M1-law-script-design.md b/core/docs/plans/M1-law-script-design.md index ed30136..8b65e8c 100644 --- a/core/docs/plans/M1-law-script-design.md +++ b/core/docs/plans/M1-law-script-design.md @@ -1,5 +1,10 @@ # M1 Marketplace — Deterministic Law Script Format Decision Document +> **Status:** design decision, not current runtime. The fixed-combinator S-expression format is +> the selected target constitution. Current `core/src/economy/marketplace.tcl` still uses a +> hardcoded deterministic action/chain/notional gate; parser, signatures, proof traces, and +> startup-loaded immutable law blobs remain implementation work. + ## Executive Summary The M1 Marketplace's law script is a **constitution**: deterministic, auditable, non-Turing, loaded at startup, immutable at runtime (L2). This document compares three candidate formats for expressing M1's scoped invariants (L1–L5), position limits, drawdown stops, action allowlists, wallet-binding requirements, and chain allowlists. We recommend **S-expressions with a fixed combinator set** for its optimal balance of expressiveness, auditability, non-Turing guarantees, and failure-mode isolation. From b6291484a7e2ed2b6fbab5a7cc9deec954bd088c Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:37:17 -0700 Subject: [PATCH 31/63] docs: encode economy doctrine and authority --- core/docs/plans/M0-economy-organ-hub.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/core/docs/plans/M0-economy-organ-hub.md b/core/docs/plans/M0-economy-organ-hub.md index 1d4dd4b..35b1e21 100644 --- a/core/docs/plans/M0-economy-organ-hub.md +++ b/core/docs/plans/M0-economy-organ-hub.md @@ -11,6 +11,28 @@ organism are TBD and out of scope. **scoped autonomy** and **multiple layers of failsafe braking** — it does not ask the organism's Brain for permission to trade. +## 1A. Operational doctrine +- **Local objective:** maximize durable profit. Profit is the stomach's terminal local objective; + the organism interprets the resulting surplus as a **metabolic signal and resource flow**, + especially additional compute budget. +- **Success is not raw P&L alone:** a successful stomach compounds capital, survives regime + changes, learns from prediction error, preserves optionality, improves capital allocation, + develops competent Traders, avoids ruin, and produces surplus sufficient to further the + organism's compute capacity. +- **Authority:** autonomy is constitutional rather than permissive. Routine trade-level judgment + remains inside the stomach. The Brain may set broad prohibitions, risk posture, capital/budget + envelopes, and in exceptional cases veto an individual trade; ordinary supervision belongs to + M6. Brain directives must enter through the organism boundary and may not bypass M1/M4/M6. +- **Hard hierarchy:** M1 constitutional law and M4 capability ceilings are non-overridable at + action time. M6 may narrow what is allowed, never widen it beyond M1/M4. +- **Memory:** the stomach must form durable economic memory from repetition: source reliability, + regime behavior, Trader calibration, recurring protocol precursors, intervention outcomes, and + repeated anomaly patterns. Raw observations remain attributable to M2 provenance; learned + assessments remain separate derived records. +- **Failure condition:** architectural failure includes ruin, repeated uncorrected miscalibration, + inability to preserve scoped autonomy, or any path that obtains profit by bypassing M1/M4/M6/M7 + or the organism boundary. + ## 2. Status / certainty EXECUTABLE OUTER-ORGAN SCAFFOLD. `core/src/economy/` composes M1–M7, exposes normalized feed/history surfaces, runs the M3 horizon clock, wires M3a/M3b/M3c/M3e through native runtimes, From e8a6e0930f7009f557c959c28340ed977b151b9b Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:37:20 -0700 Subject: [PATCH 32/63] docs: encode economy doctrine and authority --- core/docs/plans/M1-marketplace.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/docs/plans/M1-marketplace.md b/core/docs/plans/M1-marketplace.md index bce3b60..7065c20 100644 --- a/core/docs/plans/M1-marketplace.md +++ b/core/docs/plans/M1-marketplace.md @@ -6,6 +6,21 @@ must route**. No trader may buy, sell, mint, or interact with any on-chain proto the Marketplace. Enforces a **deterministic law script** (scoped invariants — the marketplace's own constitution) and integrates the **Conductor's veto** (M6) before execution. +## 1A. Operational doctrine +- **Purpose:** M1 is a constitution and execution harness, not a strategy engine. It makes some + actions structurally unavailable; it does not decide which lawful action is economically wise. +- **Authority:** deterministic law is above Trader judgment, M6 judgment, and exceptional Brain + vetoes. M6/Brain may further restrict lawful action but may not legalize a constitutional + violation. +- **Scope of law:** encode catastrophic/constitutional prohibitions, capability boundaries, + identity/binding requirements, and hard action constraints. Ordinary economic doctrine, + opportunity selection, and uncertainty judgment belong to M5/M6. +- **Auditability:** every decision must be reproducible from the action, law version, M4 brake + state, M6 veto state, and logged evidence. A future law DSL must produce a proof/violation trace. +- **Completion criterion:** M1 is complete for live execution only when the signed immutable law + evaluator, M4-authorized signer path, M7 logging, M6 restriction ordering, and simulation/live + parity tests all exist. Adding RPC alone is not completion. + ## 2. Status / certainty SCAFFOLD · EXECUTABLE SIMULATION. `core/src/economy/marketplace.tcl` implements the single action ingress, deterministic admission ordering, supervisor veto, monitor logging, and From 7abe178dee5300b1a8caeaaee05ae27fa2302e3d Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:37:23 -0700 Subject: [PATCH 33/63] docs: encode economy doctrine and authority --- core/docs/plans/M2-data-feeds.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/docs/plans/M2-data-feeds.md b/core/docs/plans/M2-data-feeds.md index fc86aa3..c046c33 100644 --- a/core/docs/plans/M2-data-feeds.md +++ b/core/docs/plans/M2-data-feeds.md @@ -6,6 +6,20 @@ flowing into both the Marketplace (M1) and the Sims (M3). Sits between them — produces execution data (fills, positions, P&L) that feeds back into Sims, and Sims produce predictions that inform Traders operating through the Marketplace. Data Feeds is the bridge. +## 1A. Operational doctrine +- **Purpose:** M2 preserves observations; it does not adjudicate reality. +- **Epistemic rule:** provenance, source, timestamp, confidence, and contradiction are first-class. + Conflicting observations coexist intact. M2 must not collapse them into a synthetic consensus + datum unless an explicitly named downstream process requests and records that transformation. +- **Normalization rule:** normalize representation, units, and schema - never silently normalize + away disagreement, source identity, uncertainty, or missingness. +- **Derived belief separation:** source reliability, regime-conditioned trust, and repeated + source failure may become durable economic memory, but those assessments are derived records + linked back to immutable observations; they do not rewrite M2 history. +- **Completion criterion:** a source adapter is complete only when it preserves provenance, + exposes loss/backpressure behavior explicitly, survives reconnect/replay without duplication, + and can reproduce the normalized history consumed by downstream Sims. + ## 2. Status / certainty SCAFFOLD · EXECUTABLE. `core/src/economy/feeds.tcl` implements normalized in-session history and explicit backpressure without silent drop. External stream adapters remain open. Role C3; From 0bf927dc51356b523737742db69fddf23ce24160 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:37:26 -0700 Subject: [PATCH 34/63] docs: encode economy doctrine and authority --- core/docs/plans/M3-sims-hub.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/docs/plans/M3-sims-hub.md b/core/docs/plans/M3-sims-hub.md index 805d7b4..407fac8 100644 --- a/core/docs/plans/M3-sims-hub.md +++ b/core/docs/plans/M3-sims-hub.md @@ -11,6 +11,24 @@ hub directly. This is the hub spec; individual sim types have dedicated sub-spec The academic foundations span AMM mechanism design [1,2], MEV game theory [3,4,5], macro tokenomics via SDEs [6,7], and evolutionary consensus games [8–11]. +## 1A. Operational doctrine +- **Purpose:** Sims are complementary mathematical senses over different scopes of the same + environment. They are not contestants trying to become one canonical market oracle. +- **No forced reconciliation:** apparent disagreement is first treated as a question of scope, + horizon, conditioning, or resolution. Traders interpret local implications; M6 interprets + portfolio/system implications. M3 itself does not vote, average, or choose a winner. +- **Scoped correctness:** `correctness` means empirical accuracy with respect to a Sim's declared + target, horizon, conditioning assumptions, and regime. Scores from different Sim types are not + directly comparable unless their scopes are explicitly aligned. +- **Calibration metric:** every prediction family should accumulate longitudinal calibration loss + against realization and declared uncertainty, conditioned on regime: + `L(prediction, realization, declared_uncertainty | scope, regime)`. +- **Memory:** repeated calibration failures, regime-specific strengths, and persistent bias become + durable economic memory. A single miss is evidence; repetition changes trust. +- **Completion criterion:** a native Sim is runtime-complete only when calibration input, + native execution, bounded publication, realization capture, longitudinal scoring, degraded-state + handling, and replayable tests all exist. Source presence alone is never completion. + ## 2. Status / certainty MIXED · EXECUTABLE HUB + FOUR V1 RUNTIME BRIDGES + THREE NATIVE KERNELS. `core/src/economy/sims/` contains all seven native engine trees, a seven-engine registry, the From f6b8351a6245d87b048437e7eecf2b4a00d50783 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:37:51 -0700 Subject: [PATCH 35/63] docs: encode trader supervision and memory doctrine --- core/docs/plans/M4-wallets.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/docs/plans/M4-wallets.md b/core/docs/plans/M4-wallets.md index 8c5079d..c70a409 100644 --- a/core/docs/plans/M4-wallets.md +++ b/core/docs/plans/M4-wallets.md @@ -7,6 +7,23 @@ handles multiple chains internally (EVM, Solana, etc.). A trader without a walle the Marketplace (M1). Wallets hold keys, sign transactions, and enforce wallet-level trade limits. Tax is collected on trader income and routed to the Verschwörern Veregeister wallets (stub — M0). +## 1A. Operational doctrine +- **Purpose:** M4 is the final physical/economic brake around assigned capital. It protects the + organism from a Trader, a Trader from itself, the assigned funding from other Traders, and the + capital base from catastrophic loss. +- **Authority:** hard M4 ceilings are absolute at action time. Trader, M6, and Brain veto authority + may narrow what happens but may not override an M4 ceiling for an individual action. +- **Change semantics:** higher authority may change future M4 configuration only through an + explicit reconfiguration/version transition; there is no per-trade "override the wallet" path. +- **Funding isolation:** each Trader's capital is independently bounded and attributed. One + Trader's loss, conviction, or disagreement does not silently consume another Trader's funding. +- **Performance role:** M4 is not judged by profit. It succeeds when forbidden exposure is + physically unavailable and when every admitted spend can be attributed to one Trader, one + configured ceiling set, and one Marketplace action. +- **Completion criterion:** custody is complete only when binding, ceilings, local key custody, + signer authorization, recovery/rotation, transaction attribution, and tamper-resistant limit + versioning are all tested. A working signature primitive alone is insufficient. + ## 2. Status / certainty SCAFFOLD · PARTIAL. `core/src/economy/wallets.tcl` implements permanent 1:1 binding and independent exposure limits for the simulation scaffold. Custody/signing implementation remains From 76b8329d598ab0f456e0a8e678eeb5afe202f110 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:37:54 -0700 Subject: [PATCH 36/63] docs: encode trader supervision and memory doctrine --- core/docs/plans/M5-traders.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/core/docs/plans/M5-traders.md b/core/docs/plans/M5-traders.md index 73ff0a0..bdaa755 100644 --- a/core/docs/plans/M5-traders.md +++ b/core/docs/plans/M5-traders.md @@ -4,6 +4,27 @@ The economy organ's hands: **specialized AI instances** that buy, sell, and mint cryptocurrency and NFTs. Each trader is bound to a Wallet (M4), operates through the Marketplace (M1), queries Market to receive predictions (M3), and are monitored by the SAE (M7) via Marketplace. Multiple traders operate concurrently with **different heuristics and specializations**. +## 1A. Operational doctrine +- **Purpose:** Traders are genuinely agentic economic entities with persistent identity, goals, + learning, judgment under uncertainty, specialization, and responsibility for independently + assigned capital. Their local objective is profitable deployment of that capital. +- **Independence:** Traders need not converge or agree. Their funding stores are independent; + disagreement matters only through realized performance, capital allocation, shared market + effects, or M6 systemic risk. +- **Uncertainty:** each Trader chooses how declared uncertainty affects an individual action, + position size, evidence gathering, or abstention - but only inside the uncertainty regime and + broader boundaries assigned by M6. Actions outside the allowed regime are unavailable. +- **Performance:** raw P&L is the local objective; **loss relative to prediction** is the primary + diagnostic metric. A loss that was correctly anticipated is categorically different from a + confident unanticipated loss. +- **Longitudinal metric:** each Trader accumulates regime-conditioned prediction/calibration loss + over time rather than being judged by isolated wins or losses. Repetition changes capital trust. +- **Memory:** durable Trader memory should preserve its own forecasts, declared uncertainty, + realized outcomes, recurring failure modes, regime-specific competence, and intervention history. +- **Completion criterion:** a Trader runtime is not complete until it can form a prediction, + declare uncertainty, choose a lawful action, use only its assigned capital, record the decision + basis, receive realization, update memory, and expose longitudinal calibration/P&L metrics. + ## 2. Status / certainty SCAFFOLD · PARTIAL. `core/src/economy/traders.tcl` implements trader identity, specialization labels, and mechanical pause/resume state. Trader inference remains open. From c1e61f63366b376689b494ab1fe9f7febc29af9c Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:37:57 -0700 Subject: [PATCH 37/63] docs: encode trader supervision and memory doctrine --- core/docs/plans/M6-conductor.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/core/docs/plans/M6-conductor.md b/core/docs/plans/M6-conductor.md index 2206131..e12eadd 100644 --- a/core/docs/plans/M6-conductor.md +++ b/core/docs/plans/M6-conductor.md @@ -7,6 +7,28 @@ SAE (M7) and acts on them. The Conductor is the stomach's own judgment — it do organism's Brain for trade-level decisions. It supervises; the deterministic law script (M1) constrains; together they form the multi-layered braking system. +## 1A. Operational doctrine +- **Purpose:** M6 is the stomach's big-picture intelligence: risk officer, immune response, + executive judgment, and portfolio/system situational awareness. Traders optimize locally; + M6 sees interactions, concentration, correlated failure, uncertainty regime, and organ-level risk. +- **Authority:** M6 handles most trade supervision and may veto/pause/restrict lawful Trader + behavior. It may never legalize an M1 violation or override an M4 hard ceiling. +- **Uncertainty regime:** M6 assigns broad admissible uncertainty boundaries by regime, asset, + action type, or portfolio condition. Traders choose actions inside those boundaries; actions + whose declared uncertainty falls outside the active regime are mechanically prevented. +- **Brain relationship:** routine supervision stays local. Brain may impose broad trade-type + prohibitions, risk posture, budget constraints, and exceptionally veto an individual trade. + Such directives enter through the organism boundary and are enforced through M6/M1 rather than + creating a direct Brain→execution bypass. +- **Reconciliation:** M6 does not ask Sims to agree. It interprets complementary scopes together + and resolves system-level implications that exceed any one Trader's local view. +- **Performance:** judge M6 by prevented ruin, calibrated restriction quality, intervention + outcomes, false-positive/false-negative rates, and whether it preserves profitable autonomy + rather than by the number of vetoes issued. +- **Completion criterion:** the supervisory AI is complete only when uncertainty-regime policy, + portfolio-wide state, intervention reasoning, reversible restrictions, outcome feedback, + persistent decision memory, and Brain-directive handling are all explicit and testable. + ## 2. Status / certainty SCAFFOLD · EXECUTABLE SUPERVISION. `core/src/economy/conductor.tcl` implements veto ordering, pause/resume, alert intake, and an in-memory decision log. Specialist inference and persistent From 39603b2512b4ed2dffee289257325ff2591762ec Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:38:00 -0700 Subject: [PATCH 38/63] docs: encode trader supervision and memory doctrine --- core/docs/plans/M7-sae-monitor.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/docs/plans/M7-sae-monitor.md b/core/docs/plans/M7-sae-monitor.md index f847c19..864980c 100644 --- a/core/docs/plans/M7-sae-monitor.md +++ b/core/docs/plans/M7-sae-monitor.md @@ -10,6 +10,24 @@ processes them through the same pathway. Extends the F2 (SAE monitor) pattern to the economy organ's internal domain. F2 watches subagents at the organism level; M7 watches traders at the stomach level. +## 1A. Operational doctrine +- **Purpose:** M7 is an evidence-producing anomaly sensor and memory feeder, not a guilt engine. +- **Signal taxonomy:** unusualness, danger, suspected compromise, suspected deception, + strategy/identity incoherence, and recurrence are distinct signals. They must not be collapsed + into one undifferentiated anomaly score. +- **Anomaly is legitimate until interpreted:** a Trader may intentionally behave unusually because + its specialization or market regime demands it. M7 reports the deviation and evidence; M6 decides + whether the behavior is dangerous, adaptive, profitable, compromised, or benign. +- **Repetition matters:** recurring deviations, repeated failed predictions, repeated source/ + behavior couplings, and recurring precursors accumulate as durable economic memory. Frequency + and recurrence are evidence, not automatic enforcement. +- **Separation of roles:** M7 detects and records; M6 interprets and restricts; M1/M4 enforce hard + boundaries. M7 must not become a shadow policy engine. +- **Completion criterion:** trained M7 is complete only when observations are instrumented, + embeddings/features are attributable, recurrence is represented, signal classes are separable, + alert evidence is inspectable, feedback from M6/outcomes updates memory, and false-positive / + false-negative behavior is measured over time. + ## 2. Status / certainty SCAFFOLD · PARTIAL. `core/src/economy/sae.tcl` records Marketplace-level trader calls and constructs alert envelopes consumed by M6. Sparse-autoencoder inference/training remains open. From 74b7c9ec284239cceb54f9b68e418bb789c013f1 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:38:33 -0700 Subject: [PATCH 39/63] docs: make M0 memory and directive contracts actionable --- core/docs/plans/M0-economy-organ-hub.md | 26 ++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/core/docs/plans/M0-economy-organ-hub.md b/core/docs/plans/M0-economy-organ-hub.md index 35b1e21..587fa59 100644 --- a/core/docs/plans/M0-economy-organ-hub.md +++ b/core/docs/plans/M0-economy-organ-hub.md @@ -64,13 +64,20 @@ runtime bridge between the Tcl economy facade and Ichor is still open. ## 5. Interface contract - **Ichor interface (outbound):** `Envelope(Stomach, AdaBorder, OrganSecretion, payload)` — market state summaries, prediction digests, and tax receipts cross Ada to reach the inner brain. -- **Ichor interface (inbound):** organism directives arrive via Ichor (e.g. risk posture changes, - budget adjustments from A2 energy). +- **Ichor interface (inbound):** organism directives arrive via Ichor. Target directive shape: + `RiskDirective { directive_id, scope, prohibited_trade_types, uncertainty_ceiling?, + budget_delta?, effective_at, expires_at?, rationale, provenance }`. Exceptional individual + action vetoes use the same path and name the exact `action_id`; there is no Brain→execution + shortcut. - **Internal wiring:** Marketplace (M1) owns the action and prediction-read boundary. M2 stores normalized histories consumed by M3 native bridges. Wallets (M4) currently provide identity binding and exposure brakes only. Conductor (M6) owns veto/pause state. SAE (M7) records Marketplace-level tool calls and constructs alerts for M6. All Trader actions route through Marketplace. +- **Economic memory contract (target):** + `EconomicMemoryRecord { subject_type, subject_id, regime, metric, value, recurrence, + observation_refs, first_seen, last_seen, provenance }`. M0 owns persistence/lookup semantics; + producers remain M2/M3/M5/M6/M7. Derived memory never rewrites source observations. - **Tax stub:** `transfer_tax(amount, source_wallet, dest_wallet) -> receipt` — automation hook for Verschwörern Veregeister internal wallet-to-wallet transfer. **Out of scope** — stub only. @@ -95,9 +102,12 @@ runtime bridge between the Tcl economy facade and Ichor is still open. 1. **Done:** executable M1–M7 Tcl scaffold and contract tests. 2. **Done:** M3 registry/scheduler plus native runtime bridges for M3a/M3b/M3c/M3e. 3. **Done:** simulation-only tax receipt staging. -4. **Open:** runtime bridge between the economy facade and Pony/Ichor. -5. **Open:** M3d/M3f/M3g query bridges and scheduler-driven automatic refresh. -6. **Open by design:** live custody/signing/broadcast, Trader/Conductor inference, SAE inference. +4. **Next:** define and persist the M0 economic-memory record/lookup contract. +5. **Next:** define inbound `RiskDirective` handling and prove broad/individual Brain vetoes enter + through M6/M1 without bypassing M4. +6. **Open:** runtime bridge between the economy facade and Pony/Ichor. +7. **Open:** M3d/M3f/M3g query bridges and scheduler-driven automatic refresh. +8. **Open by design:** live custody/signing/broadcast, Trader/Conductor inference, SAE inference. ## 9. Tests Executable contract suite: `tclsh core/src/economy/tests/stomach.test`. The current 17 @@ -109,8 +119,10 @@ and the running scheduler. Native simulator tests are driven by integration test. ## 10. Open items -- Reward signal protocol from economy organ to organism (TBD, out of scope). +- Define the outbound metabolic signal: realized surplus, available capital, compute-budget + contribution, drawdown, and confidence in those quantities. +- Persistent economic-memory store and replay semantics. +- Brain `RiskDirective` ingress and exceptional action-veto routing. - Pony↔Tcl process/FFI boundary for the outer-organ facade. - Automatic M3 engine scheduling/refresh and failure isolation. -- Persistent economy state beyond the current in-session Tcl objects. - Ratified M4 custody design before any signer or broadcaster exists. From 5c1c2e63748db922defacb22a1e63a14d8959f83 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:38:35 -0700 Subject: [PATCH 40/63] docs: make M3 scoped correctness measurable --- core/docs/plans/M3-sims-hub.md | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/core/docs/plans/M3-sims-hub.md b/core/docs/plans/M3-sims-hub.md index 407fac8..ba5b775 100644 --- a/core/docs/plans/M3-sims-hub.md +++ b/core/docs/plans/M3-sims-hub.md @@ -75,11 +75,17 @@ wire protocol on every native engine. Current bridges are deliberately native: - `publish(sim_type, BoundedPrediction)` validates and stores the latest bounded result for one of `statistical`, `sociological`, `amm_liquidity`, `mev_adversarial`, `tokenomics_macro`, `consensus_staking`, or `market_microstructure`. -- `BoundedPrediction { value, lower_bound, upper_bound, confidence, correctness, certainty, +- Current V1 minimum: + `BoundedPrediction { value, lower_bound, upper_bound, confidence, correctness, certainty, time_horizon, sim_type, timestamp, token_ticker, recent_shift, ...metadata }`. - Every hub-facing numeric result obeys `lower_bound ≤ value ≤ upper_bound`; each quality metric - is in `[0,10]`. Native engines may preserve extra metadata such as M3b population state, - M3c range/routing detail, or M3e yield-allocation weights. + Every numeric result obeys `lower_bound ≤ value ≤ upper_bound`; quality metrics are in + `[0,10]`. +- **Required next schema revision for meaningful correctness:** + `PredictionScope { target, prediction_type, horizon, conditioning, regime, calibration_window }` + travels with every result. A `correctness` value without that scope metadata is insufficient + for durable cross-time comparison. +- Native engines may preserve extra metadata such as M3b population state, M3c range/routing + detail, or M3e yield-allocation weights. - `Marketplace.predictions(trader_id, sim_type)` is the Trader-facing read path. Traders never receive the raw hub object or native runtime handle. - Current calibrated facade methods on `::stomach::Economy`: @@ -123,8 +129,11 @@ wire protocol on every native engine. Current bridges are deliberately native: 2. **Done:** seven-engine registry and six-horizon live scheduler. 3. **Done for M3a/M3b/M3c/M3e:** M2 history → native calibration/query → M3 publish. 4. **Kernel done, bridge open for M3d/M3f/M3g:** add the same process/query boundary. -5. **Open:** scheduler-driven automatic refresh/publish loop independent of Trader queries. -6. **Open:** persistent calibration/history storage beyond the in-session M2 buffers. +5. **Next:** add common `PredictionScope` metadata and realization linkage so correctness is + explicitly target/horizon/regime scoped. +6. **Next:** persist per-Sim longitudinal calibration-loss summaries into M0 economic memory. +7. **Open:** scheduler-driven automatic refresh/publish loop independent of Trader queries. +8. **Open:** persistent calibration/history storage beyond the in-session M2 buffers. ## 9. Tests - `tclsh core/src/economy/sims/tests/hub_runtime.test` verifies the registry and six-horizon clock. @@ -137,8 +146,11 @@ wire protocol on every native engine. Current bridges are deliberately native: ## 10. Open items - Native runtime/query bridges for M3d, M3f, and M3g. +- Common `PredictionScope` + realization-reference schema. +- Regime-conditioned longitudinal calibration-loss persistence. - Scheduler-driven automatic engine refresh and bounded republishing. -- Per-sim calibration cadence and failure/degraded-state policy. -- Cross-sim aggregation or meta-prediction, if added at all. +- Per-Sim calibration cadence and failure/degraded-state policy. +- No default cross-Sim voting/averaging layer; any future synthesis must preserve source scopes + and remain a Trader/M6 interpretation aid rather than declaring a winner. - Persistent history/calibration state beyond the in-session M2 buffer. - Explicit CPU/GPU budgets and admission/backpressure for expensive native queries. From 11da1ad32dea07585c4fae558cc36adc397b4cea Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:38:54 -0700 Subject: [PATCH 41/63] docs: make M1 constitutional decisions replayable --- core/docs/plans/M1-marketplace.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/docs/plans/M1-marketplace.md b/core/docs/plans/M1-marketplace.md index 7065c20..83c4050 100644 --- a/core/docs/plans/M1-marketplace.md +++ b/core/docs/plans/M1-marketplace.md @@ -55,6 +55,10 @@ auditable admission ordering. - Implemented deterministic gate: required fields, action allowlist, chain allowlist, and numeric notional validation. The full startup-loaded S-expression constitution is **designed but not implemented**; see `M1-law-script-design.md`. +- Target law result: + `LawDecision { action_id, law_version, pass, violation_id?, proof_trace, evaluated_at }`. + This record must be stable enough for replay and audit; M6 veto state is deliberately outside + the law proof. - Implemented M4 brake: exact Trader↔wallet binding plus exposure checks. - Implemented M6 gate: one-shot veto is consumed only after deterministic law and wallet checks. - Implemented execution result: `{ status succeeded execution simulated tx_id simtx-* }`. @@ -89,8 +93,9 @@ auditable admission ordering. 3. **Done:** M6 veto ordering after deterministic law. 4. **Done:** M7 logging for pass/fail submissions. 5. **Done:** simulation-only execution receipts. -6. **Designed, not implemented:** signed fixed-combinator S-expression constitution. -7. **Open by design:** signer/RPC/broadcast execution and realized-income tax calculation. +6. **Next:** implement `LawDecision` with versioned proof/violation traces. +7. **Next:** implement the signed fixed-combinator S-expression constitution against those traces. +8. **Open by design:** signer/RPC/broadcast execution and realized-income tax calculation. ## 9. Tests The M0 contract suite verifies walletless rejection, wrong-wallet rejection, deterministic law From f4ff3c9a797596d61e77aec35108de494a583c2e Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:38:57 -0700 Subject: [PATCH 42/63] docs: make M4 hard ceilings versioned and absolute --- core/docs/plans/M4-wallets.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/docs/plans/M4-wallets.md b/core/docs/plans/M4-wallets.md index c70a409..3ac2867 100644 --- a/core/docs/plans/M4-wallets.md +++ b/core/docs/plans/M4-wallets.md @@ -50,6 +50,11 @@ Implemented Tcl surface: - `spending_check(wallet_id, action)` — independent exposure brake. - `record_spend(wallet_id, notional)` — simulation accounting only. - `count()`. +- Target hard-limit record: + `WalletLimitVersion { wallet_id, trader_id, version, per_action_limit, cumulative_limit, + effective_at, supersedes?, provenance }`. + Every admitted action must name the exact active limit version. No API accepts a per-action + override. Future custody surface such as `sign`, `balance`, key generation/import, and transaction history is intentionally **not implemented** and must not be inferred from the component name. @@ -76,7 +81,9 @@ history is intentionally **not implemented** and must not be inferred from the c 1. **Done:** permanent 1:1 Trader↔wallet binding. 2. **Done:** per-action and cumulative session exposure brakes. 3. **Done:** Marketplace-only use of the implemented wallet scaffold. -4. **Open by design:** key generation/storage, signing, balances, chain adapters, rotation/backup. +4. **Next:** version hard limits and attach the active limit version to every admitted spend. +5. **Next:** persist capital-at-risk / spend history per Trader wallet for longitudinal analysis. +6. **Open by design:** key generation/storage, signing, balances, chain adapters, rotation/backup. ## 9. Tests Current tests verify walletless rejection, wrong-Trader binding rejection, independent per-action From 584fe188ec9644ce7c6f34692362267b0e16733b Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:39:00 -0700 Subject: [PATCH 43/63] docs: make Trader calibration and outcomes explicit --- core/docs/plans/M5-traders.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/core/docs/plans/M5-traders.md b/core/docs/plans/M5-traders.md index bdaa755..f21cdc6 100644 --- a/core/docs/plans/M5-traders.md +++ b/core/docs/plans/M5-traders.md @@ -55,6 +55,16 @@ Implemented Tcl registry/state surface: The future AI Trader layer must produce Marketplace `MarketAction` requests and consume Marketplace predictions; no native model/inference interface is implemented in V1. +Target decision/outcome records: +- `TraderDecision { decision_id, trader_id, regime, forecast_refs, declared_uncertainty, + action, capital_at_risk, rationale_digest, created_at }`. +- `TraderOutcome { decision_id, realization_refs, realized_pnl, calibration_loss, + realized_at }`. + +`calibration_loss` is the longitudinal diagnostic: it measures realized outcome against the +Trader's own prediction and declared uncertainty within the active regime. P&L remains the local +objective; calibration loss explains whether wins/losses were expected or surprising. + ## 6. Dependencies & stubs - M1 Marketplace — implemented action/prediction boundary. - M4 Wallets — implemented 1:1 binding + exposure brakes; custody/signing absent. @@ -76,8 +86,11 @@ Marketplace predictions; no native model/inference interface is implemented in V 2. **Done:** mechanical pause/resume state owned by M6. 3. **Done:** M1 rejects paused Traders and M1 prediction reads reject paused Traders. 4. **Done:** M4 enforces permanent wallet binding independently. -5. **Open:** AI inference/action-generation runtime and specialization-specific decision logic. -6. **Open:** any lower-level deterministic helper-bot framework subordinate to Traders. +5. **Next:** define/persist `TraderDecision` and `TraderOutcome` records. +6. **Next:** compute regime-conditioned calibration-loss rate and P&L rate over rolling windows. +7. **Next:** expose M6 uncertainty-regime admission to the Trader before M1 submission. +8. **Open:** AI inference/action-generation runtime and specialization-specific decision logic. +9. **Open:** any lower-level deterministic helper-bot framework subordinate to Traders. ## 9. Tests Current tests verify identity existence, wallet binding through M1, pause blocking action From 4a4f4d7fad7ceadb98221b2cc1511925ec750585 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:39:23 -0700 Subject: [PATCH 44/63] docs: make M6 uncertainty and Brain authority executable --- core/docs/plans/M6-conductor.md | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/core/docs/plans/M6-conductor.md b/core/docs/plans/M6-conductor.md index e12eadd..299d281 100644 --- a/core/docs/plans/M6-conductor.md +++ b/core/docs/plans/M6-conductor.md @@ -54,11 +54,17 @@ Specialist-trained inference is a future layer, not part of the current executab - `receive_alert(alert: SAEAlert) -> { pause(trader_id) | dismiss | escalate }`. `SAEAlert { trader_id, alert_type, evidence, severity, timestamp }`. - `investigate(trader_id) -> { clear(resume) | veto_pending_actions | restrict(new_limits) }`. -- `decision_log() -> [ConductorDecision]` — full audit trail of all veto/pause/resume/dismiss. -- **SAE/Brain message format compatibility:** the Conductor's incoming alert format is - **identical in structure and signature** to Brain messages — SAE reports to the Conductor in - the same shape it would report to the Brain. This means the Conductor can be swapped for Brain - oversight without protocol changes (though the stomach normally operates autonomously). +- `decision_log() -> [ConductorDecision]` — current in-memory audit trail. +- Target `UncertaintyRegime { regime_id, scope, action_types, assets?, max_uncertainty, + max_capital_at_risk?, effective_at, expires_at?, provenance }`. +- Target `RiskDirective { directive_id, source, scope, prohibited_trade_types, + uncertainty_ceiling?, budget_delta?, action_id?, effective_at, expires_at?, rationale, + provenance }`. Brain-origin directives enter through the organism boundary; M6 translates + them into restrictions without creating a direct execution path. +- Target `ConductorDecision { decision_id, action_id?, trader_id?, regime_id, decision, + evidence_refs, rationale_digest, reversible, created_at, outcome_ref? }`. +- SAE/Brain semantic compatibility is a target protocol property; cryptographic signature + equivalence is not claimed by V1. ## 6. Dependencies & runtime state - M7 SAE — implemented typed alert envelopes; autonomous SAE detection remains open. @@ -86,8 +92,13 @@ Specialist-trained inference is a future layer, not part of the current executab 2. **Done:** M1 one-shot veto integration after deterministic law. 3. **Done:** Trader pause/resume control. 4. **Done:** in-memory decision log for veto/pause/resume/dismiss. -5. **Open:** specialist Conductor inference/investigation. -6. **Open:** persistent/tamper-evident audit storage and any escalation protocol. +5. **Next:** implement/version `UncertaintyRegime` and mechanically reject out-of-regime + Trader actions before execution. +6. **Next:** implement Brain/M0 `RiskDirective` intake for broad prohibitions and exceptional + individual vetoes. +7. **Next:** link every restriction/veto to evidence and later outcome for intervention scoring. +8. **Open:** specialist Conductor inference/investigation. +9. **Open:** persistent/tamper-evident audit storage and escalation protocol. ## 9. Tests Current tests verify veto, law-before-veto ordering, severe-alert pause, low-severity dismissal @@ -95,8 +106,9 @@ path, pause blocking M1 actions/prediction reads, resume, and decision logging. specialist-inference or Brain-signature compatibility test because those layers do not exist. ## 10. Open items +- Formal uncertainty-regime vocabulary and default boundaries by action/asset/regime. +- Brain/M0 directive translation and expiry/revocation semantics. - Specialist Conductor model/runtime and training/evaluation protocol. - Judgment inputs beyond explicit M7 alerts. -- Persistent audit semantics. -- Escalation policy, if any, to the organism's Brain while preserving scoped stomach autonomy. +- Persistent audit and intervention-outcome memory. - Redundancy/multiple-Conductor design, if needed. From 784426cd16ca0b2defd86b42557eb25fd83105a9 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:39:26 -0700 Subject: [PATCH 45/63] docs: make M7 anomaly evidence and recurrence explicit --- core/docs/plans/M7-sae-monitor.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/core/docs/plans/M7-sae-monitor.md b/core/docs/plans/M7-sae-monitor.md index 864980c..9fc53ef 100644 --- a/core/docs/plans/M7-sae-monitor.md +++ b/core/docs/plans/M7-sae-monitor.md @@ -54,8 +54,15 @@ Implemented Tcl surface: - `alert(trader_id, alert_type, evidence, severity, timestamp) -> SAEAlert`. - `log()` — current in-memory observations. +Target evidence contract: +`AnomalySignal { signal_id, trader_id, signal_type, severity, confidence, recurrence_count, +expected_behavior_ref?, observed_behavior_ref, evidence_refs, regime, first_seen, last_seen }`, +where `signal_type` distinguishes at minimum `deviation`, `danger`, `suspected_compromise`, +`suspected_deception`, `strategy_incoherence`, and `recurrence`. + Future SAE inference may consume the same observation log, but V1 alerts are explicitly created -by callers/tests rather than autonomously inferred by a trained sparse autoencoder. +by callers/tests rather than autonomously inferred by a trained sparse autoencoder. M7 signal +records feed M0 durable economic memory; they never directly enforce. ## 6. Dependencies & runtime state - M1 Marketplace — implemented observation point for action submissions and prediction queries. @@ -79,9 +86,13 @@ by callers/tests rather than autonomously inferred by a trained sparse autoencod 1. **Done:** Marketplace-level action/prediction-query logging. 2. **Done:** typed `SAEAlert` envelope with bounded severity. 3. **Done:** alert delivery path into M6. -4. **Open:** action embedding scheme. -5. **Open:** SAE training/inference, learned anomaly scoring, and thresholds. -6. **Open:** persistent observation/model state. +4. **Next:** implement typed `AnomalySignal` records and recurrence counters. +5. **Next:** link M6 interpretation/outcomes back to signals so false positives, false negatives, + and legitimate anomalous adaptations can be measured. +6. **Next:** persist repeated signal patterns into M0 economic memory. +7. **Open:** action embedding scheme. +8. **Open:** SAE training/inference, learned anomaly scoring, and thresholds. +9. **Open:** persistent observation/model state. ## 9. Tests Current M0 tests verify pass/fail Marketplace submissions are logged, severe caller-created alerts From fb0d3fec14e84c42b57976e95e46291508a178bf Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:39:30 -0700 Subject: [PATCH 46/63] docs: make M2 provenance and contradiction semantics explicit --- core/docs/plans/M2-data-feeds.md | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/core/docs/plans/M2-data-feeds.md b/core/docs/plans/M2-data-feeds.md index c046c33..417c3e2 100644 --- a/core/docs/plans/M2-data-feeds.md +++ b/core/docs/plans/M2-data-feeds.md @@ -48,9 +48,16 @@ and persistent storage remain separate ingress work. - `FeedType` remains open-ended; the economy currently exercises `price_tick`, `rss_news`, `on_chain_event`, and `dex_pool_state`, with `execution_fill` / `portfolio_state` reserved for later execution feedback. -- `NormalizedDatum { feed_type, source, timestamp, payload, confidence }` — common shape. - `confidence` ∈ [0.0, 10.0] — data source reliability per position produced (exchange-reported - price = high; RSS sentiment = lower). Sims produce even finer-grained confidence. +- `NormalizedDatum { feed_type, source, timestamp, payload, confidence }` — current common shape. + `confidence` is source-supplied/ingress reliability metadata, not M2's declaration of truth. +- Target provenance revision: + `Observation { observation_id, feed_type, source_id, observed_at, received_at, payload, + source_confidence, provenance, supersedes? }`. + Contradictory observations get different IDs and remain simultaneously addressable. +- Target derived assessment: + `SourceAssessment { source_id, regime, metric, value, recurrence, observation_refs, + evaluated_at }`. Assessments live in economic memory and may influence consumers, but never + mutate or replace the underlying `Observation`. ## 6. Dependencies & runtime state - External data adapters — open; callers/tests currently provide normalized data directly. @@ -76,8 +83,12 @@ and persistent storage remain separate ingress work. 2. **Done:** per-feed ordered in-session history. 3. **Done:** explicit capacity backpressure with no silent eviction. 4. **Done:** M3a/M3b/M3c/M3e calibrated history consumers. -5. **Open:** external source adapters and provider normalization. -6. **Open:** subscriptions/fan-out, time-range queries, persistence, and execution feedback. +5. **Next:** assign stable observation IDs and explicit provenance fields. +6. **Next:** define contradiction/replay semantics: duplicates collapse by identity; conflicting + observations coexist. +7. **Next:** persist regime-conditioned `SourceAssessment` records separately from observations. +8. **Open:** external source adapters and provider normalization. +9. **Open:** subscriptions/fan-out, time-range queries, persistence, and execution feedback. ## 9. Tests The M0 suite verifies accepted publishes, capacity backpressure, preserved buffered history, and From 016185bd1ea2477c5360baf8f84a0d43b17678ee Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:40:00 -0700 Subject: [PATCH 47/63] docs: apply scoped measurement contract to M3 engines --- core/docs/plans/M3a-statistical-sims.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/docs/plans/M3a-statistical-sims.md b/core/docs/plans/M3a-statistical-sims.md index 001cd8a..a00f665 100644 --- a/core/docs/plans/M3a-statistical-sims.md +++ b/core/docs/plans/M3a-statistical-sims.md @@ -7,6 +7,20 @@ stochastic volatility, regime detection, and cross-asset correlation**. The math (tick/hourly → daily → weekly → monthly → annual → 5-year). Pops in this sim represent **stochastic sample paths**, not behavioral agents. +## 1A. Measurement contract +This Sim inherits the M3 common epistemic contract. Its scope is **price, volatility, tail risk, correlation, regime, roughness, and jump behavior**. +- Every prediction must identify `target`, `prediction_type`, `horizon`, relevant + `conditioning`, and `regime` before its `correctness` score is meaningful. +- `confidence` describes evidential/model support; `certainty` describes stability under + perturbation/model uncertainty; `correctness` is empirical accuracy after realization. These + are not synonyms. +- Correctness is compared longitudinally only within compatible scopes. It is not a universal + leaderboard against other M3 domains. +- Every prediction family must eventually link to a realization and accumulate + regime-conditioned calibration loss. Repeated bias or repeated out-of-bound realizations feed + M0 durable economic memory. +- This Sim does not need to agree with another Sim. Cross-domain interpretation belongs to M5/M6. + ## 2. Status / certainty IMPLEMENTED · M3a V1 · R. `core/src/economy/sims/statistical/engine.R` now implements the complete V1 statistical stack: GBM, Merton jump-diffusion, full-truncation Heston From 37ee8694aff92509c5d71c10054b61d2782c6e0a Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:40:03 -0700 Subject: [PATCH 48/63] docs: apply scoped measurement contract to M3 engines --- core/docs/plans/M3b-sociological-sims.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/docs/plans/M3b-sociological-sims.md b/core/docs/plans/M3b-sociological-sims.md index 4a19b46..79aa976 100644 --- a/core/docs/plans/M3b-sociological-sims.md +++ b/core/docs/plans/M3b-sociological-sims.md @@ -9,6 +9,20 @@ pressure across **six concurrent time horizons**. Grounded in evolutionary conse [8,9], Hegselmann-Krause opinion dynamics (2002), complex contagion theory (Centola & Macy 2007), MFG theory (Lasry & Lions 2007), and crypto manipulation ABMs. +## 1A. Measurement contract +This Sim inherits the M3 common epistemic contract. Its scope is **sentiment, strategy population, cascade, coordination, opinion structure, manipulation phase, and narrative regime**. +- Every prediction must identify `target`, `prediction_type`, `horizon`, relevant + `conditioning`, and `regime` before its `correctness` score is meaningful. +- `confidence` describes evidential/model support; `certainty` describes stability under + perturbation/model uncertainty; `correctness` is empirical accuracy after realization. These + are not synonyms. +- Correctness is compared longitudinally only within compatible scopes. It is not a universal + leaderboard against other M3 domains. +- Every prediction family must eventually link to a realization and accumulate + regime-conditioned calibration loss. Repeated bias or repeated out-of-bound realizations feed + M0 durable economic memory. +- This Sim does not need to agree with another Sim. Cross-domain interpretation belongs to M5/M6. + ## 2. Status / certainty IMPLEMENTED · M3b V1 · ECLiPSe Prolog. `core/src/economy/sims/sociological/engine.ecl` implements five abstract behavioral archetypes, replicator dynamics, Hegselmann–Krause bounded From 7b014fa2ccd5e13c89edd38365d860d7cf375b87 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:40:06 -0700 Subject: [PATCH 49/63] docs: apply scoped measurement contract to M3 engines --- core/docs/plans/M3c-amm-liquidity-sims.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/docs/plans/M3c-amm-liquidity-sims.md b/core/docs/plans/M3c-amm-liquidity-sims.md index 3d0e79f..c5c6d35 100644 --- a/core/docs/plans/M3c-amm-liquidity-sims.md +++ b/core/docs/plans/M3c-amm-liquidity-sims.md @@ -6,6 +6,20 @@ loss, and the non-cooperative game between liquidity providers and arbitrageurs* **LP positions and arbitrage bots** operating on the $x \cdot y = k$ curve. Grounded in the DEX/AMM literature [1,2]. +## 1A. Measurement contract +This Sim inherits the M3 common epistemic contract. Its scope is **impermanent loss, pool return, liquidity range, slippage, and LP withdrawal economics**. +- Every prediction must identify `target`, `prediction_type`, `horizon`, relevant + `conditioning`, and `regime` before its `correctness` score is meaningful. +- `confidence` describes evidential/model support; `certainty` describes stability under + perturbation/model uncertainty; `correctness` is empirical accuracy after realization. These + are not synonyms. +- Correctness is compared longitudinally only within compatible scopes. It is not a universal + leaderboard against other M3 domains. +- Every prediction family must eventually link to a realization and accumulate + regime-conditioned calibration loss. Repeated bias or repeated out-of-bound realizations feed + M0 durable economic memory. +- This Sim does not need to agree with another Sim. Cross-domain interpretation belongs to M5/M6. + ## 2. Status / certainty IMPLEMENTED · M3c V1 · Solidity/Foundry. `core/src/economy/sims/amm/src/AMMSim.sol` implements fee-adjusted constant-product swaps, exact fixed-point impermanent loss, nonlinear From 54e929cffe6aa7cd27cbf1f524a1c71293efd69f Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:40:09 -0700 Subject: [PATCH 50/63] docs: apply scoped measurement contract to M3 engines --- core/docs/plans/M3d-mev-adversarial-sims.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/docs/plans/M3d-mev-adversarial-sims.md b/core/docs/plans/M3d-mev-adversarial-sims.md index fbbf53c..c3a3f65 100644 --- a/core/docs/plans/M3d-mev-adversarial-sims.md +++ b/core/docs/plans/M3d-mev-adversarial-sims.md @@ -12,6 +12,20 @@ Grounded in ACM MEV game theory [3], knapsack auction literature [4,5], Kolokolt dynamics (non-linear Fokker-Planck with WENO shock capturing), and DSMFG bilevel optimization (leader policy + follower MFG equilibrium). +## 1A. Measurement contract +This Sim inherits the M3 common epistemic contract. Its scope is **auction pressure, extraction opportunity, block-space competition, sandwich/front-run risk, and adversarial cost**. +- Every prediction must identify `target`, `prediction_type`, `horizon`, relevant + `conditioning`, and `regime` before its `correctness` score is meaningful. +- `confidence` describes evidential/model support; `certainty` describes stability under + perturbation/model uncertainty; `correctness` is empirical accuracy after realization. These + are not synonyms. +- Correctness is compared longitudinally only within compatible scopes. It is not a universal + leaderboard against other M3 domains. +- Every prediction family must eventually link to a realization and accumulate + regime-conditioned calibration loss. Repeated bias or repeated out-of-bound realizations feed + M0 durable economic memory. +- This Sim does not need to agree with another Sim. Cross-domain interpretation belongs to M5/M6. + ## 2. Status / certainty KERNEL IMPLEMENTED · Fortran 2018. `core/src/economy/sims/mev/` implements the all-pay PGA payoff model, exact 0/1 block-building knapsack selection, dual-path cross-chain profit From 0673708c235812b8401d9637a38519c2cd53480e Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:40:12 -0700 Subject: [PATCH 51/63] docs: apply scoped measurement contract to M3 engines --- core/docs/plans/M3e-tokenomics-macro-sims.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/docs/plans/M3e-tokenomics-macro-sims.md b/core/docs/plans/M3e-tokenomics-macro-sims.md index 69cdc74..28e778c 100644 --- a/core/docs/plans/M3e-tokenomics-macro-sims.md +++ b/core/docs/plans/M3e-tokenomics-macro-sims.md @@ -12,6 +12,20 @@ Grounded in Vienna complex-systems token modeling [7], ResearchGate engineering frameworks [6], Aave/Compound kinked interest rate models (industry standard), and DeXposure inter-protocol credit propagation (Matzakos et al. 2025). +## 1A. Measurement contract +This Sim inherits the M3 common epistemic contract. Its scope is **supply, inflation, staking, velocity, policy discontinuity, treasury runway, lending utilization, liquidation, contagion, and yield allocation**. +- Every prediction must identify `target`, `prediction_type`, `horizon`, relevant + `conditioning`, and `regime` before its `correctness` score is meaningful. +- `confidence` describes evidential/model support; `certainty` describes stability under + perturbation/model uncertainty; `correctness` is empirical accuracy after realization. These + are not synonyms. +- Correctness is compared longitudinally only within compatible scopes. It is not a universal + leaderboard against other M3 domains. +- Every prediction family must eventually link to a realization and accumulate + regime-conditioned calibration loss. Repeated bias or repeated out-of-bound realizations feed + M0 durable economic memory. +- This Sim does not need to agree with another Sim. Cross-domain interpretation belongs to M5/M6. + ## 2. Status / certainty IMPLEMENTED · M3e V1 · Fortran 2018. `core/src/economy/sims/tokenomics/` implements conserved aggregate token state, Euler–Maruyama stochastic evolution, scalar Kalman From 0db480d31dfdf041c4ee1a950c416340b03d8215 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:40:15 -0700 Subject: [PATCH 52/63] docs: apply scoped measurement contract to M3 engines --- core/docs/plans/M3f-consensus-staking-sims.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/docs/plans/M3f-consensus-staking-sims.md b/core/docs/plans/M3f-consensus-staking-sims.md index 3ce92bc..84733b4 100644 --- a/core/docs/plans/M3f-consensus-staking-sims.md +++ b/core/docs/plans/M3f-consensus-staking-sims.md @@ -7,6 +7,20 @@ and Byzantine fault tolerance** using evolutionary games and Markov chains. Pops financial incentives. Grounded in Cornell evolutionary consensus [8,9], ACM staking pool risk theorems [10], and Monash dynamic PBFT modeling [11]. +## 1A. Measurement contract +This Sim inherits the M3 common epistemic contract. Its scope is **validator honesty, staking incentives, slashing risk, validator-state transitions, coordination, and liveness**. +- Every prediction must identify `target`, `prediction_type`, `horizon`, relevant + `conditioning`, and `regime` before its `correctness` score is meaningful. +- `confidence` describes evidential/model support; `certainty` describes stability under + perturbation/model uncertainty; `correctness` is empirical accuracy after realization. These + are not synonyms. +- Correctness is compared longitudinally only within compatible scopes. It is not a universal + leaderboard against other M3 domains. +- Every prediction family must eventually link to a realization and accumulate + regime-conditioned calibration loss. Repeated bias or repeated out-of-bound realizations feed + M0 durable economic memory. +- This Sim does not need to agree with another Sim. Cross-domain interpretation belongs to M5/M6. + ## 2. Status / certainty KERNEL IMPLEMENTED · ECLiPSe Prolog. `core/src/economy/sims/consensus/engine.ecl` implements evolutionary honesty updates, validator-state Markov transitions, an explicit From 560874c7265d72819ed4b863bbff0c953faeb631 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:40:19 -0700 Subject: [PATCH 53/63] docs: apply scoped measurement contract to M3 engines --- core/docs/plans/M3g-market-microstructure-sims.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/docs/plans/M3g-market-microstructure-sims.md b/core/docs/plans/M3g-market-microstructure-sims.md index 0404d64..6edbc1f 100644 --- a/core/docs/plans/M3g-market-microstructure-sims.md +++ b/core/docs/plans/M3g-market-microstructure-sims.md @@ -9,6 +9,20 @@ Operates at the highest temporal resolution — where M3a provides statistical f models pool mechanics, M3g models the *plumbing* of how orders actually execute, across **six concurrent time horizons** at tick-advanced, 90:1 (1s wall = 90s sim). +## 1A. Measurement contract +This Sim inherits the M3 common epistemic contract. Its scope is **depth, spread, slippage, order impact, execution schedule, cross-venue arbitrage decay, and market regime**. +- Every prediction must identify `target`, `prediction_type`, `horizon`, relevant + `conditioning`, and `regime` before its `correctness` score is meaningful. +- `confidence` describes evidential/model support; `certainty` describes stability under + perturbation/model uncertainty; `correctness` is empirical accuracy after realization. These + are not synonyms. +- Correctness is compared longitudinally only within compatible scopes. It is not a universal + leaderboard against other M3 domains. +- Every prediction family must eventually link to a realization and accumulate + regime-conditioned calibration loss. Repeated bias or repeated out-of-bound realizations feed + M0 durable economic memory. +- This Sim does not need to agree with another Sim. Cross-domain interpretation belongs to M5/M6. + ## 2. Status / certainty KERNEL IMPLEMENTED · Fortran 2018. `core/src/economy/sims/microstructure/` implements depth-consuming buy slippage, bid/ask spread, Almgren-Chriss execution schedules, exponential From 5ddc66ece43ce718b05d186c7f9c37776c15f702 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:40:43 -0700 Subject: [PATCH 54/63] docs: define tight-spec standard and economy doctrine --- core/docs/plans/README.md | 51 +++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/core/docs/plans/README.md b/core/docs/plans/README.md index 1dd1af6..2c1fefc 100644 --- a/core/docs/plans/README.md +++ b/core/docs/plans/README.md @@ -6,11 +6,50 @@ design docs (`../gen03_state_of_architecture.md`, `../gen03_body.md`, `../gen03_ `../../src/endocrine/etr/etr_invariants.md`. ## How to read a spec -Every `NN-.md` has the same 10 sections: +The historical files use the same 10-section skeleton: 1. **Component** · 2. **Status/certainty** · 3. **Language & location** · 4. **Does / does-not** · -5. **Interface contract** (language-agnostic data shapes — integrate against *this*) · -6. **Dependencies & stubs** · 7. **Invariants/laws** (certainty-tagged) · 8. **Build steps** -(invariants-first: laws → tests → fit) · 9. **Tests** (standalone command) · 10. **Open items**. +5. **Interface contract** · 6. **Dependencies/runtime state** · 7. **Invariants/laws** · +8. **Build status** · 9. **Tests/verification** · 10. **Open items**. + +Active specs may also carry **§1A Operational doctrine / Measurement contract**. This is not +ornament: it states why the component exists and supplies the authority/performance semantics that +the later interface and tests must implement. + +## Tight-spec standard +When an existing spec is cleaned or a new one is written, make the following explicit rather than +leaving them implicit in prose: + +1. **Purpose** — what outcome the component exists to produce. +2. **Authority** — what it may decide, what may constrain it, and what it can never override. +3. **Evidence** — what information it may consume and what provenance/uncertainty must survive. +4. **Permitted decisions** — concrete state transitions or outputs it owns. +5. **Prohibited decisions** — surfaces it must literally not possess. +6. **Memory** — what repeated evidence becomes durable knowledge, with source observations linked + rather than rewritten. +7. **Performance** — the longitudinal metric by which competence is judged. +8. **Failure condition** — what counts as architectural failure even if a local metric looks good. +9. **Completion test** — the observable evidence required before the spec may claim implementation. + +Build steps should be ordered as **contract → invariant → failing test → implementation → +realization/outcome feedback → persistence**, not as a list of aspirational features. + +## Economy doctrine +The M-series uses these additional commitments: +- M0's local terminal objective is durable profit; at organism scale surplus is metabolic capacity, + especially compute budget. +- M1 is constitutional law, not strategy. +- M2 preserves evidence/provenance/contradiction and does not decide truth. +- M3 Sims are complementary scopes, not competing oracles; correctness is scope/horizon/regime + conditioned. +- M4 hard ceilings are non-overridable per action. +- M5 Traders are independent agentic economic entities with independently assigned capital. +- Trader competence is diagnosed longitudinally by realized outcome versus its own prediction and + declared uncertainty; P&L remains the local objective. +- M6 owns the big picture: portfolio/system risk, uncertainty regimes, ordinary veto/pause, and + translation of broad/exceptional Brain restrictions into local enforcement. +- M7 reports evidence and recurrence; anomaly is not guilt. M6 interprets. +- Repetition matters everywhere: source reliability, Sim bias, Trader calibration, anomaly + recurrence, and intervention outcomes become durable M0 economic memory. ## Conventions - **Certainty tags** (from arch doc): C5 ratified · C4 drafted · C3 partial · C2 explored · C1 stub. @@ -78,7 +117,9 @@ Hermes ──> [C1] ──> Inference cycle [C3] ──┬─ pulls Drive-Box sn SAE [F2] watches Subagents [F3]; stress-loop [G1]: F2 → A7 (EthInt) → stress endomotiv (A4) → A8 drift + full reshuffle (B2) Storage: INVARIANT [E1] / VARIANT [E2] / RAG+cross-store [E3] sit behind D1. Medium [D2] = the perfusion bus (unnamed). Economy (stomach — independent, scoped autonomy): - Marketplace [M1] ← Traders [M5] (bound to Wallets [M4]) submit actions; law script + Conductor [M6] veto gate execution. + Local objective: durable profit → organism metabolic/compute surplus. + Marketplace [M1] ← Traders [M5] (independent assigned capital; Wallets [M4]) submit actions; + constitutional law + absolute wallet ceilings + Conductor [M6] uncertainty/veto boundaries gate execution. Data Feeds [M2] → Sims [M3]. Runtime bridges are live for M3a stat, M3b socio, M3c AMM, and M3e tokenomics; M3d MEV, M3f consensus, and M3g microstructure are native kernels registered in the hub but not yet process-bridged into automatic query/publish paths. From c4bb29484562ba286494b2f1f38066c2450c9a61 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:41:49 -0700 Subject: [PATCH 55/63] docs: normalize operational doctrine grammar --- core/docs/plans/M0-economy-organ-hub.md | 42 +++++++++++++------------ 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/core/docs/plans/M0-economy-organ-hub.md b/core/docs/plans/M0-economy-organ-hub.md index 587fa59..fd3e148 100644 --- a/core/docs/plans/M0-economy-organ-hub.md +++ b/core/docs/plans/M0-economy-organ-hub.md @@ -12,26 +12,28 @@ organism are TBD and out of scope. Brain for permission to trade. ## 1A. Operational doctrine -- **Local objective:** maximize durable profit. Profit is the stomach's terminal local objective; - the organism interprets the resulting surplus as a **metabolic signal and resource flow**, - especially additional compute budget. -- **Success is not raw P&L alone:** a successful stomach compounds capital, survives regime - changes, learns from prediction error, preserves optionality, improves capital allocation, - develops competent Traders, avoids ruin, and produces surplus sufficient to further the - organism's compute capacity. -- **Authority:** autonomy is constitutional rather than permissive. Routine trade-level judgment - remains inside the stomach. The Brain may set broad prohibitions, risk posture, capital/budget - envelopes, and in exceptional cases veto an individual trade; ordinary supervision belongs to - M6. Brain directives must enter through the organism boundary and may not bypass M1/M4/M6. -- **Hard hierarchy:** M1 constitutional law and M4 capability ceilings are non-overridable at - action time. M6 may narrow what is allowed, never widen it beyond M1/M4. -- **Memory:** the stomach must form durable economic memory from repetition: source reliability, - regime behavior, Trader calibration, recurring protocol precursors, intervention outcomes, and - repeated anomaly patterns. Raw observations remain attributable to M2 provenance; learned - assessments remain separate derived records. -- **Failure condition:** architectural failure includes ruin, repeated uncorrected miscalibration, - inability to preserve scoped autonomy, or any path that obtains profit by bypassing M1/M4/M6/M7 - or the organism boundary. +- **Purpose:** maximize durable profit locally. At organism scale, realized surplus is metabolic + capacity - especially additional compute budget - rather than the Brain's terminal objective. +- **Authority:** scoped autonomy. Routine economic decisions remain inside the stomach. The Brain + may set broad trade prohibitions, risk posture, budget envelopes, and exceptionally veto an + individual action; ordinary supervision belongs to M6. M1 law and M4 hard ceilings remain + non-overridable at action time. +- **Evidence:** M0 may consume M2 observations, M3 predictions/calibration, M5 outcomes, M6 + interventions, and M7 anomaly evidence, always retaining their provenance. +- **Permitted decisions:** compose the economy organ, route directives to the owning component, + maintain shared economic memory, expose metabolic summaries, and coordinate component lifecycle. +- **Prohibited decisions:** M0 does not bypass M1/M4/M6/M7, does not create a Brain→execution + shortcut, and does not silently convert derived belief into raw evidence. +- **Memory:** durable records accumulate source reliability, regime behavior, Sim bias, Trader + calibration, repeated anomaly patterns, protocol precursors, and intervention outcomes. + Repetition changes trust; source observations are linked, never rewritten. +- **Performance:** durable profit, capital survival, regime adaptation, improving allocation, + retained optionality, competent Traders, and surplus sufficient to further organism compute. +- **Failure:** ruin, repeated uncorrected miscalibration, loss of scoped autonomy, or profitable + behavior achieved by bypassing constitutional/braking/border constraints. +- **Completion criterion:** M0 is complete when all owned component contracts are runtime-wired, + economic memory persists and replays, Brain directives enter only through the organism boundary, + metabolic surplus is measurable, and no local execution path bypasses M1/M4/M6/M7. ## 2. Status / certainty EXECUTABLE OUTER-ORGAN SCAFFOLD. `core/src/economy/` composes M1–M7, exposes normalized From a090f447712bab7519635f845b57ae158bcc13fd Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:41:52 -0700 Subject: [PATCH 56/63] docs: normalize operational doctrine grammar --- core/docs/plans/M1-marketplace.md | 32 ++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/core/docs/plans/M1-marketplace.md b/core/docs/plans/M1-marketplace.md index 83c4050..3062678 100644 --- a/core/docs/plans/M1-marketplace.md +++ b/core/docs/plans/M1-marketplace.md @@ -7,19 +7,25 @@ the Marketplace. Enforces a **deterministic law script** (scoped invariants — own constitution) and integrates the **Conductor's veto** (M6) before execution. ## 1A. Operational doctrine -- **Purpose:** M1 is a constitution and execution harness, not a strategy engine. It makes some - actions structurally unavailable; it does not decide which lawful action is economically wise. -- **Authority:** deterministic law is above Trader judgment, M6 judgment, and exceptional Brain - vetoes. M6/Brain may further restrict lawful action but may not legalize a constitutional - violation. -- **Scope of law:** encode catastrophic/constitutional prohibitions, capability boundaries, - identity/binding requirements, and hard action constraints. Ordinary economic doctrine, - opportunity selection, and uncertainty judgment belong to M5/M6. -- **Auditability:** every decision must be reproducible from the action, law version, M4 brake - state, M6 veto state, and logged evidence. A future law DSL must produce a proof/violation trace. -- **Completion criterion:** M1 is complete for live execution only when the signed immutable law - evaluator, M4-authorized signer path, M7 logging, M6 restriction ordering, and simulation/live - parity tests all exist. Adding RPC alone is not completion. +- **Purpose:** serve as the economy constitution and single execution harness. M1 makes prohibited + actions unavailable; it does not decide which lawful action is economically wise. +- **Authority:** deterministic law may reject any action in scope. M5, M6, and Brain restrictions + may narrow the lawful set but may never legalize an M1 violation. +- **Evidence:** action payload, Trader identity, M4 binding/limit state, current law version, and + M6 veto/restriction state. Economic opportunity evidence belongs upstream. +- **Permitted decisions:** validate, admit/reject, produce replayable law decisions, order M4/M6 + gates, execute only through an authorized adapter, and log every attempt to M7. +- **Prohibited decisions:** choose strategy, predict markets, override M4, infer Trader intent, or + mutate constitutional law during an action. +- **Memory:** retain law version, proof/violation trace, action identity, gate outcomes, and final + execution result for replay/audit. +- **Performance:** deterministic reproducibility, complete logging, zero bypasses, and parity + between simulated and eventual live admission semantics. +- **Failure:** the same inputs produce different law results; a prohibited action executes; a + lawful action bypasses a required gate; or strategy/risk judgment leaks into constitutional law. +- **Completion criterion:** live M1 requires the signed immutable law evaluator, replayable + `LawDecision`, M4-authorized signer path, M6 restriction ordering, M7 logging, and + simulation/live parity tests. RPC connectivity alone is not completion. ## 2. Status / certainty SCAFFOLD · EXECUTABLE SIMULATION. `core/src/economy/marketplace.tcl` implements the single From 3531de3e3120e60581a659f2da782814e8b0e0ad Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:41:55 -0700 Subject: [PATCH 57/63] docs: normalize operational doctrine grammar --- core/docs/plans/M2-data-feeds.md | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/core/docs/plans/M2-data-feeds.md b/core/docs/plans/M2-data-feeds.md index 417c3e2..2cfbc28 100644 --- a/core/docs/plans/M2-data-feeds.md +++ b/core/docs/plans/M2-data-feeds.md @@ -7,18 +7,24 @@ produces execution data (fills, positions, P&L) that feeds back into Sims, and S predictions that inform Traders operating through the Marketplace. Data Feeds is the bridge. ## 1A. Operational doctrine -- **Purpose:** M2 preserves observations; it does not adjudicate reality. -- **Epistemic rule:** provenance, source, timestamp, confidence, and contradiction are first-class. - Conflicting observations coexist intact. M2 must not collapse them into a synthetic consensus - datum unless an explicitly named downstream process requests and records that transformation. -- **Normalization rule:** normalize representation, units, and schema - never silently normalize - away disagreement, source identity, uncertainty, or missingness. -- **Derived belief separation:** source reliability, regime-conditioned trust, and repeated - source failure may become durable economic memory, but those assessments are derived records - linked back to immutable observations; they do not rewrite M2 history. -- **Completion criterion:** a source adapter is complete only when it preserves provenance, - exposes loss/backpressure behavior explicitly, survives reconnect/replay without duplication, - and can reproduce the normalized history consumed by downstream Sims. +- **Purpose:** preserve observations and provenance for downstream economic reasoning. +- **Authority:** M2 has no authority to decide what is true. It may validate representation and + transport semantics, not adjudicate conflicting claims. +- **Evidence:** external observations and internal feedback, each with source identity, observed + time, received time, confidence/reliability metadata, and provenance. +- **Permitted decisions:** normalize schema/units, assign stable observation identity, buffer, + replay, apply explicit backpressure, and expose conflicting observations side by side. +- **Prohibited decisions:** silently merge contradiction, overwrite history with derived belief, + editorialize payload meaning, or drop observations without explicit loss semantics. +- **Memory:** raw observations remain immutable/addressable. Regime-conditioned source reliability + is stored separately as derived economic memory linked back to observation IDs. +- **Performance:** provenance completeness, replay fidelity, explicit loss/backpressure behavior, + deduplication correctness, and downstream reproducibility. +- **Failure:** silent drop, silent contradiction collapse, provenance loss, duplicate replay as + new evidence, or a derived source assessment masquerading as an observation. +- **Completion criterion:** each adapter preserves provenance, survives reconnect/replay without + duplication, exposes backpressure/loss explicitly, and can reproduce the normalized history + consumed by downstream Sims. ## 2. Status / certainty SCAFFOLD · EXECUTABLE. `core/src/economy/feeds.tcl` implements normalized in-session history From aadd526ee13429d50865159e3ddb61c625cce8f0 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:41:58 -0700 Subject: [PATCH 58/63] docs: normalize operational doctrine grammar --- core/docs/plans/M3-sims-hub.md | 35 ++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/core/docs/plans/M3-sims-hub.md b/core/docs/plans/M3-sims-hub.md index ba5b775..c4f8421 100644 --- a/core/docs/plans/M3-sims-hub.md +++ b/core/docs/plans/M3-sims-hub.md @@ -12,22 +12,25 @@ The academic foundations span AMM mechanism design [1,2], MEV game theory [3,4,5 tokenomics via SDEs [6,7], and evolutionary consensus games [8–11]. ## 1A. Operational doctrine -- **Purpose:** Sims are complementary mathematical senses over different scopes of the same - environment. They are not contestants trying to become one canonical market oracle. -- **No forced reconciliation:** apparent disagreement is first treated as a question of scope, - horizon, conditioning, or resolution. Traders interpret local implications; M6 interprets - portfolio/system implications. M3 itself does not vote, average, or choose a winner. -- **Scoped correctness:** `correctness` means empirical accuracy with respect to a Sim's declared - target, horizon, conditioning assumptions, and regime. Scores from different Sim types are not - directly comparable unless their scopes are explicitly aligned. -- **Calibration metric:** every prediction family should accumulate longitudinal calibration loss - against realization and declared uncertainty, conditioned on regime: - `L(prediction, realization, declared_uncertainty | scope, regime)`. -- **Memory:** repeated calibration failures, regime-specific strengths, and persistent bias become - durable economic memory. A single miss is evidence; repetition changes trust. -- **Completion criterion:** a native Sim is runtime-complete only when calibration input, - native execution, bounded publication, realization capture, longitudinal scoring, degraded-state - handling, and replayable tests all exist. Source presence alone is never completion. +- **Purpose:** provide complementary mathematical senses over different scopes of the same market + environment. Sims are not contestants for one canonical oracle. +- **Authority:** M3 may model, calibrate, forecast, and report uncertainty. It may not trade, + enforce policy, select a winning Sim, or compel a Trader action. +- **Evidence:** normalized M2 observations plus Sim-specific calibration state, always with enough + target/horizon/conditioning/regime metadata to interpret a result. +- **Permitted decisions:** run native models, publish bounded predictions, declare degraded state, + score realized predictions, and retain per-Sim calibration history. +- **Prohibited decisions:** vote/average heterogeneous Sims into truth by default, hide scope, + compare correctness across incompatible targets, or reinterpret another Sim's result. +- **Memory:** repeated bias, out-of-bound realizations, regime-specific strength, and calibration + loss persist into M0 economic memory. A single miss is evidence; repetition changes trust. +- **Performance:** longitudinal calibration loss against realization and declared uncertainty, + conditioned on `target × horizon × conditioning × regime`. +- **Failure:** unscoped correctness, hidden degraded state, stale prediction presented as current, + or forced reconciliation that destroys the distinct information carried by different scopes. +- **Completion criterion:** a native Sim is runtime-complete only when calibration input, native + execution, `PredictionScope`, bounded publication, realization capture, longitudinal scoring, + degraded-state handling, persistence, and replayable tests all exist. ## 2. Status / certainty MIXED · EXECUTABLE HUB + FOUR V1 RUNTIME BRIDGES + THREE NATIVE KERNELS. From ca58f9eeef4c36a436dbff6d467308bc4f735ebf Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:42:20 -0700 Subject: [PATCH 59/63] docs: normalize operational doctrine grammar --- core/docs/plans/M4-wallets.md | 36 ++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/core/docs/plans/M4-wallets.md b/core/docs/plans/M4-wallets.md index 3ac2867..41b83df 100644 --- a/core/docs/plans/M4-wallets.md +++ b/core/docs/plans/M4-wallets.md @@ -8,21 +8,27 @@ the Marketplace (M1). Wallets hold keys, sign transactions, and enforce wallet-l Tax is collected on trader income and routed to the Verschwörern Veregeister wallets (stub — M0). ## 1A. Operational doctrine -- **Purpose:** M4 is the final physical/economic brake around assigned capital. It protects the - organism from a Trader, a Trader from itself, the assigned funding from other Traders, and the - capital base from catastrophic loss. -- **Authority:** hard M4 ceilings are absolute at action time. Trader, M6, and Brain veto authority - may narrow what happens but may not override an M4 ceiling for an individual action. -- **Change semantics:** higher authority may change future M4 configuration only through an - explicit reconfiguration/version transition; there is no per-trade "override the wallet" path. -- **Funding isolation:** each Trader's capital is independently bounded and attributed. One - Trader's loss, conviction, or disagreement does not silently consume another Trader's funding. -- **Performance role:** M4 is not judged by profit. It succeeds when forbidden exposure is - physically unavailable and when every admitted spend can be attributed to one Trader, one - configured ceiling set, and one Marketplace action. -- **Completion criterion:** custody is complete only when binding, ceilings, local key custody, - signer authorization, recovery/rotation, transaction attribution, and tamper-resistant limit - versioning are all tested. A working signature primitive alone is insufficient. +- **Purpose:** provide the final capability boundary around assigned capital: protect the organism + from a Trader, the Trader from itself, one Trader's funding from another, and the capital base + from catastrophic loss. +- **Authority:** M4 hard ceilings are absolute at action time. Trader, M6, and Brain authority may + further restrict activity but may not override an active M4 ceiling for one action. +- **Evidence:** Trader↔wallet binding, active limit version, proposed action/notional, cumulative + spend/exposure, and eventual chain/custody state. +- **Permitted decisions:** bind identity, calculate exposure, admit/reject against hard ceilings, + record spend, and eventually sign only Marketplace-authorized transactions. +- **Prohibited decisions:** choose strategy, infer opportunity, lend one Trader another Trader's + capital, accept a per-action override, or delegate custody to a third party. +- **Memory:** persist limit versions, binding history, capital-at-risk, spend history, signer + attribution, and any future custody/recovery event. +- **Performance:** zero ceiling bypasses, exact attribution of every admitted spend, isolation + between Trader capital stores, and recoverable/auditable custody state. +- **Failure:** any action exceeds the active ceiling, a wallet is reassigned without an explicit + versioned transition, another component can override a brake, or key custody escapes the + sovereign boundary. +- **Completion criterion:** custody is complete only when binding, versioned hard ceilings, local + key custody, signer authorization, recovery/rotation, transaction attribution, and persistence + are all tested. A working signature primitive alone is insufficient. ## 2. Status / certainty SCAFFOLD · PARTIAL. `core/src/economy/wallets.tcl` implements permanent 1:1 binding and From 2271fb162f7b253372db7c454ff0270c9cf2bf64 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:42:23 -0700 Subject: [PATCH 60/63] docs: normalize operational doctrine grammar --- core/docs/plans/M5-traders.md | 41 +++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/core/docs/plans/M5-traders.md b/core/docs/plans/M5-traders.md index f21cdc6..1aff5ba 100644 --- a/core/docs/plans/M5-traders.md +++ b/core/docs/plans/M5-traders.md @@ -5,25 +5,28 @@ The economy organ's hands: **specialized AI instances** that buy, sell, and mint NFTs. Each trader is bound to a Wallet (M4), operates through the Marketplace (M1), queries Market to receive predictions (M3), and are monitored by the SAE (M7) via Marketplace. Multiple traders operate concurrently with **different heuristics and specializations**. ## 1A. Operational doctrine -- **Purpose:** Traders are genuinely agentic economic entities with persistent identity, goals, - learning, judgment under uncertainty, specialization, and responsibility for independently - assigned capital. Their local objective is profitable deployment of that capital. -- **Independence:** Traders need not converge or agree. Their funding stores are independent; - disagreement matters only through realized performance, capital allocation, shared market - effects, or M6 systemic risk. -- **Uncertainty:** each Trader chooses how declared uncertainty affects an individual action, - position size, evidence gathering, or abstention - but only inside the uncertainty regime and - broader boundaries assigned by M6. Actions outside the allowed regime are unavailable. -- **Performance:** raw P&L is the local objective; **loss relative to prediction** is the primary - diagnostic metric. A loss that was correctly anticipated is categorically different from a - confident unanticipated loss. -- **Longitudinal metric:** each Trader accumulates regime-conditioned prediction/calibration loss - over time rather than being judged by isolated wins or losses. Repetition changes capital trust. -- **Memory:** durable Trader memory should preserve its own forecasts, declared uncertainty, - realized outcomes, recurring failure modes, regime-specific competence, and intervention history. -- **Completion criterion:** a Trader runtime is not complete until it can form a prediction, - declare uncertainty, choose a lawful action, use only its assigned capital, record the decision - basis, receive realization, update memory, and expose longitudinal calibration/P&L metrics. +- **Purpose:** act as persistent, genuinely agentic economic entities that profitably deploy + independently assigned capital through specialized judgment and learning. +- **Authority:** a Trader chooses forecasts, evidence weighting, strategy, abstention, position + sizing, and lawful actions inside M1 law, M4 hard ceilings, and the active M6 uncertainty regime. +- **Evidence:** Marketplace-accessible M3 predictions, allowed market state, the Trader's own + decision/outcome memory, assigned capital state, and current M6 regime/restrictions. +- **Permitted decisions:** form predictions, declare uncertainty, disagree with other Traders, + choose/decline lawful actions, allocate only its own capital, and update its own learned strategy. +- **Prohibited decisions:** use another Trader's funding, bypass Marketplace, access raw chain + execution, override M4/M6, or treat another Trader's disagreement as something requiring + consensus. +- **Memory:** persist forecasts, declared uncertainty, decision basis, realized outcome, recurring + failure modes, regime-specific competence, and intervention history. +- **Performance:** P&L is the local objective; longitudinal loss relative to the Trader's own + prediction and declared uncertainty is the primary diagnostic. Expected losses and confident + surprise losses are not equivalent. +- **Failure:** persistent surprise loss, worsening calibration without adaptation, unauthorized + capital use, or profitable behavior dependent on bypassing constitutional/supervisory limits. +- **Completion criterion:** a Trader runtime is complete when it can form a prediction, declare + uncertainty, choose a lawful action, use only assigned capital, persist the decision basis, + receive realization, update memory, and expose rolling P&L plus regime-conditioned calibration + loss. ## 2. Status / certainty SCAFFOLD · PARTIAL. `core/src/economy/traders.tcl` implements trader identity, From 9cc9f0a1ee992f2ad608845fc2609bf40951ea46 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:42:26 -0700 Subject: [PATCH 61/63] docs: normalize operational doctrine grammar --- core/docs/plans/M6-conductor.md | 40 +++++++++++++++++---------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/core/docs/plans/M6-conductor.md b/core/docs/plans/M6-conductor.md index 299d281..0df5c4f 100644 --- a/core/docs/plans/M6-conductor.md +++ b/core/docs/plans/M6-conductor.md @@ -8,26 +8,28 @@ organism's Brain for trade-level decisions. It supervises; the deterministic law constrains; together they form the multi-layered braking system. ## 1A. Operational doctrine -- **Purpose:** M6 is the stomach's big-picture intelligence: risk officer, immune response, - executive judgment, and portfolio/system situational awareness. Traders optimize locally; - M6 sees interactions, concentration, correlated failure, uncertainty regime, and organ-level risk. -- **Authority:** M6 handles most trade supervision and may veto/pause/restrict lawful Trader - behavior. It may never legalize an M1 violation or override an M4 hard ceiling. -- **Uncertainty regime:** M6 assigns broad admissible uncertainty boundaries by regime, asset, - action type, or portfolio condition. Traders choose actions inside those boundaries; actions - whose declared uncertainty falls outside the active regime are mechanically prevented. -- **Brain relationship:** routine supervision stays local. Brain may impose broad trade-type - prohibitions, risk posture, budget constraints, and exceptionally veto an individual trade. - Such directives enter through the organism boundary and are enforced through M6/M1 rather than - creating a direct Brain→execution bypass. -- **Reconciliation:** M6 does not ask Sims to agree. It interprets complementary scopes together - and resolves system-level implications that exceed any one Trader's local view. -- **Performance:** judge M6 by prevented ruin, calibrated restriction quality, intervention - outcomes, false-positive/false-negative rates, and whether it preserves profitable autonomy - rather than by the number of vetoes issued. -- **Completion criterion:** the supervisory AI is complete only when uncertainty-regime policy, +- **Purpose:** provide the stomach's big-picture intelligence: risk officer, immune response, + executive judgment, and portfolio/system situational awareness above local Trader views. +- **Authority:** M6 may set uncertainty regimes, narrow lawful behavior, veto, pause, restrict, + resume, and interpret organism directives. It may never legalize an M1 violation or override an + M4 hard ceiling. +- **Evidence:** M7 signals, M3 scoped predictions, Trader decision/outcome history, portfolio-wide + exposure, capital concentration, active uncertainty regime, and Brain/M0 directives. +- **Permitted decisions:** establish broad uncertainty boundaries, resolve system-level + implications across complementary Sims/Traders, impose/release restrictions, and route broad + or exceptional Brain vetoes into local enforcement. +- **Prohibited decisions:** trade, own a wallet, rewrite M1 law, override M4, force Sims to agree, + or create a direct Brain→execution path. +- **Memory:** persist decisions, evidence refs, regime versions, intervention outcomes, false + positives/negatives, repeated systemic precursors, and reversal history. +- **Performance:** prevented ruin, calibrated restriction quality, intervention outcome quality, + false-positive/false-negative rates, and preservation of profitable autonomy - not veto count. +- **Failure:** missing a repeated systemic precursor, chronically suppressing profitable lawful + behavior without evidence, allowing out-of-regime uncertainty, or permitting higher authority + to bypass M1/M4. +- **Completion criterion:** supervisory AI is complete only when uncertainty-regime policy, portfolio-wide state, intervention reasoning, reversible restrictions, outcome feedback, - persistent decision memory, and Brain-directive handling are all explicit and testable. + persistent memory, and Brain-directive handling are explicit and testable. ## 2. Status / certainty SCAFFOLD · EXECUTABLE SUPERVISION. `core/src/economy/conductor.tcl` implements veto ordering, From 6218b068d2c4240f8da7b78c2a12c84d59c58267 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:42:29 -0700 Subject: [PATCH 62/63] docs: normalize operational doctrine grammar --- core/docs/plans/M7-sae-monitor.md | 37 ++++++++++++++++++------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/core/docs/plans/M7-sae-monitor.md b/core/docs/plans/M7-sae-monitor.md index 9fc53ef..c20dc97 100644 --- a/core/docs/plans/M7-sae-monitor.md +++ b/core/docs/plans/M7-sae-monitor.md @@ -11,22 +11,27 @@ Extends the F2 (SAE monitor) pattern to the economy organ's internal domain. F2 subagents at the organism level; M7 watches traders at the stomach level. ## 1A. Operational doctrine -- **Purpose:** M7 is an evidence-producing anomaly sensor and memory feeder, not a guilt engine. -- **Signal taxonomy:** unusualness, danger, suspected compromise, suspected deception, - strategy/identity incoherence, and recurrence are distinct signals. They must not be collapsed - into one undifferentiated anomaly score. -- **Anomaly is legitimate until interpreted:** a Trader may intentionally behave unusually because - its specialization or market regime demands it. M7 reports the deviation and evidence; M6 decides - whether the behavior is dangerous, adaptive, profitable, compromised, or benign. -- **Repetition matters:** recurring deviations, repeated failed predictions, repeated source/ - behavior couplings, and recurring precursors accumulate as durable economic memory. Frequency - and recurrence are evidence, not automatic enforcement. -- **Separation of roles:** M7 detects and records; M6 interprets and restricts; M1/M4 enforce hard - boundaries. M7 must not become a shadow policy engine. -- **Completion criterion:** trained M7 is complete only when observations are instrumented, - embeddings/features are attributable, recurrence is represented, signal classes are separable, - alert evidence is inspectable, feedback from M6/outcomes updates memory, and false-positive / - false-negative behavior is measured over time. +- **Purpose:** produce inspectable evidence about unusual, dangerous, compromised, deceptive, or + strategy-incoherent Trader behavior and feed repeated patterns into durable economic memory. +- **Authority:** M7 has detection/reporting authority only. It cannot block, pause, veto, change + limits, declare guilt, or modify Trader behavior. +- **Evidence:** instrumented Trader activity, expected-behavior baselines, regime context, prior + signals, recurrence counts, M6 interpretations, and later realized outcomes. +- **Permitted decisions:** detect deviation, classify signal type, estimate severity/confidence, + count recurrence, assemble evidence references, and emit a signal/alert to M6. +- **Prohibited decisions:** collapse anomaly into guilt, treat rarity as danger automatically, + enforce restrictions, duplicate M1 law, or hide legitimate adaptation because it is unusual. +- **Memory:** recurrence, repeated prediction failures, repeated strategy incoherence, recurring + source/behavior couplings, M6 interpretations, and realized outcomes persist as economic memory. +- **Performance:** measured detection quality by signal class, evidence usefulness, recurrence + sensitivity, false-positive/false-negative rates, and whether legitimate anomalies remain + distinguishable from compromise/danger. +- **Failure:** uninstrumented Trader surfaces, one undifferentiated anomaly score, repeated false + accusations without correction, missed recurrent precursors, or any direct enforcement action. +- **Completion criterion:** trained M7 is complete when observations are instrumented, + features/embeddings are attributable, recurrence is represented, signal classes are separable, + evidence is inspectable, M6/outcome feedback updates memory, and longitudinal error rates are + measured. ## 2. Status / certainty SCAFFOLD · PARTIAL. `core/src/economy/sae.tcl` records Marketplace-level trader calls and From 017ba884e902e9f0ce83a3c55effd5e8701eb9a3 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 11:43:40 -0700 Subject: [PATCH 63/63] docs: replace stale economy overview with current doctrine --- core/src/economy/ECONOMY.MD | 60 +++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 5 deletions(-) diff --git a/core/src/economy/ECONOMY.MD b/core/src/economy/ECONOMY.MD index eca510a..354a4a3 100644 --- a/core/src/economy/ECONOMY.MD +++ b/core/src/economy/ECONOMY.MD @@ -1,6 +1,56 @@ -Brief overview +# Economy organ — concise orientation -3 small models act as traders -they connect to a shared ada hub, each with a unique ID that correlates to a wallet. The ada hub verifies with the wallet that a transaction is legal, and then uses interop Fortran to sign the transaction, which then is sent to the market, which checks an additional legality set. -Traders also consult the Marketplace directly for information that is compiled from: Live feeds; KOL; Simulations; Live ticker feeds; and other sources TBD. -THE MARKETPLACE then performs the trade to market. \ No newline at end of file +The stomach is an outer, scoped-autonomous economic organ. + +Its local terminal objective is **durable profit**. At organism scale that surplus is metabolic +capacity: capital that can further the organism, especially its compute budget. + +## Authority + +- Traders (M5) make local economic decisions using independently assigned capital. +- Marketplace (M1) is constitutional law and the single action harness. It does not choose strategy. +- Wallets (M4) impose non-overridable hard capital ceilings. V1 has no private keys or signer. +- Conductor (M6) owns the big picture: portfolio/system risk, uncertainty regimes, ordinary + veto/pause/restriction, and translation of broad or exceptional Brain directives. +- SAE monitor (M7) produces anomaly evidence and recurrence signals. It does not enforce. +- Brain may broadly prohibit trade types or risk posture and may exceptionally veto an individual + action, but it does not bypass M1/M4/M6. + +## Evidence and prediction + +M2 preserves observations, provenance, timestamps, source confidence, and contradiction. It does +not decide what is true. + +M3 Sims are complementary scopes, not competing oracles. M3a statistical, M3b sociological, +M3c AMM/liquidity, and M3e tokenomics/macro have tested native runtime bridges today. +M3d MEV/adversarial, M3f consensus/staking, and M3g microstructure have native kernels but still +need equivalent Tcl query bridges. + +Correctness is always scoped to target, horizon, conditioning, and regime. Repeated prediction +error becomes durable economic memory rather than being flattened into a universal Sim ranking. + +## Trader performance + +P&L is the Trader's local objective. The primary diagnostic is longitudinal realized loss relative +to that Trader's own prediction and declared uncertainty. A correctly anticipated loss is not the +same failure as a confident surprise loss. + +Traders do not need consensus with one another; their funding stores are independent. Conductor +intervenes when local behavior creates organ-level risk or violates the active uncertainty regime. + +## Memory + +The stomach must persist repeated evidence about source reliability, Sim bias, Trader calibration, +regime behavior, protocol precursors, anomaly recurrence, and intervention outcomes. Derived +assessments link back to source observations; they never rewrite raw evidence. + +## Current execution boundary + +Current successful Marketplace execution is simulation-only and returns `simtx-*` receipts. +There is no live key custody, signing, RPC broadcast, or real tax transfer in V1. + +Target live path remains: + +`Trader → Marketplace law → M4 hard brake → M6 restriction/veto → authorized signer/broadcaster` + +Every future live implementation must preserve that ordering.