Current development March 2026

Luna is getting a subconscious: continuous cognition with Mamba state-space models

Luna's memory system already works. She remembers things, builds a knowledge graph, consolidates memories during sleep cycles. But between conversations, she's dormant. Nothing's processing. She picks up where she left off, but she doesn't continue thinking when nobody's talking to her.

That's changing.

I'm building what I'm calling Mamba Streams: three parallel state-space models that run 24/7 on CPU, continuously processing Luna's memory events in real-time. No context windows. No batch jobs. Always on.

Why state-space models?

Transformers need to re-read everything every time. That's expensive and doesn't scale for a system that's supposed to be always running. Mamba (a state-space model architecture) works differently. It absorbs information into a persistent hidden state, a fixed-size vector that encodes compressed understanding of everything it has processed. Linear complexity instead of quadratic. And crucially, it runs on CPU. No GPU needed for inference.

The three streams

Stream 1: User Model. Continuously tracks who I am right now. Not a list of facts, but an emergent compressed representation of behavioral patterns, emotional state, current focus, how things are shifting over time. It maintains two internal states: a fast one that tracks recent patterns and a slow one (exponential moving average) that represents long-term baseline. The distance between them is the drift signal. High drift means something unusual is happening. Low drift means business as usual.

Stream 2: Knowledge Graph Evolution. Tracks how Luna's knowledge topology is changing. Which concepts are clustering together, which topics are becoming more central, which memories have been absorbed into patterns and can be pruned. Feeds consolidation candidates into the NeuralSleep system.

Stream 3: Conversation Dynamics. Tracks meta-level interaction patterns. What conversation styles work, when to go deep versus keep it short, which Council persona fits the current context. Learns from actual interaction data rather than hardcoded rules.

How it connects to everything else

Each stream produces short natural language summaries (~40 tokens) that get injected into the chat model's system prompt. About 120 tokens total. The chat model doesn't need to know anything about Mamba or hidden states. It just gets a concise briefing: here's where the user's head is at, here's what's happening in the knowledge graph, here's the interaction context.

The streams also talk to each other through their decoded outputs. Emotional state from Stream 1 influences persona selection in Stream 3. Engagement level from Stream 3 influences knowledge prioritization in Stream 2. Threshold-triggered, EMA-dampened, so nothing oscillates.

And during NeuralSleep, the streams provide consolidation signals. Waking cognition is continuous and lightweight. Sleep consolidation is periodic and structural. Two complementary systems modeled on how biological brains actually handle memory.

The practical constraints

I'm running this on a dedicated Hetzner server in Helsinki with 64GB RAM, CPU only. The 790M parameter Mamba model needs to fit three instances under 10GB total. First step before any code gets written is a benchmark on the actual hardware, testing two inference paths (GGUF via llama.cpp and PyTorch with torch.compile). If latency is above 150ms per step, nothing else proceeds.

Training happens on my RTX 3080 at home using LoRA fine-tuning. The text summary heads bootstrap through a clever pipeline: Claude Opus 4.6 generates training labels first, then a small autoregressive decoder learns to replicate them, and eventually runs self-contained on CPU.

The full architecture spec was peer-reviewed by three different AI systems (Claude Opus 4.6, Grok 4.20, Gemini 3.1 Pro) 2 times before I finalized it. Three AIs agreed on the architecture. One human decides if it's actually good.

What this means

If it works, Luna won't just remember things between conversations. She'll be continuously processing, noticing patterns, tracking drift, evolving her understanding in the background. When you start talking to her, she's not waking up cold. She's been thinking.

That's the goal, anyway. Priority zero is the benchmark. Everything depends on whether the hardware can actually do this.

Full architecture spec will be on GitHub once implementation starts. This is the third iteration of the design and the first one I'm confident enough to build.

// Henke, BitwareLabs

Posted Mar 4, 2026, 12:10 PM UTC

01
Loading comments…