# Economy organ — M0 stomach 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 - **M1 Marketplace** — single action ingress; wallet-first admission; deterministic action/chain law; wallet brake; Conductor veto after law; simulated execution only. - **M2 Feeds** — normalized datum history with explicit backpressure instead of silent eviction. - **M3 Sims** — all seven native engine trees are built in. M3a V1 is complete with calibrated HMM regimes, fitted spectral rough volatility, Heston characteristic-function surface calibration, fitted DCC/t-copula dependence, Bayesian/ARIMA/GARCH risk forecasting, empirical walk-forward quality scoring, all seven prediction types, and tested price+DEX-pool M2→R→Hub routing; M3b V1 is complete with persistent five-archetype populations, native bandit-replicator learning, adaptive bounded-confidence/contagion dynamics, HJB/FP MFG stability, pump/dump ABM behavior, nine bounded prediction types, M2 social+price calibration and empirical walk-forward scoring; M3c V1 is complete with native Solidity constant-product and concentrated-liquidity mechanics, LP/JIT and arbitrage populations, split routing, five bounded prediction types, and tested M2→EVM→Hub routing; M3d is Fortran MEV; M3e V1 is complete with conserved macro state, native Kalman calibration, SDE supply dynamics, halving/burn policy, kinked lending and liquidation cascades, directional VAR contagion, exact yield allocation, ten bounded prediction types, and tested on-chain-event→Fortran→Hub routing; M3f is ECLiPSe consensus, and M3g is Fortran microstructure. A live Tcl event-loop clock runs all six horizons at 90:1 or faster. - **M4 Wallets** — permanent 1:1 trader binding plus per-action/session exposure brakes. No private-key field, signer, or RPC surface exists yet. - **M5 Traders** — trader registry and mechanical pause state. AI trader inference is not implemented here. - **M6 Conductor** — veto-next, pause/resume, SAE alert intake, append-only in-memory decision log. Specialist inference is not implemented yet. - **M7 SAE** — records Marketplace tool calls and produces alert envelopes; actual sparse-autoencoder inference/training is not implemented yet. - **M0** — composes the above, stages tax receipts without moving value, and emits a stomach→Ada status secretion. There is deliberately no live transaction broadcaster. A successful action returns `execution simulated` and a deterministic `simtx-*` identifier. Live custody/execution should not appear until the unresolved M4 key-storage design is ratified. ## Test ```sh 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 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 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 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 |