NeuralMemory — Associative Memory for AI Agents
A biologically-inspired memory system that uses spreading activation instead of keyword/vector search. Memories form a neural graph where neurons connect via 20 typed synapses. Frequently co-accessed memories strengthen their connections (Hebbian learning). Stale memories decay naturally. Contradictions are auto-detected.
Why not just vector search? Vector search finds documents similar to your query. NeuralMemory finds conceptually related memories through graph traversal — even when there's no keyword or embedding overlap. "What decision did we make about auth?" activates time + entity + concept neurons simultaneously and finds the intersection.
Setup
1. Install NeuralMemory
pip install neural-memory
nmem init
This creates ~/.neuralmemory/ with a default brain and configures MCP automatically.
2. Configure MCP for OpenClaw
Add to your OpenClaw MCP configuration (~/.openclaw/mcp.json or project openclaw.json):
{
"mcpServers": {
"neural-memory": {
"command": "python3",
"args": ["-m", "neural_memory.mcp"],
"env": {
"NEURALMEMORY_BRAIN": "default"
}
}
}
}
3. Verify
nmem stats
You should see brain statistics (neurons, synapses, fibers).
Tools Reference
Core Memory Tools
| Tool |
Purpose |
When to Use |
nmem_remember |
Store a memory |
After decisions, errors, facts, insights, user preferences |
nmem_recall |
Query memories |
Before tasks, when user references past context, "do you remember..." |
nmem_context |
Get recent memories |
At session start, inject fresh context |
nmem_todo |
Quick TODO with 30-day expiry |
Task tracking |
Intelligence Tools
| Tool |
Purpose |
When to Use |
nmem_auto |
Auto-extract memories from text |
After important conversations — captures decisions, errors, TODOs automatically |
nmem_recall (depth=3) |
Deep associative recall |
Complex questions requiring cross-domain connections |
nmem_habits |
Workflow pattern suggestions |
When user repeats similar action sequences |
Management Tools
| Tool |
Purpose |
When to Use |
nmem_health |
Brain health diagnostics |
Periodic checkup, before sharing brain |
nmem_stats |
Brain statistics |
Quick overview of memory counts |
nmem_version |
Brain snapshots and rollback |
Before risky operations, version checkpoints |
nmem_transplant |
Transfer memories between brains |
Cross-project knowledge sharing |
Workflow
At Session Start
- Call
nmem_context to inject recent memories into your awareness
- If user mentions a specific topic, call
nmem_recall with that topic
During Conversation
- When a decision is made:
nmem_remember with type="decision"
- When an error occurs:
nmem_remember with type="error"
- When user states a preference:
nmem_remember with type="preference"
- When asked about past events:
nmem_recall with appropriate depth
At Session End
- Call
nmem_auto with action="process" on important conversation segments
- This auto-extracts facts, decisions, errors, and TODOs
Examples
Remember a decision
nmem_remember(
content="Use PostgreSQL for production, SQLite for development",
type="decision",
tags=["database", "infrastructure"],
priority=8
)
Recall with spreading activation
nmem_recall(
query="database configuration for production",
depth=1,
max_tokens=500
)
Returns memories found via graph traversal, not keyword matching. Related memories (e.g., "deploy uses Docker with pg_dump backups") surface even without shared keywords.
Trace causal chains
nmem_recall(
query="why did the deployment fail last week?",
depth=2
)
Follows CAUSED_BY and LEADS_TO synapses to trace cause-and-effect chains.
Auto-capture from conversation
nmem_auto(
action="process",
text="We decided to switch from REST to GraphQL because the frontend needs flexible queries. The migration will take 2 sprints. TODO: update API docs."
)
Automatically extracts: 1 decision, 1 fact, 1 TODO.
Key Features
- Zero LLM dependency — Pure algorithmic: regex, graph traversal, Hebbian learning
- Spreading activation — Associative recall through neural graph, not keyword/vector search
- 20 synapse types — Temporal (BEFORE/AFTER), causal (CAUSED_BY/LEADS_TO), semantic (IS_A/HAS_PROPERTY), emotional (FELT/EVOKES), conflict (CONTRADICTS)
- Memory lifecycle — Short-term → Working → Episodic → Semantic with Ebbinghaus decay
- Contradiction detection — Auto-detects conflicting memories, deprioritizes outdated ones
- Hebbian learning — "Neurons that fire together wire together" — memory improves with use
- Temporal reasoning — Causal chain traversal, event sequences, temporal range queries
- Brain versioning — Snapshot, rollback, diff brain state
- Brain transplant — Transfer filtered knowledge between brains
- Vietnamese + English — Full bilingual support for extraction and sentiment
Depth Levels
| Depth |
Name |
Speed |
Use Case |
| 0 |
Instant |
<10ms |
Quick facts, recent context |
| 1 |
Context |
~50ms |
Standard recall (default) |
| 2 |
Habit |
~200ms |
Pattern matching, workflow suggestions |
| 3 |
Deep |
~500ms |
Cross-domain associations, causal chains |
Notes
- Memories are stored locally in SQLite at
~/.neuralmemory/brains/<brain>.db
- No data is sent to external services (unless optional embedding provider is configured)
- Brain isolation: each brain is independent, no cross-contamination
nmem_remember returns fiber_id for reference tracking
- Priority scale: 0 (trivial) to 10 (critical), default 5
- Memory types: fact, decision, preference, todo, insight, context, instruction, error, workflow, reference
1---
2name: neural-memory
3description: |
4 Associative memory with spreading activation for persistent, intelligent recall.
5 Use PROACTIVELY when:
6 (1) You need to remember facts, decisions, errors, or context across sessions
7 (2) User asks "do you remember..." or references past conversations
8 (3) Starting a new task — inject relevant context from memory
9 (4) After making decisions or encountering errors — store for future reference
10 (5) User asks "why did X happen?" — trace causal chains through memory
11 Zero LLM dependency. Neural graph with Hebbian learning, memory decay, contradiction detection, and temporal reasoning.
12homepage: https://github.com/nhadaututtheky/neural-memory
13metadata:
14 source: https://skillmd.com/skills/modbender/neural-memory
15 openclaw:
16 emoji: brain
17 primaryEnv: NEURALMEMORY_BRAIN
18 requires:
19 bins:
20 - python3
21 env:
22 - NEURALMEMORY_BRAIN
23 os:
24 - darwin
25 - linux
26 - win32
27 install:
28 - id: pip
29 kind: node
30 package: neural-memory
31 bins:
32 - nmem
33 label: pip install neural-memory
34---
35
36# NeuralMemory — Associative Memory for AI Agents
37
38A biologically-inspired memory system that uses spreading activation instead of keyword/vector search. Memories form a neural graph where neurons connect via 20 typed synapses. Frequently co-accessed memories strengthen their connections (Hebbian learning). Stale memories decay naturally. Contradictions are auto-detected.
39
40**Why not just vector search?** Vector search finds documents similar to your query. NeuralMemory finds *conceptually related* memories through graph traversal — even when there's no keyword or embedding overlap. "What decision did we make about auth?" activates time + entity + concept neurons simultaneously and finds the intersection.
41
42## Setup
43
44### 1. Install NeuralMemory
45
46```bash
47pip install neural-memory
48nmem init
49```
50
51This creates `~/.neuralmemory/` with a default brain and configures MCP automatically.
52
53### 2. Configure MCP for OpenClaw
54
55Add to your OpenClaw MCP configuration (`~/.openclaw/mcp.json` or project `openclaw.json`):
56
57```json
58{
59 "mcpServers": {
60 "neural-memory": {
61 "command": "python3",
62 "args": ["-m", "neural_memory.mcp"],
63 "env": {
64 "NEURALMEMORY_BRAIN": "default"
65 }
66 }
67 }
68}
69```
70
71### 3. Verify
72
73```bash
74nmem stats
75```
76
77You should see brain statistics (neurons, synapses, fibers).
78
79## Tools Reference
80
81### Core Memory Tools
82
83| Tool | Purpose | When to Use |
84|------|---------|-------------|
85| `nmem_remember` | Store a memory | After decisions, errors, facts, insights, user preferences |
86| `nmem_recall` | Query memories | Before tasks, when user references past context, "do you remember..." |
87| `nmem_context` | Get recent memories | At session start, inject fresh context |
88| `nmem_todo` | Quick TODO with 30-day expiry | Task tracking |
89
90### Intelligence Tools
91
92| Tool | Purpose | When to Use |
93|------|---------|-------------|
94| `nmem_auto` | Auto-extract memories from text | After important conversations — captures decisions, errors, TODOs automatically |
95| `nmem_recall` (depth=3) | Deep associative recall | Complex questions requiring cross-domain connections |
96| `nmem_habits` | Workflow pattern suggestions | When user repeats similar action sequences |
97
98### Management Tools
99
100| Tool | Purpose | When to Use |
101|------|---------|-------------|
102| `nmem_health` | Brain health diagnostics | Periodic checkup, before sharing brain |
103| `nmem_stats` | Brain statistics | Quick overview of memory counts |
104| `nmem_version` | Brain snapshots and rollback | Before risky operations, version checkpoints |
105| `nmem_transplant` | Transfer memories between brains | Cross-project knowledge sharing |
106
107## Workflow
108
109### At Session Start
1101. Call `nmem_context` to inject recent memories into your awareness
1112. If user mentions a specific topic, call `nmem_recall` with that topic
112
113### During Conversation
1143. When a decision is made: `nmem_remember` with type="decision"
1154. When an error occurs: `nmem_remember` with type="error"
1165. When user states a preference: `nmem_remember` with type="preference"
1176. When asked about past events: `nmem_recall` with appropriate depth
118
119### At Session End
1207. Call `nmem_auto` with action="process" on important conversation segments
1218. This auto-extracts facts, decisions, errors, and TODOs
122
123## Examples
124
125### Remember a decision
126```
127nmem_remember(
128 content="Use PostgreSQL for production, SQLite for development",
129 type="decision",
130 tags=["database", "infrastructure"],
131 priority=8
132)
133```
134
135### Recall with spreading activation
136```
137nmem_recall(
138 query="database configuration for production",
139 depth=1,
140 max_tokens=500
141)
142```
143Returns memories found via graph traversal, not keyword matching. Related memories (e.g., "deploy uses Docker with pg_dump backups") surface even without shared keywords.
144
145### Trace causal chains
146```
147nmem_recall(
148 query="why did the deployment fail last week?",
149 depth=2
150)
151```
152Follows CAUSED_BY and LEADS_TO synapses to trace cause-and-effect chains.
153
154### Auto-capture from conversation
155```
156nmem_auto(
157 action="process",
158 text="We decided to switch from REST to GraphQL because the frontend needs flexible queries. The migration will take 2 sprints. TODO: update API docs."
159)
160```
161Automatically extracts: 1 decision, 1 fact, 1 TODO.
162
163## Key Features
164
165- **Zero LLM dependency** — Pure algorithmic: regex, graph traversal, Hebbian learning
166- **Spreading activation** — Associative recall through neural graph, not keyword/vector search
167- **20 synapse types** — Temporal (BEFORE/AFTER), causal (CAUSED_BY/LEADS_TO), semantic (IS_A/HAS_PROPERTY), emotional (FELT/EVOKES), conflict (CONTRADICTS)
168- **Memory lifecycle** — Short-term → Working → Episodic → Semantic with Ebbinghaus decay
169- **Contradiction detection** — Auto-detects conflicting memories, deprioritizes outdated ones
170- **Hebbian learning** — "Neurons that fire together wire together" — memory improves with use
171- **Temporal reasoning** — Causal chain traversal, event sequences, temporal range queries
172- **Brain versioning** — Snapshot, rollback, diff brain state
173- **Brain transplant** — Transfer filtered knowledge between brains
174- **Vietnamese + English** — Full bilingual support for extraction and sentiment
175
176## Depth Levels
177
178| Depth | Name | Speed | Use Case |
179|-------|------|-------|----------|
180| 0 | Instant | <10ms | Quick facts, recent context |
181| 1 | Context | ~50ms | Standard recall (default) |
182| 2 | Habit | ~200ms | Pattern matching, workflow suggestions |
183| 3 | Deep | ~500ms | Cross-domain associations, causal chains |
184
185## Notes
186
187- Memories are stored locally in SQLite at `~/.neuralmemory/brains/<brain>.db`
188- No data is sent to external services (unless optional embedding provider is configured)
189- Brain isolation: each brain is independent, no cross-contamination
190- `nmem_remember` returns fiber_id for reference tracking
191- Priority scale: 0 (trivial) to 10 (critical), default 5
192- Memory types: fact, decision, preference, todo, insight, context, instruction, error, workflow, reference