Jump to content

IdiotProof/SPEC

From MindAttic Docs

IdiotProof — Product specification

The complete product, written down before it is built (owner, 2026-11-30, MAT-T360). Every epic, feature and story the finished product will have is listed here, built or not. The ticket tree mirrors this file one to one: every ID below is a ticket. Nothing gets built unless it is here, and anything taken out of here is closed wont-do in the tree. docs/RELEASE.md says which part of this the current milestone delivers.

1. Product definition

Place in the ecosystem: A product (App) in docs/ECOSYSTEM.md §2.2: the owner's plain-English trading studio. IdiotProof turns a plain-English trade idea into a strict, validated strategy that a 24/7 Monitor inside one local Hub evaluates against live Alpaca data and fires only through three gates: the strategy's conditions, an LLM voter panel (MindAttic.Legion) and the Risk Guardian, with every order passing one TransactionGateway. It is for one owner (and an assistant acting for them) who trades premarket gappers and intraday setups without watching charts. The finished product arms strategies by itself, first the gapper formation rule the research proved, then strategies it generates per ticker from observed behaviour, all on paper until evidence says Live, with Live always needing the owner's confirm code. Its only front doors are the idiotproof CLI and MCP server (BIBLE §1).

2. Scope boundary

2.1 In the product

  • The three gates and the TransactionGateway, with Live confirm codes and Sandbox as the default broker.
  • IdiotScript: prose-to-strategy, a strict JSON canon, diagnostics, stamps, sequences, day backtests, indicators.
  • The Hub: Monitor hosting with a leader lease, the reflected operation catalog as CLI, MCP and docs, the ledger.
  • The Gapper: per-ticker profiles, the exit brain, radar, momentum-arm, replay-and-tune, formation recorder, and formation-rule arming (paper, then Live on a go verdict), including the short leg.
  • Replay and the SQL feature store; the research scanner, catalyst intake and the pre-registered gapper study.
  • Options: manual single legs and spreads, then option legs in strategies behind an options-aware Risk Guardian.
  • Execution fidelity: actual fills, order states as rows, shorts proven on a real paper account.
  • Adaptive auto-strategies generated per ticker once there is enough information (Epic S).

2.2 Never in the product

  • A web or desktop UI. The Blazor app, Learning Center, /gapper, /research, /options pages, Cypress specs and the web-only ghost overlay were removed in IP-T504; the CLI and MCP are the only front doors.
  • Hosting on a server (Hetzner, Azure or other). The Hub is a 127.0.0.1 process with a per-user Data Protection ring on local SQL; Azure was decommissioned 2026-11-26 (IP-T649..T651 closed wont-do).
  • Multi-broker adapters. Alpaca plus the Sandbox only; IBrokerClient stays the seam, no second adapter.
  • Alpaca OAuth account linking (IP-US-R8): a web sign-in feature; keys come from MindAttic.Vault.
  • A paid fundamentals vendor in the trading path (IP-T647 wont-do): the IP-T603 connectors stay off.
  • A Roslyn IdiotScript parser: superseded by the hand-written scanner with exact diagnostics (IP-US-H1).
  • Open-ended research loops: new gapper amendments, whole-universe paper sweeps and soak-style reruns. Research is bounded: one report per question, per docs/RESEARCH_PLAYBOOK.md.
  • Direct vendor LLM calls: all LLM traffic goes through MindAttic.Legion, all keys through MindAttic.Vault.
  • Any order outside the TransactionGateway, or Live without a confirm code (IP-LAW-12/13).

3. Users and roles

  • The owner (trader). Queues and tunes strategies, reads the journal, approves every Live action.
  • An assistant (Claude or any MCP client). Drives the CLI/MCP; can preview Live actions but never confirm them.
  • The Hub (operator role). Runs unattended, hosts the Monitor, hands scheduled steps to MindAttic.Scheduler.
  • MindAttic.Scheduler jobs. Call idiotproof ... for radar, momentum-arm, research scans and data pulls.

4. Requirements

Status is built (closed ticket, with evidence) or MS-n: the milestone in §7 that delivers it. Every unbuilt story is approved and prioritised in build order; the planner splits a story into tasks when the queue reaches it. Legacy story IDs (IP-US-*) in USER_STORIES.md are cited as evidence.

