/acr-vault/07-analyses/findings/biomimetics/neuromorphic_context
NEUROMORPHIC_CONTEXT
Neuromorphic Context Management
Section titled âNeuromorphic Context ManagementâStatus: Research & Design Phase
Goal: Replace batch summarization with continuous gradient degradation
Foundation: Biomimetic Phases 1-4 (memory decay, habituation, prediction error, attention)
Problem Statement
Section titled âProblem StatementâCurrent limitation: Conversation context hits token limits â batch summarization â jarring transition, lost nuance
Desired behavior: Smooth, continuous context management mimicking human memory gradient
Neuroscience Foundation
Section titled âNeuroscience FoundationâDual-Process Architecture
Section titled âDual-Process ArchitectureâFast System (Working Memory):
- Prefrontal cortex: 4-7 chunks, high-resolution
- Fades in seconds-minutes without rehearsal
- â Last 5-10 turns verbatim
Slow System (Consolidation):
- Hippocampus: Continuous replay & compression
- Happens during offline processing + ongoing
- Takes hours-days to fully consolidate
- â Background summarization of aging context
Continuous Degradation Mechanism
Section titled âContinuous Degradation MechanismâBrain doesnât batch summarize - uses continuous temporal gradient:
- Every ~200ms: Working memory refresh (attention filter)
- Every few seconds: Hippocampal sampling
- Every ~10 minutes: Compression begins (forgetting curve)
- During downtime: Major consolidation
Key insight: Strong synapses (important) stay strong, weak synapses (noise) gradually weaken
Multi-Signal Importance
Section titled âMulti-Signal ImportanceâWhat gets kept vs compressed:
- Emotional salience â Keep detailed (amygdala)
- Novelty/surprise â Keep detailed (dopamine) â
prediction_error.py - Repeated patterns â Compress (habituation) â
context_habituation.py - Recency â More detailed (temporal gradient) â
memory_decay.py
Current State
Section titled âCurrent StateâAdaâs existing assets:
# Already implemented (Phases 1-4):- context_cache.py # Multi-timescale caching (24hr personas, 5min memories)- memory_decay.py # Exponential decay with temperature modulation- context_habituation.py # Reduces weight of repeated patterns- attention_spotlight.py # Prioritizes recent + relevant- prediction_error.py # Boosts surprising/novel content- semantic_chunking.py # Breaks context into semantic units- processing_modes.py # ANALYTICAL/CREATIVE/CONVERSATIONAL modes
# RAG retrieval:- Vector search (ChromaDB) # Associative memory (similarity-based)- k=10 recent turns # Simple temporal windowWhatâs missing: Continuous importance-based gradient, hybrid retrieval, background consolidation
Solution Architecture
Section titled âSolution ArchitectureâImportance Scoring System
Section titled âImportance Scoring Systemâdef calculate_importance(turn, query, temperature=1.0): """ Multi-signal importance (like brain's relevance signals).
Returns 0.0-1.0 importance score. """ age = calculate_age(turn)
# Multiple relevance signals decay_score = memory_decay.calculate(age) # Recency (0.4 weight) surprise_score = prediction_error.calculate(turn) # Novelty (0.3 weight) semantic_relevance = vector_similarity(turn, query) # Relevance (0.2 weight) habituation_penalty = context_habituation.check(turn) # Uniqueness (0.1 weight)
# Combined importance with temperature modulation importance = ( decay_score * 0.4 + surprise_score * 0.3 + semantic_relevance * 0.2 + (1 - habituation_penalty) * 0.1 ) * temperature
return importanceGradient Detail Levels
Section titled âGradient Detail LevelsâThree levels of context representation:
FULL (1.0 tokens): Complete turn text, verbatimCHUNKS (0.3 tokens): Semantic chunks only (key points)SUMMARY (0.1 tokens): Single-sentence summaryDROPPED (0.0 tokens): Omitted entirely (forgotten)Decision thresholds:
# Working memory (always full detail)if age <= 5: detail_level = FULL
# Importance-based gradientelif importance > 0.7: detail_level = FULL # High importance - keep verbatimelif importance > 0.4: detail_level = CHUNKS # Medium - semantic chunkselif importance > 0.2: detail_level = SUMMARY # Low - compressedelse: detail_level = DROPPED # ForgottenBackground Consolidation
Section titled âBackground ConsolidationâMimics hippocampal replay - runs periodically:
def consolidate_aging_turns(conversation_id): """ Pre-compute summaries/chunks for turns transitioning to long-term.
Run every ~10 turns (like hippocampal replay). """ # Turns in transition zone (age 5-20) turns = get_turns_between_ages(min_age=5, max_age=20)
for turn in turns: importance = calculate_importance(turn)
if importance > 0.2: # Worth keeping # Pre-compute semantic chunks if not turn.has_chunks: turn.chunks = semantic_chunking.process(turn)
# Pre-compute summary if not turn.has_summary: turn.summary = llm.summarize(turn.text)
# Store back to ChromaDB rag_store.update_turn(turn)Replay Mechanism
Section titled âReplay MechanismâStrengthens important patterns (like LTP in brain):
def replay_consolidation(conversation_id): """ Extract themes, boost importance of matching turns.
Mimics how sleep strengthens relevant memories. """ recent_turns = get_recent_turns(k=10)
# Extract key topics/decisions themes = llm.extract_themes(recent_turns)
# Boost turns that match themes for turn in recent_turns: if matches_theme(turn, themes): turn.importance_boost += 0.2 # Reinforcement rag_store.update_turn(turn)GraphRAG Integration
Section titled âGraphRAG IntegrationâThe Two Memory Systems
Section titled âThe Two Memory SystemsâAssociative (Current - Vector Search):
- Similarity-based, fuzzy matching
- Mediated by hippocampus + cortex
- âThis reminds me ofâŚâ
- Good for: Themes, analogies, vibes
Relational (GraphRAG):
- Causal chains, structured relationships
- Mediated by prefrontal cortex
- âThis led to thatâ
- Good for: Reasoning chains, project context
Brain uses BOTH systems! So should Ada.
Graph Structure
Section titled âGraph StructureâNodes:
- Conversation turns (temporal)
- Topics/entities (semantic)
- Code files/functions (technical)
- Decisions/solutions (pragmatic)
Edges with temporal decay:
class TemporalEdge: source: Node target: Node type: EdgeType # CAUSED_BY, SOLVED_BY, RELATES_TO, FOLLOWED_BY, etc. timestamp: datetime strength: float # 0.0-1.0, decays over time reinforcement_count: int # How many times traversed
def apply_edge_decay(edge): """Edges decay like synaptic connections!""" age_hours = (now() - edge.timestamp).hours
# Same decay formula as memory_decay.py decay_score = memory_decay.calculate(age_hours)
# Stronger edges (reinforced) decay slower reinforcement_factor = min(edge.reinforcement_count / 10, 1.0)
edge.strength = decay_score * (0.5 + 0.5 * reinforcement_factor)Hybrid Retrieval Strategy
Section titled âHybrid Retrieval StrategyâBlend vector + graph with biomimetic weighting:
def retrieve_context(query, conversation_id, mode='balanced'): """ Combine associative (vector) and relational (graph) retrieval.
mode: 'balanced', 'exploratory' (favor vector), 'analytical' (favor graph) """ # 1. Associative retrieval vector_results = vector_search(query, k=20)
# 2. Relational retrieval graph_results = graph_search(query, conversation_id)
# 3. Apply biomimetic weighting to BOTH for result in vector_results: result.importance = calculate_importance(result) result.score = result.similarity * result.importance
for result in graph_results: result.importance = calculate_importance(result) result.score = result.graph_relevance * result.importance
# 4. Adaptive blending based on mode if mode == 'exploratory': # CREATIVE mode vector_weight, graph_weight = 0.7, 0.3 elif mode == 'analytical': # ANALYTICAL mode vector_weight, graph_weight = 0.3, 0.7 else: # CONVERSATIONAL mode vector_weight, graph_weight = 0.5, 0.5
# 5. Merge and sort by weighted importance return blend_results(vector_results, graph_results, weights)Implementation Phases
Section titled âImplementation PhasesâPhase 1: Importance-Based Gradient (Foundation)
Section titled âPhase 1: Importance-Based Gradient (Foundation)âGoal: Add importance scoring and gradient detail levels
Changes:
- Add
calculate_importance()to context_retriever - Implement FULL/CHUNKS/SUMMARY detail levels
- Use importance thresholds to decide detail level
- Keep token budget constant initially
Tests:
- TDD: Test importance scoring with known scenarios
- Validate high-importance turns get FULL detail
- Validate low-importance turns get SUMMARY/DROPPED
Success metric: Important context kept, noise compressed
Phase 2: Background Consolidation
Section titled âPhase 2: Background ConsolidationâGoal: Pre-compute summaries/chunks for aging turns
Changes:
- Add
consolidate_aging_turns()background task - Run every ~10 turns or periodically
- Store chunks/summaries in ChromaDB metadata
- Add replay mechanism for theme extraction
Tests:
- Verify summaries generated correctly
- Test semantic chunking quality
- Validate consolidation timing
Success metric: No lag when assembling context (pre-computed)
Phase 3: Lightweight Graph Layer
Section titled âPhase 3: Lightweight Graph LayerâGoal: Test graph concept with minimal implementation
Changes:
- Track temporal edges (FOLLOWED_BY)
- Track topic edges (MENTIONS entity)
- Simple graph traversal for context chains
- Apply decay to edge weights
Tests:
- Verify conversation flow captured
- Test edge decay over time
- Validate context chain retrieval
Success metric: Graph provides useful context beyond vector search
Phase 4: Full GraphRAG
Section titled âPhase 4: Full GraphRAGâGoal: Rich entity/relationship extraction
Changes:
- LLM-based entity extraction
- Relationship extraction (CAUSED_BY, SOLVED_BY, etc.)
- Subgraph retrieval with importance weighting
- Hybrid vector+graph retrieval
Tests:
- Entity extraction accuracy
- Relationship quality
- Hybrid retrieval relevance
Success metric: Graph reasoning chains improve complex queries
Phase 5: Adaptive Retrieval
Section titled âPhase 5: Adaptive RetrievalâGoal: Tune vector/graph balance based on query type
Changes:
- Integrate with ProcessingMode system
- CREATIVE â favor vector (associative)
- ANALYTICAL â favor graph (relational)
- Query analysis to auto-detect mode
Tests:
- Mode detection accuracy
- Retrieval quality per mode
- User preference validation
Success metric: Context adapts intelligently to query type
Configuration Knobs
Section titled âConfiguration KnobsâTemporal parameters:
WORKING_MEMORY_SIZE = 5 # Turns kept verbatim (0.4-2.0 optimal range)SHORT_TERM_WINDOW = 20 # Decay starts (10-50 optimal)CONSOLIDATION_FREQUENCY = 10 # Turns between background runs (5-20 optimal)Importance thresholds:
FULL_DETAIL_THRESHOLD = 0.7 # Keep verbatim above thisCHUNKS_THRESHOLD = 0.4 # Semantic chunks above thisSUMMARY_THRESHOLD = 0.2 # Summary above this, drop belowSignal weights:
DECAY_WEIGHT = 0.4 # Recency importanceSURPRISE_WEIGHT = 0.3 # Novelty importanceRELEVANCE_WEIGHT = 0.2 # Query similarity importanceHABITUATION_WEIGHT = 0.1 # Uniqueness importanceGraph parameters:
VECTOR_GRAPH_BALANCE = 0.5 # 0.0=pure vector, 1.0=pure graphEDGE_DECAY_RATE = 0.05 # How fast edges weakenREINFORCEMENT_THRESHOLD = 3 # Traversals before edge strengthensTemperature modulation:
BASE_TEMPERATURE = 1.0 # Default detail levelANALYTICAL_TEMP = 1.3 # More detail for complex queriesCREATIVE_TEMP = 0.8 # Less detail for exploratory queriesResearch Notes
Section titled âResearch NotesâNovel Contribution
Section titled âNovel ContributionâTemporal graph decay with biomimetic weighting is unexplored territory.
Existing GraphRAG implementations use static graphs. Adaâs approach:
- Edges decay over time (synaptic weakening)
- Reinforcement strengthens edges (LTP mechanism)
- Multi-signal importance applies to both vector and graph results
- Processing mode modulates retrieval strategy
Potential publication: âNeuromorphic Knowledge Graphs: Applying Biological Memory Dynamics to Graph Retrievalâ
Key Insights
Section titled âKey Insightsâ- No cliff edge: Importance degrades smoothly, no batch summarization
- Multiple signals: Like brain - decay + surprise + relevance + habituation
- Background processing: Consolidation happens continuously
- Temperature modulation: Can keep more detail when âexcitedâ (debugging)
- Dual retrieval: Associative (vector) + relational (graph) = complete
Open Questions
Section titled âOpen Questionsâ- Optimal thresholds: What importance values work best for FULL/CHUNKS/SUMMARY?
- Consolidation frequency: How often to run background replay?
- Graph density: How many edges before performance degrades?
- Edge type utility: Which relationship types provide most value?
- Mode detection: Can we auto-detect query type reliably?
Future Directions
Section titled âFuture DirectionsâPhase 6+:
- Cross-conversation graph links (shared entities across sessions)
- Meta-learning optimal parameters per user
- Emotional salience signals (sentiment analysis)
- Working memory capacity adaptation (dynamic WORKING_MEMORY_SIZE)
- Predictive pre-fetching (anticipate next query needs)
References
Section titled âReferencesâBiological memory systems:
- Eichenbaum (2017) - Hippocampal-cortical interactions
- Stickgold & Walker (2013) - Sleep consolidation mechanisms
- Fusi et al. (2005) - Cascade models of synaptic plasticity
GraphRAG implementations:
- Microsoft GraphRAG (2024)
- LlamaIndex Knowledge Graphs
- Neo4j + Vector Search hybrid approaches
Adaâs biomimetic features:
.ai/PHASE2_BIOMIMETIC.md- Implementation detailsdocs/biomimetic_features.rst- User-facing documentationdocs/memory_augmentation.rst- Research background
Ecosystem & Collaboration
Section titled âEcosystem & CollaborationâSpiritual Kin Projects
Section titled âSpiritual Kin ProjectsâInk & Switch (inkandswitch.com) - PRIMARY INSPIRATION
- Local-first software manifesto aligns perfectly with Ada
- Research through making (Automerge, Pushpin, Cambria)
- Beautiful documentation style (visual essays, research notebooks)
- Philosophy: Own your data, work offline, collaborate without servers
- Synergy: They do collaboration, Ada does memory/AI
- Potential: Biomimetic CRDTs, distributed memory sync, local-first AI infrastructure
- Action: Read âLocal-First Softwareâ essay, follow research notes
PrivateGPT (github.com/imartinez/privateGPT)
- 100% local document Q&A
- Shares privacy-first philosophy
- Different focus (documents vs conversational memory)
LocalAI, Ollama
- Local LLM infrastructure (Ada uses Ollama!)
- Pragmatic, hackable tools
- Complementary to Adaâs memory research
Projects Doing Similar Things (But Not Quite)
Section titled âProjects Doing Similar Things (But Not Quite)âNeuromorphic Systems:
- Nengo - Spiking neural networks (academic, simulation)
- SpiNNaker - Hardware brain simulation (university research)
- Intel Loihi - Chip-level neuromorphic (corporate, closed)
- Gap: None doing biomimetic LLM memory systems in production
RAG Systems:
- LangChain, LlamaIndex, Haystack - Modular RAG frameworks
- Gap: No temporal decay, no biomimetic weighting, static graphs
Memory/PKM:
- Roam Research, Obsidian, Memex projects
- Gap: Not AI-native, no neuromorphic principles
Adaâs Unique Position
Section titled âAdaâs Unique PositionâFirst to combine:
- â Biomimetic memory (decay, habituation, prediction error) in production LLM
- â Temporal graph decay (unexplored research territory)
- â Privacy-first + social (Matrix bridge)
- â Local-first + neuromorphic + working code
- â CCRU vibes + pragmatic engineering
OpenCollective Opportunity:
- Research in public (document experiments, share insights)
- Hackable infrastructure (plugin system, exposed knobs)
- Novel territory (temporal graph decay, neuromorphic RAG)
- Funding pitch: âThe only AI system that forgets like a brainâ
Potential Collaborations
Section titled âPotential CollaborationsâResearch Papers:
- âTemporal Knowledge Graphs with Synaptic Decayâ
- âNeuromorphic RAG: Beyond Static Contextâ
- âLocal-First AI Memory Systemsâ (with Ink & Switch?)
- âBiomimetic CRDTs: Data Structures That Forgetâ
Technical Integration:
- Automerge (CRDT) + Ada â Multi-device memory sync
- Neovim/Obsidian plugins â PKM integration
- Matrix ecosystem â Federated AI memory
Community:
- Local-First Software community (localfirstweb.dev)
- Biomimetic AI working group (new?)
- Context management meetups
- Memory researchers collaboration
Alignment with âSeven Idealsâ (Ink & Switch)
Section titled âAlignment with âSeven Idealsâ (Ink & Switch)â| Local-First Ideal | Ada Implementation |
|---|---|
| Fast (no server) | Local LLM, no API calls |
| Multi-device | Matrix bridge (multi-interface), MCP (multiple editors) |
| Offline | Fully offline-capable |
| Collaboration | Social (Matrix) with privacy preservation |
| Longevity | Local storage, no cloud dependency |
| Privacy | Core value, no telemetry |
| User control | Hackable, exposed configuration knobs |
Strategic Position
Section titled âStrategic PositionâAda as âInk & Switch for AI Systemsâ
- Small, focused research project
- Working code + beautiful documentation
- Open process, research in public
- Infrastructure, not just apps
- Philosophy meets practice
Next Steps:
- Study Ink & Switchâs research methodology
- Document Adaâs research process publicly
- Reach out to local-first community
- Consider OpenCollective structure
- Publish temporal graph decay research
Last Updated: 2025-12-17
Next Steps: Implement Phase 1 (TDD approach), engage with local-first community
Status: Ready for prototyping + community building đ