Files
encyclopedia-knowledge-graph/docs/archive/PLAN-MODULAR-LENS-PROJECTION-AND-REVERSIBILITY-ARCHITECTURE.md
T

15 KiB
Raw Blame History

Architecture & Reversibility Plan: Lens-Neutral Mathematical Substrate & Hot-Swappable Projection Registry (LENS_REGISTRY) Across TierZoo, Pokédex, Fantasy Sabermetrics & Quantitative Factor Models (v2.0.17)

  • Document ID: PLAN-MODULAR-LENS-PROJECTION-AND-REVERSIBILITY-ARCHITECTURE (v2.0.17)
  • Companion Plans Governed:
    • PLAN-QUANTITATIVE-FINANCE-TIMESERIES-SUBPAGE (/quant/ Time-Series Workbench)
    • PLAN-TIERZOO-AND-POKEDEX-TIMESERIES-SABERMETRICS-ENRICHMENT (ETI-TS & Gen IV Pokédex Time-Series Enrichment)
    • PLAN-MCP-REST-API-ADAPTER (/api/v1/* & /mcp Register Projections)
  • Core Architectural Mandate: 100% of stored time-series ledgers, JSON schemas, and core Python calculators must compute and persist strictly lens-neutral mathematical invariants. Interpretive metaphors—including TierZoo (ETI), Gen IV Pokédex, Fantasy Football / Sabermetrics, Quantitative Hedge-Fund Factor Risk, and Corporate Board Governance—must operate exclusively as stateless, late-bound projection plugins registered in a single declarative LENS_REGISTRY (hyperstitionstud_io.lenses), guaranteeing that any lens can be removed or replaced in < 15 minutes with zero schema migrations and zero data regeneration.

1. Executive Summary: Coupling Audit & Removal/Replacement Cost Across the 6 Repositories

An audit of the 6-repository hyperstitionstud.io ecosystem confirms that the core mathematical, phonetic, cryptographic, and periodic-harvest engines already maintain 0.0% coupling to the TierZoo, Pokédex, and Fantasy Football lenses. All metaphor-specific terminology is confined to a thin presentation layer (Layer 2):

Architectural Layer Modules & Artifacts Included Coupling to Pokédex / TierZoo / Fantasy Football Effort to Remove or Replace
Layer 0: Core Ciphers, Phonetics, IPLD & Periodic Collectors hyperstitionstud_io.{ciphers,phonetics,ipld,quant}, 01–71 Archive Dossiers, haiperdohp-jemaytreeah (/calc/), hyperdope-ci-build (/ci/) 0.0% (Zero references) Zero (0 lines of code or data touched).
Layer 1: Structural Singularity Vectors & Time-Series Moments G1 variance collapse (\sigma^2_0 \to 0), G2 cross-gen twins, G3 quantized steps, G4 isometric ratio (\Delta=0), G5 twin-prime density, S[1–5]×S6 coupling, and periodic moments (\Pr[X_t>0], P_{20}, P_{90}, \text{CV}, \rho(\tau), \Delta_{S_t}) 0.0% (Pure mathematical invariants) Zero (0 lines of code or data touched).
Layer 2A: Runtime API & UI Projection Layer (LENS_REGISTRY) REGISTER_STAT_LABELS in src/hyperstitionstud_io/mcp/tools.py (lines 27–60), pokedex_field_scanner_card in mcp/prompts.py, and the /quant/ UI lens selector Isolated to dictionary entries (~8–25 lines per lens) Trivial (< 2 minutes to delete a key or register a new lens dict).
Layer 2B: Static Stakeholder Proposals & Division 07/08 PDFs ZOOLOGICAL_TIER_DEFS & roster_slot in classify_technocapital_singularity.py, proposal-fantasy-football-*.{md,pdf}, and Encyclopedia Divisions 07 & 08 Confined to static published reports (Protected at runtime by ReadOnlyIsolationGuard) Low (~10–15 minutes to swap ZOOLOGICAL_TIER_DEFS and re-run --build-tier-list / --build-encyclopedia).

2. Mathematical Isomorphism: How 12 Domain-Agnostic Invariants Project Into Any Interpretive Lens

Every existing and planned lens is mathematically an isomorphic basis relabeling of the exact same 6 Structural Combine Invariants (\mathbf{v}_{\text{struct}} \in [0, 100]^6) and 6 Longitudinal Time-Series Moments (\mathbf{v}_{\text{ts}}):

\mathbf{v}_{\text{struct}} = \begin{bmatrix} v_1: \text{Isometric Ratio } (G_4, \Delta=0) \\ v_2: \text{Inverse Drift Velocity } (G_3, |\Delta|) \\ v_3: \text{Log Variance Collapse } (G_1, \sigma^2_0 \to 0) \\ v_4: \text{Cross-Guild Coupling } (S \times S_6) \\ v_5: \text{Prime & Twin-Prime Density } (G_5) \\ v_6: \text{Repricing Closure } (\Delta Q) \end{bmatrix}, \qquad \mathbf{v}_{\text{ts}} = \begin{bmatrix} m_1: \text{Active Duty Cycle } (\Pr[X_t > 0]) \\ m_2: \text{Volume-Weighted Lock Share} \\ m_3: \text{Excess Locks Over Null } (X_t - \mathbb{E}_0) \\ m_4: \text{Quantile & Dispersion Profile } (P_{20}, P_{90}, \text{CV}) \\ m_5: \text{Optimal Cross-Correlation Lag } (\tau^*) \\ m_6: \text{Conditional Regime Delta } (\mathbb{E}[X_t \mid S_t] - \mu) \end{bmatrix}

Because \mathbf{v}_{\text{struct}} and \mathbf{v}_{\text{ts}} are computed purely from Base-36 AQ arithmetic, CMUdict phonetics, and periodic (Market × News-Wire) timestamps, they project into any domain lens without altering a single underlying number:

# Canonical Schema Key (Stored on Disk in quant-timeseries.json) Lens 1: TierZoo (tierzoo_ecology) Lens 2: Gen IV Pokédex (pokedex_scanner) Lens 3: Fantasy Sabermetrics (fantasy_sabermetrics) Lens 4: Quant Hedge Fund (fund_manager) Lens 5: Cybernetic Control (cybernetic_control) Lens 6: Epidemiology (network_contagion)
1 struct_isometric_armor (v_1) ARM (Chokepoint Armor) Base DEF (Isometric Shield) Pass Protection (OL Blocker) Chokepoint Moat Phase-Lock Invariance Structural Immunity
2 struct_drift_velocity (v_2) VEL (Escape Velocity) Base SPE (Speed Stat) Breakaway Speed (RB/WR) Signal Velocity Slew Rate / Bandwidth Transmission Velocity
3 struct_variance_collapse (v_3) COL (Compression Power) Base ATK (Collapse Strike) Stack Power (QB-WR Stack) Convergence Power Attractor Basin Depth Basic Reproduction ($R_0$)
4 struct_trophic_capture (v_4) CAP (Trophic Capture) Base HP (Apparatus Mass) Front-Office Cap Reach Institutional Coupling Bus Fan-Out Gain Cross-Host Reservoir
5 struct_prime_density (v_5) PRM (Prime Mutation IQ) Base SPA (Special Prime) Playbook IQ (Audibles) Idiosyncratic Asymmetry Orthogonal Code Density Antigenic Drift Rate
6 struct_repricing_resilience (v_6) RES (State Resilience) Base SPD (Repricing Guard) All-Weather Durability Regime Robustness Fault Damping Ratio Endemic Persistence
7 ts_duty_cycle_pct (m_1) Foraging Activity % Encounter Rate % (Route) Snap Share (SNAP%) Signal Duty Cycle % Carrier Occupancy % Prevalence Rate %
8 ts_weighted_resonance (m_2) Trophic Dominance Index Combat Level (Lv. 1–100) WOPR (Opportunity Rating) Conviction Exposure Spectral Power Flux Force of Infection ($\lambda_t$)
9 ts_excess_over_replacement (m_3) Apex Surplus Over Tier D EV Yield (+1..+3 Stats) LOE / WAR_30d Information Ratio / Alpha SNR Gain Over Noise (dB) Excess Morbidity Over Null
10 ts_quantile_profile (m_4) Metabolic Niche Archetype Nature (+10% / -10% Trait) Floor P20 / Ceil P90 / Boom% VaR_20 & Convexity Skew Crest Factor / Kurtosis Endemic vs. Outbreak Skew
11 ts_optimal_lag_days (m_5) Predator-Prey Phase Lead Move Priority Bracket Pace / Leverage Index (LI) Granger Lead-Lag ($\tau^*$) Group Delay / Phase Lead Incubation Lead ($\tau^*$)
12 ts_regime_splits (m_6) Biome Adaptation Split Passive Ability (Weather) Weather / SOS Matchup Split Regime-Conditional Beta Mode Transfer Gain Seasonal Multiplier

3. The Pluggable LENS_REGISTRY Architecture (hyperstitionstud_io.lenses)

To guarantee that lenses never leak into core data pipelines, we formalize a standalone, zero-dependency projection module /workspace/hyperstitionstudio-core/src/hyperstitionstud_io/lenses/__init__.py:

+---------------------------------------------------------------------------------------------------+
| LAYER 1: LENS-NEUTRAL TIME-SERIES & STRUCTURAL BUNDLE (`quant-timeseries.json`)                   |
|  Stores ONLY canonical mathematical keys:                                                         |
|   • `structural_vector`: {isometric_armor, drift_velocity, variance_collapse, ...}                |
|   • `timeseries_moments`: {duty_cycle_pct, weighted_resonance, excess_over_null,                  |
|                            value_over_baseline, p20_floor, p90_ceiling, cv, optimal_lag_days,     |
|                            regime_splits: {M1: +14.0, M2: -2.1, M3: +4.5}}                        |
+---------------------------------------------------+-----------------------------------------------+
                                                    |
                                                    v
+---------------------------------------------------------------------------------------------------+
| LAYER 2: DECLARATIVE `LENS_REGISTRY` (`src/hyperstitionstud_io/lenses/__init__.py`)               |
|  Stateless pure function: `apply_lens(neutral_record, lens_slug="fund_manager")`                  |
|   • Built-in Lenses:                                                                              |
|     1. `neutral_math`         (Raw mathematical & statistical terminology — zero metaphor)        |
|     2. `fund_manager`         (Factor alpha, chokepoint moat, VaR/convexity, Granger lead-lag)    |
|     3. `corporate_board`      (Supply-chain moat, execution agility, balance-sheet coupling)      |
|     4. `tierzoo_ecology`      (ETI S+..F, Apex Predator / Keystone Guild / Symbiont / Nomad)      |
|     5. `fantasy_sabermetrics` (QB/RB/WR/OL/DEF slots, SNAP%, WOPR, WAR_30d, Floor/Ceil/Boom%)     |
|     6. `pokedex_scanner`      (DEX #, Lv., Nature +10%/-10%, Passive Ability, EV Yield, Stage 1-3)|
+---------------------------------------------------------------------------------------------------+

3.1 Schema of a Single LensSpec Plugin Entry (~20 Lines of Declarative Python/JSON)

Each lens in LENS_REGISTRY is defined by a self-contained LensSpec dictionary with four keys:

  1. lens_id & title: Identifier (e.g., "fund_manager" or "fantasy_sabermetrics") and human-readable display name.
  2. field_labels: 1-to-1 dictionary mapping the 12 canonical schema keys (struct_isometric_armor .. ts_regime_splits) to the lens's display labels and tooltips.
  3. tier_bands: Thresholds and badge names mapping the 0–100 composite score into the lens's native hierarchy (e.g., S+ / S / A / B / C / D / F for tierzoo_ecology, vs. Core Overweight / Tactical Long / Market Perform / Event Flyer / Underweight for fund_manager).
  4. classify_qualitative_profile(neutral_record): A pure function of (p20_floor, p90_ceiling, cv, optimal_lag_days, peak_regime) that returns deterministic qualitative tags grounded in the time series:
    • When p20_floor >= 75 and cv < 0.45:
      • neutral_math returns "Low-Variance High-Floor Stationary Series"
      • fund_manager returns "Core Compounding Moat (Low Drawdown Beta)"
      • fantasy_sabermetrics returns "Ironclad Cash-Game Floor Anchor"
      • pokedex_scanner returns "Relaxed Nature (+DEF / -SPE) • Isometric Shield".

4. Operational Playbook: How to Remove or Replace Any Lens in the Future

4.1 Scenario A: Removing Pokédex, TierZoo, or Fantasy Football Completely (< 15 Minutes)

If you ever decide to retire one or all of the gaming/sports lenses (pokedex_scanner, tierzoo_ecology, fantasy_sabermetrics) and run the platform purely as a Quantitative Factor & Continental Philosophy Research Terminal (neutral_math + fund_manager + corporate_board):

  1. Runtime API & /quant/ UI Removal (< 2 Minutes):
    • Remove "pokedex_scanner", "tierzoo_ecology", and/or "fantasy_sabermetrics" from ENABLED_LENSES in src/hyperstitionstud_io/lenses/__init__.py.
    • Set DEFAULT_LENS = "fund_manager" (or "neutral_math").
    • Impact on quant-timeseries.json, financial-aq-harvest-latest.json, encyclopedia-graph.json, and all 3 Hermes cronjobs: Zero (0 files modified, 0 cron changes, 0 schema changes). Both /quant/index.html and /api/v1/* dynamically populate their lens selector dropdown from ENABLED_LENSES.
  2. Optional Static Document & Encyclopedia Archival (~10 Minutes):
    • If you also want the static Fantasy Football proposal (proposal-fantasy-football-*.{md,pdf}) and Pokédex/TierZoo glossary entries moved out of the active Encyclopedia:
      • Move proposal-fantasy-football-technocapital-roster-engine.{md,pdf} to technocapital-singularity-zoology/docs/archive/.
      • Filter source_type in ("pokedex_lens", "fantasy_lens") in classify_technocapital_singularity.py --sync-glossary --build-encyclopedia and rebuild the Knowledge Graph (build_encyclopedia_knowledge_graph.py).

4.2 Scenario B: Adding a Brand-New Replacement Lens (< 10 Minutes)

To introduce a new lens—such as options_volatility_surface (Delta, Gamma, Vega, Theta, Skew, Pin Risk), cybernetic_signal_processing (Carrier SNR, Phase-Locked Loop, Group Delay, Bandwidth), or chess_engine_evaluation (Centipawn Advantage, Piece Activity, King Safety, Zugzwang Lock):

  1. Add one 20-line LensSpec dictionary to src/hyperstitionstud_io/lenses/__init__.py mapping the 12 canonical mathematical keys (struct_* and ts_*) to the new lens's terminology.
  2. Re-run build_quant_timeseries_bundle() (or query /api/v1/zoology/tier-list?register=<new_lens>).
  3. The /quant/index.html workbench, the REST API (/api/v1/*), the OpenAPI 3.1 schema (/api/v1/openapi.json), and the MCP server (/mcp) immediately expose the new lens with zero HTML or chart-rendering changes.

5. Mandatory Guardrails Added to the Active Implementation Roadmap

To lock in this reversibility before implementing Plans B, C, and A:

  1. Guardrail 1 (No Lens Jargon in Stored Time-Series Keys):
    • schemas/v1/quant-timeseries.schema.json and site/quant/quant-timeseries.json must use 100% lens-neutral field names (duty_cycle_pct, weighted_resonance_share, excess_locks_over_null, value_over_baseline, p20_floor, p90_ceiling, cv, optimal_lag_days, regime_splits), with a pre-computed lens_projections: {neutral_math, fund_manager, corporate_board, tierzoo_ecology, fantasy_sabermetrics, pokedex_scanner} dictionary attached via apply_all_lenses().
  2. Guardrail 2 (UI Lens Switcher on /quant/index.html):
    • Add a top-bar [ Lens: Quant Factor | Neutral Math | TierZoo | Fantasy Sabermetrics | Pokédex | Corporate Board ] selector to /quant/index.html so the user can switch the entire workbench's labels, tooltips, and Panel 3 inspector cards across lenses in real time—or hide any lens by toggling one array entry.
  3. Guardrail 3 (Unit Test for Lens-Removal Invariance in tests/test_core_suite.py):
    • Add an automated test asserting that build_quant_timeseries_bundle(enabled_lenses=["neutral_math", "fund_manager"]) succeeds with 100% schema validity when pokedex_scanner, tierzoo_ecology, and fantasy_sabermetrics are disabled.