Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions brainsnn-r3f-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,35 @@ All optional. Copy [.env.example](.env.example) to `.env` and fill in only what
| 33 | Multimodal RAG Router | [MultimodalRagPanel.jsx](src/components/MultimodalRagPanel.jsx) + [utils/multimodalRag.js](src/utils/multimodalRag.js) |
| 34 | Vector-Graph Fusion | [VectorGraphFusionPanel.jsx](src/components/VectorGraphFusionPanel.jsx) |
| 35 | Direct Content Insertion (JSON) | [DirectInsertPanel.jsx](src/components/DirectInsertPanel.jsx) |
| 101 | Quantum Coherence Lab | [QuantumCoherencePanel.jsx](src/components/QuantumCoherencePanel.jsx) + [utils/quantumCoherence.js](src/utils/quantumCoherence.js) |

## Quantum Coherence Lab

**Layer 101 — Quantum Coherence Lab.** A pure-JavaScript, in-browser simulation
of a single qubit running through `|0⟩ → H → RZ(θ) → H → M`. Slide the phase
θ to watch interference move probability between |0⟩ and |1⟩. Add noise to
damp the fringe. Toggle a mid-circuit observation to collapse superposition.
Stack X·X pairs (algebraically identity) to watch decoherence eat depth.

**What this is.** A teaching sandbox for the *mechanism* behind the word
"alignment": phase coherence steers outcomes; noise and observation kill it.
A **Scientific / Metaphor** mode toggle reframes the same numbers in
plain English alongside the math.

**What this is not.** This does **not** prove literal multiverse theory,
consciousness collapse, Planck foam, or spiritual portals. Those are framing
metaphors when the toggle is on, not physics claims.

**Future backend.** The function surface (`runPhaseExperiment`,
`runDecoherenceExperiment`, etc.) is intentionally compatible with a
hardware-backed run — a future version can swap the local simulator for
IBM Quantum or OriginQ. **No vendor API keys are added to the frontend.**

Run the unit tests directly with Node (no extra dev deps):

```bash
npm run test:quantum
```

## Keyboard shortcuts

Expand Down
3 changes: 2 additions & 1 deletion brainsnn-r3f-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"build": "vite build",
"preview": "vite preview",
"start": "node server.js",
"start:dev": "npm run build && node server.js"
"start:dev": "npm run build && node server.js",
"test:quantum": "node --test src/utils/quantumCoherence.test.mjs"
},
"dependencies": {
"@ffmpeg/ffmpeg": "^0.12.15",
Expand Down
23 changes: 23 additions & 0 deletions brainsnn-r3f-app/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ import HotkeyMap from './components/HotkeyMap';
import ThemePanel from './components/ThemePanel';
import CommunityPackPanel from './components/CommunityPackPanel';
import MilestonePanel from './components/MilestonePanel';
import QuantumCoherencePanel from './components/QuantumCoherencePanel';
import { registerServiceWorker } from './utils/pwa';
import { registerTheme } from './utils/theme';
import DreamModePanel from './components/DreamModePanel';
Expand Down Expand Up @@ -779,6 +780,28 @@ export default function App() {
<MilestonePanel />
</ErrorBoundary>

<ErrorBoundary name="Quantum Coherence Lab">
<QuantumCoherencePanel
onApplyToBrain={({ result, deltas, score }) => {
markActivity();
setState((prev) => {
const regions = { ...prev.regions };
for (const [region, delta] of Object.entries(deltas)) {
if (regions[region] === undefined) continue;
regions[region] = Math.max(0.04, Math.min(0.95, regions[region] + delta * 0.3));
}
return {
...prev,
regions,
tick: (prev.tick ?? 0) + 1,
scenario: `Quantum Coherence (${score}/100)`,
};
});
toastSuccess(`Quantum coherence ${score}/100 mapped to brain · ${result.kind}`);
}}
/>
</ErrorBoundary>

<ErrorBoundary name="Dream Mode">
<DreamModePanel />
</ErrorBoundary>
Expand Down
Loading