7.6 KiB
M1 — Marketplace (multi-trader harness)
1. Component
The economy organ's trading floor: a multi-trader harness through which all market actions must route. No trader may buy, sell, mint, or interact with any on-chain protocol except through 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: 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
action ingress, deterministic admission ordering, supervisor veto, monitor logging, and
simulation-only execution. The full law-script loader remains open. Role C4; scaffold C2.
3. Language & location
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 now: receive
MarketActionrequests; 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 simulatedsimtx-*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 }. 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. 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.- 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-* }. - 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 & 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 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 outright; Conductor veto applies only to law-passing actions. The law is above the Conductor.
- L5 (C4): every action is logged — SAE (M7) receives a record of every submitted action (including rejected ones) for behavioral analysis.
8. Build status
- Done:
MarketActionvalidation and deterministic hardcoded gate. - Done: M4 binding/exposure brake before execution.
- Done: M6 veto ordering after deterministic law.
- Done: M7 logging for pass/fail submissions.
- Done: simulation-only execution receipts.
- Next: implement
LawDecisionwith versioned proof/violation traces. - Next: implement the signed fixed-combinator S-expression constitution against those traces.
- 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 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
- 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.