E1. Gates before money moves — IP-T674 — built

F1.1 Risk Guardian — IP-T675 — built

  • S1.1.1 Stop discipline — IP-T676 — built. As a trader, a trade with no stop, a wrong-side stop, a micro-stop or an absurdly wide stop is blocked. Acceptance: given a setup with no stop, when validated, then it is blocked. Evidence: IP-US-A1/A2/A4.
  • S1.1.2 Risk caps and circuit breaker — IP-T677 — built. As a trader, per-trade, account-percent and daily-loss limits block a trade and suggest a size. Evidence: IP-US-A3/A5/A6.
  • S1.1.3 Sizing from limits — IP-T678 — built. As a trader, my max quantity derives from my limits and good setups pass. Evidence: IP-US-A7/A8.

F1.2 LLM voter panel — IP-T679 — built

  • S1.2.1 Panel quorum — IP-T680 — built. As a trader, only an explicit approval quorum lets a fire through; a split, malformed ballot or dead panel blocks it. Evidence: IP-US-K15.
  • S1.2.2 Owner keys — IP-T681 — built. As a trader, the gate votes on my Claude key, then the host key, never another user's. Evidence: IP-US-K14.

F1.3 Transaction gateway — IP-T682 — built

  • S1.3.1 One order path — IP-T683 — built. Every order goes through the TransactionGateway. Evidence: IP-US-W3.
  • S1.3.2 Live confirm codes — IP-T684 — built. A Live action previews and returns a single-use code bound to that order. Evidence: IP-US-W4.
  • S1.3.3 Sandbox by default — IP-T685 — built. Sandbox is the default; Alpaca only with both keys. Evidence: IP-US-K8, IP-LAW-3.

E2. IdiotScript strategies — IP-T686 — built

F2.1 Authoring — IP-T687 — built

  • S2.1.1 Describe, don't code — IP-T688 — built. As a trader, prose becomes parse-checked IdiotScript through Legion with a reflected verb catalog. Evidence: IP-US-E1.
  • S2.1.2 Script diagnostics and fixes — IP-T689 — built. Exact line/column diagnostics and single correct fixes; dsl validate fails closed. Evidence: IP-US-H1, IP-T523.

F2.2 Strategy canon — IP-T690 — built

  • S2.2.1 Strict JSON canon — IP-T691 — built. Unreadable canon is quarantined, never partly run. Evidence: IP-US-K11.
  • S2.2.2 Sequences — IP-T692 — built. A multi-step sequence is one strategy. Evidence: IP-LAW-14, DslSequenceTests.
  • S2.2.3 ASCII stamps — IP-T693 — built. A strategy prints as a stamp that pastes back exactly. Evidence: IP-US-W7.

F2.3 Backtesting and indicators — IP-T694 — built

  • S2.3.1 Day backtest — IP-T695 — built. A chosen day's minute bars replay the strategy with a per-candle condition table and a P&L summary. Evidence: IP-US-C1..C5, J1..J3.
  • S2.3.2 Indicator math — IP-T696 — built. Evidence: IP-US-D1/D2.

E3. Hub and front doors — IP-T697 — built

F3.1 Hub and Monitor hosting — IP-T698 — built

  • S3.1.1 Unattended loop — IP-T699 — built. The Monitor survives failing ticks, writes a heartbeat, exits cleanly. Evidence: IP-US-B1..B3.
  • S3.1.2 Leader lease and service — IP-T700 — built. One leader per database; Windows Service option. Evidence: IP-US-K9/W5.

F3.2 CLI and MCP — IP-T701 — built

  • S3.2.1 One catalog, three doors — IP-T702 — built. Evidence: IP-US-W1.
  • S3.2.2 Exit codes and usage fixes — IP-T703 — built. Evidence: IP-US-W2, IP-T523.
  • S3.2.3 Command ledger — IP-T704 — built. Evidence: IP-US-W6.
  • S3.2.4 Agent bootstrap and docs — IP-T705 — built. Evidence: IP-US-W8/W9.
  • S3.2.5 Full Alpaca coverage and streams — IP-T706 — built. Evidence: IP-US-W10/W13.
  • S3.2.6 Public docs privacy — IP-T707 — built. Evidence: IP-US-W11.

