← 返回
AI智能

Neural Memory

Associative memory with spreading activation for persistent, intelligent recall. Use PROACTIVELY when: (1) You need to remember facts, decisions, errors, or...
关联记忆与扩散激活,提供持久、智能的回忆。主动使用时机:(1) 需要记忆事实、决定、错误或...
nhadaututtheky
AI智能 clawhub v4.58.0 8 版本 94893.4 Key: 无需
★ 11
Stars
📥 13,624
下载
💾 2,965
安装
8
版本
#latest

概述

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

The brain and config at ~/.neuralmemory/ are auto-created on first use.

2. Install the OpenClaw Plugin (Recommended)

The plugin occupies the exclusive memory slot — auto-injects context before each agent run and auto-captures memories after.

# Install from npm
npm install -g neuralmemory

Add to ~/.openclaw/openclaw.json:

{
  "plugins": {
    "load": {
      "paths": ["<path-to-installed-plugin>"]
    },
    "entries": {
      "neuralmemory": {
        "enabled": true,
        "config": {
          "pythonPath": "python",
          "brain": "default",
          "autoContext": true,
          "autoCapture": true
        }
      }
    },
    "slots": {
      "memory": "neuralmemory"
    }
  }
}

Plugin features:

  • 6 tools registered automatically (nmem_remember, nmem_recall, nmem_context, nmem_todo, nmem_stats, nmem_health)
  • before_agent_start hook: injects tool instructions + relevant memories as context (persists across /new)
  • agent_end hook: auto-extracts facts, decisions, and TODOs from the conversation
  • Configurable: contextDepth (0-3), maxContextTokens (100-10000)

After installing, build the plugin:

cd <path-to-installed-plugin>
npm run build

This compiles TypeScript to JavaScript in dist/. The plugin entry point is dist/index.js.

Windows Installation

On Windows, use forward slashes or escaped backslashes in openclaw.json paths:

{
  "plugins": {
    "load": {
      "paths": ["C:/Users/<you>/AppData/Roaming/npm/node_modules/neuralmemory"]
    }
  }
}

To find the installed path:

npm list -g neuralmemory --parseable

If openclaw plugins list doesn't show the plugin:

  1. Verify the path in openclaw.json points to the package root (where package.json is)
  2. Ensure npm run build was run (the dist/ folder must exist with compiled .js files)
  3. Use python instead of python3 in the plugin config (Windows default)

Alternative: MCP Configuration (Manual)

If you prefer MCP over the plugin, add to ~/.openclaw/mcp.json:

{
  "mcpServers": {
    "neural-memory": {
      "command": "python",
      "args": ["-m", "neural_memory.mcp"],
      "env": {
        "NEURALMEMORY_BRAIN": "default"
      }
    }
  }
}

On Windows, use "python" (not "python3"). This gives you all 63 MCP tools but without the auto-context/auto-capture hooks.

3. Verify

nmem stats

You should see brain statistics (neurons, synapses, fibers).

Troubleshooting

SymptomCauseFix
---------------------
openclaw plugins list doesn't show pluginPlugin path wrong or not builtRun npm run build, verify path in openclaw.json
Agent runs nmem remember in terminalAgent confused CLI vs toolPlugin now auto-injects tool instructions via systemPrompt
Agent forgets tools after /newNo tool instructions in new sessionPlugin now injects systemPrompt on every before_agent_start
python3 not found (Windows)Windows uses python not python3Set pythonPath: "python" in plugin config
Timeout errorsSlow machine or large brainIncrease timeout in plugin config (max 120000ms)

Tools Reference

Core Memory Tools

ToolPurposeWhen to Use
----------------------------
nmem_rememberStore a memoryAfter decisions, errors, facts, insights, user preferences
nmem_recallQuery memoriesBefore tasks, when user references past context, "do you remember..."
nmem_contextGet recent memoriesAt session start, inject fresh context
nmem_todoQuick TODO with 30-day expiryTask tracking

Intelligence Tools

ToolPurposeWhen to Use
----------------------------
nmem_autoAuto-extract memories from textAfter important conversations — captures decisions, errors, TODOs automatically
nmem_recall (depth=3)Deep associative recallComplex questions requiring cross-domain connections
nmem_habitsWorkflow pattern suggestionsWhen user repeats similar action sequences

Management Tools

ToolPurposeWhen to Use
----------------------------
nmem_healthBrain health diagnosticsPeriodic checkup, before sharing brain
nmem_statsBrain statisticsQuick overview of memory counts
nmem_versionBrain snapshots and rollbackBefore risky operations, version checkpoints
nmem_transplantTransfer memories between brainsCross-project knowledge sharing

Workflow

At Session Start

  1. Call nmem_context to inject recent memories into your awareness
  2. If user mentions a specific topic, call nmem_recall with that topic

During Conversation

  1. When a decision is made: nmem_remember with type="decision"
  2. When an error occurs: nmem_remember with type="error"
  3. When user states a preference: nmem_remember with type="preference"
  4. When asked about past events: nmem_recall with appropriate depth

At Session End

  1. Call nmem_auto with action="process" on important conversation segments
  2. 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

DepthNameSpeedUse Case
------------------------------
0Instant<10msQuick facts, recent context
1Context~50msStandard recall (default)
2Habit~200msPattern matching, workflow suggestions
3Deep~500msCross-domain associations, causal chains

Notes

  • Memories are stored locally in SQLite at ~/.neuralmemory/brains/.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

版本历史

共 8 个版本

  • v4.58.0 当前
    2026-05-20 04:15 安全 安全
  • v4.55.2
    2026-05-11 03:47 安全 安全
  • v4.55.1
    2026-05-09 03:07 安全 安全
  • v4.54.0
    2026-05-03 02:22 安全
  • v4.53.3
    2026-04-30 06:03 安全
  • v3.2.1
    2026-03-28 00:09 安全
  • v4.10.0
    2026-03-27 18:19
  • v1.0.0
    2026-03-11 10:51

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-intelligence

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,349 📥 317,677
ai-intelligence

self-improving agent

pskoett
捕获经验教训、错误和纠正,以实现持续改进。使用时机:(1)命令或操作意外失败;(2)用户纠正……
★ 4,055 📥 795,672
ai-intelligence

Proactive Agent

halthelobster
将AI智能体从任务执行者升级为主动预判需求、持续优化的智能伙伴。集成WAL协议、工作缓冲区、自主定时任务及实战验证模式。Hal Stack核心组件 🦞
★ 833 📥 212,746