Sandbox
@raphasouthall/neurostack

MCP server and CLI for Markdown knowledge bases

NeuroStack indexes a folder of Markdown files into a local database, then serves search, graph queries, summaries, memories, and write tools through CLI and MCP. It keeps the base in sync with stale-note detection, session harvesting, and optional git-backed writes, while leaving your notes read-only by default.

47 stars3 forksPythonUpdated 7d ago
Who it's for

Builders who keep a Markdown vault in Obsidian, Logseq, Notion exports, or plain files and want their agent to use it well.

What it delivers

You can ask your agent grounded questions about your notes, keep stale information out of answers, and carry useful context across sessions.

What it does

Hybrid note search

Indexes Markdown into SQLite with FTS5, embeddings, and wiki-link graph data, then returns ranked evidence with paths and excerpts.

MCP access for many clients

Exposes the vault through MCP tools so Claude Code, Cursor, Windsurf, Gemini CLI, VS Code, Codex, and other MCP clients can use it.

Stale-note detection

Flags notes that keep appearing in the wrong contexts and demotes them in later results.

Session harvesting

Scans AI session transcripts and saves decisions, bugs, conventions, and learnings as memories.

Memory synthesis and promotion

Turns recurring memories into learnings and queues the strongest ones for promotion into notes.

Optional git-backed writes

Lets MCP clients create, edit, and delete vault files with commits and pushes recorded in git history.

Local-first operation

Keeps indexing and retrieval on your machine, with no model run during retrieval unless you configure external summary or embedding providers.

How to get it

  1. 1NeuroStack indexes a folder of .md files (Obsidian, Logseq, Notion exports, plain…
    npm install -g neurostack && neurostack init
  2. 2Step 1. Install
    npm install -g neurostack
  3. 3Step 2. Set up (takes about two minutes)
    neurostack init
  4. 4For Claude Desktop
    neurostack setup-desktop
  5. 5For Claude Code
    claude mcp add neurostack -- neurostack serve
  6. 6For Cursor, Windsurf, Gemini CLI, or VS Code
    neurostack setup-client cursor      # or: windsurf, gemini, vscode

README

NeuroStack

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 SQLite with FTS5, embeddings and a wiki-link graph, and exposes it to any MCP client as search, graph queries and agent memories. Retrieval returns ranked evidence and your AI does the reasoning — no model runs while you wait on a query. NeuroStack then keeps the base accurate: it flags notes that have gone stale, harvests decisions and root causes from AI sessions into memories, synthesises recurring memories into learnings, and queues proven ones for promotion into notes. Indexing never modifies your files. Optional MCP write tools let a client author or edit notes through your git history.

npm install -g neurostack && neurostack init

Works with Claude, Cursor, Windsurf, Gemini CLI, VS Code, Codex and any other client that supports MCP.


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.

If you are...NeuroStack helps you...
A researcherAsk your AI "what do my notes say about X?" across hundreds of papers. Get warned when a note references a retracted finding or superseded paper before your AI cites it confidently.
A fiction writerYour AI knows your world-building bible, character histories, and chapter decisions. It remembers that you agreed in session 4 that Elena's backstory changes in act 2.
A studentAsk your AI to explain connections across all your course notes. When a syllabus topic changes, stale revision notes are flagged automatically.
A professionalYour AI remembers client context, project decisions, and meeting notes session-to-session. No more re-pasting the same background every time.
A developer or DevOps engineerNotes that reference deprecated APIs or reversed architecture decisions get flagged before your AI cites them as current.

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

npm install -g neurostack

Step 2. Set up (takes about two minutes)

neurostack init

The setup wizard asks which vault folder to index, which mode to run (Lite or Full), and which profession pack to apply. It does everything else automatically.

Step 3. Connect to your AI

For Claude Desktop:

neurostack setup-desktop

For Claude Code:

claude mcp add neurostack -- neurostack serve

For Cursor, Windsurf, Gemini CLI, or VS Code:

neurostack setup-client cursor      # or: windsurf, gemini, vscode

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:

neurostack init --mode lite ~/my-notes    # lite mode
neurostack init --mode full ~/my-notes    # full mode
Alternative install methods (PyPI, pip, curl)
# PyPI
pipx install neurostack
pip install neurostack        # inside a venv
uv tool install neurostack

# One-line script
curl -fsSL https://raw.githubusercontent.com/raphasouthall/neurostack/main/install.sh | bash

# Lite mode (no ML deps)
curl -fsSL https://raw.githubusercontent.com/raphasouthall/neurostack/main/install.sh | NEUROSTACK_MODE=lite bash

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)

NeuroStack technical pipeline: vault, indexer, store, serving and optimizer lanes with the module that owns each step

Editable sources live in the .drawio files next to the images.


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.

CapabilityNote appsBasic RAGNeuroStack
Stores your notesYesNoNo (read-only by default; opt-in git-backed write tools)
AI can search your notesSomeYesYes
Detects stale/outdated notesNoNoYes
AI memories persist across sessionsNoNoYes
Works with any MCP-compatible AINoVariesYes
Tiered retrieval (saves 80-95% tokens)NoNoYes
Profession-specific workflowsNoNoYes
Open source, self-hostableVariesVariesYes (Apache 2.0)

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.

