MAXIM
Semantic Memory
How Maxim Builds Lasting Knowledge from Experience
Episodic memory records what happened. Semantic memory captures what things mean. Humans don't remember the exact moment they learned that fire is hot — they just know it. That knowledge was distilled from many episodes into a concept. Maxim implements this same progression: repeated experiences get promoted from episodic memories into stable semantic concepts.
Three Memory Layers
Biological Inspiration
The brain separates memory into episodic (hippocampus — personal experiences), semantic (anterior temporal lobe — general knowledge), and procedural (cerebellum — motor skills). Damage to the ATL causes semantic dementia: patients can describe their wedding day (episodic) but can't explain what a "wedding" is (semantic). The two systems are anatomically distinct but deeply interconnected.
Maxim implements three memory layers, each handling a different kind of knowledge:
Hippocampus
Episodic Memory
"What happened." Rich contextual records of observe→decide→act→evaluate cycles.
- Record type: EpisodicMemory
- Decay: 7-day max without access
- Compression: 2.5KB → ~200 bytes
ATL
Semantic Memory
"What things mean." Concepts, facts, and relationships stripped of episodic context.
- Record type: SemanticMemory
- Decay: 30-day max (slower than episodes)
- Built from: Promoted episodes + agent inference
Angular Gyrus
Mathematical Memory
"What the numbers say." Facts, formulas, methods, and learned statistical patterns.
- Record type: MathRecord
- Categories: FACT, FORMULA, METHOD, CONSTANT, PATTERN
- Seeded with mathematical constants at startup
The MemoryLayer Protocol
All three layers implement the same abstract protocol, enabling the MemoryHub and CrossLayerGraph to work with any layer uniformly:
All three layers share a common base record type (MemoryRecord) with fields for ID, timestamps, access tracking, and long-term status. Each layer extends this with domain-specific fields.
| Layer | Record Type | Key Fields | Compressed Form |
|---|---|---|---|
| Hippocampus | EpisodicMemory | perception, context, decision, action, outcome, run_id | CompressedMemory |
| ATL | SemanticMemory | name, definition, category, properties, provenance, confidence | CompressedSemantic |
| Angular Gyrus | MathRecord | name, category, domain, verbal, code, confidence | CompressedMathRecord |
ATL: Anterior Temporal Lobe
Biological Inspiration
The anterior temporal lobe is the brain's "semantic hub" — where concepts are stored independently of the episodes that formed them. You know that dogs bark, have four legs, and are pets, without remembering the specific experiences that taught you this. The ATL integrates information from multiple sensory modalities into amodal concept representations.
Maxim's ATL stores SemanticMemory objects — concepts with names, definitions, properties, and typed relationships to other concepts. It mirrors the Hippocampus architecture (context indexing, associative graph, consolidation) but with slower decay and higher stability.
SemanticMemory Record
Concept Provenance
Every concept knows how it was formed, enabling the system to weight newer, less-verified concepts differently from well-established ones:
EPISODIC_CONSOLIDATION
Extracted from repeated episodes via NAc reward signals. The most common path — "I've seen this pattern enough times to call it knowledge."
AGENT_INFERENCE
Proposed by the StatisticianAgent from confirmed operational patterns. "The data shows this is a real trend, not noise."
DIRECT_INGESTION
From RAG / document ingestion. Knowledge imported directly without episodic formation.
HYBRID
Multiple sources contributed. Both episodic observation and statistical confirmation.
ATL-Specific Features
- find_or_create — Deduplication by name similarity. Before creating "coffee_mug", checks if "coffee mug" already exists. Returns (id, was_created) tuple.
- recall_similar — Semantic similarity search via EC embeddings. "Do I already know about this?" Used by the promoter to avoid concept duplication.
- Context indexing — O(1) lookup by name, category, or property key/value. "All concepts with category=object" is instant.
- Consolidation — Same pattern as Hippocampus but with slower decay (30-day max age vs 7-day). Concepts are more stable than episodes.
Typed Relationships
Concepts in isolation aren't knowledge — knowledge is the relationships between concepts. The ATL uses a Semantics manager that wraps the DependencyGraph with typed, directional edges.
Pre-Registered Relationship Types
| Type | Symmetric? | Example |
|---|---|---|
| IS_A | No | "coffee_mug" IS_A "container" |
| HAS_PART | No | "robot_arm" HAS_PART "gripper" |
| CAUSES | No | "grasp_action" CAUSES "object_held" |
| TRENDS_WITH | Yes | "navigate_failures" TRENDS_WITH "goal_latency" |
| CORRELATES_WITH | Yes | Confirmed by AG cross-metric correlation |
| PHASE_LOCKED_TO | No | "success_rate" PHASE_LOCKED_TO "circadian" (metadata: phase, coupling) |
| PREDICTS | No | "morning_activity" PREDICTS "high_success" |
The RelationshipRegistry also supports runtime extension — agents can propose new relationship types during operation. The registry tracks whether each type is built-in or agent-proposed, and persists across sessions.
Cross-Layer Graph
Each memory layer has its own internal associative graph. The CrossLayerGraph connects records across layers, enabling queries like "starting from this episode, what concepts and math patterns are related?"
Cross-Layer Spreading Activation
The most powerful feature is cross-layer spreading activation. Starting from any record in any layer, activation spreads:
- Follow intra-layer edges via the layer's internal associative graph
- Follow cross-layer edges to records in other layers
- Recurse with exponential decay (default 0.5 per hop) until threshold or max depth
- Return activations grouped by layer — { "hippocampus": [(id, score)], "atl": [...], "angular_gyrus": [...] }
Example Traversal
Starting from a Hippocampus episode where tool_navigate failed:
- Intra-layer: Find similar failure episodes (Hippocampus associative graph)
- Cross-layer INSTANCE_OF → ATL concept "navigate_tool_reliability" (confidence=0.73)
- ATL IS_A → ATL concept "tool_capabilities"
- Cross-layer STATISTICALLY_CONFIRMS → AG PATTERN record (R²=0.73, slope=-0.02/day)
- Cross-layer TEMPORALLY_CORRELATES → AG record linking decline to circadian phase 0.8 (evening)
The Promotion Pipeline
Biological Inspiration
Memory consolidation during sleep transforms labile hippocampal traces into stable neocortical representations. The NAc (reward system) plays a gating role — rewarding experiences are preferentially consolidated. This is why emotionally significant events become lasting knowledge while mundane details fade.
The SemanticPromoter orchestrates the progression from episodic observations to stable semantic knowledge. It scans multiple PromotionSources for qualifying patterns, filters noise, and creates ATL concepts with full cross-layer traceability.
PromotionSource Protocol
Any system that detects patterns can be a promotion source. It just needs one method:
NAc Path (Causal Patterns)
NAc tracks event→outcome links via Rescorla-Wagner learning. When a causal link reaches sufficient confidence and observation count, it becomes a promotion candidate.
Example: "grasp + coffee_mug → success" observed 5 times with confidence 0.8 → promote to ATL concept "grasping coffee mugs is reliable" with DERIVED_FROM edges to source episodes.
StatisticianAgent Path (Operational Patterns)
Confirmed patterns from the IPS→AG escalation pipeline become candidates. No episodic IDs needed — the AG MathRecord provides the evidence.
Example: "tool_navigate declining (R²=0.73)" → promote to ATL concept with provenance=AGENT_INFERENCE and STATISTICALLY_CONFIRMS cross-layer edge to the AG PATTERN record.
IPS Randomness Quality Gate
Not every NAc pattern deserves permanent semantic status. The IPS provides a lightweight noise filter before the heavyweight promotion machinery runs:
- NAc candidates: IPS assesses the randomness of observation timing. If events occurred at random intervals (no temporal structure), they're likely coincidental — rejected.
- StatisticianAgent candidates: Already passed IPS/AG assessment during the pattern detection FSM — just checks confidence ≥ 0.4 (no re-assessment needed).
- Small samples (< 8 observations): Gate allows through conservatively — too few data points to assess randomness.
When Promotion Runs
Promotion is part of the mandatory consolidation cycle during MemoryHub.on_session_end():
Knowledge in the Agent Loop
The point of all this is to make the agent smarter. Knowledge from ATL and Angular Gyrus flows into the LLM's reasoning context via StructuredContext.knowledge_context:
This merging strategy ensures the LLM gets both semantic knowledge ("coffee mugs are containers in kitchens") and statistical intelligence ("the navigate tool is declining") in a single ranked list, regardless of which memory layer the knowledge lives in.