E4. The Gapper — IP-T708 — built

F4.1 Gapper profiles — IP-T709 — built

  • S4.1.1 Dial and queue — IP-T710 — built. Evidence: IP-US-K1.
  • S4.1.2 Gap and window conditions — IP-T711 — built. Evidence: IP-US-K2/K3.

F4.2 Gapper execution — IP-T712 — built

  • S4.2.1 Extended-hours orders — IP-T713 — built. Evidence: IP-US-K5.
  • S4.2.2 Exit brain — IP-T714 — built. Evidence: IP-US-K4; df21cf87, 7b157450, 008e28c3.
  • S4.2.3 Monitor gapper pipeline — IP-T715 — built. Evidence: IP-US-K6, MonitorWorkerHarnessTests.
  • S4.2.4 Short gappers on Sandbox — IP-T716 — built. Evidence: IP-US-K13.

F4.3 Gapper tooling — IP-T717 — built

  • S4.3.1 Replay and tune — IP-T718 — built. Evidence: IP-US-K12.
  • S4.3.2 Radar and momentum-arm — IP-T719 — built. Evidence: 45800636, d4ebd087.
  • S4.3.3 Formation recorder and move-start watch — IP-T720 — built. Evidence: 04392f84, a60c22a8.

E5. Replay and dataset — IP-T721 — built

F5.1 Replay archive — IP-T722 — built

  • S5.1.1 Replay any strategy — IP-T723 — built. Evidence: IP-US-R1/R2.
  • S5.1.2 SQL is the archive — IP-T724 — built. Evidence: IP-US-R3/R4.

F5.2 Feature store — IP-T725 — built

  • S5.2.1 Feature store and export — IP-T726 — built. Evidence: IP-US-R5/R7.
  • S5.2.2 Strategy families — IP-T727 — built. Evidence: IP-US-R6, R9..R12.

E6. Research — IP-T728 — built

F6.1 Research scanner — IP-T729 — built

  • S6.1.1 Autonomous scan — IP-T730 — built. Evidence: IP-US-T1.
  • S6.1.2 Real claims — IP-T731 — built. Evidence: IP-US-T2..T4, T6, U9.
  • S6.1.3 Significance and outcomes — IP-T732 — built. Evidence: IP-US-T5/T8.

F6.2 Catalysts and gapper study — IP-T733 — built

  • S6.2.1 Catalyst intake — IP-T734 — built. Evidence: IP-T602, CatalystIngestorTests.
  • S6.2.2 Gapper study — IP-T735 — built. Evidence: gapper-study-2026-11.md; H11 detector supported on validation, H12 profit claim refuted, holdout locked.
  • S6.2.3 Decision feature store — IP-T736 — built. Evidence: IP-US-S4.

E7. Manual options — IP-T737 — built

F7.1 Options math and orders — IP-T739 — built

  • S7.1.1 Options math — IP-T740 — built. Evidence: IP-US-U1..U3.
  • S7.1.2 Options orders — IP-T741 — built. Evidence: IP-US-U4/U5/U12.
  • S7.1.3 Take-profit hint — IP-T742 — built. Evidence: IP-US-U7.

E8. Formation arming on paper — IP-T656 — MS-25

F8.1 Formation trigger arming — IP-T659 — MS-25

  • S8.1.1 Arm from the study's rule — IP-T634 — MS-25. As a trader, formation-trigger.json carries the thresholds of the surviving H11 detector and the paper-only arming gate is lifted, so formation gappers arm on Paper by themselves. Acceptance: given a snapshot that clears the rule on a paper route, when the recorder sees it, then a Gapper strategy arms on Paper and an audit row records why.

F8.2 Catalyst classification — IP-T660 — MS-25

  • S8.2.1 LLM classification within a budget — IP-T635 — MS-25. Acceptance: given catalyst.intake.llmClassify on with a budget, when news arrives, then the queue classifies it and stops at the budget.

F8.3 Paper shadow verdict — IP-T661 — MS-25

  • S8.3.1 Shadow comparison — IP-T636 — MS-25. Live formation snapshots compared against backtest features.
  • S8.3.2 Go/no-go — IP-T669 — MS-25. After 20 trading days, a written verdict on Live in docs/research/.

