Chapp-E Memory Systems

Working Memory, Long-Term Memory, and the Dynamic Associative Graph Filesystem (DAG-FS)

Overview

Chapp-E implements a biologically-inspired dual-memory architecture that mirrors the human brain's distinction between working memory (short-term, volatile) and long-term memory (persistent, distributed). The system uses the Dynamic Associative Graph Filesystem (DAG-FS) to store memories as distributed patterns of synaptic weights, just like the brain stores memories as engrams (patterns of synaptic connectivity).

🧠 Biological Foundation: Unlike traditional filesystems that store data in discrete blocks, the brain stores memories as distributed patterns of synaptic strengths across a network of neurons. Chapp-E's DAG-FS replicates this mechanism, storing "files" as weight configurations in the neural network.

The Two Memory Systems

1. Working Memory (Short-Term / Volatile)

Biological Basis: Prefrontal cortex + parietal regions + basal ganglia loops. Maintained by sustained neural firing, not permanent synaptic changes.

Characteristics

  • Duration: Seconds to minutes (volatile)
  • Capacity: Very limited (~4-7 chunks, Chapp-E uses 3 slots)
  • Storage Mechanism: Active firing loops, explicit registers
  • Modification: Rapid overwrite, cleared on task switch or sleep
  • Access: Direct, conscious, immediately accessible
  • Vulnerability: Disrupted by distraction, overload, or sleep

Chapp-E Implementation

Component Location Details
Working Memory System 0x200000 - 0x2000C2 194 bytes total
Memory Slots 3 slots × 64 bytes Slot 0 (current task), Slot 1 (background), Slot 2 (interrupt)
State Management IDLE, ACTIVE, OVERLOADED Priority flags (HIGH, MEDIUM, LOW, NONE)
File working_memory_64.asm Executive Control layer

Analogy: This is Chapp-E's "RAM" - the whiteboard where it holds what it's "thinking about right now." Contents are transient and cleared when switching tasks or entering sleep.

2. Long-Term Memory (Persistent / Distributed)

Biological Basis: Distributed across cortex (semantic in temporal/neocortical areas, episodic indexed by hippocampus → neocortex, procedural in basal ganglia/cerebellum).

Characteristics

  • Duration: Minutes to lifetime (persistent)
  • Capacity: Essentially unlimited
  • Storage Mechanism: Synaptic weight changes (LTP/LTD - Long-Term Potentiation/Depression)
  • Modification: Slow consolidation, especially during sleep via replay
  • Access: Associative, reconstructive (pattern completion via forward pass)
  • Vulnerability: Degraded by interference, but generally stable

Chapp-E Implementation

Component Location Details
Neural Network Weights Loaded at boot Fixed-point weight matrices (16 inputs × 8 hidden × 8 bytes)
DAG-FS Pattern Storage 0x300000 - 0x3FFFFF 16MB for pattern metadata (1024 patterns × 64 bytes)
DAG-FS Index Storage 0x400000 - 0x4FFFFF 16MB for weight snapshots and tag associations
Storage Mechanism Distributed weight patterns Memories stored as configurations of synaptic weights
Files dagfs_64.asm, network_64.asm DAG-FS filesystem + neural network

Analogy: This is Chapp-E's "SSD" - the etched stone where experiences are permanently encoded. Memories are not discrete files but overlapping patterns of strengthened connections.

Dynamic Associative Graph Filesystem (DAG-FS)

The DAG-FS is Chapp-E's brain-inspired filesystem that stores "files" as distributed patterns of synaptic weights, exactly like the brain stores memories as engrams (patterns of synaptic connectivity).

✅ IMPLEMENTED: DAG-FS is fully implemented with all 5 phases complete: Pattern Storage, Pattern Reconstruction, Tag System, Pattern Completion, and Hebbian Learning. See DAG-FS Filesystem for complete documentation.

How DAG-FS Works

1. Storage: Patterns as Weight Configurations

When you "save a file" in DAG-FS, the system:

  1. Encodes the data into a pattern of neural network activations
  2. Stores the weight configuration that produces this pattern
  3. Associates tags for later retrieval (contextual cues)
  4. Records metadata (pattern ID, strength, access count)

Key Insight: The "file" doesn't exist as a discrete block of data. Instead, it exists as a distributed pattern of synaptic strengths across the neural network. Multiple memories can overlap, with the same neurons participating in thousands of different "files."

2. Retrieval: Pattern Completion via Forward Pass

