Back to MCP Servers

Cortex

Persistent memory for Claude Code grounded in computational neuroscience (41 cited papers). Thermodynamic decay, hippocampal-cortical consolidation, predictive-coding write gate, WRRF retrieval. PostgreSQL + pgvector, 33 MCP tools, 7 lifecycle hooks. Benchmarked 97.8% R@10 on Lo…

knowledge-memorypostgres
By cdeust
7111Updated 3 days agoPythonMIT

Installation

npx -y Cortex

Configuration

{
  "mcpServers": {
    "Cortex": {
      "command": "npx",
      "args": ["-y", "Cortex"]
    }
  }
}

How to use

  1. Run the installation command above (if needed)
  2. Open your Claude Code settings file (~/.claude/settings.json)
  3. Add the configuration to the mcpServers section
  4. Restart Claude Code to apply changes
<!-- mcp-name: io.github.cdeust/hypermnesia-mcp --> <p align="center"> <img src="assets/banner.svg" alt="Cortex — cross-platform persistent memory for AI coding agents" width="820"> </p> <p align="center"> <a href="https://github.com/cdeust/Cortex/actions/workflows/ci.yml"><img src="https://github.com/cdeust/Cortex/actions/workflows/ci.yml/badge.svg" alt="CI"></a> <a href="LICENSE"><img src="assets/badge-license.svg" alt="License: MIT"></a> <img src="assets/badge-python.svg" alt="Python 3.10+"> <img src="assets/badge-tests.svg" alt="tests passing"> <img src="assets/badge-references.svg" alt="97 referenced papers"> <img src="assets/badge-version.svg" alt="Version 4.17.1"> <a href="https://www.bestpractices.dev/projects/13836"><img src="https://www.bestpractices.dev/projects/13836/badge" alt="OpenSSF Best Practices"></a> <a href="https://mcptoplist.com/server/io.github.cdeust%2Fhypermnesia-mcp"><img src="assets/badge-mcp-toplist.svg" alt="MCP Toplist: Top 1.2% of 81,919 tracked MCP servers, July 2026"></a> </p> <p align="center"> <strong>Cross-platform persistent memory for Codex, Gemini CLI, Claude Code, and other local MCP hosts — built on computational neuroscience, not just retrieval.</strong> 36 cited brain mechanisms consolidate what matters, keep it current as your project evolves, and reconstruct the right context at the right time. The MCP server is host-agnostic; Claude Code adds optional automatic lifecycle hooks. </p> <p align="center"> <a href="#getting-started">Getting Started</a> · <a href="#configuration">Configuration</a> · <a href="#examples">Examples</a> · <a href="#whats-new">What's New</a> · <a href="#the-science-under-the-hood">Science</a> · <a href="#retrieval-that-actually-works">Benchmarks</a> · <a href="#the-autonomous-wiki">Wiki</a> · <a href="#architecture">Architecture</a> </p> <p align="center"> <strong>Part of a four-piece stack</strong> — each runs standalone; together they cover what an agent forgets, can't see, and can't verify. <a href="#the-rest-of-the-stack">Full comparison ↓</a><br> <a href="https://github.com/cdeust/ai-architect-mcp-codebase">ai-architect-mcp-codebase</a> — the repo as a queryable code graph (callers, blast radius, execution paths), so agents stop re-reading files; Cortex ingests it via <code>ingest_codebase</code> / <code>change_impact</code><br> <a href="https://github.com/cdeust/ai-architect-mcp-spec">ai-architect-mcp-spec</a> — <em>verifies</em> a spec rather than only generating one; standalone, or a CI gate over spec-kit / Kiro / BMAD output<br> <a href="https://github.com/cdeust/zetetic-team-subagents">zetetic-team-subagents</a> — 97 sourced reasoning patterns as specialist agents, each with its own scoped Cortex memory<br> <a href="https://github.com/cdeust/cortex-viz">hypermnesia-mcp-viz</a> — read-only visualization MCP (galaxy graph, execution trace, wiki browser) over this same store · <a href="https://github.com/cdeust/cortex-know-when-to-stop-training-model">cortex-beam-abstain</a> — retrieval abstention model for RAG </p> <p align="center"> <sub><em><strong>Independent project:</strong> Cortex is an independent, open-source project. It is <strong>not an Anthropic product</strong> and is not affiliated with, sponsored by, or endorsed by Anthropic.</em></sub> </p>

