43 Cognition Subsystems: The Scope and Structure of a Cognitive AI Layer
LEO's cognition layer contained 43 distinct subsystems covering adaptive intelligence, causal reasoning, metacognition, trust modeling, risk assessment, conflict resolution, self-modeling, identity, and work rhythm analysis.
- Reference
- L017
- Project
- LEO
- Status
- Partial
- Evidence
- high
- Source
- 017-43-cognition-subsystems-depth.md
Context
Most AI assistant architectures separate personality configuration from memory from execution. LEO's cognition layer attempted a much more granular decomposition: every cognitive capability was a named subsystem with its own repository, manager, and test suite.
The Architecture
The backend/app/cognition/ directory contained 43 subdirectories:
adaptive/ context/ extraction/ memory_merger/
behavior/ contradiction/ goals/ metacognition/
causal/ decay/ health/ meta/
certification/ episodic/ identity/ patterns/
communication_baseline/ episodic_index/ importance/ prediction/
conflict_resolution/ extraction/ integrity/ presence/
consolidation/ goals/ learning/ profile/
context/ health/ memory/ profile_api/
profile_synthesis/
reflection/
resources/
retrieval/
risks/
scheduler/
self/
semantic/
tasks/
temporal/
trust/
work_rhythm/
working_memory/Notable subsystems by category:
Self-modeling:
self/— containslimits.py,dashboard.py,reflection.py,confidence.py,attention.py,engine.py,health.py,blind_spot.pymetacognition/— metacognitive store, engine, manageridentity/— identity engineprofile/+profile_api/+profile_synthesis/— user profile management
Reasoning:
causal/— causal graph writing, candidate builder, certificationcontradiction/— contradiction detection and resolutionconflict_resolution/— conflict resolution managertemporal/— temporal reasoning with Neo4j integrationprediction/— prediction engine and evaluator
Memory:
episodic/— episodic memory writerepisodic_index/— episodic indexersemantic/— semantic synthesizerconsolidation/— knowledge consolidation with Neo4j graph writingmemory_merger/— memory deduplication and similaritydecay/— memory decay managerimportance/— memory importance scoring
Learning:
learning/— acquisition, processing, evaluation, schedulingadaptive/— adaptive balance, freshness, enginemeta/— meta-learning: belief revision, mental models, strategy optimizer, skill evolution
Risk and integrity:
risks/— risk repository, updater, managerintegrity/— integrity manager, optimizer, verifiertrust/— trust repository, updater, manager
What Happened
All 43 subsystems had test coverage. The test_results.txt shows all cognition tests passing:
app/cognition/behavior/tests/test_extractor.py ...— passingapp/cognition/causal/tests/test_causal.py ....— 4/4 passingapp/cognition/metacognition— (confirmed in test list)- All cognition tests passed in the test run
The Phase 28 audit found 115 violations in the cognition layer — direct database access in 115 files. This suggests each subsystem had a repository with direct SQLAlchemy access.
The self/blind_spot.py component is particularly notable: a component modeling the AI's own cognitive "blind spots" — areas where the AI system has systematic biases or gaps in awareness. This is a metacognitive self-modeling concept that goes beyond standard AI assistant design.
Evidence
backend/app/cognition/directory listing — 43 subdirectories confirmedbackend/test_results.txt— all cognition subsystem tests listed as passingphase_28_x_2_violation_report.md— V091-V205: 115 cognition-layer violationsbackend/app/cognition/self/— 8 self-modeling components includingblind_spot.pybackend/app/cognition/meta/— belief_revision.py, mental_models.py, strategy_optimizer.py
Diagnosis
Established: 43 cognition subsystems exist with unit tests. All tests pass. Each subsystem has a manager, repository, and test module.
Likely: The subsystems were designed to interact through events (the Interconnect) and through the CMMU (for storage). The 115 violations indicate they were implemented with direct database access, meaning the inter-subsystem data flow through the CMMU was not yet operational.
Unknown: Whether subsystems like causal/graph_writer.py, consolidation/graph_writer.py, and temporal/ were actually writing to and reading from Neo4j knowledge graphs, or whether their operations were test-only.
What I Learned
Decomposing a cognitive AI into 43 discrete subsystems makes each individually testable and independently evolvable. The challenge is integration: 43 subsystems each with their own database access pattern create 43 points of violation when a central access policy is introduced.
The self-modeling subsystems (self/, metacognition/, identity/) represent a deliberate design choice to give the AI system a model of its own state, capabilities, limits, and blind spots. Whether this self-model was ever populated from real execution data is not established.
Broader Principle
Fine-grained cognitive decomposition is architecturally powerful but creates integration complexity proportional to the number of subsystems. At 43 subsystems, the integration overhead becomes a significant engineering cost.
Technical References
backend/app/cognition/(all 43 subdirectories)backend/app/cognition/self/blind_spot.pybackend/app/cognition/meta/belief_revision.pybackend/app/cognition/causal/graph_writer.pybackend/test_results.txt(cognition test results)
Failure sequence
On the record- Attempt
- Failure
- All 43 subsystems had test coverage. The test_results.txt shows all cognition tests passing: - `app/cognition/behavior/tests/test_extractor.py ...` — passing - `app/cognition/causal/tests/test_causal.py ....` — 4/4 passing - `app/cognition/metacognition` — (confirmed in test list) - All cognition tests passed in the test run The Phase 28 audit found 115 violations in the cognition layer — direct database access in 115 files. This suggests each subsystem had a repository with direct SQLAlchemy access. The `self/blind_spot.py` component is particularly notable: a component modeling the AI's own cognitive "blind spots" — areas where the AI system has systematic biases or gaps in awareness. This is a metacognitive self-modeling concept that goes beyond standard AI assistant design.
- Diagnosis
- **Established:** 43 cognition subsystems exist with unit tests. All tests pass. Each subsystem has a manager, repository, and test module. **Likely:** The subsystems were designed to interact through events (the Interconnect) and through the CMMU (for storage). The 115 violations indicate they were implemented with direct database access, meaning the inter-subsystem data flow through the CMMU was not yet operational. **Unknown:** Whether subsystems like `causal/graph_writer.py`, `consolidation/graph_writer.py`, and `temporal/` were actually writing to and reading from Neo4j knowledge graphs, or whether their operations were test-only.
- Lesson
- Decomposing a cognitive AI into 43 discrete subsystems makes each individually testable and independently evolvable. The challenge is integration: 43 subsystems each with their own database access pattern create 43 points of violation when a central access policy is introduced. The self-modeling subsystems (`self/`, `metacognition/`, `identity/`) represent a deliberate design choice to give the AI system a model of its own state, capabilities, limits, and blind spots. Whether this self-model was ever populated from real execution data is not established.
- Next iteration