E9. Runs locally, reliably — IP-T657 — MS-25

F9.1 Local SQL defaults — IP-T662 — MS-25

  • S9.1.1 Local code defaults — IP-T667 — MS-25. CloudDatabases.cs names local SQL / LocalDB, never the deleted Azure server.
  • S9.1.2 Docs say local SQL — IP-T668 — MS-25.

F9.2 R: deploy and run menu — IP-T663 — MS-25

  • S9.2.1 Publish on deploy-lib — IP-T652 — MS-25. Hub, Cli, Mcp publish to R:\MindAttic\Apps\IdiotProof.
  • S9.2.2 Run menu and consumers — IP-T653 — MS-25. Nothing in the repo names C:\Apps\IdiotProof.
  • S9.2.3 Remove the old C: deploy — IP-T654 — MS-25.

F9.3 Hub reliability — IP-T664 — MS-25

  • S9.3.1 Long pulls don't time out — IP-T645 — MS-25. A research pull no longer surfaces a 15 s HttpClient timeout as a Hub error.

E10. Gapper causes understood — IP-T658 — MS-25

F10.1 History backfill — IP-T665 — MS-25

  • S10.1.1 Backfill the missed month — IP-T640 — MS-25.

F10.2 Cause-and-effect report — IP-T666 — MS-25

  • S10.2.1 One bounded report — IP-T641 — MS-25. What precedes gapper days, per RESEARCH_PLAYBOOK.md.

F10.3 Polish and release MS-25 — IP-T743 — MS-25

  • S10.3.1 MS-25 sign-off — IP-T744 — MS-25. As the owner, I watch a paper-arming day from the R: Hub and the docs describe exactly what runs.

E11. Execution fidelity — IP-T745 — MS-118

F11.1 Fill-price reconciliation — IP-T746 — MS-118

  • S11.1.1 Record actual fills — IP-T747 — MS-118. As a trader, entry/exit prices and realized P&L come from the broker's actual fills. Acceptance: given a fill below the limit, then the row, diary and Risk Guardian use the fill price; given a partial fill, quantity and P&L count only filled shares.

F11.2 Order state as rows — IP-T748 — MS-118

  • S11.2.1 Track every order state — IP-T749 — MS-118. Acceptance: given a pending order, when the Hub restarts, then it is reloaded and reconciled with Alpaca; cancels and rejects record their reason.

F11.3 Shorts proven on paper — IP-T750 — MS-118

  • S11.3.1 Prove shorts against Alpaca — IP-T751 — MS-118. Owner hands-on first: enable shorting on the paper account (equity >= $2,000). Acceptance: a sell_to_open is accepted and a filled short covers by buy_to_close.

E12. Canonical strategy authoring — IP-T752 — MS-118

F12.1 Model JSON from prose — IP-T753 — MS-118

  • S12.1.1 From-text emits canon — IP-T754 — MS-118. strategy from-text returns canonical JSON directly.

F12.2 Schema holds only live data — IP-T755 — MS-118

  • S12.2.1 Drop web-only columns — IP-T756 — MS-118. UserPreferences.OpenStrategyTabs removed by a migration.

F12.3 Polish and release 1.1 — IP-T757 — MS-118

  • S12.3.1 1.1 sign-off — IP-T758 — MS-118. A paper day whose records match Alpaca line for line; docs current.

E13. Live formation gappers — IP-T759 — MS-120

F13.1 Live BrokerMode for formation gappers — IP-T760 — MS-120

  • S13.1.1 Offer Live on a go verdict — IP-T761 — MS-120. Acceptance: given a go verdict, Live formation gappers arm through all gates with a confirm code; given a no-go, this story closes wont-do citing the verdict.

F13.2 Gapper short leg — IP-T762 — MS-120

  • S13.2.1 Short leg on paper — IP-T763 — MS-120. The fade side arms on Paper once the long exit survived the shadow.

E14. Options trading proven — IP-T764 — MS-120

F14.1 Paper options round trip — IP-T765 — MS-120

  • S14.1.1 Fill and close a paper option — IP-T766 — MS-120. In market hours, one contract fills and closes; the account ends flat (IP-US-U10).

