| # ๐๏ธ OpenSkyNet Architecture: The 5 Jewels Integration |
|
|
| ``` |
| โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ |
| โ HEARTBEAT LOOP (~1 Hz) โ |
| โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค |
| โ โ |
| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ SPARSE METABOLISM โ โ Decides WHAT to compute โ |
| โ โ (5% of cycle) โ Based on frustration โ |
| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ โ |
| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ READ KERNEL STATE + JEPA โ โ |
| โ โ - successRate, failureCount โ โ |
| โ โ - frustration (0-1) โ โ |
| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ โ |
| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ INNER DRIVES โ โ EXISTING (unchanged) โ |
| โ โ - curiosity, exploration, etc โ โ |
| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ (only if metabolism says so) โ |
| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ NEURAL LOGIC ENGINE โ โ NEW Jewel #1 โ |
| โ โ 64 learned rules in latent space โ SIN LLM โ |
| โ โ - Infer state based on patterns โ 10-15ms โ |
| โ โ - Return confidence โ โ |
| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ (only if metabolism says so) โ |
| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ HIERARCHICAL MEMORY โ โ NEW Jewel #2 โ |
| โ โ โโ Level 0: Working Memory (7 items) โ 4 LEVELS โ |
| โ โ โโ Level 1: Episodic (tensor states) โ 30-40ms โ |
| โ โ โโ Level 2: Semantic (concepts) โโโโโโค Consolidation โ |
| โ โ โโ Level 3: Procedural (skills) โ โ |
| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ โ |
| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ JEPA DRIVE ENHANCEMENT (+ Logic) โ โ Plan B (existing) โ |
| โ โ frustration > 0.5 โ boost drive โ + NLE input โ |
| โ โ + Lyapunov damping (next step) โ โ |
| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ (only if metabolism says so) โ |
| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ LYAPUNOV CONTROLLER โ โ NEW Jewel #3 โ |
| โ โ Compute divergence โ damping factor โ Homeostasis โ |
| โ โ Prevents "thermal epilepsy" (V7 bug) โ 5-8ms โ |
| โ โ Apply damping to drive.urgency โ โ |
| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ (only if complexity high) โ |
| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ CAUSAL REASONER โ โ NEW Jewel #4 โ |
| โ โ Build DAG of cause-effect โ Causal not correl โ |
| โ โ Reason about interventions โ 10-20ms โ |
| โ โ Detect confounders โ โ |
| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ โ |
| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ AUTONOMY LOGGER โ โ Plan B (existing) โ |
| โ โ Log decision + all context โ + Extended fields โ |
| โ โ nleConfidence, hmSize, lyapunovDamping โ <1ms โ |
| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ โ |
| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ EXECUTE DECISION โ โ |
| โ โ If drive.kind != 'idle' โ โ |
| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ โ |
| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ OPTIONAL: BIFรSIC ODE INTEGRATION โ โ Phase 5 (conditional) โ |
| โ โ If autonomy >= 95%, add spike generationโ Decision trigger โ |
| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ |
| โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ |
| โ LOOP ~1Hz |
| ``` |
|
|
| --- |
|
|
| ## ๐ Memory Consolidation (Sleep-like Process) |
|
|
| ``` |
| โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ |
| โ OVER TIME (Idle Periods) โ |
| โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค |
| โ โ |
| โ Heartbeat #1 Heartbeat #2 Heartbeat #3 โ |
| โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โ |
| โ โ |
| โ Working Memory: Working Memory: Working Memory: โ |
| โ [ drive_A ] [ drive_B ] [ drive_C ] โ |
| โ โ (3+ episodes similar) โ |
| โ โ โ |
| โ Episodic: Episodic: โ |
| โ [zโ] [zโ, zโ, zโ] Consolidate โ โ |
| โ โ |
| โ Semantic Memory: โ |
| โ "Pattern: high-frustrationโ |
| โ โ exploration" โ |
| โ โ |
| โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ |
| ``` |
|
|
| --- |
|
|
| ## ๐ Metabolism Levels by Frustration |
|
|
| ``` |
| Frustration Total Active Components |
| 0.0 โโโโโโโโโโ [NLE, Logger] |
| 0.3 โโโโโโโโโโ [NLE, HM, JEPA, Logger] |
| 0.5 โโโโโโโโโโ [NLE, HM, JEPA, Lyapunov, Logger] |
| 0.7 โโโโโโโโโโ [ALL 5 fully active] |
| 1.0 โโโโโโโโโโ [FULL EMERGENCY MODE] |
| ``` |
|
|
| --- |
|
|
| ## ๐ Why Each Jewel Matters |
|
|
| ### 1๏ธโฃ Neural Logic Engine |
| - **Problem:** OpenSkyNet asks LLM "what next?" โ slow, depends on API |
| - **Solution:** Learn 64 pattern-rules in latent space, infer instantly |
| - **Result:** <10ms per decision, zero LLM calls |
|
|
| ### 2๏ธโฃ Hierarchical Memory |
| - **Problem:** Logs are write-only, no learning from past |
| - **Solution:** 4-level memory + automatic consolidation |
| - **Result:** Can retrieve similar past situations, find patterns |
|
|
| ### 3๏ธโฃ Lyapunov Controller |
| - **Problem:** V7_METABOLISM "epileptic" when frustrated |
| - **Solution:** Monitor divergence, apply dynamic damping |
| - **Result:** Stays stable under pressure, doesn't explode |
| |
| ### 4๏ธโฃ Causal Reasoner |
| - **Problem:** LLMs see "A happened before B" โ assume A caused B |
| - **Solution:** Build DAG of true causal chains, detect confounders |
| - **Result:** Interventions are smarter (avoid backfires) |
| |
| ### 5๏ธโฃ Sparse Metabolism |
| - **Problem:** Run all 5 components every cycle โ inefficient |
| - **Solution:** Activate only what's needed based on frustration |
| - **Result:** Stays fast, scales to 10Hz+ if needed |
| |
| --- |
| |
| ## ๐ฆ Decision Flow Example |
| |
| ### Scenario: "Frustration spike to 0.8, need to act" |
| |
| ``` |
| 1. SPARSE METABOLISM |
| frustration=0.8 โ Activate ALL 5 components |
| metabolic_rate = 95% |
|
|
| 2. NEURAL LOGIC ENGINE |
| State: [frustration=0.8, success_rate=0.2, ...] |
| Active rules: [curiosity_boost, exploration_trigger] |
| Confidence: 0.87 |
| |
| 3. HIERARCHICAL MEMORY |
| Query episodic: Found 3 similar states from yesterday |
| All led to "exploration" โ semantic pattern confirms |
| Suggest: "Try alternatives" |
| |
| 4. JEPA DRIVE ENHANCEMENT |
| Base drive: curiosity@0.4 |
| JEPA boost: +0.3 (frustration > 0.5) |
| New drive: curiosity@0.7 |
| |
| 5. LYAPUNOV CONTROLLER |
| Divergence: 0.38 (high but rising) |
| Damping: 0.4 (moderate brake) |
| Final drive: curiosity@0.42 (dampened from 0.7) |
| |
| 6. CAUSAL REASONER |
| Action "explore_alternatives" โ causes? |
| Direct: [success_rate โ, entropy โ] |
| Indirect: [frustration โ (if success)] |
| Confounders: "previous_failures" may backfire |
| Confidence: 0.65 |
|
|
| 7. EXECUTE |
| โ Execute: curiosity@0.42 with monitoring |
|
|
| 8. LOG |
| Recorded: [nleConfidence=0.87, hmMatches=3, |
| lyapunovDamping=0.4, causalConfidence=0.65 |
| metabolicRate=0.95] |
| |
| 9. NEXT CYCLE |
| See result โ update episodic memory |
| If success โ consolidate to semantic |
| If backfire โ Causal Reasoner learns confounder |
| ``` |
| |
| --- |
| |
| ## ๐ฏ Performance Targets |
| |
| | Metric | Before | After | Unit | |
| |--------|--------|-------|------| |
| | Autonomy | 90% | 99% | % | |
| | LLM calls | 80% | <5% | % of decisions | |
| | Heartbeat latency | 50ms | <100ms | ms | |
| | Memory levels | 1 | 4 | count | |
| | Causal nodes learned | 0 | 10-50 | count | |
| | Metabolic overhead | 100% | 30-95% | % adaptive | |
| | Divergence max | 0.5 | <0.35 | exponent | |
| |
| --- |
| |
| ## ๐ File Structure |
| |
| ``` |
| src/omega/ |
| โโโ heartbeat.ts (MODIFIED - new flow) |
| โโโ neural-logic-engine.ts (NEW - 350 lines) |
| โโโ hierarchical-memory.ts (NEW - 380 lines) |
| โโโ lyapunov-controller.ts (NEW - 300 lines) |
| โโโ causal-reasoner.ts (NEW - 280 lines) |
| โโโ sparse-metabolism.ts (NEW - 320 lines) |
| โโโ jepa-drive-enhancement.ts (EXISTING - optimized) |
| โโโ autonomy-logger.ts (EXISTING - extended) |
|
|
| docs/ |
| โโโ UPGRADE_PLAN_PHASE4.md (NEW - integration guide) |
| ``` |
| |
| --- |
| |
| ## โ
Readiness Checklist |
| |
| - โ
Neural Logic Engine (implemented) |
| - โ
Hierarchical Memory (implemented) |
| - โ
Lyapunov Controller (implemented) |
| - โ
Causal Reasoner (implemented) |
| - โ
Sparse Metabolism (implemented) |
| - โณ Integrate into heartbeat.ts |
| - โณ Test each component individually |
| - โณ Test integration |
| - โณ Validate autonomy >= 99% |
| - โณ Measure latency |
| - โณ Monitoring dashboard (extend live-autonomy-monitor.mjs) |
| |
| --- |
| |
| ## ๐ฎ Future Directions |
| |
| ### Phase 5 (Optional, if autonomy > 95%) |
| - Integrate Bifรกsic ODE for spike-based decisions |
| - Add "dreaming" mode (offline replay + consolidation) |
| |
| ### Phase 6 (Optional, if needed) |
| - Attention mechanism between memory levels |
| - Cross-memory retrieval (episodic โ semantic โ procedural) |
| - Skill learning (procedural memory update) |
| |
| ### Phase 7 (Research) |
| - Multi-scale reasoning (microsecond to hours) |
| - Modal reasoning (different reasoning modes per domain) |
| - Symbolic-neural integration (ASP + neural jointly) |
| |