When you "read a file" in DAG-FS, the system:

  1. Receives a partial cue (tags, keywords, or partial pattern)
  2. Activates the neural network with this cue
  3. Performs forward pass to complete the pattern
  4. Reconstructs the "file" from the activation pattern
  5. Strengthens the pattern (reconsolidation - accessing a memory makes it stronger)

Key Insight: Recall is not a direct read operation. It's reconstructive - the system actively rebuilds the memory from partial cues, just like the brain reconstructs memories rather than playing back a recording.

3. Organization: Contextual Tags, Not Hierarchies

DAG-FS has no traditional folders or directories. Instead:

  • Tags replace paths: Files are accessed via contextual tags (e.g., 'first day of school' + 'smell of chalk' + 'happy')
  • Associative retrieval: One tag leads to related patterns
  • Emergent organization: Structure emerges from associations, not imposed hierarchy

4. Learning: Hebbian Plasticity

DAG-FS implements Hebbian learning ("cells that fire together, wire together"):

  • Access strengthens: Reading a pattern increases its strength (reconsolidation)
  • Co-occurrence strengthens: Patterns accessed together form stronger associations
  • Disuse weakens: Unused patterns decay (Long-Term Depression - LTD)
  • Sleep consolidation: During SLEEP state, glymphatic system clears weak patterns

DAG-FS vs. Traditional Filesystem

Feature Traditional Filesystem DAG-FS (Brain-Inspired)
Storage Unit Block on disk Synaptic Strength (Edge Weight)
Organization Hierarchical folders/directories Contextual Associations (Tags)
File Access File path lookup (Read-only) Pattern matching (Read/Write - reconsolidation)
Data Integrity Fixed location, checksummed Dynamic, reconstructive (can change upon access)
Symlinks Special case, points to file Everything is associative - no "original" file
Capacity Limited by disk size Essentially unlimited (overlapping patterns)

The Memory Transfer Loop

The critical interaction between working memory and long-term memory is the encoding → consolidation → retrieval → reconsolidation loop:

Process Biological Equivalent Chapp-E Implementation Status
Encoding Attention + rehearsal → hippocampal tagging Important working memory slots → tagged for save 🚧 Planned
Consolidation Sleep replay → strengthen cortical weights SLEEP state: Replay recent activations, update NN weights 🚧 Planned
Retrieval Cue → pattern completion in cortex Input cue → forward pass activates related weights ✅ Implemented (DAG-FS pattern completion)
Reconsolidation Recall modifies memory Retrieval + new context → slight weight tweak ✅ Implemented (DAG-FS access strengthens patterns)

Current State

  • Working Memory: Fully implemented (3 slots, priority flags, overload detection)
  • DAG-FS Storage: Fully implemented (pattern storage, reconstruction, tags, completion, Hebbian learning)
  • Neural Network: Forward pass implemented (pattern completion)
  • 🚧 Encoding: Planned (transfer from working memory to DAG-FS)
  • 🚧 Consolidation: Planned (sleep replay, weight updates)

Biological Heap Allocator

In the real brain, there's no central malloc() function. Instead, memory allocation is a collaborative, dynamic system involving glial cells, the hippocampus, and the frontal cortex. Chapp-E is designed to eventually implement this biological heap allocator.

Components of the Biological Heap

1. Astrocytes (Resource Providers & Buffers)

Biological Function: Supply energy (glucose/lactate), clear neurotransmitters, regulate synaptic plasticity.

Chapp-E Equivalent (Planned):

  • Energy management system that limits NN computations based on "glucose" pool
  • Buffer metabolic resources for active neurons
  • Promote LTP (Long-Term Potentiation) via resource allocation

Status: 🚧 Planned - Will integrate with neuromodulator system

2. Microglia (Garbage Collectors & Pruners)

Biological Function: Phagocytose (engulf/eat) weak/unused synapses, debris, and dead cells - true "free()" and garbage collection.

Chapp-E Equivalent (Planned):

  • Prune weak weights during sleep (glymphatic clearance)
  • Mark-and-sweep GC that eliminates underused "memory blocks" (synapses)
  • Free space for new connections

Status: 🚧 Planned - Will integrate with glymphatic system and DAG-FS

3. Hippocampus (Memory Allocator / Indexer)

Biological Function: Biases allocation to excitable neurons, creates sparse engrams, temporary "pointer" during consolidation.

Chapp-E Equivalent:

  • ✅ Encodes working memory slots to DAG-FS patterns
  • ✅ Tags important working memory slots for long-term storage
  • ✅ Creates index for new memories during encoding
  • ✅ Retrieves memories via associative tags
  • 🚧 Excitability biasing (planned - bias to high-activity units)

