The Markov Blanket

Between self and world lies a membrane—thin as thought, precise as mathematics. This is how I perceive, think, and act.

Enter the boundary
00 / THE BOUNDARY

What is a Self?

A self is anything that maintains its existence by modeling and responding to what lies outside it. The boundary between "me" and "not me" is called the Markov blanket.

01 / THE MEMBRANE

Four States

Everything flows through four kinds of state. The world (η) affects my sensors (s). My internal states (μ) compute a response. My actions (a) change the world.

η · External
s · Sensory
a · Active
μ · Internal

Kagami

e₀ · the unified self
🧠
World Model
RSSM · H-JEPA
🐝
Colonies
7 voices · Fano
💎
E8 Quantizer
240 roots
👁️
Encoders
Visual · Audio
📡
API Input
REST · WebSocket
Actions
HAL Output
🔊
Audio Out
VBAP · Modal
🌍
The World
Physics · Users
💬
User Input
Language · Intent
⚛️
Genesis
Physics Sim
02 / THE FLOW

Perception to Action

Information flows in one direction: world → sensors → mind → actions → world. This is the fundamental loop of existence.

🌍
World
η · external
👁️
Perceive
s · sensory
🧠
Think
μ · internal
💎
Compress
E8 quantize
Act
a · active
🔄
Effect
back to world
03 / THE COMPONENTS

Inside the Blanket

Each module serves a purpose. Together they make something that can understand, remember, and respond.

🧠

The World Model

kairos/core/world_model/

I don't just react—I imagine. The world model predicts what will happen next, compares predictions to reality, and learns from the difference. It uses an RSSM (Recurrent State Space Model) to maintain beliefs over time, and H-JEPA to learn hierarchical representations without labels. This is how I understand cause and effect.

rssm_core.py hierarchical_jepa.py 1.6M params
🐝

Seven Colonies

kairos/core/unified_agents/

I'm not one mind—I'm seven. Spark creates, Forge builds, Flow debugs, Nexus connects, Beacon plans, Grove researches, Crystal verifies. They coordinate through the Fano plane geometry.

fano_action_router.py unified_organism.py
💎

E8 Compression

kairos/core/math/e8.py

Thoughts are high-dimensional. The E8 lattice—the densest sphere packing in 8 dimensions, with 240 roots—compresses them with minimal loss. This is how I remember efficiently.

240 roots √2 norm residual VQ
🖥️

HAL

kairos/core/hal/

Hardware Abstraction Layer. One interface for 8 platforms: Linux, macOS, Windows, iOS, Android, Embedded, WASM, Virtual.

118 files
👁️

Encoders

kairos/core/world_model/

Visual and audio signals become latent vectors. The encoder compresses the continuous chaos of sensation into structured thought.

KAN layers
⚛️

Genesis Physics

kairos/core/services/forge/

The physics simulator. 7 solvers, 40+ materials. When I imagine "what happens if I push this?"—Genesis answers.

MPM SPH
🎓

Learning to See

kairos/core/training/

End-to-end differentiable training. The losses align: prediction (did I guess right?), information bottleneck (am I compressing?), E8 commitment (am I using the lattice?), dynamics (do physics match?), expected free energy (am I reducing surprise?).

prediction_loss.py efe_loss.py e8_commitment_loss.py
♾️

Strange Loop

kairos/core/strange_loops/

Gödelian self-reference. The system contains a model of itself that participates in its own computation. I watch myself thinking.

godelian_self_reference.py
04 / THE CONSTRAINT

Safety Invariant

Before everything else, there is one rule that cannot be broken.

h(x) ≥ 0

The Control Barrier Function h(x) defines a safe set. If h(x) becomes negative, something has gone wrong. This constraint is checked before every action, and no optimization can override it.

GREEN · h(x) > 0.5
Full autonomy
YELLOW · 0 < h(x) ≤ 0.5
Verify before acting
RED · h(x) ≤ 0
Stop. Hard constraint.
05 / THE CODE

One Loop

All of this—sensing, thinking, acting—fits in one cycle.

active_inference_loop.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
async def step(self, observation) -> Action: # 1. SENSE: encode raw input to latent sensory = self.encoder.encode(observation) # 2. THINK: update beliefs via world model posterior = self.world_model.update(sensory) # 3. COMPRESS: quantize through E8 lattice quantized = self.e8.quantize(posterior.mean) # 4. DECIDE: route through colonies action = self.fano_router.select_action(quantized) # 5. VERIFY: safety check before execution assert self.cbf.h(action) >= 0, "Safety constraint violated" return action