diff --git a/.claude/hooks/install-toolchains.sh b/.claude/hooks/install-toolchains.sh index bd2fe1d..6e3e284 100755 --- a/.claude/hooks/install-toolchains.sh +++ b/.claude/hooks/install-toolchains.sh @@ -65,15 +65,113 @@ else fi fi +# --------------------------------------------------------------------------- +# Fortran 2018 (gfortran) + OpenBLAS (economy organ: M3d, M3e) +# --------------------------------------------------------------------------- +if command -v gfortran >/dev/null 2>&1; then + log "gfortran already present; skipping." +else + log "Installing gfortran libopenblas-dev via apt-get ..." + if ! sudo apt-get install -y gfortran libopenblas-dev; then + warn "apt-get install of gfortran/libopenblas-dev failed; continuing." + fi +fi + +# --------------------------------------------------------------------------- +# fpm — Fortran Package Manager (economy organ: M3d, M3e) +# --------------------------------------------------------------------------- +if command -v fpm >/dev/null 2>&1; then + log "fpm already present; skipping." +else + log "Installing fpm ..." + FPM_URL="https://github.com/fortran-lang/fpm/releases/download/v0.10.1/fpm-0.10.1-linux-x86_64" + if curl -sSL -o /tmp/fpm "$FPM_URL"; then + sudo cp /tmp/fpm /usr/local/bin/fpm && sudo chmod +x /usr/local/bin/fpm + log "fpm installed to /usr/local/bin/fpm" + else + warn "fpm download failed; continuing." + fi +fi + +# --------------------------------------------------------------------------- +# Tcl (economy organ: M3 sim hub) +# --------------------------------------------------------------------------- +if command -v tclsh >/dev/null 2>&1; then + log "tclsh already present; skipping." +else + log "Installing tcl via apt-get ..." + if ! sudo apt-get install -y tcl; then + warn "apt-get install of tcl failed; continuing." + fi +fi + +# --------------------------------------------------------------------------- +# ECLiPSe Prolog (economy organ: M3b, M3f) +# --------------------------------------------------------------------------- +if command -v eclipse >/dev/null 2>&1 || [ -x /opt/eclipseclp/bin/x86_64_linux/eclipse ]; then + log "ECLiPSe Prolog already present; skipping." +else + log "Installing ECLiPSe Prolog ..." + ECLIPSE_URL="https://eclipseclp.org/Distribution/Current/7.1_13/x86_64_linux/eclipse_basic.tgz" + if curl -sSL -o /tmp/eclipse_basic.tgz "$ECLIPSE_URL"; then + if sudo mkdir -p /opt/eclipseclp && sudo tar -xzf /tmp/eclipse_basic.tgz -C /opt/eclipseclp; then + log "ECLiPSe installed to /opt/eclipseclp" + else + warn "ECLiPSe extraction failed; continuing." + fi + else + warn "ECLiPSe download failed; continuing." + fi +fi + +# --------------------------------------------------------------------------- +# Zig (economy organ: M3g) +# --------------------------------------------------------------------------- +if command -v zig >/dev/null 2>&1; then + log "zig already present; skipping." +else + log "Installing Zig ..." + ZIG_URL="https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz" + if curl -sSL -o /tmp/zig.tar.xz "$ZIG_URL"; then + if sudo tar -xJf /tmp/zig.tar.xz -C /opt && sudo ln -sf /opt/zig-linux-x86_64-0.13.0/zig /usr/local/bin/zig; then + log "zig installed to /usr/local/bin/zig" + else + warn "Zig extraction/linking failed; continuing." + fi + else + warn "Zig download failed; continuing." + fi +fi + +# --------------------------------------------------------------------------- +# Solidity / Foundry (economy organ: M3c) +# --------------------------------------------------------------------------- +if command -v forge >/dev/null 2>&1; then + log "forge (Foundry) already present; skipping." +else + log "Installing Foundry (forge, anvil) ..." + if curl -sSL https://foundry.paradigm.xyz | bash; then + if "$HOME/.foundry/bin/foundryup"; then + log "Foundry installed" + else + warn "foundryup failed; continuing." + fi + else + warn "Foundry install script failed; continuing." + fi +fi + # --------------------------------------------------------------------------- # Ensure ponyc is on PATH for future shells. # --------------------------------------------------------------------------- -PONY_PATH_LINE='export PATH=/root/.local/share/ponyup/bin:$PATH' -if [ -f "$HOME/.bashrc" ] && grep -qF "$PONY_PATH_LINE" "$HOME/.bashrc"; then - log "ponyup PATH line already in ~/.bashrc; skipping." +EXTRA_PATHS='/root/.local/share/ponyup/bin:/opt/eclipseclp/bin/x86_64_linux' +FOUNDRY_PATH="$HOME/.foundry/bin" +FULL_PATH_LINE="export PATH=$EXTRA_PATHS:$FOUNDRY_PATH:\$PATH" +if [ -f "$HOME/.bashrc" ] && grep -qF "eclipseclp" "$HOME/.bashrc"; then + log "Economy-organ PATH lines already in ~/.bashrc; skipping." else - log "Appending ponyup PATH line to ~/.bashrc" - echo "$PONY_PATH_LINE" >> "$HOME/.bashrc" || warn "Could not append to ~/.bashrc; continuing." + log "Appending toolchain PATH lines to ~/.bashrc" + echo "$FULL_PATH_LINE" >> "$HOME/.bashrc" || warn "Could not append to ~/.bashrc; continuing." fi log "Done." diff --git a/core/docs/plans/M1-marketplace.md b/core/docs/plans/M1-marketplace.md index de91c84..6dea5ba 100644 --- a/core/docs/plans/M1-marketplace.md +++ b/core/docs/plans/M1-marketplace.md @@ -27,6 +27,10 @@ signing (M4), and the Conductor (M6). Deterministic law script must be auditable Diagnostic reasons (law violation, veto, missing wallet) are internal — routed to Conductor (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. - `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). diff --git a/core/docs/plans/M3-sims-hub.md b/core/docs/plans/M3-sims-hub.md index 2430b60..81c50aa 100644 --- a/core/docs/plans/M3-sims-hub.md +++ b/core/docs/plans/M3-sims-hub.md @@ -3,9 +3,10 @@ ## 1. Component The economy organ's prediction engine: **always-running simulations** ("Sims") populated by autonomous simulation agents ("Pops") that model market dynamics across multiple mathematical -domains and time scales. Sims are **queryable at any time** by Traders (M5) — they produce -**predictions with explicit upper and lower bounds** on every output value. This is the hub spec; -individual sim types have dedicated sub-specs (M3a–M3g). +domains and time scales. Sims produce raw simulation data; the hub transforms it into +**predictions with explicit upper and lower bounds** and publishes them continuously to the +Marketplace via M2 Data Feeds. Traders query predictions from the Marketplace (M1), not from the +hub directly. This is the hub spec; individual sim types have dedicated sub-specs (M3a–M3g). 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]. @@ -22,12 +23,13 @@ stdin/stdout JSON — **Fortran** (M3d, M3e), **Prolog** (M3b, M3f), **R** (M3a) sub-processes it orchestrates. ## 4. Does / does-not -- **Does:** tick-advance continuously at **90:1** (1 wall-second = 90 simulated seconds) +- **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; respond to Trader queries with bounded predictions; produce outputs with - **explicit upper/lower bounds** on every prediction value. + 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 | @@ -37,27 +39,35 @@ sub-processes it orchestrates. | 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); skip ticks; - run slower than 90:1. + decide); enforce laws (Marketplace does); supervise behavior (Conductor/SAE do); receive + trader queries (traders query the Marketplace); skip ticks; run slower than 90:1. ## 5. Interface contract -- `query(sim_type: SimType, query: PredictionQuery) -> BoundedPrediction`. +- `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). -- `BoundedPrediction { value, lower_bound, upper_bound, confidence, time_horizon, sim_type, timestamp }`. +- `BoundedPrediction { value, lower_bound, upper_bound, confidence, correctness, certainty, + time_horizon, sim_type, timestamp }`. Every output is bounded — no point estimates without uncertainty ranges. - `confidence` ∈ [0.00, 10.00] — printed as `7.62/10.00`. Gain rates print as - `lower - value - upper / 10.00` (e.g. `2.31 - 4.44 - 7.11 / 10.00 gain over next 30 days`); + 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; + **certainty** — how stable the estimate is across perturbations. + 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, - time_horizon: "4h", sim_type: "amm_liquidity" }`. + correctness: 8.10, certainty: 6.50, time_horizon: "4h", sim_type: "amm_liquidity" }`. - `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. ## 6. Dependencies & stubs - M2 Data Feeds — calibration data source; *stub:* canned market data. -- M5 Traders — query consumers; *stub:* canned queries. +- M1 Marketplace — prediction consumer (via M2); *stub:* print predictions. - M3a–M3g sub-specs — individual sim implementations; *stub:* each returns fixed predictions. ## 7. Invariants / laws @@ -70,24 +80,26 @@ sub-processes it orchestrates. steps and update less frequently. Each horizon completes its forecast window in **~40s wall time**. Each horizon runs **in parallel** — they are concurrent, not sequential. No horizon runs slower than 90:1. -- **L4 (C4):** sims are **read-only from traders' perspective** — a query never mutates sim - state. Calibration happens only from Data Feeds (M2). +- **L4 (C4):** sims are **read-only from traders' perspective** — traders consume predictions + from the Marketplace; they cannot mutate sim state. Calibration happens only from Data Feeds + (M2). - **L5 (C4):** each sim type is **independent** — failure in one sim does not cascade to others. Degraded sims report their status; traders handle missing predictions. - **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 and query protocol. +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 trader query interface. +5. Wire continuous prediction publishing → M2 → Marketplace. ## 9. Tests Always-on: sim running after init without external trigger. Bounded output: every prediction has -lower ≤ value ≤ upper. Query: trader receives prediction without mutating sim. Independence: -one sim's failure doesn't affect others. Calibration: new data updates model state. +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. ## 10. Open items - Pop lifecycle (birth/death/mutation within sims, or fixed populations?). diff --git a/core/docs/plans/M3b-sociological-sims.md b/core/docs/plans/M3b-sociological-sims.md index 7867b6f..abca9a6 100644 --- a/core/docs/plans/M3b-sociological-sims.md +++ b/core/docs/plans/M3b-sociological-sims.md @@ -81,7 +81,7 @@ strategy mutation, PDE solvers for MFG (HJB + Fokker-Planck), and bandit algorit - M3 Sims hub — lifecycle management; *stub:* manual init. ## 7. Invariants / laws -- **L1 (C5):** pops are **archetypal individuals, not literao living persons** — no attempt to model or track real +- **L1 (C5):** pops are **archetypal individuals, not literal living persons** — no attempt to model or track real market participants. The sim models emergent behavior from abstracted populations. - **L2 (C5):** strategies **evolve** — the population distribution shifts over time via replicator dynamics. No fixed strategy ratios. diff --git a/core/docs/plans/M3d-mev-adversarial-sims.md b/core/docs/plans/M3d-mev-adversarial-sims.md index 163a1bf..7f9e26a 100644 --- a/core/docs/plans/M3d-mev-adversarial-sims.md +++ b/core/docs/plans/M3d-mev-adversarial-sims.md @@ -19,7 +19,9 @@ optimization C3 (emerging — SMFRL solvers); Kolokoltsov adversarial C3 (non-li WENO discretization established but crypto application novel). Parameterization C1. ## 3. Language & location -FORTRAN [WHICH IMPLEMENTATIOBS?] · `src/economy/sims/mev/`. **Fortran** — dense numerical loops for PDE solvers (WENO +**Fortran 2018** (gfortran) · `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 MEV extraction demands; no GC pauses during hot-path simulation. diff --git a/core/docs/plans/M3e-tokenomics-macro-sims.md b/core/docs/plans/M3e-tokenomics-macro-sims.md index 8679693..256df1d 100644 --- a/core/docs/plans/M3e-tokenomics-macro-sims.md +++ b/core/docs/plans/M3e-tokenomics-macro-sims.md @@ -19,10 +19,12 @@ DeXposure inter-protocol credit propagation C3 (emerging, 2025 — high DeFi spe composable yield optimization C4 (Yearn v3, Beefy, production-validated). Specific parameters C1. ## 3. Language & location -TBD · `src/economy/sims/tokenomics/`. **Fortran** — SDE solvers (Euler-Maruyama, Milstein), -state-space estimation, and VAR impulse responses are dense matrix-heavy loops where Fortran's -array intrinsics and zero-overhead numerics dominate; same language as M3d avoids a toolchain -split across the heaviest numerical sims. +**Fortran 2018** (gfortran) · `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 +intrinsics and zero-overhead numerics dominate; same language as M3d avoids a toolchain split +across the heaviest numerical sims. ## 4. Does / does-not - **Does:** simulate token state dynamics via the SDE framework: diff --git a/core/docs/plans/M4-wallets.md b/core/docs/plans/M4-wallets.md index 45a5a4d..e20a235 100644 --- a/core/docs/plans/M4-wallets.md +++ b/core/docs/plans/M4-wallets.md @@ -2,8 +2,10 @@ ## 1. Component The economy organ's vault: **sovereign, local-hosted, our-custody-only cryptocurrency wallets**. -Each wallet binds to exactly one Trader (M5) — a trader without a wallet cannot access the -Marketplace (M1). Wallets hold keys, sign transactions, and enforce wallet-level spending limits. +Each wallet binds to exactly one Trader (M5) — strictly 1:1 both directions. A single wallet +handles multiple chains internally (EVM, Solana, etc.). A trader without a wallet cannot access +the Marketplace (M1). Wallets hold keys, sign transactions, and enforce wallet-level spending +limits. Tax is collected on trader income and routed to the Verschwörern Veregeister wallets (stub — M0). ## 2. Status / certainty @@ -24,7 +26,8 @@ with web3 libs for prototyping. custody to any third party — ever. ## 5. Interface contract -- `create_wallet(chain: Chain, trader_id) -> wallet_id` — generates keys, binds to trader. +- `create_wallet(chains: [Chain], trader_id) -> wallet_id` — generates keys for each chain, + binds to trader. One multi-chain wallet per trader. - `sign(wallet_id, tx: UnsignedTransaction) -> SignedTransaction` — signs with the wallet's key. Only the bound trader (via Marketplace) can request signing. - `balance(wallet_id) -> { chain, assets: [{ token, amount }] }`. diff --git a/core/docs/plans/M5-traders.md b/core/docs/plans/M5-traders.md index 732acce..7d36900 100644 --- a/core/docs/plans/M5-traders.md +++ b/core/docs/plans/M5-traders.md @@ -11,16 +11,15 @@ long-term holding, etc.). DESIGN-FIRST · ABSENT. Role C3; implementation C1. ## 3. Language & location -TBD · `src/economy/traders/`. Each trader is an AI actor — likely LLM-based (small models for -speed) or hybrid (LLM for strategy + deterministic execution logic). The harness managing -multiple traders may be Pony actors or a Python async framework. +TBD · `src/economy/traders/`. Traders are a mixed roster: some are LLM-powered AI agents, some +are deterministic strategy bots. All use the same `MarketAction` interface through the +Marketplace regardless of implementation. ## 4. Does / does-not -- **Does:** query Sims (M3) for market predictions (bounded, multi-domain); consume Data Feeds - (M2) for real-time market state; formulate trade decisions based on predictions + data + - specialization; submit `MarketAction` requests to the Marketplace (M1) via bound wallet (M4); - operate with **scoped autonomy** — trades within law/budget constraints don't need Brain or - Conductor approval. +- **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) via bound wallet (M4); operate with **scoped + autonomy** — trades within law/budget constraints don't need Brain or Conductor approval. - **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). @@ -30,16 +29,16 @@ multiple traders may be Pony actors or a Python async framework. `specialization` ∈ { `defi_yield`, `nft_minter`, `arbitrageur`, `trend_follower`, `market_maker`, … } — extensible. - `decide(market_state, predictions: [BoundedPrediction]) -> MarketAction?` — the trader's core - loop. May return no action (waiting is a valid decision). -- `tool_call(tool_name, args) -> result` — every tool call is intercepted and logged to SAE (M7) - before execution. Includes Marketplace submissions, Sim queries, and Data Feed reads. + loop. May return no action (waiting is a valid decision). Predictions are read from the + Marketplace, which receives them continuously from the sim hub via M2. +- `tool_call(tool_name, args) -> result` — every tool call is intercepted and logged by the SAE + (M7) at the Marketplace level. The Marketplace is the only interface traders can act through. - `pause() / resume()` — Conductor (M6) can pause a trader pending investigation. - `status() -> { active | paused | investigating, wallet_id, specialization, position_summary }`. ## 6. Dependencies & stubs - M1 Marketplace — action submission; *stub:* mock marketplace that logs actions. -- M2 Data Feeds — market data; *stub:* canned data. -- M3 Sims — predictions; *stub:* fixed predictions. +- M1 Marketplace — predictions (from sims via M2) and action submission; *stub:* mock marketplace. - M4 Wallet — bound 1:1; *stub:* mock wallet. - M6 Conductor — supervision; *stub:* no supervision. - M7 SAE — monitors all tool calls; *stub:* print calls. diff --git a/core/docs/plans/M6-conductor.md b/core/docs/plans/M6-conductor.md index 565c1b0..3a347c9 100644 --- a/core/docs/plans/M6-conductor.md +++ b/core/docs/plans/M6-conductor.md @@ -57,7 +57,8 @@ inference wrapper sits alongside the Marketplace. fields, same signatures. The Conductor processes them the same way the Brain would. ## 8. Build steps -1. Define the Conductor's decision model (rule-based for v1? fine-tuned LLM for v2?). +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. diff --git a/core/docs/plans/M7-sae-monitor.md b/core/docs/plans/M7-sae-monitor.md index d8fe780..b2becd2 100644 --- a/core/docs/plans/M7-sae-monitor.md +++ b/core/docs/plans/M7-sae-monitor.md @@ -20,21 +20,23 @@ TBD · `src/economy/sae/`. ML interpretability (sparse autoencoder over trader a Shares the architectural pattern with F2 but is a separate instance scoped to the economy organ. ## 4. Does / does-not -- **Does:** intercept and log **every trader tool call** (Marketplace, Sims, Feeds, internal); - embed trader action sequences; run SAE anomaly detection over action embeddings; flag suspicious - patterns (unusual trading frequency, outsized positions, coordinated behavior across traders, - repeated failed actions, unusual Sim query patterns); report alerts to the Conductor (M6) with - evidence; format alerts **identically to Brain messages** (same structure, same signatures). +- **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, coordinated behavior across traders, 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. ## 5. Interface contract -- `log_tool_call(trader_id, tool_name, args, result, timestamp)` — called on every trader tool - invocation. Synchronous interception (the call is logged before execution proceeds). +- `log_action(trader_id, action_type, args, result, timestamp)` — called on every trader + interaction at the Marketplace level. Synchronous interception (the action is logged before + execution proceeds). - `alert(trader_id, alert_type, evidence, severity) -> SAEAlert`. `alert_type` ∈ { `unusual_frequency`, `outsized_position`, `coordinated_behavior`, - `repeated_failures`, `anomalous_queries`, `pattern_deviation` }. + `repeated_failures`, `pattern_deviation` }. `severity` ∈ { `low`, `medium`, `high`, `critical` }. - `SAEAlert` structure is **identical to Brain message structure** — same fields, same signature scheme. The Conductor (M6) processes SAE alerts and Brain messages through the @@ -62,15 +64,15 @@ Shares the architectural pattern with F2 but is a separate instance scoped to th in M1). ## 8. Build steps -1. Implement tool-call interception in the trader harness (M5). +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. ## 9. Tests -Interception: every tool call produces a log entry. Anomaly: known-suspicious patterns (e.g. -100x normal frequency) trigger alert. Normal: baseline behavior does not trigger alert. +Interception: every Marketplace action produces a log entry. Anomaly: known-suspicious patterns +(e.g. 100x normal frequency) trigger alert. Normal: baseline behavior does not trigger alert. No enforcement: SAE cannot pause or block a trader (only Conductor can). Alert format: SAE alert parses as valid Brain message. Conductor-blind: no Conductor action appears in SAE logs. diff --git a/core/src/economy/sims/mev/fpm.toml b/core/src/economy/sims/mev/fpm.toml new file mode 100644 index 0000000..43cdbca --- /dev/null +++ b/core/src/economy/sims/mev/fpm.toml @@ -0,0 +1,13 @@ +name = "mev-sims" +version = "0.1.0" +license = "proprietary" + +[build] +auto-executables = false +auto-tests = true +link = ["openblas"] + +[fortran] +implicit-typing = false +implicit-external = false +source-form = "free"