yb-zhai/agent-memory
Local JSONL agent memory with four-way recall, MCP, and optional semantic search
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Tracked from daily D1 telemetry snapshots. Hover any data point for exact daily star counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
Nebula Memory is an embeddable agent memory engine, not a general-purpose database. Its core, exposed by memory/index.mjs, runs on Node.js without external runtime dependencies and persists text in local JSONL. Recall combines four signals: TF-IDF lexical matching, activation with time decay, graph propagation, and user profiles. The thin index stores metadata, term frequencies, and byte offsets, so the engine can defer reading full text until it needs it.
The standalone server.js and DeepSeek Harness (DSH) plugin expose the panel and can query an optional Hindsight HTTP backend alongside local recall. Reciprocal rank fusion (RRF) merges the two ranked lists. On those surfaces, local recall stays enabled and continues to serve queries if Hindsight becomes unavailable. The standalone MCP package exposes the local engine without the panel or Hindsight.
Key Capabilities & Differentiators
Writes redact recognized secrets and personal identifiers before term counting and split text beyond the 2,000-character item limit into linked chunks that can be grouped by docId. Memories pinned with importance=1.0 avoid time decay. Rule-based contradiction handling marks older claims as superseded on recognized polarity reversals and excludes them from default recall without deleting them. Background maintenance can prune edges, archive low-value chatter, and compact storage without model calls.
The 3D panel shows memory links and recall traces, updates via SSE, and lets users inspect ranking contributions. MCP also provides explain_recall. Optional pinyin indexing adds full-pinyin, initial-letter, and fuzzy pronunciation matches for Chinese text. On a compacted corpus of 23.8k nodes and 41.4k edges, the project benchmark measured about 13 ms median local recall and 31 ms median MCP end-to-end latency; the timings apply to that snapshot, not every corpus.
Trade-offs & Limitations
The local engine trades semantic reach for a simple offline deployment: graph and profile signals can improve retrieval, but weak lexical overlap can still defeat queries. Hindsight targets paraphrases and older history at the cost of another service, PostgreSQL, and an LLM backend. In the scale test, median recall rose to 319 ms at 100,000 entries and 1.75 s at 500,000; candidate scoring was the bottleneck. Test against a representative corpus before relying on the smaller-bank latency figures.
Plaintext JSONL is easy to inspect and back up, but the local store is a single-writer design without transactions, tenant isolation, or cross-device conflict resolution. watchExternalWrites lets other local processes pick up fresh rows; it does not coordinate writers. LangChain Memory fits a Python-first application more naturally, while a managed offering such as Mem0 or Zep is worth evaluating when cross-device access and team controls matter. For sensitive deployments, restrict file access and review what leaves the machine through Hindsight or prompts sent to a remote model.
Hardware & Deployment Guide
Start with Node.js and a writable data directory. Embed NebulaMemory for an application-controlled integration, run node server.js for the HTTP service and panel on port 8898, or use npx nebula-memory-mcp for a compatible client. DSH desktop users can install the full plugin with dsh plugin --profile desktop add github:yb-zhai/agent-memory; the profile must match the active installation. The engine can run offline once installed. The MCP package and DSH plugin have separate release lines.
For hybrid recall, provision Hindsight with PostgreSQL and an LLM backend, set hindsightUrl and a hindsightKey if needed, and check /healthz for local or hybrid mode. The plugin probes backend readiness every 30 seconds and falls back to local recall if checks fail. v2.7.1 bounded deduplication candidates and made snapshot writes tolerant of certain concurrent failures; v2.8.0 introduced optional pinyin search, and v2.8.1 reduced its persisted index footprint.
index.thin.json keeps metadata, term frequencies, and byte offsets so full text can be loaded on demand.explain_recall.pinyinIndex supports full pinyin, initials, and fuzzy pronunciation matches.Personal assistants and single-machine agent workflows that need cross-session text memory, offline recall, and a way to inspect why results ranked.
You need a transactional shared store, concurrent writers, cross-device sync, native multimodal indexing, or strong paraphrase recall without operating a semantic backend.
Quick Start & Installation
npm run check:downstream # 列出每个下游与上游的文件差异 npm run check:downstream:strict # 有漂移就 exit 1(发版前务必跑)
Comparison vs. Top RAG, Data & Memory Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| agent-memory ★ | 81 | +19 | JavaScript | MIT | Local JSONL agent memory with four-way recall, MCP, and optional semantic search |
| OpenViking | 43.2k | +283 | Python | AGPL-3.0 | A directory-scoped RAG database for inspectable agent knowledge and memory |
| firecrawl | 216.7k | +4.8k | TypeScript | AGPL-3.0 | Local and hosted web ingestion that turns sites into RAG-ready Markdown |
| markitdown | 199.7k | +950 | Python | MIT | Python library and CLI that turn mixed-format documents into Markdown for RAG in |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/yb-zhai/agent-memory.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about agent-memory
Which entry point should I use, and can multiple clients share memory?
NebulaMemory from memory/index.mjs when your Node.js application should own the write and recall lifecycle. Use npx nebula-memory-mcp for a compatible MCP client that only needs local recall tools. Choose node server.js or the DSH plugin if you need the panel or optional Hindsight integration. Multiple clients on one machine can point NEBULA_DATA_DIR at the same directory, but each process has its own in-memory view. Enable watchExternalWrites for visibility into new writes without restarting; it does not make concurrent writers safe.Does local recall need a GPU, and how should I size the deployment?
Can I self-host Nebula Memory in a commercial product?
When is Nebula a better fit than LangChain Memory, Mem0, or Zep?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy