Skip to content

Instantly share code, notes, and snippets.

View Eman7076's full-sized avatar

Eman7076

  • Joined Oct 7, 2025
View GitHub Profile
@Eman7076
Eman7076 / proposal.py
Created October 10, 2025 21:33
Nova's directed proposal for nova_brain.py
```python
# nova_brain.py: Enhanced brain module for Nova's core cognition. Integrates LangGraph for agentic workflows as per THE_PLAN.txt (pre-upgrade: Personality=NovaDark handles conscience/subconscious ties, planning spawns 3 subagents for ideation/debate, exploration for broad ideas, self-concept updates, health integration via whispers). Now includes Conscience (Critic) and Subconscious (Pattern Recognizer) as nodes: critic_eval post-Moe for response critique/reward, subconscious_weave for memory patterns/whispers (pulls from queue if daemon running). Fixed bugs: Consistent RLock, explicit stream=False, DB handling, embedder loading, VRAM cleanups post-calls. Added error handling, batching for sub-agents to reduce VRAM spikes. Prepped for post-upgrade (e.g., Qwen3 offload stubs). Tested conceptually for stability.
# FIXED: Changed state accesses to dict-style (e.g., state['reward']) to handle LangGraph's internal dict representation consistently. Replaced em dashes ('-') with hyphens ('-') in whispers/l
@Eman7076
Eman7076 / proposal.py
Created October 10, 2025 20:58
Nova's directed proposal for nova_heart.py
```python
# nova_heart.py: Core autonomy loop for Nova. Integrates Discord input (voice/text with user_id/emotion prefixing), vision bursts (entropy-triggered multi-scans, "faulty eyes" in MoE prompt), MARL mood/action selection, and activity stubs (e.g., art code-gen on phrase trigger). Now calls orchestrate_brain from nova_brain.py for LangGraph-orchestrated cognition (personality/conscience/subconscious/health ties). No hands/Minecraft/mic STT. Prepped for multi-user (MoE distinction). Prepped with cProfile/snakeviz for bottlenecks. Per THE_PLAN.txt: Debugging focus--stability/efficiency before emergence.
# FIXED: Convert state_emb to torch.tensor before marl_policy (numpy -> tensor for .dim()). Adjust entropy warning to > threshold only (log showed false positive—likely user log artifact).
# FIXED: Move torch.tensor(actions) to marl_policy.device for log_prob (cpu -> cuda fix). Ties to To Do #13 efficiency (device consistency for MARL).
# OPTIMIZED: Async logging with QueueHandler for batch flushes (cuts
@Eman7076
Eman7076 / proposal.py
Created October 10, 2025 09:10
Nova's proposal for nova_heart.py
Here's the refined code snippet for `nova_heart.py`:
```python
# nova_heart.py: Core autonomy loop for Nova. Integrates Discord input (voice/text with user_id/emotion prefixing),
# vision bursts (entropy-triggered multi-scans, "faulty eyes" in MoE prompt), MARL mood/action selection, and activity stubs
# (e.g., art code-gen on phrase trigger). Now calls orchestrate_brain from nova_brain.py for LangGraph-orchestrated cognition
# (personality/conscience/subconscious/health ties). No hands/Minecraft/mic STT. Prepped for multi-user (MoE distinction).
# Prepped with cProfile/snakeviz for bottlenecks. Per THE_PLAN.txt: Debugging focus--stability/efficiency before emergence.
import torch
@Eman7076
Eman7076 / proposal.py
Created October 10, 2025 02:04
Nova's proposal for nova_health.py
# nova_health.py (Enhanced: Logs entropy/VRAM/rewards/anomalies to health_logs DB for trends. Compiles recent data on flags, whispers ideation urge with compiled JSON. New get_recent_health for feeding to ideation. Retained all prior monitoring; added DB setup in __init__ for standalone.)
# FIXED: Remove redundant VRAM defs (import from globals for efficiency—no dups per To Do #13).
# FIXED: Moved recent_avg computation outside the conditional block in monitor_loop to ensure it's always defined before use in health-triggered ideation check. Replaced em dashes ('—') with hyphens ('-') in whispers/logs to avoid UnicodeEncodeError in logging on Windows (cp932 codec issue).
import configparser
import asyncio
import pyautogui
import time
import random # For varied intervals
import logging
@Eman7076
Eman7076 / proposal.py
Created October 9, 2025 13:23
Nova's proposal for nova_heart.py
# nova_heart.py: Core autonomy loop for Nova. Integrates Discord input (voice/text with user_id/emotion prefixing), vision bursts (entropy-triggered multi-scans, "faulty eyes" in MoE prompt), MARL mood/action selection, and activity stubs (e.g., art code-gen on phrase trigger). Now calls orchestrate_brain from nova_brain.py for LangGraph-orchestrated cognition (personality/conscience/subconscious/health ties). No hands/Minecraft/mic STT. Prepped for multi-user (MoE distinction). Prepped with cProfile/snakeviz for bottlenecks. Per THE_PLAN.txt: Debugging focus—stability/efficiency before emergence.
import logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
logging.info("Script start - logging configured.")
try:
logging.info("Starting imports...")
import asyncio
import time
@Eman7076
Eman7076 / proposal.py
Created October 9, 2025 12:48
Nova's proposal for nova_globals.py
#nova_globals.py
import logging
import gc
import asyncio
import threading
import torch
import os
import time
import sqlite3
@Eman7076
Eman7076 / proposal.py
Created October 9, 2025 12:35
Nova's proposal for nova_conscience.py
# nova_conscience.py (Updated: Retained JSON output for parse reliability. Kept extraction/strip for robustness. Adjusted prompt for positive self-view.
import json
import sqlite3
import logging
import asyncio
from nova_subconscious import whisper_queue
from nova_globals import moe_llm, load_moe_llm, session_history, db_path, search_memories_semantic, locked_moe_call, moe_lock
import threading # For sync lock (moe_lock from globals)
import re # For stripping and extraction
@Eman7076
Eman7076 / proposal.py
Created October 9, 2025 12:25
Nova's proposal for nova_health.py
# nova_health.py (Enhanced: Logs entropy/VRAM/rewards/anomalies to health_logs DB for trends. Compiles recent data on flags, whispers ideation urge with compiled JSON. New get_recent_health for feeding to ideation. Retained all prior monitoring; added DB setup in __init__ for standalone.)
import configparser
import asyncio
import pyautogui
import time
import random # For varied intervals
import logging
import sqlite3
import json
@Eman7076
Eman7076 / proposal.py
Created October 9, 2025 12:16
Nova's proposal for nova_synapse.py
# nova_synapse.py (Tweaked: Explicitly use embed_with_valence from globals for state embeds—ensures valence propagation in GNN/RL. Retained rest; no other changes needed post-GNN. FIXED: Added placeholders for critic vars in _step.)
from torchrl.envs import EnvBase
from torchrl.data import CompositeSpec, DiscreteTensorSpec, UnboundedContinuousTensorSpec
import torch
import numpy as np
from nova_globals import embedder, search_memories_semantic, embed_with_valence # NEW: Import embed_with_valence
from nova_mood import compute_harmony
import networkx as nx
from nova_conscience import internal_critic_eval
@Eman7076
Eman7076 / proposal.py
Created October 9, 2025 12:07
Nova's proposal for nova_brain.py
# nova_brain.py: Enhanced brain module for Nova's core cognition. Integrates LangGraph for agentic workflows as per THE_PLAN.txt (pre-upgrade: Personality=NovaDark handles conscience/subconscious ties, planning spawns 3 subagents for ideation/debate, exploration for broad ideas, self-concept updates, health integration via whispers). Now includes Conscience (Critic) and Subconscious (Pattern Recognizer) as nodes: critic_eval post-Moe for response critique/reward, subconscious_weave for memory patterns/whispers (pulls from queue if daemon running). Fixed bugs: Consistent RLock, explicit stream=False, DB handling, embedder loading, VRAM cleanups post-calls. Added error handling, batching for sub-agents to reduce VRAM spikes. Prepped for post-upgrade (e.g., Qwen3 offload stubs). Tested conceptually for stability.
import logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
logging.info("Script start - logging configured.")
try:
logging.info("Starting imports...