LIVING MEMORY
The Exocortex
Thousands of siloed agent sessions, zero consolidation — the exocortex is the cognitive organ that captures, structures, and feeds it all back.
The Dark Matter of Agent Data
Weeks of active agent work across some fifteen projects leave behind thousands of JSONL session files — on the order of 1.5 GB — sitting in ~/.claude/projects/. A colossal corpus that never speaks. In parallel, agent conversations on Telegram and Discord, git commits, pull requests, issues, and voice notes each live in their own silo.
Every agent — Lyra, Claude Code — builds a fragmented memory with no access to what the others already know. The same recurring conditions resurface. Context evaporates between sessions. Learning never accumulates. What is missing is not storage; it is an organ — something that knows how to capture, how to selectively forget, and how to surface the right thing at the right moment.
We call this unstructured, massive, invisible corpus the dark matter of agent data: present, heavy, and silent to the agents that produced it.
Why « Exocortex »
An exocortex is an external extension of the cerebral cortex — a system that carries cognition beyond the skull. The metaphor is exact: this is not a tool you consult, it is an organ that thinks with the operator and their agents. The grounding is Clark & Chalmers' extended-mind thesis (1998): tools used habitually — a notebook, a calendar, a phone — become genuine parts of a cognitive process. The exocortex takes that to its conclusion. A digital system shared between human and agents becomes a cognitive actor in its own right.
What it is not: a cache (a replica for speed), a dump (accumulation without structure), or a RAG index (text retrieval). What it is: a living graph that learns, forgets, and reorganises; a typed map where every entity carries meaning; a memory that decays and strengthens like a biological one.
The durable asset is the graph. Producers, analysers, and consumers are all swappable — the structured memory they feed is what compounds.
Two Maps, One Tissue
Memory here is not undifferentiated. It separates into two coupled maps, joined by a tissue of raw events.
The external world (world:*) holds everything that exists independently of the operator — people, organisations, projects, contracts, events, topics, places, artefacts. It is a statically enriched ontology, the analogue of Tulving's semantic memory (1972): decontextualised facts about the world.
The internal world (self:* + agent:*) holds the operator's own functioning — patterns, values, preferences, work rhythms, recurring conditions — and each agent's functioning — skills, personas, instruction sets, observed failure modes. It is a dynamic ontology, the analogue of procedural memory and the brain's Default Mode Network.
Between them runs the tissue: raw events, append-only, source-tagged, immutable — the episodic layer, dated and lived. A single interaction can update several entries across both maps at once: closing a contract by message touches world:person, world:contract, and self:operator:pattern:contract-closure from one event.
world:* and the internal self:*/agent:* — both fed by a single immutable tissue of raw events.Four Domains by Responsibility
The system decomposes by responsibility, not by data source — so any new source plugs in without touching the core, and any analyser is replaced without breaking the graph. Four domains:
- Producers parse one source and emit typed events — Claude Code JSONL ingest, git/gh ingest, mail/Telegram/voice ingest to come. Interchangeable.
- Substrate (
cortex-memory) stores, consolidates, synthesises, and serves. The stable long-term asset. - Analysers (
cortex-insight) turn events into typed findings — the behavioural pipeline over Claude Code sessions. Replaceable. A single repo can be both producer and analyser when the roles are inseparable. - Consumers read the graph to act — Claude Code
/devassembly, Lyra recall for chat context, the weekly behavioural digest. Autonomous.
At the boundary, producers speak to the substrate through a typed envelope, and the substrate emits Observation objects on NATS (roxabi.memory.observations.publish, roxabi.memory.query.*). That contract is the subject of the Observation Contract document.
The Four Layers of the Substrate
Inside cortex-memory, four successive layers turn raw flux into knowledge you can act on.
- Layer 1 — Raw Event Log. Append-only, immutable, source-tagged, sanitised. The fossil record; ground truth that can regenerate everything above it. Each
MemoryEventcarries a ULID, source, timestamp, type/subtype, actor, project, a correlation triple, and a payload. - Layer 2 — Knowledge Graph. Entities and relations, with temporal decay, deduplication (cosine + alias), conflict detection (Jaccard + polarity), and a
schema_fitscore that fast-tracks the familiar (>0.7) and quarantines dark matter (<0.3). A heuristic Retain Job routes each (source, subtype) to the handler that extracts its entities. - Layer 3 — Compiled Truth. A per-entity markdown synthesis, regenerated nightly, versioned through a
superseded_bychain, rewritten only when strength shifts past the regen threshold (~10%). The analogue of memory reconsolidation: every recall rewrites the trace. - Layer 4 — Actuation. The loop closes. The system proposes edits to the very artefacts it observes —
CLAUDE.md, skills, memory entries — behind a mandatory human gate; once approved, an automatic PR lands on the target repo.
Mapped onto Atkinson-Shiffrin (1968): L1 ≈ sensory memory, L2 ≈ long-term memory, L3 ≈ working/narrative memory, L4 ≈ modified behaviour.
Memory Strength: Decay, Retrieval, Emotion
A node's strength in the graph is continuous and dynamic, never binary. It is computed from a handful of terms, each mapped to a validated cognitive phenomenon.
strength(t) = base × decay × retrieval_boost × emotional_mult
decay = 0.5 ^ (Δt / effective_half_life)
effective_half_life = half_life × reward_factor
reward_factor = 1 + 0.5 × ((pos − neg) / (pos + neg + 1))
retrieval_boost = 1 + 0.1 × log₂(retrieval_count + 1)
emotional_mult = neutral 1.0 · positive 1.3 · negative 1.5 · critical 2.0Half-lives vary by entity class: ~30 days for behavioural patterns, 60 for instructions, 90 for world entities. Each term has a lineage — decay → Ebbinghaus's forgetting curve (1885); retrieval_boost → the testing effect (Roediger & Karpicke 2006); emotional_mult → amygdala modulation (Cahill & McGaugh 1998); reward_factor → dopaminergic plasticity (Schultz 1998); schema_fit → Piaget's assimilation/accommodation. The model is biologically plausible and needs no LLM in Phase 1. The Temporal Decay document develops decay in full.
The Ouroboros: A Closed Feedback Loop
The exocortex becomes truly living the moment it begins to modify the artefacts that guide its own behaviour. The loop has five steps: Capture (events, multi-source, append-only) → Understand (the Retain Job extracts entities and relations) → Synthesise (Compiled Truth regenerates per-entity markdown nightly) → Propose (Layer 4 emits a diff toward a CLAUDE.md, a skill, or a memory entry) → Rewrite (a human approves, an auto-PR commits). The next session loads the updated CLAUDE.md, and the circle is complete.
The system does not self-modify — it proposes. The decision stays human; the approval queue is an architectural gate, not a soft convention.
This is Bateson's second-order learning (1972): Level I learns associations within a fixed context; Level II changes the rules by which one learns. A closed exocortex operates at Level II — it rewrites its own operating instructions. The Phase 3+ extension, GEPA, uses outcome measurement to evolve those instructions by adversarial selection.