mirror of
https://github.com/SHOGGOTH-SECTOR/sica-fondt.git
synced 2026-09-30 01:15:10 +00:00
Economy organ spec review: data flow corrections, toolchain decisions, typo fix
- M3 hub: predictions publish continuously to Marketplace via M2 (not trader-queried) - M3 BoundedPrediction: three quality metrics (confidence, correctness, certainty) - M5 traders: read predictions from Marketplace, mixed roster (LLM + bots) - M7 SAE: monitors at Marketplace level (the only trader interface) - M6 Conductor: clarified as LLM, not rule-based - M4 wallets: one multi-chain wallet per trader, strictly 1:1 - M1 Marketplace: added query_predictions interface for traders - M3d/M3e: Fortran 2018, gfortran, fpm, OpenBLAS, hand-rolled numerics - M3b typo: "literao" -> "literal" - SessionStart hook: added gfortran, fpm, Tcl, ECLiPSe Prolog, Zig, Foundry - Stub fpm.toml for M3d (mev sims) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -65,15 +65,113 @@ else
|
|||||||
fi
|
fi
|
||||||
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.
|
# Ensure ponyc is on PATH for future shells.
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
PONY_PATH_LINE='export PATH=/root/.local/share/ponyup/bin:$PATH'
|
EXTRA_PATHS='/root/.local/share/ponyup/bin:/opt/eclipseclp/bin/x86_64_linux'
|
||||||
if [ -f "$HOME/.bashrc" ] && grep -qF "$PONY_PATH_LINE" "$HOME/.bashrc"; then
|
FOUNDRY_PATH="$HOME/.foundry/bin"
|
||||||
log "ponyup PATH line already in ~/.bashrc; skipping."
|
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
|
else
|
||||||
log "Appending ponyup PATH line to ~/.bashrc"
|
log "Appending toolchain PATH lines to ~/.bashrc"
|
||||||
echo "$PONY_PATH_LINE" >> "$HOME/.bashrc" || warn "Could not append to ~/.bashrc; continuing."
|
echo "$FULL_PATH_LINE" >> "$HOME/.bashrc" || warn "Could not append to ~/.bashrc; continuing."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "Done."
|
log "Done."
|
||||||
|
|||||||
@@ -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
|
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).
|
(M6) for upstream output. Immune system is a separate organ (out of scope here).
|
||||||
`MarketAction` ∈ { `buy`, `sell`, `mint`, `provide_liquidity`, `withdraw_liquidity`, `claim_rewards`, … }.
|
`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,
|
- `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 /
|
pure function. The law script is loaded at startup and **immutable at runtime** (mirrors S3 /
|
||||||
the COBOL vault pattern).
|
the COBOL vault pattern).
|
||||||
|
|||||||
@@ -3,9 +3,10 @@
|
|||||||
## 1. Component
|
## 1. Component
|
||||||
The economy organ's prediction engine: **always-running simulations** ("Sims") populated by
|
The economy organ's prediction engine: **always-running simulations** ("Sims") populated by
|
||||||
autonomous simulation agents ("Pops") that model market dynamics across multiple mathematical
|
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
|
domains and time scales. Sims produce raw simulation data; the hub transforms it into
|
||||||
**predictions with explicit upper and lower bounds** on every output value. This is the hub spec;
|
**predictions with explicit upper and lower bounds** and publishes them continuously to the
|
||||||
individual sim types have dedicated sub-specs (M3a–M3g).
|
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
|
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].
|
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.
|
sub-processes it orchestrates.
|
||||||
|
|
||||||
## 4. Does / does-not
|
## 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
|
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
|
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)
|
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
|
for calibration; transform raw sim data into bounded predictions and publish them continuously
|
||||||
**explicit upper/lower bounds** on every prediction value.
|
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 |
|
| Horizon | Window | Tick step | Effective ratio | Wall time for window |
|
||||||
|---------|--------|-----------|-----------------|---------------------|
|
|---------|--------|-----------|-----------------|---------------------|
|
||||||
| Tick–hourly | Next 1–60 min | 1s | 90:1 | ~40s |
|
| 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 |
|
| Annual | Next 365d | ~2.5 hr | ~788,000:1 | ~40s |
|
||||||
| 5-year | Next 1825d | 12 hr | ~3,942,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
|
- **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;
|
decide); enforce laws (Marketplace does); supervise behavior (Conductor/SAE do); receive
|
||||||
run slower than 90:1.
|
trader queries (traders query the Marketplace); skip ticks; run slower than 90:1.
|
||||||
|
|
||||||
## 5. Interface contract
|
## 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`,
|
`SimType` ∈ { `statistical`, `sociological`, `amm_liquidity`, `mev_adversarial`,
|
||||||
`tokenomics_macro`, `consensus_staking`, `market_microstructure` } (M3a–M3g).
|
`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.
|
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
|
Three quality metrics, each ∈ [0.00, 10.00]:
|
||||||
`lower - value - upper / 10.00` (e.g. `2.31 - 4.44 - 7.11 / 10.00 gain over next 30 days`);
|
**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.
|
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,
|
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.
|
- `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
|
- `calibrate(sim_type, feed_data: [NormalizedDatum])` — Data Feeds (M2) pushes live data for
|
||||||
model recalibration.
|
model recalibration.
|
||||||
|
|
||||||
## 6. Dependencies & stubs
|
## 6. Dependencies & stubs
|
||||||
- M2 Data Feeds — calibration data source; *stub:* canned market data.
|
- 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.
|
- M3a–M3g sub-specs — individual sim implementations; *stub:* each returns fixed predictions.
|
||||||
|
|
||||||
## 7. Invariants / laws
|
## 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
|
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
|
time**. Each horizon runs **in parallel** — they are concurrent, not sequential. No horizon
|
||||||
runs slower than 90:1.
|
runs slower than 90:1.
|
||||||
- **L4 (C4):** sims are **read-only from traders' perspective** — a query never mutates sim
|
- **L4 (C4):** sims are **read-only from traders' perspective** — traders consume predictions
|
||||||
state. Calibration happens only from Data Feeds (M2).
|
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.
|
- **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.
|
Degraded sims report their status; traders handle missing predictions.
|
||||||
- **L6 (C3):** Pops are **simulation constructs, not AI actors** — they follow mathematical
|
- **L6 (C3):** Pops are **simulation constructs, not AI actors** — they follow mathematical
|
||||||
rules within the sim. Traders (M5) are the AI actors.
|
rules within the sim. Traders (M5) are the AI actors.
|
||||||
|
|
||||||
## 8. Build steps
|
## 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).
|
2. Build the sim runner (lifecycle management for always-on sims).
|
||||||
3. Wire M2 Data Feeds → calibration pipeline.
|
3. Wire M2 Data Feeds → calibration pipeline.
|
||||||
4. Implement sub-specs M3a–M3g as they land.
|
4. Implement sub-specs M3a–M3g as they land.
|
||||||
5. Wire trader query interface.
|
5. Wire continuous prediction publishing → M2 → Marketplace.
|
||||||
|
|
||||||
## 9. Tests
|
## 9. Tests
|
||||||
Always-on: sim running after init without external trigger. Bounded output: every prediction has
|
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:
|
lower ≤ value ≤ upper. Three metrics: confidence, correctness, certainty all present in every
|
||||||
one sim's failure doesn't affect others. Calibration: new data updates model state.
|
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
|
## 10. Open items
|
||||||
- Pop lifecycle (birth/death/mutation within sims, or fixed populations?).
|
- Pop lifecycle (birth/death/mutation within sims, or fixed populations?).
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ strategy mutation, PDE solvers for MFG (HJB + Fokker-Planck), and bandit algorit
|
|||||||
- M3 Sims hub — lifecycle management; *stub:* manual init.
|
- M3 Sims hub — lifecycle management; *stub:* manual init.
|
||||||
|
|
||||||
## 7. Invariants / laws
|
## 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.
|
market participants. The sim models emergent behavior from abstracted populations.
|
||||||
- **L2 (C5):** strategies **evolve** — the population distribution shifts over time via
|
- **L2 (C5):** strategies **evolve** — the population distribution shifts over time via
|
||||||
replicator dynamics. No fixed strategy ratios.
|
replicator dynamics. No fixed strategy ratios.
|
||||||
|
|||||||
@@ -19,7 +19,9 @@ optimization C3 (emerging — SMFRL solvers); Kolokoltsov adversarial C3 (non-li
|
|||||||
WENO discretization established but crypto application novel). Parameterization C1.
|
WENO discretization established but crypto application novel). Parameterization C1.
|
||||||
|
|
||||||
## 3. Language & location
|
## 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
|
shock-capturing), knapsack combinatorics, and continuous-time auction modeling at the throughput
|
||||||
MEV extraction demands; no GC pauses during hot-path simulation.
|
MEV extraction demands; no GC pauses during hot-path simulation.
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
composable yield optimization C4 (Yearn v3, Beefy, production-validated). Specific parameters C1.
|
||||||
|
|
||||||
## 3. Language & location
|
## 3. Language & location
|
||||||
TBD · `src/economy/sims/tokenomics/`. **Fortran** — SDE solvers (Euler-Maruyama, Milstein),
|
**Fortran 2018** (gfortran) · `src/economy/sims/tokenomics/`. Build: **fpm**. Dependencies:
|
||||||
state-space estimation, and VAR impulse responses are dense matrix-heavy loops where Fortran's
|
**OpenBLAS** (LAPACK/BLAS via native Fortran interfaces). Hand-rolled: Box-Muller RNG, SDE
|
||||||
array intrinsics and zero-overhead numerics dominate; same language as M3d avoids a toolchain
|
solvers, JSON I/O against fixed schemas. SDE solvers (Euler-Maruyama, Milstein), state-space
|
||||||
split across the heaviest numerical sims.
|
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
|
## 4. Does / does-not
|
||||||
- **Does:** simulate token state dynamics via the SDE framework:
|
- **Does:** simulate token state dynamics via the SDE framework:
|
||||||
|
|||||||
@@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
## 1. Component
|
## 1. Component
|
||||||
The economy organ's vault: **sovereign, local-hosted, our-custody-only cryptocurrency wallets**.
|
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
|
Each wallet binds to exactly one Trader (M5) — strictly 1:1 both directions. A single wallet
|
||||||
Marketplace (M1). Wallets hold keys, sign transactions, and enforce wallet-level spending limits.
|
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).
|
Tax is collected on trader income and routed to the Verschwörern Veregeister wallets (stub — M0).
|
||||||
|
|
||||||
## 2. Status / certainty
|
## 2. Status / certainty
|
||||||
@@ -24,7 +26,8 @@ with web3 libs for prototyping.
|
|||||||
custody to any third party — ever.
|
custody to any third party — ever.
|
||||||
|
|
||||||
## 5. Interface contract
|
## 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.
|
- `sign(wallet_id, tx: UnsignedTransaction) -> SignedTransaction` — signs with the wallet's key.
|
||||||
Only the bound trader (via Marketplace) can request signing.
|
Only the bound trader (via Marketplace) can request signing.
|
||||||
- `balance(wallet_id) -> { chain, assets: [{ token, amount }] }`.
|
- `balance(wallet_id) -> { chain, assets: [{ token, amount }] }`.
|
||||||
|
|||||||
@@ -11,16 +11,15 @@ long-term holding, etc.).
|
|||||||
DESIGN-FIRST · ABSENT. Role C3; implementation C1.
|
DESIGN-FIRST · ABSENT. Role C3; implementation C1.
|
||||||
|
|
||||||
## 3. Language & location
|
## 3. Language & location
|
||||||
TBD · `src/economy/traders/`. Each trader is an AI actor — likely LLM-based (small models for
|
TBD · `src/economy/traders/`. Traders are a mixed roster: some are LLM-powered AI agents, some
|
||||||
speed) or hybrid (LLM for strategy + deterministic execution logic). The harness managing
|
are deterministic strategy bots. All use the same `MarketAction` interface through the
|
||||||
multiple traders may be Pony actors or a Python async framework.
|
Marketplace regardless of implementation.
|
||||||
|
|
||||||
## 4. Does / does-not
|
## 4. Does / does-not
|
||||||
- **Does:** query Sims (M3) for market predictions (bounded, multi-domain); consume Data Feeds
|
- **Does:** read sim predictions from the Marketplace (M1) (bounded, multi-domain, per-sim-type);
|
||||||
(M2) for real-time market state; formulate trade decisions based on predictions + data +
|
formulate trade decisions based on predictions + market state + specialization; submit
|
||||||
specialization; submit `MarketAction` requests to the Marketplace (M1) via bound wallet (M4);
|
`MarketAction` requests to the Marketplace (M1) via bound wallet (M4); operate with **scoped
|
||||||
operate with **scoped autonomy** — trades within law/budget constraints don't need Brain or
|
autonomy** — trades within law/budget constraints don't need Brain or Conductor approval.
|
||||||
Conductor approval.
|
|
||||||
- **Does-not:** execute on-chain directly (Marketplace does); hold keys (Wallet does); supervise
|
- **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
|
other traders (Conductor does); modify the law script (immutable — M1-L2); bypass the
|
||||||
Marketplace (M1-L1).
|
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`,
|
`specialization` ∈ { `defi_yield`, `nft_minter`, `arbitrageur`, `trend_follower`,
|
||||||
`market_maker`, … } — extensible.
|
`market_maker`, … } — extensible.
|
||||||
- `decide(market_state, predictions: [BoundedPrediction]) -> MarketAction?` — the trader's core
|
- `decide(market_state, predictions: [BoundedPrediction]) -> MarketAction?` — the trader's core
|
||||||
loop. May return no action (waiting is a valid decision).
|
loop. May return no action (waiting is a valid decision). Predictions are read from the
|
||||||
- `tool_call(tool_name, args) -> result` — every tool call is intercepted and logged to SAE (M7)
|
Marketplace, which receives them continuously from the sim hub via M2.
|
||||||
before execution. Includes Marketplace submissions, Sim queries, and Data Feed reads.
|
- `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.
|
- `pause() / resume()` — Conductor (M6) can pause a trader pending investigation.
|
||||||
- `status() -> { active | paused | investigating, wallet_id, specialization, position_summary }`.
|
- `status() -> { active | paused | investigating, wallet_id, specialization, position_summary }`.
|
||||||
|
|
||||||
## 6. Dependencies & stubs
|
## 6. Dependencies & stubs
|
||||||
- M1 Marketplace — action submission; *stub:* mock marketplace that logs actions.
|
- M1 Marketplace — action submission; *stub:* mock marketplace that logs actions.
|
||||||
- M2 Data Feeds — market data; *stub:* canned data.
|
- M1 Marketplace — predictions (from sims via M2) and action submission; *stub:* mock marketplace.
|
||||||
- M3 Sims — predictions; *stub:* fixed predictions.
|
|
||||||
- M4 Wallet — bound 1:1; *stub:* mock wallet.
|
- M4 Wallet — bound 1:1; *stub:* mock wallet.
|
||||||
- M6 Conductor — supervision; *stub:* no supervision.
|
- M6 Conductor — supervision; *stub:* no supervision.
|
||||||
- M7 SAE — monitors all tool calls; *stub:* print calls.
|
- M7 SAE — monitors all tool calls; *stub:* print calls.
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ inference wrapper sits alongside the Marketplace.
|
|||||||
fields, same signatures. The Conductor processes them the same way the Brain would.
|
fields, same signatures. The Conductor processes them the same way the Brain would.
|
||||||
|
|
||||||
## 8. Build steps
|
## 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).
|
2. Wire SAE alert intake (M7 → M6).
|
||||||
3. Wire Marketplace veto check (M1 → M6 → approve/veto).
|
3. Wire Marketplace veto check (M1 → M6 → approve/veto).
|
||||||
4. Implement trader pause/investigate/resume flow.
|
4. Implement trader pause/investigate/resume flow.
|
||||||
|
|||||||
@@ -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.
|
Shares the architectural pattern with F2 but is a separate instance scoped to the economy organ.
|
||||||
|
|
||||||
## 4. Does / does-not
|
## 4. Does / does-not
|
||||||
- **Does:** intercept and log **every trader tool call** (Marketplace, Sims, Feeds, internal);
|
- **Does:** intercept and log **every trader action at the Marketplace level** — the Marketplace
|
||||||
embed trader action sequences; run SAE anomaly detection over action embeddings; flag suspicious
|
is the only interface traders can act through, so monitoring it captures everything; embed trader
|
||||||
patterns (unusual trading frequency, outsized positions, coordinated behavior across traders,
|
action sequences; run SAE anomaly detection over action embeddings; flag suspicious patterns
|
||||||
repeated failed actions, unusual Sim query patterns); report alerts to the Conductor (M6) with
|
(unusual trading frequency, outsized positions, coordinated behavior across traders, repeated
|
||||||
evidence; format alerts **identically to Brain messages** (same structure, same signatures).
|
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
|
- **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
|
"homunculus" — echoes F2-L1); correct trader behavior (detection only — F2-L2: no closed
|
||||||
elimination loop); trade or access wallets.
|
elimination loop); trade or access wallets.
|
||||||
|
|
||||||
## 5. Interface contract
|
## 5. Interface contract
|
||||||
- `log_tool_call(trader_id, tool_name, args, result, timestamp)` — called on every trader tool
|
- `log_action(trader_id, action_type, args, result, timestamp)` — called on every trader
|
||||||
invocation. Synchronous interception (the call is logged before execution proceeds).
|
interaction at the Marketplace level. Synchronous interception (the action is logged before
|
||||||
|
execution proceeds).
|
||||||
- `alert(trader_id, alert_type, evidence, severity) -> SAEAlert`.
|
- `alert(trader_id, alert_type, evidence, severity) -> SAEAlert`.
|
||||||
`alert_type` ∈ { `unusual_frequency`, `outsized_position`, `coordinated_behavior`,
|
`alert_type` ∈ { `unusual_frequency`, `outsized_position`, `coordinated_behavior`,
|
||||||
`repeated_failures`, `anomalous_queries`, `pattern_deviation` }.
|
`repeated_failures`, `pattern_deviation` }.
|
||||||
`severity` ∈ { `low`, `medium`, `high`, `critical` }.
|
`severity` ∈ { `low`, `medium`, `high`, `critical` }.
|
||||||
- `SAEAlert` structure is **identical to Brain message structure** — same fields, same
|
- `SAEAlert` structure is **identical to Brain message structure** — same fields, same
|
||||||
signature scheme. The Conductor (M6) processes SAE alerts and Brain messages through the
|
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).
|
in M1).
|
||||||
|
|
||||||
## 8. Build steps
|
## 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).
|
2. Define the action embedding scheme (how tool calls are vectorized).
|
||||||
3. Train the SAE on normal trader behavior (bootstrapped from simulated trading).
|
3. Train the SAE on normal trader behavior (bootstrapped from simulated trading).
|
||||||
4. Implement anomaly scoring and alert threshold.
|
4. Implement anomaly scoring and alert threshold.
|
||||||
5. Wire alerts to Conductor (M6) in Brain-compatible message format.
|
5. Wire alerts to Conductor (M6) in Brain-compatible message format.
|
||||||
|
|
||||||
## 9. Tests
|
## 9. Tests
|
||||||
Interception: every tool call produces a log entry. Anomaly: known-suspicious patterns (e.g.
|
Interception: every Marketplace action produces a log entry. Anomaly: known-suspicious patterns
|
||||||
100x normal frequency) trigger alert. Normal: baseline behavior does not trigger alert.
|
(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
|
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.
|
alert parses as valid Brain message. Conductor-blind: no Conductor action appears in SAE logs.
|
||||||
|
|
||||||
|
|||||||
@@ -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"
|
||||||
Reference in New Issue
Block a user