בס״ד

MIS — Definitive System State

docs/MIS_SYSTEM_STATE.md · last changed (pre-VM history) · rendered from GitHub master

MIS — Definitive System State

🛑 THIS FILE IS RETIRED AS A LIVING DOC (stamped 2026-06-12). It was repeatedly the most-misleading MIS doc (multiple sessions behind). Do NOT update it; do NOT trust its numbers. Live truth: MIS/docs/MIS_SACS_CALIBRATION_MODULE.md (process) · MIS/docs/MIS_ROADMAP.md (map) · docs/MIS_OPERATOR.md (beacon) · fn=portrecon/fn=health (numbers). Kept for history only.

Last updated: 2026-06-02 · Session 41 · Written from verified code, not memory.

🟢 LIVE-OPS DELTA — 2026-06-05 (Fri eve, pt 3 MIS LIVE-OPS). Real pre-Shabbos trading-support session; no engine deploys (FSE freeze holds), one safe data write (holdings load). State changes since the notes below:
- Holdings made CURRENT — loaded fresh Fidelity export (MIS/Portfolio_Positions_Jun-04-2026.csv) into HOLDINGS_CLEAN via fn=loadholdings (25 positions; ABBV 17→7 sale now reflected). Recon GREEN all 5 accounts; equity $22,135 now broker-verified (not a snapshot). Caught + fixed a SPAXX double-count (load must exclude cash-likes; cash comes from the control layer).
- Movers restored (fn=topmovers, top/bottom-10 of ~20 tickers).
- Crypto/gold feed is STALE + percent-only — MIS was WRONG 6/5 (BTC −6.2%/Gold $4,498) vs live (BTC ~$61,550 −2.8%, ETH ~$1,600 −9%, Gold ~$4,330 −3%). Cross-check live (CoinGecko+Coinbase); add ETH + dollar levels + freshness stamp (Sunday #5).
- Broker-stop honesty: MIS shows stop LEVELS only — cannot place orders, cannot see live broker stops → 0 active stops 6/5. Protection plan = SELL/TRIM/STOP/HOLD by mandate, sized to a stated max-loss budget ($500–750 → capped ~$490 loss, freed ~$5.9K).
- BUG: DONE/DEFER from the Claude-Code inbox path returns "?" (captures, doesn't action) — Sam must DONE/DEFER from his Telegram bot until fixed (Sunday #8).
- Bot "MIS BRIEF" is NOT live — returns the bot's stale AI-snapshot (old cards, e.g. Schwab re-auth wrongly "overdue"), NOT fn=brief. Live-routing + make-permanent = Sunday #3.
- Account renaming pending: Growth / Safe / Son / Daughter / Trading (Sunday #7).
- Sunday = #1 ("set up everything calculated for Monday"): trades GTC for Mon open + the 9-item agenda. Phase 2 vision = 200–250 tickers. Full lessons → mis-daily-report skill Live-ops section + memory feedback_mis_live_ops_data_truth.

⚠️ MIS STALE-DOC NOTICE — propagated 2026-06-04 ~11:30 PM ET (ZW-ENGINE-V9, docs-only). This file is ONE SESSION BEHIND — it does not record the 2026-06-04 PM work (A/B recon, GATE-4 contamination finding, $22,135 correction, the freeze). Canonical MIS source = MIS/docs/MIS_SACS_CALIBRATION_MODULE.md — read it first; do not duplicate it here. Corrections as of 2026-06-04 PM:
- Engine = v2 (MIS/v2/Code.gs), two-layer arch (Engine: Durability/Trend/Setup→Action, pure · Portfolio: WARNING, never mutates Action). v1 / v7.x / v11 = RETIRED / reference only.
- Live = A (recon) + B (exposure) ONLY. Equity $22,135 is a SNAPSHOT — must re-fire fn=portrecon before use (old $32K = phantom from un-netted margin).
- GATE-4 rewrite = SUPERSEDED unless the synthV2 clean-trace fails: decomposed engine already clean → C (promote synthV2) IS the fix, not an engine rewrite.
- synthV2 = proven clean but NOT wired to any operator surface (orphan until Gate C).
- ASML brief-drop = code-path-plausible, NOT live-confirmed.
- Production swap = NOT approved · Dashboard = deferred (built LAST) · D / F / absolute-score / scale 50-183-250 = BLOCKED.
- Next deploy-window contract (freeze holds until Sam opens it): B.75 → C → STOP.
- SACS formula / Flow-tristate facts below may be stale — actual SACS = FlowStrength×0.5 + RS_SPY×25 + RS_Sector×25 (never used RR); verify against the canonical module.


The three pieces — what each one IS

1. MIS v1 Brain (the scoring engine)

2. MIS v2 Data Layer (portfolio truth + decisions)

3. ops-api Worker (the router / portal backend)


What's connected vs what's missing

Connection Status What it unlocks
Plaid → real banks ✅ LIVE (production) Cash tile shows real Chase/Citi/USBank/etc.
ops-api FINNHUB_API_KEY ✅ SET /mis/peek can fetch live quote + news
ops-api MIS_V2_URL + MIS_V2_TOKEN ❌ NOT SET peek overlay (FSE verdict, cost basis, held?, P&L) dark
ops-api OPENAI_API_KEY ❌ NOT SET voice sounds like MeloTTS (flat) not OpenAI (natural)
v1 Schwab credentials ⚠️ PLAINTEXT in CONTROL tab Security hole — must migrate to PropertiesService
v2 Schwab credentials ✅ Already in Script Properties Right pattern
v1 triggers ✅ KILLED 2026-06-02 No more auto-emails
SACS Upgrade ✅ 3 fixes applied 2026-06-02 Lethal position sizer bug fixed, risk gate fixed, RR divide-by-zero fixed
Flow formula (continuous) ❌ STILL TRISTATE 28/44/76 not 0-100. Session 2 Brain Restore proper.
FSE Foundation tabs ✅ Created (fse_foundation.js) FINAL_STATE_ENGINE + FINAL_STATE_HISTORY + SURFACE_CONFLICT_CHECK exist
Full 183-ticker FSE ❌ NOT DONE Session 3 of the 9-session plan

The two things Sam needs to do to fully wire MIS v2 → portal

Action 1 — Get the RUN_TOKEN from the v2 Script Properties

  1. Open MIS v2 sheet: https://docs.google.com/spreadsheets/d/1N2v-MDDi_vv0uyD90HQvDjylKG7mGkKXydU_nEFJGIM/edit
  2. Extensions → Apps Script → left sidebar → Project Settings (gear icon) → Script Properties
  3. Copy the value of RUN_TOKEN
  4. Run in this terminal: ! echo "PASTE_TOKEN_HERE" and tell me the value
    (I will then run: cd ops-api && npx wrangler secret put MIS_V2_TOKEN and set it + the URL)

Action 2 — (Optional, do alongside) OpenAI voice


What the portal shows once fully wired

home.html (ops.hookstreetservices.com/home.html)

peek.html (scope any ticker)

The MIS dashboard site (not built yet)

The Stitch designs are done (outputs/mockups/2026-05-31_stitch/):
- Screen 1: Portfolio Cockpit (lifetime P&L hero, by-account, winners/drags)
- Screen 2: Watchlist grid (per-ticker: ADD/STARTER/WATCH/BLOCKED badge, Signal Health bar, ↑/↓ % @ price, AI-insight)
- REIMAGINE variants: Signal Spectrum, Decision Stack, Triage Treemap
The BUILD requires: Worker render endpoint /mis/dashboard → portal page pulls JSON → displays fast (kills the 4-5 min GAS load). Next session.


Script Properties — what lives where (the secure pattern going forward)

Secret Lives in Status
v1 Schwab tokens (CLIENT_ID, SECRET, REFRESH_TOKEN, ACCOUNT_HASH) CONTROL tab cells (PLAINTEXT) ❌ MUST MIGRATE to v1 Script Properties (PropertiesService.getScriptProperties())
v1 Finnhub API key CONTROL tab cells ❌ MUST MIGRATE
v2 Schwab credentials v2 Script Properties ✅ ALREADY CORRECT
v2 Finnhub API key v2 Script Properties ✅ ALREADY CORRECT
v2 RUN_TOKEN v2 Script Properties ✅ ALREADY CORRECT
ops-api Plaid secret Cloudflare Worker secret ✅ ALREADY CORRECT
ops-api FINNHUB_API_KEY Cloudflare Worker secret ✅ ALREADY CORRECT
ops-api OPS_READ_TOKEN Cloudflare Worker secret ✅ ALREADY CORRECT
ops-api MIS_V2_URL Cloudflare Worker secret ❌ NOT SET
ops-api MIS_V2_TOKEN Cloudflare Worker secret ❌ NOT SET
ops-api OPENAI_API_KEY Cloudflare Worker secret ❌ NOT SET (voice still MeloTTS)

The ordered next-session build list

  1. Set MIS_V2_URL + MIS_V2_TOKEN on Worker (Sam gets RUN_TOKEN from v2 Script Properties → I set secrets → peek overlay is live). 10 min.
  2. Migrate v1 Schwab/Finnhub credentials to Script Properties (security P0 from forensic teardown — credentials in CONTROL tab are readable by anyone with viewer access to the sheet). One session.
  3. Flow formula restore (Brain Restore Session 2 proper — get continuous 0-100 Flow from the March 5 reference sheet formula). One session.
  4. Turn emails back on (MIS Tools → Install / Rebuild) once Flow is restored and Sam wants the briefings again.
  5. Worker render layer (/mis/dashboard endpoint) → kills the 4-5 min GAS load.
  6. MIS dashboard site → portal page using the Stitch designs as anchor.
  7. Full 183-ticker FSE (Sessions 3-9 of the build plan).
  8. OPENAI voice (3 steps: Sam gets key → I set secret → I redeploy + flip default voice to nova).
Source trail · docs/MIS_SYSTEM_STATE.md @ master · rendered 2026-07-02 7:23 PM EDT by scripts/build-docs.py · the .md in the repo is the truth; this page is the phone-readable view