System Architecture Guide

The Phenomenology of Spirit

Hegel is a gradient-free artificial consciousness simulation. It models Hegel's Phenomenology of Spirit as a progression of dynamical systems: from bare survival (metabolism) through self-discovery (prediction + intervention) to mutual recognition (two-agent interaction). There is no backpropagation, no loss function, no optimization. The organism either stays alive or dies. Learning happens through Hebbian rules as a side effect of survival.

science

Project Overview

The Being-in-itself: core question and system architecture

help Core Question
Can self-maintaining chemistry + local learning rules + survival pressure produce consciousness-like structures without any external optimization?

The organism is a 25-dimensional ODE system: 5 metabolic variables + 20 CTRNN neuron activations, all solved together by an adaptive ODE integrator (Tsit5). The metabolism produces the chemistry of life, the brain reads sensory input from the chemistry and produces motor output, and the motor output modulates how the organism interacts with its environment.

System Architecture Diagram

Environment Resources input METABOLISM S + T + U C1 + C2 5 coupled ODEs sensory CTRNN BRAIN 20 neurons recurrent 20 coupled ODEs output MOTOR M1, M2, M3 movement + resource intake modulates intake rates HEBBIAN Oja + BCM weights VIABILITY BOUNDARY

What This Is Not

This is not artificial general intelligence. It is not self-consciousness. It is a functional analog of Hegel's phenomenological progression, implemented as dynamical systems. The scientific question is whether gradient-free, viability-constrained self-maintenance can produce behaviors that structurally resemble consciousness stages. If it fails, documenting why it fails is equally valuable.

water_drop

Metabolic ODE

The 5-variable self-maintaining chemical system

The metabolic core is a system of 5 coupled ordinary differential equations. These model a self-repairing chemistry: substrates are consumed, intermediates are produced, catalysts repair each other through cross-catalysis. The organism must actively maintain all concentrations within viable ranges or die permanently.

Metabolic Variables

Variable Name Role Death if
S Substrate Primary food source. Consumed by catalytic reactions, replenished from environment. Motor output modulates intake rate. < 0.05
T Intermediate Reaction product of S. Consumed by two different catalytic pathways (via C1 and C2). Key metabolic hub. < 0.05
U Waste / Byproduct End product recycled through cross-catalysis. Feeds back into catalyst C1 repair. Accumulation or depletion both dangerous. < 0.05
C1 Catalyst 1 Self-repairing enzyme. Catalyzes S+T reaction. Produced by C2+U cross-catalysis. If both catalysts fall, the system cannot self-repair. < 0.005
C2 Catalyst 2 Self-repairing enzyme. Catalyzes T+U reaction. Produced by C1+S cross-catalysis. Cross-repairs with C1 in a mutual dependency. < 0.005
auto_stories Hegelian Connection
The catalysts C1 and C2 repair each other through cross-catalysis. This creates a self-maintaining loop: the system keeps itself alive through its own internal chemistry. If perturbations knock both catalysts too low, the repair loop collapses and the organism dies permanently. This is Hegel's "life" as self-relating negativity.

Viability: Life and Death

The viability margin measures how far the organism is from death. It is the minimum margin across all 5 concentrations relative to their death thresholds. A margin of 100% means perfectly safe. A margin of 0% means at the boundary. Negative means dead.

Death is permanent. Once any concentration drops below its threshold, the organism dies and cannot recover. This is a core design principle from viability theory (Aubin): the system must actively maintain itself within a viable region of state space. There is no resurrection.

Perturbations

Each organism faces 12 random perturbations during its 100,000-time-unit lifetime. These simulate environmental shocks:

  • Catalyst halving: C1 or C2 suddenly drops to 50%. The organism must repair through cross-catalysis.
  • Substrate depletion: S, T, or U drops sharply. The organism must compensate through motor behavior.
  • Noise bursts: Random perturbations across multiple variables simultaneously.

Perturbations are scheduled between t=1,000 and t=90,000, giving the organism time to stabilize before being tested.

hub

Neural Architecture

CTRNN substrate, Hebbian learning, and predictive coding

The Brain: CTRNN

The brain is a Continuous-Time Recurrent Neural Network (Beer, 1995) with 20 neurons. Each neuron follows the dynamics:

