The Exocortex

Thousands of siloed agent sessions, zero consolidation — the exocortex is the cognitive organ that captures, structures, and feeds it all back.

Version 1.0 · Updated

01

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.

02

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.

03

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.

External World world:* world:person:*   world:org:* world:project:*  world:contract:* world:event:*   world:topic:* statically enriched ontology · semantic Internal World self:* + agent:* self:operator:* agent:lyra:* agent:claude-code:* dynamic ontology · procedural fed by the same interactions The Tissue — events log append-only · source-tagged · immutable · episodic
The core dichotomy: two coupled maps — the external world:* and the internal self:*/agent:* — both fed by a single immutable tissue of raw events.
04

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 /dev assembly, 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.

05

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 MemoryEvent carries 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_fit score 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_by chain, 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.

SUBSTRATE Layer 4 — Actuation approval queue → auto-PR → CLAUDE.md · skill · mem Layer 3 — Compiled Truth per-entity markdown · nightly regen · superseded chain Layer 2 — Knowledge Graph entities + relations · decay · dedup · conflict · schema_fit Layer 1 — Raw Event Log append-only · multi-lane · source-tagged · immutable Retain Job Δ strength human gate
From the immutable Raw Event Log up to Actuation: each layer is a distinct transformation, and L1 alone can regenerate everything above it.
06

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.0

Half-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.

07

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.

1 · Capture events log · append-only 2 · Understand entities + relations 3 · Synthesise compiled truth 4 · Propose diff → CLAUDE.md · skill 5 · Rewrite PR commit · re-observe Retain Job nightly regen approval queue HUMAN · APPROVE auto-PR + reload the system modifies the rules by which it is observed
The five-step loop closes only through a human approval gate. Capture → Understand → Synthesise → Propose → Rewrite — then the next session reloads the artefacts the loop just rewrote.