
NeuroStack
io.github.raphasouthall由 GitHub 账号 raphasouthall 发布v0.12.0更新于 Oct 25, 2026
Token-efficient MCP memory for Markdown vaults. Tiered search, GraphRAG, AI memories.
概览
NeuroStack 将本地 Markdown 笔记库索引为可搜索的记忆层,让 AI 助手检索笔记、遍历链接图谱并跨会话保存记忆。
- 可以做什么
- 以关键词与语义混合检索笔记,按事实、摘要或全文分层返回带笔记路径的排序证据。在 token 预算内组装上下文,并探索 wiki 链接图谱、主题聚类与文件夹摘要。保存、检索、编辑和遗忘带类型的记忆(决策、约定、经验、缺陷),跨会话保留。标记过时笔记,并从 AI 会话记录中提取决策存为记忆。可选地在 git 仓库笔记库中写入或删除笔记,每次改动都会提交并推送。
- 适用场景
- 适合用 Markdown 记笔记(Obsidian、Logseq、Notion 导出)并希望 AI 助手据此回答、引用来源,并在会话之间记住决策、无需反复粘贴背景的场景。
- 运行要求
- 以本地进程(npm 包,也有 PyPI)或远程端点运行。Lite 模式需 Node.js 与 Python 3.11+;Full 模式另需本地 Ollama 及嵌入与摘要模型。笔记库路径通过 NEUROSTACK_VAULT_ROOT 指定。可选的嵌入、LLM、评判与代理服务在配置文件中或通过 NEUROSTACK_* 变量设置。
安装
在 SourceWeft 中
- 打开 控制台中的 NeuroStack,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。
交给智能体安装
把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。
阅读 https://sourceweft.com/mcp/io.github.raphasouthall%2Fneurostack/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。其他 MCP 客户端
把它添加到你客户端的 mcpServers 配置中。
{
"mcpServers": {
"neurostack": {
"type": "http",
"url": "https://mcp.neurostack.sh/mcp"
}
}
}README
[PyPI] [npm] [License] [CI] [MCP]
A local retrieval layer and optimizer for the Markdown knowledge base you already have.
NeuroStack indexes a folder of .md files (Obsidian, Logseq, Notion exports, plain Markdown) into one SQLite database with full-text search, embeddings and a wiki-link graph. Any MCP client can then search it, walk the graph and save memories. A query returns ranked evidence with note paths, and your AI does the reasoning, so no model runs while you wait. Between queries NeuroStack keeps the knowledge base accurate. It flags notes that have gone stale, harvests decisions and root causes from your AI sessions, merges recurring memories into learnings, and queues the proven ones to become notes. Indexing never changes your files, and optional MCP write tools let a client edit notes through your git history.
Works with Claude, Cursor, Windsurf, Gemini CLI, VS Code, Codex and any other client that supports MCP.
60-second start
The steps below explain each part and how to connect other AI clients.
Your notes, in your control
By default, NeuroStack is a read-only indexing layer:
- Indexing, search, summaries, and graph analysis never modify your Markdown files
- All index data lives in NeuroStack's own separate database
- To remove it completely, run
neurostack uninstall. Your notes stay untouched. - Nothing ever leaves your machine, unless you configure a third-party LLM provider for summaries and embeddings
If your vault is a git repo, four opt-in MCP write tools let an AI client author and edit notes for you: vault_write_file, vault_delete_file, plus vault_read_file / vault_list_files. Every write commits and pushes to your git remote with a descriptive message, so every change is visible in git log, revertable with git revert, and serialised under a per-vault lock. Writes hard-reject invalid frontmatter, paths outside the vault, and hidden directories (.git, .obsidian, …). Because the tools are exposed to any client talking to neurostack serve, gate them at the transport (auth, tunnel, LAN only) if you put the MCP endpoint on the public internet.
Who this is for
You do not need to be a developer. If you take notes in Markdown, or can export your notes as Markdown from Obsidian, Notion, Bear, or Roam, NeuroStack works for you.
Get started in three steps
You will need Node.js installed (most computers already have it). The npm package handles the Python setup for you.
Step 1. Install
Step 2. Set up (takes about two minutes)
The setup wizard asks which vault folder to index, which mode to run (Lite or Full), and which profession pack to apply. Then it finishes the install for you. It adds the NeuroStack hook to omp or Claude Code if you have them, so /save keeps what a session learned. It sets up the AI that turns saved sessions into memories, using the same model as your summaries. If no model answers yet, it leaves that off and tells you so. It also installs one background timer that keeps the index tidy, and a failed background job shows up as a desktop notification. Press Enter at each question to take the default. At the end it runs neurostack doctor and shows what to try first.
Step 3. Connect to your AI
For Claude Desktop:
For Claude Code:
For Cursor, Windsurf, Gemini CLI, or VS Code:
Done. Open a new conversation and ask your AI about something from your notes.
Lite and Full modes
Everything runs on your machine. Choose a tier during neurostack init:
- Lite (~130 MB) gives you keyword search, link-based connections between notes, stale detection and the MCP server. No GPU or Ollama required.
- Full (~560 MB) adds semantic search by meaning, AI-generated summaries, connections between notes, and topic clustering via local Ollama. GPU or 6+ core CPU recommended.
Non-interactive setup takes every default:
--no-hooks, --no-schedule and --checkpoint none turn off the hook, the timer and the checkpoint AI.
Alternative install methods (PyPI, pip, curl)
On Ubuntu 23.04+, Debian 12+, and Fedora 38+, bare pip install outside a virtual environment is blocked by the operating system. Use npm, pipx, or uv tool install instead.
To uninstall: neurostack uninstall
What it does
[How NeuroStack works: vault, index, serve, clients, and the optimizer loop]
- Hybrid search (FTS5 keyword + semantic) with tiered depth, so a client can fetch triples, summaries or full notes by token budget.
- Ranked evidence with note paths and excerpts over the CLI, MCP, or an OpenAI-compatible API, for your AI to cite and reason over.
- Stale detection. A note that keeps surfacing in contexts where it no longer fits is flagged and demoted in later results.
- Session harvest. A timer scans Claude Code, Codex, Gemini and omp transcripts and saves decisions, bugs, conventions and learnings as memories with TTLs.
- Synthesis and promotion. Recurring memories become learnings; a promotion queue lists which ones are ready to become notes.
- Wiki-link graph with PageRank, community detection, gap and bridge analysis.
- Read-only by default. Opt-in write tools commit and push every change to your git remote.
Technical pipeline (module by module)
Editable sources live in the .drawio files next to the images.
Design
Philosophy
- Your files stay yours. The index lives in its own database, so deleting it leaves your notes exactly as they were.
- NeuroStack returns evidence and your AI reasons over it. No tool answers questions, and
tests/test_no_answering.pykeeps it that way. - Removing a memory moves it to an archive that search cannot reach, and you can restore it later.
- NeuroStack redacts secrets from text a model wrote, such as harvested summaries. It stores what you or your agent saved on purpose word for word.
- Ranking changes get measured first.
neurostack evalswitches off usage learning while it runs, so one pass cannot skew the next.
Mental model
NeuroStack holds two layers and one loop.
The vault is your Markdown. NeuroStack reads it, splits it into chunks, embeds them, summarises each note, extracts facts as triples and builds the link graph. Note status and tags live in NeuroStack's own note_metadata table, so it never needs to edit your frontmatter.
The memory layer holds what agents learn, typed as observations, decisions, conventions, learnings, bugs or context. These rows belong to NeuroStack and carry an optional workspace and an optional expiry.
The optimizer loop runs on a timer and connects the two. A memory usually starts in an AI session, becomes a learning when it keeps recurring, and becomes a note once no existing note covers it.
Architecture
One OS timer runs neurostack run-due every minute, and that command runs each due job in turn. neurostack serve exposes 33 MCP tools over stdio or HTTP, and neurostack api serves the same retrieval as an OpenAI-compatible API.
Data model
A memory row stores its content, tags, type, workspace, source agent, embedding and expiry. It also records embed_pending when the embedder was down, so neurostack backfill can embed it later, plus revision_count and merged_from for edits and merges. A second database, sessions.db, indexes raw session transcripts for neurostack sessions search.
Write mechanics
- Deliberate saves.
vault_rememberandneurostack memories addstore the text as written, embed it once, then report any near-duplicate above 0.85 similarity without refusing the save. If embedding fails, the row still saves and gets flagged for backfill. - Harvest. The index LLM reads each session message and keeps decisions, root causes, rules and facts. A second pass reads the session as a whole and saves up to 3 final conclusions tagged
session-verdict. The judge model then picks each memory's type. Harvest redacts secrets, skips anything above 0.88 similarity to a live memory, and records how many messages of each session it has read. - Synthesis. Observations at least 7 days old that cluster at 0.75 similarity or higher (one anchor plus 3 or more others) become one learning. The originals stay, tagged
superseded_by:<id>. - Removal. Forget, the losing side of a merge, expiry and prune all go through one helper that copies the row into
memories_archivewith a reason and a timestamp, then deletes it from the live table. Search checks expiry before it runs, so an expired memory never shows up. - Vault writes. Only the opt-in tools (
vault_write_file,vault_delete_file) and the promotion job touch the vault, and each one commits and pushes to git.
Read mechanics
- Hybrid search. NeuroStack runs keyword search and embedding search separately, takes the top 50 chunks from each, and merges the two lists by reciprocal rank (k = 60). A chunk found by only one search still competes. It then adds a convergence bonus, a 1.4× boost for the caller's context, usage hotness and co-occurrence, and demotes notes flagged as stale.
- Diversity. Results keep one chunk per note, and similar notes suppress each other, so one long note cannot fill the result list.
- Tiered depth. A client asks for triples (about 15 tokens), summaries (about 75) or full notes (about 300), or lets
autoescalate only when the cheaper tier misses. - Context assembly.
vault_contextsplits its token budget into 40% memories, 20% triples, 30% summaries and 10% sessions, so no single source crowds out the rest. - Hard limits. Every search returns at most
top_kresults. No retrieval path calls an LLM unless you passrerank=True(see below).
Optional reranking. vault_search(rerank=True) asks the judge model to score each whole-note result against your query and returns the judge's order. On 76 real search clicks it raised MRR from 0.503 to 0.652, top-1 hits from 34% to 49% and top-3 hits from 57% to 75% (paired permutation p=0.004). Each search costs about $0.0004 and adds about 0.4 s. It works with depth="full" or reference_only=True and raises an error at the other depths. If the judge fails, you get the normal order back.
Usage makes a note easier to find again. It never marks a note as true.
Known limits
- Harvested memories do not record their workspace yet, so a workspace-scoped search misses them.
- A harvested memory does not link back to the session and message it came from.
- A forgotten memory can come back if a later session says the same thing, because the duplicate check reads only live memories.
- Editing a memory replaces its text, and only
revision_countshows that it changed.
External services
Lite mode needs none of these. Everything below is opt-in and set in ~/.config/neurostack/config.toml, and each one has a matching NEUROSTACK_* env var. When a service is missing, the feature that needs it switches off and the rest keeps working.
Only the embedder and the index LLM see your note text. The judge sees queries, memories and the notes being ranked or checked. Point every URL at localhost to keep all data on your machine.
What makes it different
NeuroStack is not a replacement for Obsidian, Notion, or any note-taking app. It sits on top of what you already use and adds what they don't have.
Stale detection is the part other tools lack. When a note keeps appearing in contexts where it no longer fits, such as a deprecated API or a superseded paper, NeuroStack flags it and demotes it in later results.
Profession packs
When you run neurostack init, you choose a profession pack. Each one configures NeuroStack with templates, folder structures, and AI guidance suited to how your profession actually uses notes.
Apply a pack to an existing vault without losing any notes:
You can also import an existing Markdown directory:
How retrieval works
Most memory tools give your AI a wall of text and let it figure out what's relevant. NeuroStack is tiered. It starts with the cheapest retrieval that answers the question and escalates only when it needs to.
Simple factual questions resolve at ~15 tokens. Deep dives get full context. Your AI spends its attention budget where it matters.
Your AI remembers decisions
Across sessions, your AI can save and retrieve typed memories: observations, decisions, conventions, learnings, bugs. When you start a new session, those memories are surfaced automatically.
"We decided to keep authentication stateless." "The thesis framing shifted from consolidation to complementary learning systems." "Elena's surname changed from Vasquez to Reyes in the chapter 7 revision."
These aren't just notes. They're things your AI remembers you decided together. They survive /clear. They survive closing the terminal. They survive switching machines.
Learns from your AI sessions
NeuroStack scans your past AI conversations on a timer, extracts the decisions, observations and learnings, and saves them as memories. You do not have to write them down yourself.
Supports Claude Code, VS Code, Codex CLI, Aider, and Gemini CLI session formats.
Keeps itself current
Your vault changes. NeuroStack watches it.
The index updates as you write and stale detection runs continuously, so you do not maintain it by hand.
Scheduling
NeuroStack runs its background jobs from one OS timer. The timer calls neurostack run-due once a minute, and run-due works out which jobs are due and runs them one at a time. neurostack init installs the timer for you. Installing it records each daily job as just run, so the jobs start at their next scheduled time instead of all at once. The commands below manage it by hand.
schedule install uses the scheduler your OS already ships:
The timer calls the neurostack executable it finds on your PATH at install time, so run schedule install again after you move or reinstall NeuroStack. All three subcommands accept --json.
A systemd user timer runs only while you have a login session. On a headless Linux server, or when you run NeuroStack as root, enable lingering for that user so the timer keeps running after you log out:
neurostack doctor shows when each job last ran.
Checkpoints with a laptop and a server
/save on the laptop uploads the session transcript to the server's queue. The server's checkpoint-worker job turns it into memories within a minute, and harvest-worker does the same for transcripts harvest-scan uploads every 30 minutes. Each host reads its own file.
On the laptop, ~/.config/neurostack/client.toml names the server. Its checkpoint_command turns on harvest-scan and serves any hook checkpoint --run you start by hand:
The hook waits up to context_timeout_s (15 s) for the session brief and per-prompt context, and up to timeout_s (5 s) on each tool call, so a server that is down never stalls every tool call.
On the server, ~/.config/neurostack/config.toml holds the command the workers pipe each checkpoint prompt through. Any command that reads the prompt on stdin and prints the model's reply works, so it can call an OpenAI-compatible endpoint or a local proxy:
NEUROSTACK_CHECKPOINT_COMMAND, NEUROSTACK_CHECKPOINT_TIMEOUT_S and NEUROSTACK_CHECKPOINT_MAX_MESSAGES override them. With no checkpoint_command in config.toml, neurostack jobs shows both workers off and says why.
Dashboard
neurostack ui serves a read-only dashboard at http://127.0.0.1:8765. It shows six pages. Overview has index coverage, communities, recent notes and memory counts. Automations lists every scheduled job with its last run, next run and 14-run history, and you can click a job to see its runs. Graph draws the top notes by PageRank, and clicking a node opens its summary and links. Memories lists memories with type tabs and search. Search runs note and memory searches with every option the vault_search and vault_memories tools take: mode, depth, result count, workspace, context boost, max tokens, judge rerank and reference-only for notes, and type, workspace and count for memories. A search there embeds the query, so it needs the embedder, and it does not count as note usage. Each note result has a Best result button that stores the search and the note as a label. Tuning runs weight tuning on those labels and on the ones the feedback loop inferred: it tunes on half, scores the other half, and Apply makes the winning weights the ones every search uses, only when they rank the unseen half better. Revert goes back to config.toml. Applying and marking are the dashboard's only writes.
It needs no extra install and makes no model calls. Pass --port to change the port and --open to open a browser. On any address other than localhost, create a login first with neurostack ui user add NAME, which prompts for a password of at least 8 characters (--password-stdin reads it from a pipe). The page then shows a sign-in form, and a session lasts 30 days. neurostack ui user list shows the users and neurostack ui user remove NAME deletes one and ends their sessions.
What changes day-to-day
How your vault is stored
NeuroStack reads your vault. By default it writes nothing back, and all index data lives in its own SQLite databases. The opt-in MCP write tools (vault_write_file / vault_delete_file) are the one exception: they create or edit .md files in the vault and commit + push the change to your git remote on the spot.
Memory write-back (opt-in)
Memories live in SQLite by default, so they're invisible in Obsidian and vanish if the database is lost. Turn on write-back to persist qualifying memories as markdown files you own:
- Files land under
{vault_root}/.neurostack/memories/<type>/<YYYY-MM>/<uuid>.md. NeuroStack only ever writes inside that one directory, so your own notes stay untouched. - Only persistent (no-TTL)
decision/convention/learning/bugmemories are written; ephemeral (TTL) memories never are. - The database stays the source of truth; files are readable exports.
vault_remember/vault_update_memory/vault_forget/vault_mergekeep the files in step automatically. - The directory self-ignores via its own
.gitignoreso memories stay out of git until you opt in (delete that file to version them). NeuroStack never commits on your behalf. neurostack migrate write-back [--dry-run]exports existing memories;neurostack syncreconciles files against the DB (the DB wins on conflict).
All 24 MCP tools
Search & retrieval
Context & insights
Memories
Sessions
Vault files (opt-in write surface — git-backed)
Full CLI reference
Checkpoint runners use a nonblocking OS lock per conversation. Overlapping saves for one
conversation return checkpoint already running, while separate conversations can save at
the same time. The runner keeps the extracted reply and a receipt for each acknowledged
item, so a partial retry does not call the model again or repeat confirmed saves. Each
conversation retains the 256 most recent SHA-256 receipts of exact redacted content. Changed
facts produce different receipts. A connection can still fail after the server commits but
before it acknowledges the write. Avoiding that remote duplicate requires server-side
idempotency, which the current vault_remember contract does not provide.
No harness fires a checkpoint on its own: /save is the only trigger, and it hands the
request to the server's queue instead of running one directly. neurostack hook enqueue --harness <claude|omp> reads the session's transcript and uploads it with the queue_add
MCP tool, gzip-compressed. A transcript over 10 MB goes up as its newest records only. The
queue takes 50 checkpoints a day, and the server's checkpoint-worker job in
neurostack run-due runs each one within a minute against the uploaded text. enqueue
prints one line back (queued, already queued, the daily cap reached, or unreachable) and
exits 0 on a landed request, 1 otherwise. The server runs it with the checkpoint_command
from its own config.toml. harvest --pending --enqueue and the client's harvest-scan job
upload pending transcripts to the harvest queue the same way.
Neuroscience basis
Each feature models a specific mechanism from memory neuroscience:
Full citations: docs/neuroscience-appendix.md
FAQ
Does it modify my vault files? Not by default. Indexing, search, summaries, and every read tool leave your files untouched, and all index data lives in NeuroStack's own SQLite databases. Four opt-in MCP write tools (vault_write_file, vault_delete_file, plus vault_read_file / vault_list_files) let an AI client author and edit notes; every write commits and pushes to your git remote, so changes are tracked and revertable. If your vault is not a git repo, the file is still written to disk but the commit step is skipped. Separately, opt-in memory write-back persists memories as markdown, but only inside the quarantined .neurostack/ directory, away from your own notes.
Do I need a GPU? No. Lite mode has zero ML dependencies. Full mode runs on CPU but summarization is slow without a GPU.
Do I need to know Python? No. The npm package handles everything. You never touch a virtualenv.
How large a vault can it handle? Tested with ~5,000 notes. FTS5 search stays fast at any size.
Can I use it without an AI client? Yes. The CLI works standalone and pipes into any LLM.
Is my vault private? Yes. Nothing leaves your machine, unless you point Full mode at a third-party LLM provider instead of local Ollama. In that case the text you index goes to that provider under its own policy.
What AI clients does it work with? Claude Code, Claude Desktop, Cursor, Windsurf, Gemini CLI, VS Code, Codex and any other client that supports MCP.
Requirements
- Linux, macOS, or Windows
- Lite mode: Node.js + Python 3.11+. No GPU or Ollama required.
- Full mode: Ollama with
nomic-embed-textand a summary model. GPU or 6+ core CPU recommended.
Get started
neurostack init picks a tier, installs dependencies, indexes the vault and configures your MCP client.
- Contributing: CONTRIBUTING.md
- GitHub: github.com/raphasouthall/neurostack
- Sponsor: GitHub Sponsors | Buy me a coffee
Apache-2.0, see LICENSE. No GPL dependencies.
来源:README.md,提交 62c6d46
工具
0版本历史
1- v0.12.0最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通必需25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式必需10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分