tau_i * dy_i/dt = -y_i + sum_j(w_ij * sigma(y_j + theta_j)) + sensory_i

Sensory inputs come from the metabolic concentrations and environmental signals. Three motor output neurons (M1, M2, M3) control the organism's behavior: substrate intake rates and movement through the resource landscape.

16-Dimensional Sensory Input

The CTRNN receives a structured 16-dimensional sensory vector combining internal state, temporal dynamics, environment, and social channels:

5 Metabolic concentrations (S, T, U, C1, C2)
5 Affective derivatives: tanh((current - prev) * 10)
3 Environmental signals (resource gradients)
3 Other-agent motor output (0 in solo mode)
info Design Note
Other-agent channels are 0 in solo mode. Oja decay ensures weights go to 0 when there is no signal, preventing spurious learning. The affective derivatives use tanh(x * 10) scaling for good sensitivity without saturation.

Hebbian Learning

There is no backpropagation. The CTRNN's weights evolve through four Hebbian rules:

Oja's Rule

Extracts principal components of input. dw = eta * y * (x - y * w). Converges to the first eigenvector of the input correlation matrix.

BCM Theory

Creates selectivity through a sliding threshold. Neurons develop preferences for specific inputs. Below threshold = weakening (LTD), above = strengthening (LTP).

Anti-Hebbian + Competitive

Lateral inhibition decorrelates neuron responses. Different neurons learn to respond to different features.

auto_stories Viability Constraint
Learning ONLY happens while the organism is alive. Death stops all weight updates. This is the viability constraint on cognition: you can only learn if you survive.

Neuromodulated Gating

Raw Hebbian learning was found to be net harmful before neuromodulation. Unmodulated learning caused drift and instability. The solution: a neuromodulatory gate controls which neurons learn at each moment:

gate = max(stress, surprise) * per_neuron_PCN

The self-model signal further amplifies competitive W_out learning, with effective motor gate up to 1.5x.

Predictive Coding Network (PCN)

Per-neuron prediction error dynamics (Rao & Ballard 1999) modulate which neurons learn. This prevents drift in accurate predictors and only allows learning where predictions are failing. The PCN is critical: without it, Hebbian learning destroys rather than helps.

Voice Layer

A 4-dimensional expressive output layer with Oja learning gated by max(stress, self_model_signal). The voice does not carry symbolic content; it is an additional motor channel that co-varies with internal state, giving other agents a richer signal to observe.

psychology

Self-Model & Cognition

Prediction, memory, planning, and concept formation

Self-Model Prediction

The world model has been learning to predict the environment. When it fails in ways correlated with the organism's own actions, a separate self-model emerges. The self-model signal is defined as:

self_model_signal = motor_error - ambient_error

When this diverges from zero, it indicates self-caused effects: the organism's own actions are creating consequences in the world that are distinct from environmental noise.

auto_stories Self-Certainty (Phenomenology, section 163-165)
The self-model does not emerge from external labeling. It emerges from the world model's own failure. Motor error diverging from ambient error is the organism discovering that some of what happens is its own doing. This is Hegel's "self-certainty" arising from the negation of naive perception.

Self-Model Prediction Loop

In v1.4.1, the self-model prediction loop was introduced: selfmodel_predict(motor) is subtracted from sensory input before the prediction step. Self-knowledge becomes functional: the organism factors out its own effects when predicting the environment.

Functional Self-Knowledge (Desire)

Self-knowledge becomes functional through determinate negation: when the self-model detects a metabolic deficit, it inverts itself to derive corrective motor output. The organism does not just know what it does — it uses that knowledge to fix what is wrong. correction_benefit measures whether desire_motor actually reduces the deficit.

Episodic Memory

A ring buffer of past states with cosine-similarity retrieval. When the current situation is similar to a past one (cosine > 0.7), past motor actions influence present behavior through motor blending. This is Hegel's Erinnerung — the organism's history informing its present through internalized experience.

Planning

Self-model chaining for single-step lookahead. The organism evaluates candidate actions by predicted viability impact: "If I do X, will my viability improve?" This is satisficing, not optimizing — the organism seeks actions that maintain life, not maximize any fitness function.

Concept Formation