PackBuilt for
researcherLiterature review, citation tracking, evolving arguments, stale paper detection
writerCharacter sheets, world-building, chapter outlines, continuity tracking
studentCourse notes, spaced repetition, exam prep, syllabus change detection
developerCode decisions, architecture notes, runbooks, deprecated API detection
devopsInfrastructure runbooks, incident notes, change logs
data-scientistExperiment tracking, model notes, dataset documentation

Apply a pack to an existing vault without losing any notes:

neurostack scaffold researcher ~/my-notes    # or: writer, student, developer, devops, data-scientist

You can also import an existing Markdown directory:

neurostack onboard ~/my-notes

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.

LevelTokensWhat your AI gets
Quick facts~15Structured facts extracted from your notes: experiment-3 used learning-rate 0.001
Summaries~75AI-generated overview of a note
Full content~300Actual Markdown content
Auto (default)VariesStarts at quick facts, escalates only if the answer isn't there

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.

neurostack memories add "revised thesis framing to CLS, not just consolidation" --type decision --tags "thesis,neuroscience"
neurostack memories search "thesis direction"

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.

neurostack harvest --sessions 5          # extract insights from last 5 sessions
neurostack hooks install                 # set up hourly auto-harvest

Supports Claude Code, VS Code, Codex CLI, Aider, and Gemini CLI session formats.


Keeps itself current

Your vault changes. NeuroStack watches it.

neurostack watch     # auto-index on vault changes

The index updates as you write and stale detection runs continuously, so you do not maintain it by hand.


What changes day-to-day

Without NeuroStackWith NeuroStack
AI answers from training dataAI answers from your actual notes
Cites the runbook you deprecatedFlags it as stale, demotes it automatically
No memory of yesterday's sessionsession_brief reconstructs working context
Reading 10 notes to find one factTiered retrieval: ~15 tokens for a structured fact
Decisions lost after /clearTyped memories persist indefinitely

How your vault is stored

~/your-vault/                           # your Markdown files (not modified by indexing; AI clients can edit via opt-in MCP write tools)
~/.config/neurostack/config.toml        # configuration
~/.local/share/neurostack/
    neurostack.db                       # SQLite + FTS5 knowledge graph
    sessions.db                         # session transcript index

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:

[writeback]
enabled = true                 # opt-in; default false
path = ".neurostack"           # quarantine dir, relative to vault_root
include_observations = false   # also write the noisier observation/context types
  • 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 / bug memories 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_merge keep the files in step automatically.
  • The directory self-ignores via its own .gitignore so 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 sync reconciles files against the DB (the DB wins on conflict).

All 24 MCP tools

Search & retrieval

ToolDescription
vault_searchHybrid search with tiered depth (triples, summaries, full, auto)
vault_summaryPre-computed note summary
vault_graphWiki-link neighborhood with PageRank scores
vault_relatedSemantically similar notes by embedding distance
vault_triplesKnowledge graph facts (subject-predicate-object)
vault_communitiesGraphRAG queries across topic clusters
vault_contextTask-scoped context assembly within token budget

Context & insights

ToolDescription
session_briefCompact session briefing
vault_statsIndex health, excitability breakdown, memory stats
vault_record_usageTrack note hotness
vault_prediction_errorsSurface stale notes

Memories

ToolDescription
vault_rememberStore a memory (returns duplicate warnings + tag suggestions)
vault_update_memoryUpdate a memory in place
vault_mergeMerge two memories (unions tags, audit trail)
vault_forgetDelete a memory
vault_memoriesList or search memories
vault_harvestExtract insights from session transcripts
vault_harvest_transcriptExtract insights from a transcript posted by the client (no server filesystem access)

Sessions

ToolDescription
vault_session_startBegin a memory session
vault_session_endEnd session, storing a summary you write, plus auto-harvest

Vault files (opt-in write surface — git-backed)

ToolDescription
vault_read_fileRead a .md file under your vault root
vault_list_filesList .md files; hidden segments (.git, .obsidian, …) always excluded
vault_write_fileCreate or overwrite a .md file; commits + pushes origin/main. Hard-rejects writes without required frontmatter (date, tags, type). On push conflict: git pull --rebase --autostash + retry once, then rollback.
vault_delete_fileDelete a .md file; commits + pushes origin/main
Full CLI reference
# Setup
neurostack init                          # one-command setup: deps, vault, index
neurostack init --mode full ~/brain      # non-interactive full mode
neurostack onboard ~/my-notes            # import existing Markdown notes
neurostack scaffold researcher           # apply a profession pack
neurostack scaffold --list               # see all packs
neurostack update                        # pull latest source + re-sync deps
neurostack uninstall                     # complete removal

# Search & retrieval
neurostack search "query"                # hybrid search
neurostack tiered "query"                # tiered: triples -> summaries -> full
neurostack triples "query"               # knowledge graph triples
neurostack summary "note.md"             # AI-generated note summary
neurostack related "note.md"             # semantically similar notes
neurostack graph "note.md"               # wiki-link neighborhood
neurostack communities query "topic"     # GraphRAG across topic clusters
neurostack context "task" --budget 2000  # task-scoped context recovery
neurostack brief                         # session briefing