Your coding agent forgets you every time you close the session. Every architecture decision you explained. Every debugging session where you traced a bug through four layers of abstraction. Every "remember, we decided to use event sourcing, not CRUD" correction. Gone. Next session, your agent is a stranger to its own tools.

Cortex is a cross-platform persistent memory engine for AI coding agents, built on computational neuroscience. Codex, Gemini CLI, Claude Code, and any local stdio MCP host can use the same remember/recall, knowledge-graph, consolidation, and wiki tools. Claude Code's plugin adds automatic capture and injection hooks; other hosts use the same memory through explicit tool calls.

It runs entirely on your machine — a local SQLite database by default (zero setup, no services to install), or PostgreSQL + pgvector when you want it. A 22 MB embedding model, no LLM in the retrieval loop, no data leaving localhost.

36 neuroscience mechanisms · 52 memory tools · 9 lifecycle hooks · a self-curating, continuously-groomed per-project wiki — all local, all open-source.


Getting Started

Cortex ships as a single-click MCP bundle (.mcpb). Download the latest hypermnesia-mcp.mcpb from Releases, then open it in Claude Desktop — Settings → Extensions installs it in one click.

It runs immediately on the built-in SQLite backend: zero configuration, no database to provision, nothing to set up. Memory persists to a local file under ~/.claude/methodology/. That's the whole install.

Claude Cowork works the same zero-setup way: the sandboxed environment is detected automatically (CLAUDE_ENVIRONMENT=cowork) and Cortex uses the local SQLite store — no PostgreSQL required.

Want PostgreSQL + pgvector instead (for very large stores or a shared team database)? It's a single configuration field — see Configuration below. SQLite is the default; PostgreSQL is opt-in.

Claude Code plugin (marketplace):

claude plugin marketplace add cdeust/Cortex
claude plugin install hypermnesia-mcp

Upgrading from the cortex plugin? The plugin was renamed hypermnesia-mcp in v4.15.0 (a community-directory name collision with an unrelated cortex plugin): claude plugin uninstall cortex && claude plugin install hypermnesia-mcp — your memories and configuration are untouched, storage paths do not change.