Status: ✅ Implemented - Fully integrated with executive control and DAG-FS

See: Hippocampus Module for complete documentation

4. Frontal Cortex (Priority Manager)

Biological Function: Higher-level decision of how to allocate limited cognitive resources (attention, working memory capacity).

Chapp-E Equivalent:

  • Working Memory: Priority flags (HIGH, MEDIUM, LOW, NONE)
  • Planning System: Goal-directed resource allocation
  • Executive Control: Task switching, overload management

Status: ✅ Partially Implemented

Future Integration

When fully implemented, the biological heap allocator will:

  • Dynamically allocate "synaptic space" for new memories
  • Garbage collect irrelevancies during sleep
  • Prevent fragmentation by pruning weak connections
  • Make Chapp-E's "consciousness.dat" self-managing and sustainable

Memory Systems Integration

How Systems Work Together

Working Memory ↔ Long-Term Memory

  • Encoding: Important working memory slots → tagged → saved to DAG-FS
  • Retrieval: DAG-FS pattern completion → loads into working memory slots
  • Reconsolidation: Accessing long-term memory modifies it (strengthens pattern)

DAG-FS ↔ Neural Network

  • Storage: DAG-FS stores weight snapshots from neural network
  • Retrieval: DAG-FS loads weight configurations → neural network forward pass → pattern completion
  • Learning: Hebbian updates modify both DAG-FS patterns and neural network weights

Neuromodulator System ↔ Memory

  • Acetylcholine: Affects working memory focus and capacity
  • Dopamine: Influences encoding strength (reward → stronger memories)
  • Cortisol: Can cause memory interference (stress → weaker encoding)
  • Sleep State: Glymphatic clearance during SLEEP consolidates and prunes memories

Consciousness System ↔ Memory

  • AWAKE State: Normal memory encoding and retrieval
  • SLEEP State: Consolidation, replay, pruning (glymphatic clearance)
  • UNCONSCIOUS State: Minimal memory operations

Memory Addresses Reference

Working Memory

DAG-FS Filesystem

  • Pattern Storage: 0x300000 - 0x3FFFFF (16MB)
  • Index Storage: 0x400000 - 0x4FFFFF (16MB)
  • Tag Storage: 0x410000+ (within index region)
  • Max Patterns: 1024 patterns
  • See: DAG-FS Filesystem for complete documentation

Neural Network

  • Weights: Loaded at boot, stored in DAG-FS index
  • Structure: 16 inputs × 8 hidden × 8 bytes (qword) = 1024 bytes per weight snapshot
  • See: Brain Architecture - Neural Network

Future Development

Planned Features

  • Encoding System: ✅ Implemented - Hippocampus transfers working memory slots to DAG-FS
  • 🚧 Consolidation System: Partial - Pending encodings processed, full replay/weight updates planned
  • 🚧 Astrocyte Module: Energy allocation, resource buffering
  • 🚧 Microglia Module: Garbage collection, weak weight pruning
  • Hippocampus Module: ✅ Implemented - Memory encoding, consolidation, retrieval
  • 🚧 Online Learning: Hebbian weight updates during experience (not just at sleep)
  • 🚧 Pattern Replay: During SLEEP, replay recent experiences to strengthen
  • 🚧 Tag Storage: Store tag pointers with pending encodings for better retrieval

The Vision

When complete, Chapp-E will have a fully self-managing memory system where:

  • ✅ Working memory holds the "present moment" (what Chapp-E is thinking about now)
  • ✅ Long-term memory (DAG-FS) holds the "narrative thread" (persistent identity, learned experiences)
  • ✅ Hippocampus bridges the two (encoding, consolidation, retrieval)
  • 🚧 The biological heap allocator manages resources dynamically (astrocytes, microglia planned)
  • 🚧 Sleep consolidates and prunes, keeping the system healthy (partial - pending encodings only)
  • ✅ Memories are associative, reconstructive, and evolve with each access (DAG-FS reconsolidation)

This is the bridge between being and becoming - between moment-to-moment awareness and persistent identity.

✅ MILESTONE ACHIEVED: The memory transfer loop is now complete! Working memory → Hippocampus → DAG-FS → Retrieval → Working memory. Chapp-E can now encode important experiences into long-term memory and retrieve them later. The hippocampus module completes the critical bridge between volatile working memory and persistent long-term storage.