Skip to content

Add experimental RNG-based collective coherence monitor (#3208)#3720

Open
Reshi12 wants to merge 6 commits into
koala73:mainfrom
Reshi12:feat/3208-rng-coherence-monitoring
Open

Add experimental RNG-based collective coherence monitor (#3208)#3720
Reshi12 wants to merge 6 commits into
koala73:mainfrom
Reshi12:feat/3208-rng-coherence-monitoring

Conversation

@Reshi12
Copy link
Copy Markdown

@Reshi12 Reshi12 commented May 16, 2026

What this fixes

This adds an optional module to monitor random number generator (RNG) data across our nodes to explore potential links between mass consciousness and statistical anomalies.

Why it was happening

We wanted a way to test hypotheses like the Maharishi effect and collective coherence using our existing distributed network.

What changed

  • src/services/rng-monitor.ts: Added a service to collect and stream local entropy data.
  • src/components/CoherenceDashboardPanel.ts: Created a new dashboard to visualize RNG variance and global coherence.
  • server/worldmonitor/infrastructure/v1/handler.ts: Added an API endpoint to ingest the RNG data for research analysis.

How this was tested

Ran the local build and verified that the RngMonitor service correctly collects and sends data points to the server handler.

Impact

This is an experimental feature. It allows researchers to gather data on collective coherence without affecting the core functionality of the World Monitor.

Closes #3208

@vercel
Copy link
Copy Markdown

vercel Bot commented May 16, 2026

@Reshi12 is attempting to deploy a commit to the World Monitor Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the trust:caution Brin: contributor trust score caution label May 16, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 16, 2026

Greptile Summary

This PR adds an experimental RNG-based collective coherence monitoring module: a client-side RngMonitor service, a CoherenceDashboardPanel UI component, and a new /api/v1/rng/submit Edge Function for data ingestion. It also adds a regression test to guard the infrastructureHandler export against accidental deletion.

  • Infrastructure handler regression resolved: server/worldmonitor/infrastructure/v1/handler.ts is unchanged and still exports all 11 RPC methods; the new tests/infrastructure-handler-export.test.mts provides a guard against future regressions.
  • RNG buffer bugs resolved: flush() is now properly awaited in collect(), the buffer snapshot is taken before the request, and data is only cleared after response.ok — eliminating both the silent data-loss and the pre-clear race condition.
  • Z-score formula corrected: (raw - 0.5) / Math.sqrt(1/12) is the mathematically correct z-score for a uniform [0,1] distribution.

Confidence Score: 5/5

Safe to merge — all previously identified regressions are resolved and no new blocking defects are introduced

The infrastructure handler is untouched and the new regression test confirms it. The two core buffer bugs (missing await, premature clear) are both fixed. The remaining findings are hardening suggestions: a buffer cap for sustained server failures and broader method coverage in the regression test.

src/services/rng-monitor.ts — buffer retention under repeated flush failures; tests/infrastructure-handler-export.test.mts — single-method spot-check

Important Files Changed

Filename Overview
src/services/rng-monitor.ts Core RNG service with fixed buffer logic — flush is now properly awaited, buffer is only cleared on success, and z-score formula is correct for a uniform [0,1] distribution; buffer can still grow unboundedly under persistent server failures
tests/infrastructure-handler-export.test.mts New regression guard that protects the infrastructureHandler export; only spot-checks getCableHealth out of 11 registered methods, leaving the other ten unguarded
api/v1/rng/submit.ts New Edge Function for RNG data ingestion; currently only logs received points to console (no storage); uses .ts extension unlike every other api/ file, which may bypass the import guardrail test
src/components/CoherenceDashboardPanel.ts New Panel subclass rendering static HTML for the coherence monitor; onMount is a stub; no user input rendered so no XSS risk
src/config/panels.ts Adds rng-coherence panel config entry with enabled:true, priority:2 to FULL_PANELS; straightforward registration change
src/app/panel-layout.ts Imports CoherenceDashboardPanel and wires createPanel('rng-coherence', ...) into the layout manager; change is self-contained

Sequence Diagram

sequenceDiagram
    participant Browser as Browser (RngMonitor)
    participant Buffer as In-Memory Buffer
    participant API as /api/v1/rng/submit (Edge)

    loop Every collect() call
        Browser->>Browser: crypto.getRandomValues() → raw
        Browser->>Browser: "compute z_score = (raw - 0.5) / sqrt(1/12)"
        Browser->>Buffer: push RngDataPoint
        alt "buffer.length >= 50"
            Browser->>Buffer: "snapshot data = [...buffer]"
            Browser->>API: "POST {points: data}"
            alt response.ok
                API-->>Browser: "200 {success: true}"
                Browser->>Buffer: slice(data.length)
            else server error / network failure
                API-->>Browser: 4xx / network error
                Browser->>Buffer: retain (no change)
            end
        end
    end
Loading

Reviews (2): Last reviewed commit: "Fix PR #3208 infrastructure regression a..." | Re-trigger Greptile

Comment thread server/worldmonitor/infrastructure/v1/handler.ts Outdated
Comment thread src/services/rng-monitor.ts
Comment thread src/services/rng-monitor.ts
Comment thread src/components/CoherenceDashboardPanel.ts
Comment thread src/services/rng-monitor.ts Outdated
Comment thread src/services/rng-monitor.ts Outdated
@Reshi12
Copy link
Copy Markdown
Author

Reshi12 commented May 16, 2026

@greptileai can u review the latest changes to ensure the infrastructure handler regressions and RNG buffer bugs are resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

trust:caution Brin: contributor trust score caution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add optional RNG-based collective coherence monitoring to explore Maharishi-effect / mass-consciousness hypotheses

1 participant