Upgrading from cortex-viz@cortex-plugins? Its Claude Code marketplace identity was renamed to hypermnesia-mcp-viz, first published in cortex-viz v3.1.0 (the rename commit itself was never tagged as v3.0.0 — that version number was pinned here for six days without a matching release; see cortex-viz's CHANGELOG). Run claude plugin uninstall cortex-viz@cortex-plugins, then claude plugin marketplace update cortex-plugins, then claude plugin install hypermnesia-mcp-viz@cortex-plugins. The retained cortex-viz@cortex-plugins item is a frozen, nonfunctional migration shim: it only prints this notice and exposes no MCP server or tools. The repository remains cdeust/cortex-viz; only its marketplace plugin identity changed.

Claude tool allowlists, hooks, skills, and agents must migrate both composed names: mcp__plugin_cortex-viz_cortex-viz__open_visualization becomes mcp__plugin_hypermnesia-mcp-viz_hypermnesia-mcp-viz__open_visualization, and mcp__plugin_cortex-viz_cortex-viz__get_methodology_graph becomes mcp__plugin_hypermnesia-mcp-viz_hypermnesia-mcp-viz__get_methodology_graph.

That is the whole install — zero configuration, no PostgreSQL, no system packages. The postInstall provisions Python dependencies and selects the local SQLite store (~/.claude/methodology/memory.db); the store schema auto-creates on first use. The embedding model is not downloaded at install time — it fetches lazily on first use (~100 MB, one-time; see PRIVACY.md) and runs fully offline afterwards. The plugin path registers all lifecycle hooks (session-start context injection, per-prompt auto-recall, auto-capture, compaction checkpointing, the autonomous wiki cycle) and the /cortex-setup-project command.

An existing PostgreSQL install is never downgraded: the installer detects a configured DATABASE_URL, a prior PostgreSQL backend marker, or a reachable local cortex database and keeps using it across plugin updates.

Upgrading the plugin to PostgreSQL (optional):

bash <plugin-dir>/scripts/install-plugin.sh --postgres   # <plugin-dir> = the installed plugin root

In one line: PostgreSQL adds connection-pooled concurrency (two psycopg_pool latency classes), server-side PL/pgSQL WRRF fusion, and pgvector HNSW ANN indexing — worth it for very large stores or a shared team database (see Under the Hood); the memory tools and retrieval contract are identical on both backends. After upgrading, run /cortex-setup-project once — it handles pgvector setup, database creation, the embedding-model pre-cache, profile building, codebase seeding, and hook registration.

What SQLite mode does not do (honest disclosure): the WRRF fusion runs in-process instead of server-side, without HNSW ANN indexing (fine at personal-store scale, slower at very large scale); and three PostgreSQL-only hook enrichments degrade to silent no-ops — cross-agent team-decision injection (agent_briefing, plus the banner's Team Decisions section), file-based preemptive context (preemptive_context), and pipeline symbol heat-bumps (pipeline_impact_bump). Session-start banners, auto-recall injection, auto-capture, checkpoints, and all 52 memory tools work on both backends.

Verify any install:

python3 -m mcp_server.doctor

The check list is backend-aware: on SQLite it verifies Python, the store opens, a writable methodology dir, and the pool-capacity invariant; on PostgreSQL it additionally checks the PG driver, DATABASE_URL, connection, and extensions. Exit 0 means ready.

<details> <summary><strong>More options</strong> (Clone, Docker, PyPI)</summary>

Clone + setup script:

git clone https://github.com/cdeust/Cortex.git && cd Cortex
bash scripts/setup.sh        # macOS / Linux
python3 scripts/setup.py     # Windows / cross-platform

Docker:

git clone https://github.com/cdeust/Cortex.git && cd Cortex
docker build -t cortex-runtime -f docker/Dockerfile .
docker run -it \
  -v $(pwd):/workspace \
  -v cortex-pgdata:/var/lib/postgresql/17/data \
  -v ~/.claude:/home/cortex/.claude-host:ro \
  cortex-runtime

PyPI (uvx / pip) — best-effort hook-free compatibility:

uvx hypermnesia-mcp          # run the MCP server directly
pip install hypermnesia-mcp  # or install into your environment

The server is published on PyPI as hypermnesia-mcp (registry name io.github.cdeust/hypermnesia-mcp). Claude Code remains the primary integration because it adds the lifecycle hooks; PyPI is the best-effort hook-free stdio compatibility channel for Gemini CLI, Codex CLI, and other MCP hosts.

WSL / TLS client-cert / remote PostgreSQL: See deployment scenarios.

</details>

Use with other MCP hosts

The MCP server is host-agnostic: any host that can launch a stdio process gets the full tool surface — remember, recall, the wiki, navigation, consolidation, all 52 tools — on the default local SQLite store. What is not portable are the 9 lifecycle hooks, which are Claude Code plugin machinery. The server itself does not import or require those hooks at startup.

What works where (honest matrix):

CapabilityClaude Code pluginLocal stdio hosts (Gemini CLI, Codex CLI, ChatGPT desktop, Cursor, Windsurf, VS Code, Agents SDK)ChatGPT web
All 52 memory tools (remember, recall, wiki, navigation, consolidation, triggers, rules)❌ — Cortex does not ship a remote HTTPS endpoint
SQLite default store / PostgreSQL opt-in❌ — a remote deployment and per-user storage/auth model would be required
Auto-capture of significant tool output✅ (PostToolUse hook)❌ — store explicitly with remember
Session-start context injection✅ (SessionStart hook)❌ — call recall yourself
Per-prompt auto-recall
Compaction checkpoints
Autonomous wiki cycle (headless worker)❌ — run consolidate / curate_wiki manually
Cognitive profiling (query_methodology)⚠️ profiles are mined from Claude Code session logs under ~/.claude/; without them the profile is empty

View source on GitHub