From 3532ee024b4f6b6996dd8a909141f4e88df325c8 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sat, 24 Oct 2026 03:30:18 -0700 Subject: [PATCH] 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.