This is an incredible brief! Let me build "THE COHERENCE FIELD" — a living scientific visualization. I'll create this immersive experience with the custom dark theme, animated panels, coupled oscillator math, particle system, and all the interactive elements.
Now let me create the main page component with all three panels and the interactive visualization:
Now let me update the tailwind config to include the custom fonts:
I need to add framer-motion to the dependencies:
I've built THE COHERENCE FIELD — a dark, immersive scientific visualization that unifies bioelectric morphogenesis, autonomic coherence, and AI alignment.
The app features:
The whole interface breathes with subtle animations, grain texture overlay, and responds to coherence states with color shifts (cyan for coherent, amber for golden corridor, magenta for disrupted).
# RESONA RESEARCH INSTRUMENT — v2 ITERATION PROMPT ## For: v0.dev | Built on The Coherence Field visualization ----- ## CONTEXT You are upgrading an existing app at v0-coherence-field-visualization.vercel.app Keep the existing aesthetic EXACTLY: dark bioluminescent ocean (#050810 bg), cyan (#00FFD4), amber/gold (#FFB347), magenta (#FF6B9D), serif + monospace type pairing, bioluminescent particle field background, animated oscilloscope with golden corridor bands. Do NOT redesign the visual language — extend it. This upgrade transforms the visualization into a WORKING CLINICAL RESEARCH INSTRUMENT for HRV (Heart Rate Variability) coherence research, implementing the QOTE / CUST framework by Dr. Michael A. Kayser, DO, FACMG. ----- ## NEW FEATURE 1: SESSION CONTROL BAR ### Fixed top bar (doesn’t scroll), below the title header ``` [ ● START SESSION ] Session: --:-- | Mode: [ LIVE ] [ IMPORT ] [ DEMO ] ``` - **START SESSION** button: begins a timed session, button becomes **[ ■ END SESSION ]** (red glow) - **Session timer**: counts up in MM:SS from 00:00, monospace display - **Mode toggle** (3 states): - `LIVE` — uses simulated real-time data (for now; hook ready for WebSocket) - `IMPORT` — activates CSV import panel (see Feature 2) - `DEMO` — runs the existing animation loop (default state) - Thin separator line below bar before main content ----- ## NEW FEATURE 2: HRV DATA IMPORT PANEL ### Appears below the session bar ONLY when Mode = IMPORT A drop zone card in the bioluminescent style: ``` ┌─────────────────────────────────────────────┐ │ ⬇ DROP HRV CSV HERE or [ Browse File ] │ │ │ │ Expected format: │ │ timestamp_ms, rr_interval_ms │ │ 1000, 847 │ │ 1847, 823 │ │ ... │ │ │ │ Also accepts: Polar H10, Garmin, Apple │ │ Health, Kubios standard export │ │ │ │ [ LOAD SAMPLE DATA ] (pre-loads 5 min │ │ of realistic HRV with coherence arc) │ └─────────────────────────────────────────────┘ ``` **On file load:** 1. Parse CSV in-browser (no server needed) 1. Calculate coherence score from RR intervals using this formula: - Coherence = normalize(SDNN / (RMSSD + 0.001)) clamped to [0, 1] - Target corridor: 0.618 – 0.667 (the golden corridor) 1. Drive ALL existing visualizations from the imported data timeline 1. Show import confirmation: `✓ 847 intervals loaded — 4m 23s of data` 1. Playback controls appear: `[ ◀◀ ] [ ▶ PLAY ] [ ▶▶ ] [ ■ ]` with a scrub bar **Sample data (hardcode this as the LOAD SAMPLE DATA option):** Generate 300 RR intervals (≈5 minutes) with this arc: - t=0–60s: noisy/incoherent (RR ~650-950ms random) - t=60–180s: building coherence (RR trending toward 800ms rhythmic) - t=180–300s: deep coherence (RR sinusoidal 750-850ms, 0.1Hz rhythm) ----- ## NEW FEATURE 3: THRESHOLD EVENT LOG ### New panel between THE GOLDEN CORRIDOR and RESONA/CUST panels Title: `THRESHOLD EVENTS` in cyan serif A scrolling terminal-style log (max height 220px, overflow-y scroll, custom scrollbar in cyan): ``` THRESHOLD EVENTS ● LOGGING ──────────────────────────────────────────────────────── ▲ 02:14 ENTERED CORRIDOR coherence: 0.621 Δ+0.043 ◆ 02:31 PEAK COHERENCE coherence: 0.651 +17s in ▼ 03:02 EXITED CORRIDOR coherence: 0.601 31s dwell ⚡ 03:15 PERTURBATION EVENT triggered manually ▲ 03:44 RE-ENTERED coherence: 0.624 recovery: 29s ◆ 04:01 CROSSING φ⁻¹ coherence: 0.618 ← attractor floor ◆ 04:19 CROSSING 2/3 coherence: 0.667 ← attractor ceiling ──────────────────────────────────────────────────────── SESSION SUMMARY (live updating): Time in corridor: 1m 47s (42.3% of session) Peak coherence: 0.674 Mean recovery time: 29s Perturbations: 1 ``` Event icons: - `▲` = entered corridor (amber) - `▼` = exited corridor (magenta) - `◆` = notable threshold (cyan) - `⚡` = perturbation event (white flash) **Every event is timestamped from session start.** New events appear at TOP (most recent first) with a brief highlight flash. ----- ## NEW FEATURE 4: REAL-TIME COHERENCE ANALYTICS BAR ### Thin panel that sits just above THE GOLDEN CORRIDOR oscilloscope Four live stats displayed horizontally: ``` φ-FLOOR 0.618 | CORRIDOR 0.618–0.667 | NOW 0.641 | SESSION AVG 0.632 ``` Color coding: - φ-FLOOR label: amber - CORRIDOR range: amber - NOW value: cyan if in corridor, magenta if outside - SESSION AVG: white, turns amber if > 0.618 average ----- ## NEW FEATURE 5: CLINICAL EXPORT ENGINE ### New button in the RESONA/CUST panel: `[ ⬇ EXPORT SESSION REPORT ]` On click, generates a downloadable PDF report with this structure: **PAGE 1 — Session Header** ``` RESONA COHERENCE SESSION REPORT Dr. Michael A. Kayser, DO, FACMG Kayser Medical PLLC | Saint Francis Hospital, Tulsa OK Session ID: RES-[timestamp] Date: [date] Duration: [MM:SS] Protocol: HRV Biofeedback — Golden Corridor (QOTE Framework) Data Source: [CSV filename / LIVE / DEMO] ``` **PAGE 1 continued — Key Metrics (formatted as a clean data table)** |Metric |Value | |-------------------------------------------|----------------| |Total time in golden corridor (0.618–0.667)|X min Y sec (Z%)| |Peak coherence score |0.XXX | |Mean coherence score |0.XXX | |Corridor entry events |N | |Mean dwell time in corridor |Xs | |Perturbation events |N | |Mean recovery time post-perturbation |Xs | |φ⁻¹ threshold crossings |N | |2/3 threshold crossings |N | **PAGE 2 — Coherence Timeline Chart** A full-width line chart of coherence score over session time, with: - Amber horizontal band marking the 0.618–0.667 corridor - Cyan line = coherence score - Magenta dots = perturbation events - Amber triangles = corridor entry/exit events - X-axis: session time (MM:SS) - Y-axis: coherence (0.0–1.0) **PAGE 2 continued — Threshold Event Table** Full log of all threshold events with timestamps, coherence values, dwell times **PAGE 3 — Theoretical Framework Reference** ``` THEORETICAL FRAMEWORK This session report implements the Quantum Oscillator Theory of Everything (QOTE) coherence monitoring protocol developed by Dr. Michael A. Kayser. Golden Corridor Definition: The coherence threshold range of φ⁻¹ (≈0.618) to 2/3 (≈0.667) represents the optimal phase-lock zone identified in the QOTE framework, corresponding to the golden ratio attractor boundary in coupled oscillator systems. Clinical Significance: [3-4 sentences on HRV coherence and autonomic regulation] CUST (Coherence Under Stability Threshold) Gating: [2-3 sentences on CUST framework and hallucination prevention analog] References: - Becker, R.O. (1985). The Body Electric. William Morrow. - Levin, M. (2024). The Multiscale Wisdom of the Body. BioEssays. - Kayser, M.A. QOTE/CUST Framework. Provisional Patent (2024). - Kayser, M.A. et al. HRV Biofeedback Protocol Study (n=47). [in preparation] ``` **PDF styling:** Use jsPDF. Clean, professional, dark header bar (matching app aesthetic), white body. Kayser Medical PLLC letterhead feel. Monospace for data, serif for headings. ----- ## NEW FEATURE 6: ENHANCED SYSTEM EVENTS FEED ### Upgrade the existing sparse event feed in RESONA/CUST panel The current feed shows only 2 lines. Replace with: - Auto-scrolling terminal (newest at top) - Generates a new event every 2-4 seconds - Events are contextually intelligent: ``` > [02:14] Corridor entry detected — coherence: 0.621 > [02:19] Gap junction analog: connectivity 94.2% > [02:23] Phase lock strengthening — Δ+0.008/s > [02:31] PEAK COHERENCE — 0.651 — threshold event logged > [02:44] BODY node: phase-locked ● > [02:51] AUTONOMIC node: phase-locked ● > [02:58] MIND node: phase-locked ● — full triad coherent > [03:02] Corridor exit — dwell: 31s — recovery timer started > [03:15] ⚡ PERTURBATION triggered > [03:17] Field disruption propagating across nodes... > [03:22] Re-coherence sequence initiated > [03:44] Recovery confirmed — 29s — corridor re-entered ``` When all 3 resonance nodes (BODY/AUTONOMIC/MIND) are lit simultaneously: - Add a system event: `◆ FULL TRIAD COHERENCE ACHIEVED` - Brief golden pulse radiates from all three nodes outward - Coherence score briefly glows larger ----- ## NEW FEATURE 7: BODY/AUTONOMIC/MIND NODE ANIMATION FIX ### The three resonance nodes were unlit — fix and animate them properly These three circles should: 1. Start dim (20% opacity, no glow) 1. Light sequentially as coherence builds: - BODY lights at coherence > 0.40 - AUTONOMIC lights at coherence > 0.55 - MIND lights at coherence > 0.618 (the φ⁻¹ threshold exactly) 1. When lit: full amber glow with pulsing ring animation (keyframe scale 1→1.15→1) 1. When coherence drops below threshold: node dims with 1s fade 1. When all three lit simultaneously: thin amber line connects them in a triangle, pulsing ----- ## TECHNICAL REQUIREMENTS - React single-file component - State architecture: useReducer for session state (importing, running, paused, ended) - CSV parsing: Papa Parse (already available) - PDF export: jsPDF + jsPDF-AutoTable (import from CDN) - Chart in PDF: use Chart.js to render to canvas, then embed as image in jsPDF - No external API calls — all computation in-browser - The coherence calculation runs on a requestAnimationFrame loop during LIVE/DEMO mode - During IMPORT/PLAYBACK mode: coherence is derived from RR interval data at playback speed - Playback speed: 1x real time (5 min of data takes 5 min) with 10x fast-forward option ## STATE FLOW ``` DEMO mode (default): Simulated oscillator → coherence score → drives all panels → logs threshold events LIVE mode: Same as DEMO but with "AWAITING WEBSOCKET" label (hook ready, no actual connection needed) IMPORT mode: CSV parsed → RR array → coherence timeline computed → playback drives all panels All threshold events computed from timeline, logged in real time during playback ``` ----- ## LAYOUT CHANGES (scroll order, top to bottom) 1. Title header (unchanged) 1. **[NEW] Session control bar** (fixed or sticky) 1. **[NEW] Import panel** (conditional, only in IMPORT mode) 1. BODY ELECTRIC panel (unchanged) 1. **[NEW] Coherence analytics bar** 1. THE GOLDEN CORRIDOR (unchanged oscilloscope + corridor + nodes + score) 1. **[NEW] Threshold events log** 1. RESONA/CUST panel (with enhanced event feed + export button) 1. **[NEW] Export button** prominent at bottom of RESONA panel 1. Temporal synchronization strip (unchanged) 1. Footer citations (add Kayser n=47 study citation) ----- ## CRITICAL DETAILS - All numbers animate (count up/down with lerp), never snap - The PDF export should work entirely client-side — no server - Session timer keeps running even while scrolling - On mobile: stack layout works as-is (already single column) - The golden corridor on the oscilloscope should visually widen its amber band as coherence holds steady (subtle: band expands from 0.005 to 0.01 width after 30s in corridor — representing “attractor deepening”) - Add subtle haptic feedback suggestion comment in code for future mobile implementation - The perturbation button should add a `⚡ PERTURBATION triggered` event to the threshold log with timestamp ----- ## THE GOAL When a clinician or researcher finishes a 5-minute HRV session — either live or from imported data — they should be able to: 1. Watch their coherence field in real time across all three panels 1. See every threshold crossing logged automatically 1. Hit one button and receive a publication-ready PDF 1. Have that PDF cite the QOTE framework and list their session metrics in a format ready for a methods section This is an n=1 research instrument that scales to n=47 and beyond. The app should feel like scientific infrastructure, not a demo.
Now I have a complete picture of the existing codebase. Let me implement the clinical research instrument upgrade. I'll need to add papaparse, jspdf, jspdf-autotable, and chart.js dependencies, then create the new components and update the main page.
Now let me create the shared types and state management for the research instrument:
Now let me create the Session Control Bar component:
Now let me create the PDF export engine:
Now let me update the Golden Corridor panel to fix the resonance nodes animation and add the corridor band expansion feature:
Now let me update the Resona/CUST panel with the enhanced system events feed and export button:
Now let me update the main page to wire everything together:
I've transformed THE COHERENCE FIELD from a visualization into a full clinical research instrument. Here's what was added:
You can send messages while the preview loads