非线性内存OS 是 AI Skill Hub 本期精选MCP工具之一。综合评分 7.5 分,整体质量较高。我们推荐使用将其纳入你的 AI 工具库,帮助提升工作效率。
非线性内存OS 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
非线性内存OS 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/pbmagnet4/nlm-memory
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"-----os": {
"command": "npx",
"args": ["-y", "nlm-memory"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 非线性内存OS 执行以下任务... Claude: [自动调用 非线性内存OS MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"_____os": {
"command": "npx",
"args": ["-y", "nlm-memory"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
<p align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="assets/banner-dark.svg" /> <source media="(prefers-color-scheme: light)" srcset="assets/banner-light.svg" /> <img alt="nlm-memory — Local-first non-linear memory OS" src="assets/banner-light.svg" width="720" /> </picture> </p>
<p align="center"> <a href="https://www.npmjs.com/package/nlm-memory"><img src="https://img.shields.io/npm/v/nlm-memory?color=CB3837&label=npm&logo=npm" alt="npm version" /></a> <a href="https://github.com/pbmagnet4/nlm-memory/actions/workflows/ci.yml"><img src="https://github.com/pbmagnet4/nlm-memory/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI status" /></a> <a href="https://github.com/pbmagnet4/nlm-memory/blob/main/LICENSE"><img src="https://img.shields.io/github/license/pbmagnet4/nlm-memory?color=blue" alt="License: Apache 2.0" /></a> <a href="https://nodejs.org"><img src="https://img.shields.io/node/v/nlm-memory?color=brightgreen" alt="Node 20+" /></a> <img src="https://img.shields.io/badge/tests-726%20passing-success" alt="726 tests passing" /> <img src="https://img.shields.io/badge/MCP-9%20runtimes-8A2BE2" alt="MCP across 9 runtimes" /> <img src="https://img.shields.io/badge/hooks-3%20runtimes-7B2CBF" alt="Hooks on 3 runtimes" /> <img src="https://img.shields.io/badge/telemetry-none-informational" alt="Zero telemetry" /> </p>
<p align="center"> <a href="#install">Install</a> · <a href="#quick-start">Quick Start</a> · <a href="#runtimes">Runtimes</a> · <a href="#how-recall-works">How recall works</a> · <a href="#agent-self-improvement-signals">Signals</a> · <a href="#mcp-tools">MCP</a> · <a href="#rest-api">REST API</a> · <a href="#daily-digest">Digest</a> · <a href="#configuration">Config</a> · <a href="#security">Security</a> · <a href="#vs-alternatives">vs Alternatives</a> </p>
---
nlm-memory is a local-first memory layer for AI coding agents. It indexes every session from Claude Code, Codex, OpenCode, Cursor, Windsurf, Hermes, Aider, and pi into a single searchable store on your machine. Three properties no other memory layer ships together:
Everything stays on your machine by default. No telemetry, no account. The classifier defaults to local (Ollama); if you opt into a cloud classifier (DeepSeek, OpenAI, Anthropic, OpenRouter, or any OpenAI-compatible endpoint), session transcripts are sent to that provider — see Security for the exact data-flow.
---
Open http://localhost:3940/ui after the daemon starts.
| Page | What it shows |
|---|---|
| **Live** | Sessions being written in real time, recent reads, recent decisions |
| **Pulse** | System health — coherence, runtimes, stale entities, recent sessions |
| **River** | Full session timeline with density controls + superseded-lane visualization |
| **Thread** | Per-entity conversation history with runtime filters and ←/→ navigation |
| **Search** | Keyword, semantic, or hybrid recall with match snippets and field-origin tags |
| **Recall** | Adoption telemetry — useful_hit_rate, source breakdown, query log |
| **Settings** | Sources, providers, classifier, data backup/restore |
---
npm install -g nlm-memory
nlm setup
nlm setup is the interactive first-run wizard. It picks your classifier + model, wires the runtimes you actually use, generates an NLM_MCP_TOKEN, hardens permissions on ~/.nlm/, and installs the daemon supervisor for your platform. For headless environments (servers, CI, agents), use nlm start directly after initial setup — it boots the daemon without interactive prompts.
| Platform | Daemon | Notes |
|---|---|---|
| **macOS** | LaunchAgent at ~/Library/LaunchAgents/com.github.pbmagnet4.nlm-memory.plist | Auto-starts on login |
| **Linux** | systemd user unit at ~/.config/systemd/user/nlm.service | Headless servers: loginctl enable-linger $USER so the daemon survives logout |
| **Windows** | Manual nlm start for now | Hook + MCP install paths are platform-aware; supervisor lands next release |
Stop or remove: nlm uninstall.
---
After nlm setup finishes, open http://localhost:3940/ui — the daemon is running. (If you changed NLM_PORT, substitute your port in all examples below.) A 30-second sanity check:
nlm recall "what was that pgvector decision" # one-shot search from the shell
nlm digest # yesterday's activity at a glance
nlm --version
---
| Var | Default | What |
|---|---|---|
NLM_SIGNALS_ENABLED | 1 (on) | Set to 0 to disable signal ingest entirely |
NLM_SIGNAL_RETENTION_DAYS | 90 | Raw signals older than this are pruned |
Signals are local-only. They are stamped with a per-install ID from ~/.nlm/install-id and never leave the machine.
| Var | Default | What |
|---|---|---|
NLM_PORT | 3940 | Daemon bind port (loopback only) |
NLM_DB_PATH | ~/.nlm/canonical.sqlite | SQLite canonical store location |
NLM_HOOK_MODE | live | live injects pointer block; shadow logs without injecting |
NLM_HOOK_LOG | ~/.nlm/hook-log.jsonl | Hook fire log; powers digest's liveness alert |
NLM_USEFUL_HIT_LOG | ~/.nlm/useful-hit-log.jsonl | Citation/useful-hit ledger |
NLM_QUERY_LOG | ~/.nlm/query-log.jsonl | Recall query telemetry |
NLM_CITATION_LOG | ~/.nlm/citation-log.jsonl | Stop-hook citation events |
NLM_MISS_LOG | ~/.nlm/miss-log.jsonl | Stop-hook miss events — sessions the agent explicitly fetched via get_session/cite_session that the hook never surfaced. Reviewed via nlm misses. |
NLM_MISS_LOG_ENABLED | true | Set to 0 to disable miss-log emission entirely. |
NLM_MCP_TOKEN | auto-generated | 256-bit bearer for /api/* (non-browser) and /mcp |
NLM_MCP_CONFIG | ~/.mcp.json | Path the connect/disconnect commands modify |
NLM_CLASSIFIER | ollama | ollama (local, default), deepseek, openai, anthropic, openrouter, or openai-compatible |
NLM_CLASSIFIER_MODEL | qwen3:4b-instruct-2507-q4_K_M | Model id for the chosen provider. See [classifier bench](reports/classifier-comparison/2026-06-02-deepseek-v4-vs-qwen3.md) for why this is the recommended local default. |
NLM_OLLAMA_URL | http://localhost:11434 | Override Ollama endpoint |
NLM_ADAPTERS | all | Comma-separated allowlist of adapters to enable |
DEEPSEEK_API_KEY | — | Required only when classifier=deepseek |
NLM_DISABLE_UPDATE_CHECK | — | Set to 1 to disable the daily npm-registry update check |
NLM_RECALL_DECAY_HALF_LIFE_DAYS | 180 | Half-life of the recency multiplier applied to recall scores. Older sessions score lower; defaults to 6 months. Set to 0 to disable recency weighting entirely. |
NLM_RECALL_DECAY_FLOOR | 0.25 | Lower bound on the recency multiplier — even ancient sessions retain at least 25% of their raw score so a perfect-match old session can still surface. |
NLM_RECALL_REWRITE_DEFAULT | true | Default value for the MCP recall_sessions rewrite parameter. When true, the service runs an LLM rewrite on vague natural-language queries before search. The HTTP hook caller bypasses rewrite regardless (hot-path protection). |
NLM_RECALL_REWRITE_TIMEOUT_MS | 5000 | Per-call timeout for the rewrite LLM. Separate from the classifier timeout. |
NLM_FACT_CORROBORATION_BOOST_CAP | 2.0 | Maximum multiplicative boost applied to fact recall scores based on how many sessions corroborate the same (subject, predicate, value). Log-scale: 1 corroboration is 1.0×, 10 is 2.0× (capped). Set to 1.0 to disable the boost — the count is still returned on each hit. |
NLM_HOOK_INJECT_FACTS | true | Whether to attach high-confidence facts about top-hit entities to the pointer block injected by the hook. Set to 0 to disable globally. |
NLM_HOOK_FACT_LIMIT | 5 | Maximum number of facts in the "Known facts" section of the pointer block. |
NLM_HOOK_FACT_MIN_CORROBORATION | 2 | Minimum number of sessions that must have asserted a fact before it qualifies for hook injection. Set to 1 to include single-source facts. |
NLM_HOOK_FACT_MIN_CONFIDENCE | 0.7 | Minimum classifier confidence for a fact to qualify for hook injection. |
TELEGRAM_BOT_TOKEN / TELEGRAM_CHAT_ID | — | Required for nlm digest --telegram |
~/.nlm/.env — autoloaded by every CLI command. Mode 0600, owned by you, never readable by other users. The setup wizard writes the initial keys; you can edit it directly.
The pi quality-gate extension (in the pi-sandbox repo) is a ~10-line integration that emits nlm.signal per gate step and again on retry exhaustion. It is the canonical example of the session-embedded transport.
---
Daemon binds 127.0.0.1:3940 (override with NLM_PORT). Selected endpoints:
| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | /api/health | Host-only | Liveness probe; returns {version, status, service} |
| GET | /api/recall | Bearer/Origin | Hybrid recall — ?q=, ?mode=keyword\|semantic\|hybrid, ?limit=, ?include_superseded=true (default off; opt-in to surface overturned sessions down-ranked, badged with superseded_by). Each result carries status + superseded_by. |
| GET | /api/recall/stats | Bearer/Origin | 7-day stats: total, hit_rate, useful_hit_rate, top queries |
| GET | /api/recall/recent | Bearer/Origin | Last N recall events for live tail/telemetry |
| GET | /api/recall/cite-stats | Bearer/Origin | Citation rate over ?days= |
| GET | /api/session/:id | Bearer/Origin | Full session body + supersedence links |
| GET | /api/recall/facts | Bearer/Origin | Structured fact search; includes hint field when empty |
| GET | /api/facts/history | Bearer/Origin | Version chain for one fact |
| GET | /api/dataset | Bearer/Origin | Full session list for the UI dataset view |
| GET | /api/live/recent-writes | Bearer/Origin | Live tail of ingested sessions |
| GET | /api/data/backup | Bearer/Origin | Streaming SQLite snapshot download |
| POST | /api/data/restore | Bearer/Origin | Stage a snapshot for apply-on-restart |
| POST | /api/citation/explicit | Bearer/Origin | Log an explicit session citation (the route backing the cite_session MCP tool; payload {id, conversation_id?, reason?}) |
| POST | /api/hook/pre-compact | Bearer/Origin | Hook endpoint; flushes the surfaced-IDs memo |
| ALL | /mcp | Bearer required | Streamable-HTTP MCP transport for container agents |
/api/* is gated by three layers: 127.0.0.1 Host check (defeats DNS rebinding), Origin check when the browser sends one (defeats cross-origin drive-by), Bearer fallback when Origin is absent (server-to-server clients).
---
What happens when an AI runtime writes a session and you later recall it:
ingest: runtime transcript (jsonl/sqlite)
-> adapter parses runtime-specific format
-> classifier (Ollama local by default; DeepSeek / OpenAI / Anthropic / OpenRouter / OpenAI-compatible if you opt in) extracts label + entities + decisions + open questions
-> embedder (nomic-embed-text via Ollama) computes 768-dim vector
-> SQLite canonical store + FTS5 keyword index + sqlite-vec ANN index
recall: prompt / query
-> tokenize + match scoring (label x3, entity-exact x4, decision x2, summary x1, phrase-bonus +5)
-> hybrid: BM25-style keyword + vector cosine, fused by score
-> select-top-N gate (per-fire cap 3, per-conversation cap 10)
-> pointer block prepended to model context (hooks) or returned as tool result (MCP)
---
| **nlm-memory** | mem0 | Letta / MemGPT | Built-in (CLAUDE.md) | |
|---|---|---|---|---|
| **Unit of memory** | Whole session + extracted markers | Atomic facts | Graph nodes + edges | Static file |
| **Cross-runtime** | 9 adapters, one corpus | Per-app SDK integration | Per-app SDK integration | Per-runtime config |
| **Editable timeline** | Sessions can be superseded, retired, aborted | Append-only fact log | Graph edits | Manual file edits |
| **R@5 baseline** | 97.2% on 14mo corpus | published varies | published varies | n/a |
| **External deps** | SQLite + Ollama (local) | Postgres or Qdrant | Postgres | none |
| **Hosted offering** | none — local only | yes | yes | n/a |
| **Account required** | none | yes (cloud tier) | yes | none |
| **Telemetry** | none | yes | yes | none |
| **License** | Apache 2.0 | Apache 2.0 | Apache 2.0 | — |
The defining property is the editable timeline. mem0 and Letta append; NLM lets you reach back and mark a session as superseded by a newer one, retire one as no-longer-relevant, or flag one as aborted-mid-flight. The next recall surfaces the corrected version, not the stale one. A claim from 6 months ago can be patched today.
---
高质量的MCP工具,为AI运算提供了便捷的内存管理
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ Apache 2.0 — 宽松开源协议,可商用,需保留版权声明和 NOTICE 文件,含专利授权条款。
经综合评估,非线性内存OS 在MCP工具赛道中表现稳健,质量良好。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | nlm-memory |
| Topics | aiaiderclaude-codecodexcursortypescript |
| GitHub | https://github.com/pbmagnet4/nlm-memory |
| License | Apache-2.0 |
| 语言 | TypeScript |
收录时间:2026-06-12 · 更新时间:2026-06-12 · License:Apache-2.0 · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端