docs: finish M1 implemented-vs-target contract

This commit is contained in:
2026-10-24 03:30:18 -07:00
parent 8243d3a9bf
commit 3532ee024b
+35 -34
View File
@@ -37,29 +37,30 @@ auditable admission ordering.
M3a/M3b/M3c/M3e currently publish when their calibrated facade query runs; a scheduler-driven 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 continuous refresh loop is still open. Traders see individual sim results and decide how to
weight them. weight them.
- `law_check(action: MarketAction) -> { pass | violation(rule_id, reason) }` — deterministic, - Implemented deterministic gate: required fields, action allowlist, chain allowlist, and numeric
pure function. The law script is loaded at startup and **immutable at runtime** (mirrors S3 / notional validation. The full startup-loaded S-expression constitution is **designed but not
the COBOL vault pattern). implemented**; see `M1-law-script-design.md`.
- `veto_check(action: MarketAction, trader_id) -> { approved | vetoed(reason) }` — calls M6 - Implemented M4 brake: exact Trader↔wallet binding plus exposure checks.
Conductor. - Implemented M6 gate: one-shot veto is consumed only after deterministic law and wallet checks.
- `execute(action: MarketAction, wallet_id) -> { tx_hash | error }` — on-chain execution via - Implemented execution result: `{ status succeeded execution simulated tx_id simtx-* }`.
wallet API. - Implemented M7 observation: every submission is logged before admission checks.
- `tax_event(trader_id, income_amount) -> receipt` — triggers tax collection. - Tax staging exists on M0 as `tax_event`; Marketplace does not currently calculate realized
income or move value.
## 6. Dependencies & stubs ## 6. Dependencies & runtime state
- M4 Wallets — signing + execution; *stub:* "if finished, would sign and broadcast tx [details]". - M4 Wallets — implemented binding + exposure brakes; no signer/custody.
- M5 Traders — action source; *stub:* "if finished, would submit [action] for [asset] at [price]". - M5 Traders — registry/state exists; AI action generation is open.
- M6 Conductor — veto authority; *stub:* "if finished, would evaluate [action] against risk policy; approving". - M6 Conductor — implemented deterministic veto/pause surface; AI judgment is open.
- M7 SAE — action log consumer; *stub:* "if finished, would analyze [action] for behavioral anomalies". - M7 SAE — implemented logging + caller-created alert envelopes; SAE inference is open.
- Blockchain RPCs — on-chain execution; *stub:* "if finished, would execute [action] on [chain], returning tx_hash". - M3 Sims — latest prediction reads are implemented through Marketplace.
- Blockchain RPC/signing/broadcast — deliberately absent.
## 7. Invariants / laws ## 7. Invariants / laws
- **L1 (C5):** **all market actions route through the Marketplace** — no direct on-chain - **L1 (C5):** **all market actions route through the Marketplace** — no direct on-chain
execution by any trader. This is the economy organ's S1. execution by any trader. This is the economy organ's S1.
- **L2 (C5):** the **deterministic law script is immutable at runtime** — loaded at startup, - **L2 (C5 target):** the future startup-loaded deterministic law script is immutable at runtime
never modified by traders, conductor, or sims. Changes require a restart with a new script and dual-signed. **Current implementation note:** V1 uses hardcoded deterministic allowlists and
version **and a pair of signatures from the operator and the Homunculus**. Mirrors the COBOL field/notional validation; the signed fixed-combinator evaluator is still open.
vault (S3).
- **L3 (C4):** **no wallet, no access** — a trader without a bound wallet cannot submit actions. - **L3 (C4):** **no wallet, no access** — a trader without a bound wallet cannot submit actions.
The Marketplace enforces this before any other check. The Marketplace enforces this before any other check.
- **L4 (C4):** **veto is checked after law, before execution** — law violations are rejected - **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 - **L5 (C4):** **every action is logged** — SAE (M7) receives a record of every submitted
action (including rejected ones) for behavioral analysis. action (including rejected ones) for behavioral analysis.
## 8. Build steps ## 8. Build status
1. Define `MarketAction` types and the law script format. 1. **Done:** `MarketAction` validation and deterministic hardcoded gate.
2. Implement the law checker (deterministic, pure, non-Turing). 2. **Done:** M4 binding/exposure brake before execution.
3. Wire veto check to M6 Conductor. 3. **Done:** M6 veto ordering after deterministic law.
4. Wire execution to M4 Wallet API. 4. **Done:** M7 logging for pass/fail submissions.
5. Wire action logging to M7 SAE. 5. **Done:** simulation-only execution receipts.
6. Implement tax collection on realized income. 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 ## 9. Tests
Law enforcement: known violations rejected; valid actions pass. Veto: conductor veto blocks The M0 contract suite verifies walletless rejection, wrong-wallet rejection, deterministic law
execution. Wallet binding: walletless trader rejected. Logging: every action (pass + fail) logged. rejection, law-before-veto ordering, valid simulation-only execution, per-action/session brakes,
Tax: income event triggers tax stub. Immutability: law script cannot be modified at runtime. 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 ## 10. Open items
- The law script language/format (DSL? declarative rules? S-expressions?). - Implement the already-decided fixed-combinator S-expression evaluator and signature checks.
- Which blockchain protocols/RPCs to support initially. - Ratify M4 custody before choosing or exposing any chain execution adapter.
- Position limits, drawdown stops, and other risk parameters — live in the law script or in the - Position/drawdown rules that belong in deterministic law versus M6 judgment.
Conductor's judgment? - Realized-income accounting and tax calculation/transfer policy.
- Tax rate / calculation method (fixed %, tiered, per-asset?).
- Non-Turing law script design — to discuss (format, expressiveness, bounds).