# Maintenance
neurostack index                         # build/rebuild knowledge graph
neurostack watch                         # auto-index on vault changes
neurostack decay                         # excitability report
neurostack prediction-errors             # stale note detection
neurostack backfill [summaries|triples|all]
neurostack communities build             # rebuild topic clusters
neurostack reembed-chunks                # re-embed all chunks
neurostack export --include triples -o dump.json  # dump index data as JSON

# Memories
neurostack memories add "text" --type observation
neurostack memories search "query"
neurostack memories list
neurostack memories update <id> --content "revised"
neurostack memories merge <target> <source>
neurostack memories forget <id>
neurostack memories prune --expired

# Sessions
neurostack harvest --sessions 5          # extract session insights
neurostack sessions search "query"       # search transcripts
neurostack hooks install                 # decay timer (default --type)

# Harness hooks (session brief, auto-RAG, trigger memories, checkpoints)
neurostack hooks install --harness claude   # or: omp
neurostack hooks status

# Trigger memories: did the warnings change anything?
neurostack triggers stats                # fired, followed, ignored per memory (30d)
neurostack triggers stats --days 7

# Checkpoint: manual only — a harness never fires one on its own (issue #176).
# `/save` (both harnesses) queues a request instead of running one directly:
neurostack hook enqueue --harness claude    # or: omp — POSTs to client.toml's queue_url
neurostack hook checkpoint --run --session <id>  # what the queue's worker runs
neurostack hook checkpoint --save               # a model's JSON reply on stdin
# Client setup
neurostack setup-client cursor           # or: windsurf, gemini, vscode, claude-code
neurostack setup-client --list
neurostack setup-desktop                 # Claude Desktop

# Diagnostics
neurostack stats                         # index health
neurostack doctor                        # validate all subsystems
neurostack demo                          # interactive demo with sample vault

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 a server-side queue named by queue_url in client.toml instead of running one directly. neurostack hook enqueue --harness <claude|omp> POSTs the request and prints one line back — queued, already queued, the daily cap reached, or unreachable — and exits 0 on a landed request, 1 otherwise. neurostack status shows the configured queue_url under LEARN. Whatever runs the actual checkpoint (a queue worker, a timer, herdr) passes --format omp or --format claude-code to checkpoint --run so it knows which transcript root to search when nothing is piped in on stdin.

Neuroscience basis

Each feature models a specific mechanism from memory neuroscience:

FeatureMechanismCitation
Stale detection + demotionPrediction error signals trigger reconsolidationSinclair & Bhatt 2022
Excitability decayCREB-elevated neurons preferentially join new memoriesHan et al. 2007
Co-occurrence learningHebbian "fire together, wire together" plasticityHebb 1949
Topic clustersHopfield attractor basin dynamics, inverse temperatureRamsauer et al. 2020
Convergence confidenceEnergy landscape retrieval, basin width = robustnessKrotov & Hopfield 2016
Lateral inhibitionPV+/SOM+ interneuron winner-take-all competitionRashid et al. 2016
Tiered retrievalComplementary learning systemsMcClelland et al. 1995

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 or macOS
  • Lite mode: Node.js + Python 3.11+. No GPU or Ollama required.
  • Full mode: Ollama with nomic-embed-text and a summary model. GPU or 6+ core CPU recommended.

Get started

npm install -g neurostack
neurostack init

neurostack init picks a tier, installs dependencies, indexes the vault and configures your MCP client.

  • Contributing: [CONTRIB

Files in the repo

Repository payload24 top-level entries
  • .github
  • docs
  • npm
  • src
  • tests
  • vault-template
  • .gitignore
  • .mcpbignore
  • CHANGELOG.md
  • CLA.md
  • CLAUDE.md
  • CODE_OF_CONDUCT.md
  • CONTRIBUTING.md
  • icon.png
  • install.sh
  • LICENSE
  • manifest.json
  • NOTICE
  • PRIVACY.md
  • pyproject.toml
  • README.md
  • SECURITY.md
  • server.json
  • TERMS.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More connectors

Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface

86k

High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.

43k

Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code

14k
okf-memory/
okf-agent-memory

Git-native persistent memory for AI coding agents. Implements Google OKF v0.2 with sub-300µs in-memory BM25 search, embedded MCP server, and progressive disclosure. Slashes token bloat by 80% with zero external databases or dependencies. Built in pure Go.

547
2akouwu/
reverify

Stop your AI from making things up — it proposes, deterministic tools decide, every claim checked against ground truth with evidence. Grounded facts and context survive resets. Reverse engineering is the proving ground. MCP server + CLI.

1.1k

x64dbg-MCP Server is a native MCP (Model Context Protocol) plugin for x64dbg that exposes the debugger's full functionality over HTTP. Connect any MCP-compatible AI assistant and control x64dbg programmatically: set breakpoints, step through code, read memory, dump registers, and more. Built with Zig — zero dependencies, single-binary output, cros

1.9k