Release v2.0.25: Dark-mode hs-pdf-build, bidirectional 14-point census & Dose 0..3+, FRED macro indicators, 5-agenda Bayesian daily brief, one-shot .png+.json chatbot stats cards, Group 3 unified style, and minimal /donate/ reduction

This commit is contained in:
Hermes Agent committed 2026-11-30 21:47:09 +00:00
1 parent 8de82a373d
commit 0de9d616f1
54 files changed
+1053 -20

No files matched your search

@@ -0,0 +1,147 @@
# Plan: Daily Portfolio & Memetic Regime Update Feature (`hs-daily-brief`) — Zero-Synthetic-Data Bayesian Inference, Cross-Species Support/Challenge Audit & Compounding Methodological Rigor (`v2.0.24`)
- **Document ID:** `PLAN-DAILY-PORTFOLIO-AND-MEMETIC-REGIME-UPDATE-FEATURE` (`v2.0.24`)
- **Roadmap Status:** **ACTIVE / READY**
- **Strict Zero-Synthetic-Data & Null-Preserving Mandate:**
1. **100% Real Observations Only:** Every price, basis-point move, volume ratio, macro yield/volatility reading, news headline, and `333/666/777` equation in the Daily Update is drawn strictly from real exchange feeds (`site/quant/real-market-history.json`, Yahoo Finance v8, Stooq CSV, CoinGecko v3) and real dated `00:00 UTC` news-wire dossiers (`25..71-dossier-news-YYYY-MM-DD.md` & `news-aq-harvest-latest.json`).
2. **Language-Appropriate `null` When Unavailable:** Whenever any instrument (such as private company `ANTHR-PVT`), market session (such as a weekend, US market holiday, or pre-close session), or feed field (such as unreported equity `market_cap_str`) lacks a real observation on date $t$, it is stored as `None` (Python) / `null` (JSON/JS) / `NULL` (SQLite) and rendered in the brief and UI as `"No data available"`—never `0.0`, never interpolated, and never simulated.
- **Target Modules, Routes & Artifacts:**
- `/workspace/hyperstitionstudio-core/src/hyperstitionstud_io/quant/daily_brief.py` (`hs-daily-brief` CLI & Python engine)
- `/workspace/hyperstitionstudio-core/site/quant/{index.html,quant-app.js,daily-brief-latest.json,daily-brief-data.js}` (Interactive **Daily Portfolio & Memetic Regime Update** panel on `/quant/`)
- `/workspace/ingglish-hyperdope-gematria/ingglish-aq-archive/daily-brief-state.json` (Longitudinal Bayesian prior/posterior & daily macro question ledger)
---
## 1. Five-Part Daily Update Agenda & Architectural Specification
Each execution of `hs-daily-brief` (designed to run automatically after the `21:30 UTC` US closing-bell harvest and/or `00:00 UTC` news-wire rollover, or on demand via CLI/REST) produces a structured 5-section analytical brief backed by a machine-verifiable JSON state (`daily-brief-latest.json`):
---
### Agenda 1: Executive Summary — Portfolio-Impacting Findings, Trend Durability/Severity, Risk-On/Off Regime & Bayesian Best/Base/Worst-Case Scenarios
**Core Question:** *What was learned today that will likely have the greatest impact on asset portfolios?*
1. **Ranking Today's Findings by Portfolio Impact Score ($I_{i,t}$):**
Every real instrument observation on date $t$ is scored across two orthogonal dimensions—**Trend Durability** and **Shock Severity**—without inventing missing numbers:
- **Financial & Memetic Durability ($D^{\text{dur}}_{i,t}$):**
- Consecutive-run persistence count ($k \ge 1$ days in a row that ticker $i$ or its guild has held an active `Scope 1/2` lock or `Scope 3` news-wire co-presence),
- Structural `G4` Isometric Chokepoint status ($\Delta = \text{AQ}_{\text{Ing}} - \text{AQ}_{\text{Eng}} == 0$, e.g., `ASML = 81`, `TSMC = 91`, `ARM = 59`, `SOL = 73`), and
- Cross-species Confluence Dose ($D_{i,t} \in \{0, 1, 2, 3, 4\}$).
- **Financial & Memetic Severity ($S^{\text{sev}}_{i,t}$):**
- Within-ticker volatility $z$-score $z_{i,t} = \frac{|\Delta\text{bps}_{i,t}|}{\bar{\sigma}_i}$ (computed strictly over available real trading bars for ticker $i$; `null` if $< 3$ bars exist),
- Relative 20-day volume surge (`Vol20d` $V_{i,t} / \bar{V}_{20}$), and
- Same-day news-wire equation velocity ($M_t$ total verified `333/666/777` equations in that date's dossier).
2. **Macro Risk-On / Risk-Off Regime Classification (Real Market Barometers):**
Evaluates four real cross-asset indicators from the watchlist (reporting `"No data available"` for any indicator whose market was closed on date $t$):
- **Volatility Barometer (`^VIX`):** Close level (e.g. `< 18` Risk-On Calm, `18–24` Elevated Caution, `>= 25` Risk-Off Stress / `M2` trigger) and daily $\Delta\text{bps}$.
- **Rates / Duration Barometer (`^TNX` 10-Year US Treasury Yield):** Yield level (`%`) and daily basis-point shift.
- **Industrial Cyclical Barometer (`HG=F` Copper):** Real price & $\Delta\text{bps}$ vs. `S1` AI / `S3` Semiconductor equity breadth.
- **24/7 Liquidity Barometer (`BTC-USD`, `ETH-USD`, `SOL-USD`):** Continuous weekend/overnight risk-appetite proxy when US equity markets are closed (`"No data available"` on equity bars).
3. **Bayesian Inference Engine with Extant Priors (`Best Case`, `Base Case`, `Worst Case` Portfolio Scenarios):**
Rather than using arbitrary subjective probabilities, the brief maintains an explicit 3-state **Portfolio Regime Prior** $\mathbf{P}_{t-1} = \big(P_{t-1}(\text{Bull / Risk-On}),\; P_{t-1}(\text{Pinned / Range-Bound}),\; P_{t-1}(\text{Tail Drawdown / Risk-Off})\big)$ loaded directly from the previous run's `daily-brief-state.json` (initialized on cold start from the empirical base rates of the real historical window in `real-market-history.json`):
- **Empirical Likelihood Update (Bayes' Rule):**
Given today's observed evidence vector $E_t = (\text{Breadth}_t,\; \text{VIX}_t,\; \text{MeanVol20d}_t,\; \text{Dose2Share}_t,\; \text{Dose3Count}_t)$, the engine computes empirical likelihoods $L(E_t \mid R_m)$ from the historical distribution of real bars and updates the posterior via Bayes' theorem:
$$P_t(R_m \mid E_t) = \frac{P_{t-1}(R_m) \cdot L(E_t \mid R_m)}{\sum_{j} P_{t-1}(R_j) \cdot L(E_t \mid R_j)}$$
- **Three Portfolio Scenarios Grounded in Real Empirical Quantiles (Zero Fabricated Targets):**
- **Best-Case Scenario (`Risk-On / Constructive Breakout`, Posterior $P_t(R_{\text{Bull}})$):** Projects the empirical **80th/90th percentile (`P80/P90`)** daily basis-point return observed across real historical bars in that regime, identifying which guilds (`S1..S6`) hold the strongest positive lead-lag and chokepoint protection.
- **Base-Case Scenario (`Isometric Pinning / Range Equilibrium`, Posterior $P_t(R_{\text{Pinned}})$):** Projects the empirical **median (`P50`)** basis-point displacement, highlighting `Dose 2` variance-pinned tickers (`has_doss = 1, has_wire = 0`, where empirical move variance compresses by `-33%` to `-50%`).
- **Worst-Case Scenario (`Risk-Off / M1 Halt or M2 Tail Drawdown`, Posterior $P_t(R_{\text{Tail}})$):** Projects the empirical **10th percentile (`P10` / worst historical drawdown)** in basis points from the real exchange dataset, flagging high-beta concentration risks and `137` (`M1` halt) / `193` (`M2` flash-crash) exposure.
---
### Agenda 2: Substantive Support for Active Memetic Themes & Consensus Expectations (`Confirming Signals`)
**Core Question:** *What key macro financial and memetic signals provide substantive support for active memetic themes or consensus expectations?*
1. **Cross-Species Confirmations (`Financial Tape × Memetic Wire Alignment`):**
Lists every real observation on date $t$ where financial price/volume action and memetic news-wire coordinates reinforce each other:
- **Confirmed Sector Leadership:** E.g., when `S1` AI or `S3` Semiconductor tickers post positive returns/volume while simultaneously locking onto active coordinates in that day's `00:00 UTC` dossier (`Scope 3B` Dossier Confluence).
- **Confirmed Isometric Moat Stability (`G4` $\Delta = 0$):** Tracks whether the physical/legal chokepoints (`ASML = 81`, `TSM = 91`, `ARM = 59`, `BLK`) held their ground relative to high-beta peers.
- **Confirmed Multi-Run Persistence (`Run N-1 -> Run N`):** Highlights coordinates and equations that appeared in yesterday's brief and re-confirmed today.
---
### Agenda 3: Substantive Challenges to Active Memetic Themes & Consensus Expectations (`Disconfirming & Counter-Trend Signals`)
**Core Question:** *What key macro financial and memetic signals provide substantive challenges for active memetic themes or consensus expectations?*
1. **Four Explicit Falsification & Divergence Detectors:**
- **Detector 1 — Narrative-Tape Divergence (`High Memetic Velocity vs. Negative Financial Breadth`):**
Flags when a guild dominates the `00:00 UTC` news wire (`has_wire = 1`, multiple `333/666/777` equations) but its constituent stocks sell off on heavy volume (e.g., `NVDA` on `2026-11-12` & `2026-11-13` dropping `-434 bps` on `4.52x` volume and `-201 bps` on `1.86x` volume while co-occurring in Dossiers 52 & 53).
- **Detector 2 — Macro Rate/Volatility Headwinds Against Consensus Equity Themes:**
Flags when rising `^TNX` 10-Year Treasury yields or spiking `^VIX` volatility challenge long-duration `S1` AI / `S2` crypto consensus positioning.
- **Detector 3 — Chokepoint vs. Application-Layer Decoupling:**
Flags when upstream hardware/foundry chokepoints (`ASML`, `TSM`, `HG=F` Copper) diverge from downstream software/model valuations (`MSFT`, `GOOGL`, `META`, `PLTR`).
- **Detector 4 — Expired / Unconfirmed Provisional Candidates:**
Lists any provisional memetic or ring lock from the prior run that failed to re-occur today, preventing survivorship bias.
---
### Agenda 4: Delta-Since-Last-Run Audit — Newly Analyzed Macro Financial, Policy & Memetic Signals (`Run N-1 -> Run N`)
**Core Question:** *What other key macro financial and memetic data or policy signals were analyzed since the last run that may have a significant impact on financial and memetic asset markets?*
1. **Deterministic Run-to-Run Diff (`diff_since_previous_run()`):**
Compares today's harvest state against the previous run stored in `daily-brief-state.json`:
- **New Policy, Regulatory, Sovereign & Geopolitical Wire Signals:** Extracts all newly ingested headlines and verified `333/666/777` equations from the latest `*-dossier-news-YYYY-MM-DD.md` that were not present in the prior run (categorized by tariff/trade policy, central-bank/fiscal policy, antitrust/governance, infrastructure/grid outages, and defense/kinetic events).
- **New Cross-Asset Moves & Regime Flips:** Lists every ticker whose daily move $|\Delta\text{bps}_{i,t}|$ exceeded `200 bps` or whose `Vol20d` exceeded `1.5x` since the prior run, plus any newly activated or cleared `M1–M3` regime flags.
- **Data Availability Audit:** Explicitly lists which markets were open vs. closed (`"No data available"`) since the last run.
---
### Agenda 5: Daily Key Macro Question & Compounding Qualitative + Quantitative Methodological Rigor
**Core Question:** *Given all prior analytical questions, what is today's key macro question, how is the multi-day trend evolving, and how do today's qualitative and quantitative methods hold up under scrutiny?*
1. **Formulating Today's Testable Daily Key Macro Question + Scoring Yesterday's Question (`Longitudinal Compounding`):**
- **Review of Prior Run's Question ($Q_{t-1}$):** Reads yesterday's Daily Key Macro Question from `daily-brief-state.json`, evaluates what today's real market and news-wire observations showed, and records a permanent verdict (`CONFIRMED`, `CHALLENGED / REFUTED`, or `PENDING — Market Closed / No Data Available`).
- **Today's New Key Macro Question ($Q_t$):** Synthesizes the single highest-stakes question at the intersection of Agenda 1 (Bayesian portfolio risk), Agenda 2 (confirming signals), Agenda 3 (challenging divergences), and Agenda 4 (new policy/wire inputs), specifying the exact observable metrics (`Tickers`, `Coordinates`, `bps / Vol20d thresholds`) that will test $Q_t$ on tomorrow's run ($t+1$).
2. **Compounding Qualitative Rigor (`Contingent Meaning & Anti-Apophenia Audit`):**
- Explicitly documents *why* each highlighted lock in today's brief passes **"The Room Filter"** (co-occurrence within the same day's news wire, supply chain, or closing bell) and rejects ungrounded dictionary fishing.
- Tracks the cumulative **Multi-Day Signal-to-Noise Ratio** across consecutive daily runs.
3. **Compounding Quantitative Rigor (`Statistical Significance, Exact Sample Sizes & Methodological Applicability`):**
Every daily brief includes a transparent **Methodological & Statistical Audit Table** explaining both the numbers and *why each statistical method is or is not applicable to that specific problematic*:
| Analytical Problematic | Statistical Method Applied | Reported Metrics in Daily Brief | Why This Method Applies & Its Explicit Limitations |
| :--- | :--- | :--- | :--- |
| **1. Regime Belief Updating (`Agenda 1`)** | **Discrete Bayesian Inference with Extant Priors** ($P_{t-1} \to P_t$) | Prior $P_{t-1}(R_m)$, Likelihood Ratio $\Lambda_t$, Posterior $P_t(R_m \mid E_t)$, Historical `P10 / P50 / P90` bps bounds ($n$ stated) | **Why applicable:** Explicitly compounds evidence day-over-day without resetting context to zero.<br/>**Limitation disclosed:** Likelihood estimates are bounded by the historical sample size ($n$ trading days); when a market session is closed (`null`), the posterior is held invariant ($\Lambda_t = 1.0$, `"No new market data"`). |
| **2. Cross-Sectional Volatility & Pinning (`Agendas 2–3`)** | **Spearman Rank Correlation ($\rho$) & Within-Ticker $z$-Score ($z_{i,t} = |\Delta\text{bps}_{i,t}|/\bar{\sigma}_i$)** alongside Pearson $r$ & Student $t$-stat ($\text{df}=n-2$) | $\rho$, $r$, $t$-stat, two-tailed $p$-value, exact $n$ (e.g. `has_doss` pinning: $\rho = -0.2101, r = -0.1518, t = -3.19, p < 0.002, n = 433$; `has_wire` shock: $r = +0.2334, t = +4.98, p < 0.0001, n = 433$) | **Why applicable:** Spearman $\rho$ and within-ticker $z$-scores prevent high-volatility instruments (`^VIX`, crypto) from distorting cross-sectional Pearson $r$.<br/>**Limitation disclosed:** Opposite-signed species (`has_doss` $< 0$ vs. `has_wire` $> 0$) must never be summed into a single linear regressor. |
| **3. Multi-Species Tail Breakouts (`Dose 3+`)** | **Exact Small-Sample Regime Flagging (`n < 10` Gate)** | Exact count $n$, mean `Vol20d` (`1.98x`), next-day mean $|\Delta\text{bps}|$ (`377.5 bps`), $t$-stat (`+1.52`) | **Why applicable:** Surfaces high-impact tail confluences (`NVDA 4.52x` volume on `2026-11-12`) without hiding them.<br/>**Limitation disclosed:** Automatically badged `Exploratory / Small-Sample (n=4, |t|<1.96)` until cumulative daily runs reach $n \ge 10$ tail observations. |
| **4. News-Volume Confounding (`Agenda 3 & 5`)** | **Conditional Split (`Locked News Days` vs. `Unlocked News Days`)** | $\mathbb{E}[|\Delta\text{bps}| \mid \text{wire}=1, \text{lock}=1]$ vs. $\mathbb{E}[|\Delta\text{bps}| \mid \text{wire}=1, \text{lock}=0]$ | **Why applicable:** Separates ordinary fundamental news volatility from incremental coordinate-lock confluence. |
---
## 2. Four-Phase Implementation Roadmap (`Phases 1–4`)
### Phase 1: Build `src/hyperstitionstud_io/quant/daily_brief.py` & `hs-daily-brief` CLI
1. Create `/workspace/hyperstitionstudio-core/src/hyperstitionstud_io/quant/daily_brief.py` implementing:
- `build_daily_portfolio_regime_brief(target_date_utc=None, write_files=True)`:
- Reads strictly real market history (`site/quant/real-market-history.json`), `quant-timeseries.json`, and dated news dossiers (`25..71-dossier-news-YYYY-MM-DD.md`),
- Loads extant Bayesian priors and prior Daily Key Macro Questions from `daily-brief-state.json`,
- Computes Agendas 1–5 with zero synthetic data and `None` / `null` (`"No data available"`) on all missing observations,
- Writes `site/quant/daily-brief-latest.json`, `site/quant/daily-brief-data.js` (`window.HyperstitionStudio.DailyBrief`), and `site/quant/DAILY-PORTFOLIO-AND-MEMETIC-REGIME-BRIEF.{md,pdf}`.
2. Register `hs-daily-brief = "hyperstitionstud_io.quant.daily_brief:main"` in `pyproject.toml`.
### Phase 2: Integrate the Interactive Daily Update Panel into `/quant/` (`site/quant/index.html` & `site/quant/quant-app.js`)
1. Add a collapsible **Daily Portfolio & Memetic Regime Update (`Agenda 1–5`)** panel on `/quant/index.html` displaying:
- **Agenda 1 Card:** Executive Summary, Durability/Severity top movers, Risk-On/Risk-Off barometer pills (`^VIX`, `^TNX`, `HG=F`, `BTC-USD`), and the Bayesian Prior -> Posterior `Best / Base / Worst Case` scenario table,
- **Agenda 2 & 3 Split Cards:** Side-by-side **Confirming Signals (Support)** vs. **Challenging Signals (Divergences & Falsifications)**,
- **Agenda 4 Card:** Delta-Since-Last-Run Policy, Macro & Memetic Wire Diff, and
- **Agenda 5 Card:** Today's Testable Key Macro Question ($Q_t$), Prior Question Verdict ($Q_{t-1}$), and the Qualitative + Quantitative Methodological Rigor Audit table (with inline `ⓘ` info icons).
### Phase 3: Wire into `version_sync.py` & `hs-quant-harvest`
1. Call `build_daily_portfolio_regime_brief(write_files=True)` at the end of `hs-quant-harvest` (`src/hyperstitionstud_io/quant/collector.py`) so every scheduled closing-bell harvest automatically compounds the Bayesian prior/posterior ledger and refreshes `/quant/daily-brief-latest.json`.
2. Register `site/quant/daily-brief-data.js?v={V}` in `src/hyperstitionstud_io/version_sync.py`.
### Phase 4: Verification in `tests/test_core_suite.py` & `deploy/test-first-deployment.sh`
1. Add unit assertions in `tests/test_core_suite.py` verifying:
- `build_daily_portfolio_regime_brief()` executes with `synthetic_data_eliminated == True`,
- Bayesian posterior probabilities sum to `1.0` (`abs(sum(posteriors.values()) - 1.0) < 1e-6`) and update deterministically from extant priors,
- All 5 agenda sections (`executive_summary`, `supporting_signals`, `challenging_signals`, `delta_since_last_run`, `daily_macro_question_and_rigor`) are populated from real data and use `None` / `null` when unavailable, and
- Statistical audit fields (`pearson_r`, `spearman_rho`, `t_stat`, `sample_n`, `is_exploratory_low_n`) are present and accurate.
2. Add `/quant/daily-brief-latest.json` and `/quant/daily-brief-data.js` to `deploy/test-first-deployment.sh`.