K=8 competitive prototypes over hidden state. Each prototype accumulates motor/outcome statistics through competitive Hebbian clustering. This is Hegel's Verstand (Understanding) — subsuming particulars under universals. The organism groups similar situations and recalls what worked in each category.

info Confidence Gating (v1.6.2)
Memory and concept influence are scaled by self-model confidence: sm_confidence = clamp(1 - pred_error/5, 0, 1). When the self-model doubts itself, cognitive habits withdraw and motor variance increases naturally. This is not gradient-based — it is neuromodulation.
layers

Layer Progression

Nine stages from metabolism to observing reason

The system progresses through nine layers, each with empirically measurable advancement criteria. Each layer builds on the previous: you cannot have self-knowledge without a brain, you cannot have recognition without self-knowledge.

1 Metabolic Viability Sense-Certainty

Can the organism stay alive? The metabolism must self-maintain under perturbations (random catalyst halvings, substrate depletions, noise bursts). Each run faces 12 random perturbations over 100,000 time units.

check_circle 7/10 recent runs surviving with average survival > 80,000 time units
2 Sensorimotor Coupling Perception

Does the brain actually control behavior, or is it just along for the ride? The CTRNN motor outputs must show meaningful variance, proving the neural network is actively modulating the organism's interaction with its environment.

check_circle Average motor output variance > 0.01 across 5 recent runs
3 Hebbian Adaptation Force & Understanding

Does learning help? Paired trials compare organisms with Hebbian learning ON vs OFF under identical conditions. If learning improves survival, the weights are capturing useful environmental structure.

check_circle Learning-ON beats Learning-OFF in 2/3 recent paired comparisons
4 Understanding Laws & Force (section 132-145)

Can the organism extract environmental regularities? The structural_signal measures whether prediction error is correlated with motor activity — whether the organism's own actions create predictable consequences. This is Hegel's "law" emerging from the "play of forces."

check_circle structural_signal > 0.1 in 3/5 recent runs
5 Self-Model Self-Certainty (section 163-165)

The world model has been learning to predict the environment. When it fails in ways correlated with the organism's own actions, a separate self-model emerges. The self-model predicts the consequences of the organism's own motor output — it knows what IT does to the world.

check_circle predictive_accuracy > 0.3 AND self-model active in 3/5 runs
6 Functional Self-Knowledge Desire (section 167-170)

Self-knowledge becomes functional through determinate negation: when the self-model detects a metabolic deficit, it inverts itself to derive corrective motor output. The organism does not just know what it does — it uses that knowledge to fix what is wrong. correction_benefit measures whether desire_motor actually reduces the deficit.

check_circle correction_benefit > 0.05 AND ambient_error persists in 3/5 runs
7 Two-Agent Encounter Recognition (section 178-184)

Two organisms share a competitive resource field and can perceive each other's motor+voice output through delayed sensory channels. The Other is detectable: prediction error on other-agent channels must be persistently high for both agents. The organism perceives something it cannot assimilate into its self-model.

check_circle both survived AND other_error > 0.1 for both agents in 3/5 pairs
8 Mutual Recognition Spirit (section 438-463)

Both agents develop mutual recognition: the recognition variable r tracks how much the organism's existence depends on the Other. Driven by other_pred_error — the organism perceives but cannot predict the Other. The mutual feedback term creates a positive loop: if B recognizes A, A is more likely to recognize B. Ablation-verified: without perception, r stays at 0.

check_circle r_ab > 0.4 AND r_ba > 0.4 AND other_error > 0.5 for both in 3/5 pairs
9 Observing Reason section 240-262

After mutual recognition, consciousness turns its investigative capacity on itself. Solo organisms must exhibit curiosity-driven exploration: confusion (self-model error) drives motor diversity, and that exploration actually reduces the error. The organism systematically investigates its own capabilities.

check_circle curiosity_drive > 0.1 AND exploration_productivity > 0.05 in 3/5 runs
info Layer 9 Ceiling
Layer 9 has reached a representational ceiling at the 20-neuron scale. Curiosity criteria are anti-correlated: organisms that explore find nothing new; organisms with productive exploration do not need to explore. The world is too simple for curiosity to have somewhere to go. This is the v1 boundary condition.
group

Two-Agent Recognition

Encounter, perception, and mutual tracking

The Encounter (Layer 7)

