Skip to content

Repository files navigation

version license python status stars llm-free activation lifecycle

🧠 NeuroWeave Cortex

A Hippocampal-Inspired Cognitive Memory Engine for AI Agents

Not a vector database. Not a graph database. Not RAG.
Not even an "LLM-powered memory system".
A self-organizing cognitive memory β€” memory is structured by use, not by prompt.
No memory is ever deleted. Only accessibility changes.
LLM reads memory. LLM does not decide what memory says.



✨ Core Design Principle

Memory structure is decided by the memory system, not by the LLM.

The LLM can read memory. The LLM can maintain memory (summarize, merge, archive).
But the LLM does not determine retrieval paths, edge weights, or relevance scores.

Brightness = f(historical access frequency, recency, edge strength)
NOT f(LLM-generated vector at query time)

This is the difference between a memory system that learns and one that re-computes every time.


πŸ”¬ What Makes It Different

Vector databases retrieve. Graph databases traverse. RAG systems query.
NeuroWeave Cortex learns from use:

Capability Vector DB Graph DB RAG NWC
Semantic retrieval βœ… ❌ βœ… βœ…
Graph traversal ❌ βœ… ❌ βœ…
Activation-based retrieval ❌ ❌ ❌ βœ…
Edge decay (no deletion) ❌ ❌ ❌ βœ…
Memory never deleted ❌ ❌ ❌ βœ…
Memory lifecycle (L1β†’L2β†’L3) ❌ ❌ ❌ βœ…
LLM-free retrieval routing βœ… βœ… ❌ βœ…
LLM for maintenance only ❌ ❌ ❌ βœ…
Sleep consolidation ❌ ❌ ❌ βœ…
Source attribution & trust ❌ ❌ ❌ βœ…

🧠 How Retrieval Actually Works

The Wrong Way (what most systems do):

Query β†’ LLM generates embedding β†’ LLM decides what's relevant β†’ Return

Problem: LLM is the router. Every retrieval is a new LLM computation. Nothing stabilizes.

The NWC Way (v1.4.0):

Query β†’ Embedding β†’ Find seed nodes β†’ Activation spread β†’ Return

The LLM never touches the retrieval path. Retrieval is driven by:

  1. Historical activation β€” how often has each memory been accessed?
  2. Edge strength β€” how strongly are memories connected (reinforced by co-use)?
  3. Temporal decay β€” edges weaken naturally over days of disuse (but NEVER to zero)
  4. Recency boost β€” recently accessed memories activate more readily

πŸ—οΈ Core Design Principle: No Memory Is Ever Deleted

Traditional memory systems:  Store β†’ Retrieve β†’ Delete (when full)
NWC memory system:          Create β†’ Activate β†’ Dim β†’ Dormant β†’ Reactivate ♾️

Memories do NOT have a "delete" state. They transition between activation levels:

  • 1.0 β€” currently active (just recalled)
  • 0.7 β€” frequent access
  • 0.3 β€” infrequent but known
  • 0.1 β€” dormant (not accessed in a long time)
  • 0.01 β€” deep dormant (years old)

Even a memory with activation_level = 0.01 is retrievable β€” if activation propagation from a connected query reaches it. This mimics human memory: you may not think about your elementary school classmates for decades, but a single photo can bring everything flooding back.


πŸ—οΈ Memory Layers (L0–L3)

NWC organizes memory into four cognitively-grounded layers:

L0: Input    ─── Ephemeral, per-session only (minutes)
    ↓ promote on repeated access (>3 times) or age (>30 days)
L1: Working  ─── Recent active memories (hours-days)
    β”‚               LLM maintains: add, merge, summarize
    β”‚               System routes: retrieval is LLM-free
    ↓ consolidate
L2: Long-term ─── Stable facts, experiences, relationships (months-years)
    β”‚               ONLY operations: strengthen, supplement, weaken
    β”‚               NEVER: full reconstruction
    ↓ archive on 90d no-access or low importance
L3: Dormant  ─── Low-activation memories retrievable via propagation (years)
    β”‚               NEVER deleted. Only activation_level approaches 0.
    ↑ reactivate on query similarity or activation propagation

This is not a flat table. Memories physically transition between layers based on access patterns β€” just like human memory.


πŸš€ Quick Start

pip install NWcortex
from star_graph import MemoryManager, AgentContext

mgr = MemoryManager()

# Remember
mgr.remember("User prefers type hints and concise code", tags=["preference"])
mgr.remember("Debugged Redis timeout β€” pool 10 β†’ 20", tags=["redis","debug"])

# Recall (LLM-free activation spreading)
ctx = AgentContext(task_type="debugging")
memories = mgr.recall("Redis connection pool config", context=ctx)

# Sleep: consolidate, migrate layers, decay weak edges
report = mgr.sleep()

# Persist
mgr.save("agent_memory.db")

⚑ LoCoMo-10 Benchmark

10 conversations Β· 5,882 turns Β· 1,986 QA pairs Β· Zero LLM calls

Method has_answer Ξ” vs Vector
Pure Vector Search 25.3% β€”
Cosine + BM25 31.5% +6.2 pp
NWC (BM40+txt60) 44.1% +18.8 pp

πŸ“¦ Installation

Command Includes
pip install NWcortex Core engine (138 modules)
pip install "NWcortex[embeddings]" + sentence-transformers
pip install "NWcortex[mcp]" + MCP Server
pip install "NWcortex[all]" Everything

πŸ§ͺ Running Tests

pip install pytest pytest-cov
pytest tests/ -v

βš–οΈ License

MIT


Report a bug Β· Discussion Β· Roadmap

About

Hippocampal-inspired star graph memory system with sleep consolidation. AI long-term memory via anchor points, spreading activation, and nightly replay/merge/prune/bridge cycles.

Resources

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages