import './BrainProcess.css'; const STAGES = [ { id: 'reflect', label: 'Reflect', region: 'Prefrontal Cortex', desc: 'Sets cognitive direction, interprets intent', phases: ['perception'], color: '#d4a853', /* amber */ }, { id: 'retrieve', label: 'Retrieve', region: 'Hippocampus', desc: 'Searches sensory, semantic & episodic stores', phases: ['recall', 'association'], color: '#4ecdc4', /* teal */ }, { id: 'synthesize', label: 'Synthesize', region: 'Neocortex', desc: 'Weaves memories into language & response', phases: ['synthesis', 'reasoning'], color: '#e07a38', /* fire */ }, ]; const MEMORY_LAYERS = [ { id: 'sensory', label: 'Sensory', tech: 'ChromaDB', detail: 'Vector embeddings', key: 'sensoryDocuments', color: '#4ecdc4' }, { id: 'semantic', label: 'Semantic', tech: 'Neo4j', detail: 'Knowledge graph', key: 'graphRelations', color: '#a87ecf' }, { id: 'episodic', label: 'Episodic', tech: 'SQLite', detail: 'Temporal log', key: null, color: '#d4a853' }, { id: 'working', label: 'Working', tech: 'Context', detail: 'Active buffer', key: 'workingMemory', color: '#e07a38' }, ]; function getActiveStage(traces, isLoading) { if (!isLoading || !traces?.length) return null; const last = traces[traces.length - 1]; for (const s of STAGES) { if (s.phases.includes(last?.phase)) return s.id; } return null; } // 3D card tilt on mouse move function tiltCard(e) { const el = e.currentTarget; const r = el.getBoundingClientRect(); const dx = (e.clientX - (r.left + r.width / 2)) / (r.width / 2); const dy = (e.clientY - (r.top + r.height / 2)) / (r.height / 2); el.style.setProperty('--tx', `${dy * -7}deg`); el.style.setProperty('--ty', `${dx * 7}deg`); } function resetTilt(e) { e.currentTarget.style.setProperty('--tx', '0deg'); e.currentTarget.style.setProperty('--ty', '0deg'); } function BrainProcess({ brainState, messageCount = 0 }) { const isActive = brainState.isLoading; const activeId = getActiveStage(brainState.traces, isActive); const traces = (brainState.traces || []).slice(-6); const hasSparks = brainState.sparks?.length > 0; const showIdle = !isActive && traces.length === 0 && !brainState.reflection && !hasSparks; return (
{/* ── Section: Pipeline ── */}

Neural Pipeline

{STAGES.map((stage, i) => { const isThis = activeId === stage.id; const isDone = activeId && STAGES.findIndex(s => s.id === activeId) > i && isActive; return (
{isThis &&
}
{String(i + 1).padStart(2, '0')}
{stage.label}
{stage.region}

{stage.desc}

{isDone &&
}
{i < STAGES.length - 1 && (
)}
); })}
{/* ── Section: Memory Architecture ── */}

Memory Architecture

{MEMORY_LAYERS.map(layer => (
{layer.label} {layer.key ? (brainState[layer.key] ?? 0) : layer.id === 'episodic' ? messageCount : '—'}
{layer.tech}
{layer.detail}
))}
{/* ── Section: Internal monologue ── */} {brainState.reflection && (

Internal Monologue

"

{brainState.reflection}

)} {/* ── Section: Live Trace ── */} {traces.length > 0 && (

Cognitive Trace

{traces.map((tr, i) => (
{tr.phase || 'info'} {tr.message}
))}
)} {/* ── Section: Neural Sparks ── */} {hasSparks && (

Neural Sparks

Background dreaming — spontaneous associations

{brainState.sparks.slice(0, 3).map((s, i) => (
{s.entities?.map(e => #{e})}

{s.content}

))}
)} {/* ── Idle state ── */} {showIdle && (

Send a message to watch
the cognitive process unfold live.

{STAGES.map(s => (
{s.label} — {s.region}
))}
)}
); } export default BrainProcess;