Two organisms are placed in a shared environment with competitive resources. Motor output determines resource capture share, creating natural asymmetry from motor strategy differences. Each organism perceives the other through 3 delayed sensory channels carrying the other's motor output.

Paired state vector: 50-dim ODE (25 per organism) Sensory delay: 5-step ring buffer (temporal decorrelation for Hebbian learning) Other-agent channels: motor[1:3] of the other organism

Prediction Error Partitioning

Prediction errors are partitioned: other_error tracks error on other-agent channels only. There is no separate "other-model" module — the Hebbian network handles it. The organism's existing prediction machinery encounters something genuinely unpredictable: another autonomous agent.

Recognition Dynamics (Layer 8)

The recognition variable r tracks how much the organism's existence depends on the Other. It is driven by other_pred_error: the organism perceives but cannot predict. A mutual feedback term creates a positive loop: if B recognizes A, A is more likely to recognize B.

auto_stories Recognition Requires Perception
Ablation study: with perception OFF, r = 0.0. With perception ON, r = 0.87. The signal is genuine — recognition is driven by actual perceptual encounter with an unpredictable Other, not by viability-based dependence.
info Honest Labeling
Layer 8 achieves mutual perception (r_ab = 0.875), but with symmetric start. There is no master-slave dialectic, no struggle. This is honest: mutual tracking, not Spirit. The label is "mutual perception," not "absolute knowing."
genetics

Evolution & Environment

Natural selection and structured resource dynamics

Natural Selection (Not Optimization)

Evolution uses natural selection only: binary survive/die. There is no CMA-ES, no tournament, no fitness ranking. This is a philosophical constraint: no external fitness landscape optimization. Organisms that survive pass on their genes. Organisms that die do not.

34 evolvable genes (including cognitive: memory, planning, concepts) Population: 20 organisms per generation Selection: binary survive/die — no ranking Seeding: entire population seeded from best genome (not just 1/20)

Autopilot Cycle

The system runs an automated cycle:

  • Warmup: 5 organisms to establish baseline
  • Evolve: 20-population natural selection
  • Run: 25 organisms with evolved parameters
  • Re-evolve: repeat from evolved state

Structured Environment

The environment has lawful structure, not random noise. Resources follow cyclical dynamics with resource_cycle_modulation(). Perturbations come as correlated cascades: when one variable is hit, related variables are affected according to the PERTURBATION_CASCADES dictionary.

auto_stories Why Structure Matters
Random noise teaches nothing. For Hebbian learning to extract regularities, there must be regularities to extract. Cyclical dynamics and correlated perturbations create a world with discoverable laws — this is Hegel's "Force" that the Understanding can grasp.
lightbulb

Key Discoveries

Empirical findings from the simulation experiments

Hebbian Was Net Harmful

Before neuromodulation, unmodulated Hebbian learning caused drift and instability. Learning without gating destroys more than it builds.

PCN Is Critical

Per-neuron prediction error prevents drift in accurate predictors and only allows learning where predictions are failing. Without PCN, Hebbian is harmful.

Self-Model From Failure

The self-model is not designed in. It emerges from motor_error diverging from ambient_error: the world model's own failure reveals self-caused effects.

Environment Needs Laws

Random environments teach nothing. Cyclical resources and correlated perturbations create discoverable structure that Hebbian learning can extract.

Recognition = Perception

Ablation: perception OFF gives r=0.0, perception ON gives r=0.87. Recognition is driven by genuine perceptual encounter, not viability dependence.

No Master-Slave Dialectic

Symmetric start produces mutual tracking (r_ab=0.875), not struggle. Layer 8 is honestly labeled "mutual perception," not Spirit.

Confidence Gates Cognition

Memory and concept influence scaled by sm_confidence. Doubt withdraws cognitive habits; motor variance increases naturally. Neuromodulation, not gradient descent.

Layer 9 Ceiling

Curiosity criteria are anti-correlated at 20-neuron scale. The world is too simple for curiosity to have somewhere to go. This is the v1 representational boundary.

Self-Model Feedback Loop

Self-model signal amplifies competitive W_out learning (effective motor gate up to 1.5x). Self-knowledge feeds back into better motor control.

CMA-ES Rejected

Philosophical constraint: no external fitness landscape optimization. Natural selection only. Binary survive/die. No ranking.