F14.2 Multi-leg spreads — IP-T767 — MS-120

  • S14.2.1 Manual spreads — IP-T768 — MS-120. mleg spreads by hand with net premium, breakeven and max loss shown.

F14.3 Option legs in strategies — IP-T769 — MS-120

  • S14.3.1 Schema v2 option legs — IP-T770 — MS-120. Option legs and IV/Greeks conditions in canon v2; v1 strategies stay byte-identical.
  • S14.3.2 Non-linear Risk Guardian — IP-T771 — MS-120. Risk for a long option is the premium; the Monitor fires options only on Paper until signed off.

F14.4 Polish and release 1.2 — IP-T772 — MS-120

  • S14.4.1 1.2 sign-off — IP-T773 — MS-120. Includes updating BIBLE §3 for gated options strategies.

E15. Adaptive auto-strategies — IP-T774 — MS-121

F15.1 Enough-information generation — IP-T775 — MS-121

  • S15.1.1 Generate when informed — IP-T776 — MS-121. Nothing is generated before the information threshold; the decision store records why (IP-US-S1).

F15.2 Intraday reversion and fade — IP-T777 — MS-121

  • S15.2.1 Reversion and fade templates — IP-T778 — MS-121. Mean-reversion long at the low, fade short at the high, through all gates on Paper (IP-US-S2).

F15.3 Per-ticker parameters — IP-T779 — MS-121

  • S15.3.1 Parameters from behaviour — IP-T780 — MS-121. Stops and size from price tier, gap, volume and ATR, inside Risk Guardian limits (IP-US-S3).

F15.4 Polish and release 2.0 — IP-T781 — MS-121

  • S15.4.1 2.0 sign-off — IP-T782 — MS-121. Every story in this spec built; the docs describe the product.

5. Non-functional requirements

  • Platform: Windows, .NET 10, local SQL Server / LocalDB; the Hub binds 127.0.0.1 only.
  • Safety: Sandbox default; paper before Live; Live needs a single-use confirm code; exits are always audited.
  • Reliability: the Monitor survives its own failures (IP-LAW-5) and one leader runs per database.
  • Secrets: keys only in MindAttic.Vault; ledgers redact; public docs carry no key or account id.
  • Quality bar: a story is built only with a green NUnit test named in USER_STORIES (BIBLE §8).

6. Interfaces and dependencies

  • Platform concerns (docs/ECOSYSTEM.md §2.1): Credentials and settings: MindAttic.Vault. LLM calls: MindAttic.Legion (the voter panel and from-text). Scheduled jobs: MindAttic.Scheduler. Shipping: the shared run menu (MindAttic.Agency deploy-lib, MindAttic.Deploy).
  • Uses: Alpaca Trading and Market Data (REST + websocket), SEC EDGAR, Federal Register, news wires; MindAttic.Legion (LLM panel), MindAttic.Vault (keys), MindAttic.Scheduler (jobs), deploy-lib from MindAttic.Agency (run menu).
  • Used by: the owner and assistants through the CLI and MCP; nothing else calls the Hub.

7. Release sequence

  1. MS-25 IdiotProof Gapper paper arming (active): E8, E9, E10. Ends with F10.3.
  2. MS-118 IdiotProof 1.1 Execution fidelity: E11, E12. Ends with F12.3.
  3. MS-120 IdiotProof 1.2 Live gappers and options: E13, E14. Ends with F14.4.
  4. MS-121 IdiotProof 2.0 Adaptive strategies (the finished product): E15. Ends with F15.4.

8. Change log

Date Change to scope Ticket
2026-11-30 Specification written from BIBLE, USER_STORIES, RELEASE, research and the ticket history; release sequence MS-25, MS-118, MS-120, MS-121. Options phase 2 is scheduled from BIBLE §7 although §3 says "not an options autotrader" today; S14.4.1 updates §3 when it ships. MAT-T376
2026-11-30 MAT-T462 single-source pass: 5 renamed (IP-T657, T658, T752, T755, T764), 0 buckets dissolved (IP-T755 "Schema cleanup" reworded to a capability), 48 requires added (0 cross-repo; each later milestone's stories now wait for the previous sign-off), 0 platform re-points MAT-T470
Part of IdiotProof.
From IdiotProof/docs/SPEC.md via MindAttic.Docs; synced automatically, so edit the repo, not this page.