Claude Cortex Core
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Claude Cortex Core
Claude Cortex Core is a minimal, production-ready MCP (Model Context Protocol) server that gives Claude Code persistent brain-like memory. It's a stripped-down fork of claude-cortex that removes all non-essential subsystems while preserving the complete remember/recall/forget/consolidate pipeline.
Key Stats
Dependencies: 3 production deps (down from 7)
@modelcontextprotocol/sdk- MCP protocolbetter-sqlite3- Databasezod- Schema validation
Size: 75MB node_modules (down from ~150MB+)
Code: 4,748 lines across 15 source files
Attack Surface: Zero network connections, no HTTP server, no external model downloads
Tools: 15 MCP tools for memory operations
Related MCP server: claude-memory
What Was Removed
❌ Dashboard (Next.js + Three.js 3D brain visualization)
❌ API server (Express + WebSocket)
❌ Embeddings (@huggingface/transformers semantic search)
❌ Spreading activation (ephemeral session state)
❌ Contradiction detection (active analysis)
❌ Brain worker (background tick processing)
❌ Service installer (auto-start system)
✅ Hook scripts (SessionStart, PreCompact) - Now re-added as optional feature
The original claude-cortex had two hooks that provided automatic saving. These have been re-implemented in claude-cortex-core as standalone executables that maintain the minimal philosophy.
These are completely optional and can be enabled by configuring Claude Code hooks. See the "Automated Memory Hooks" section below for setup instructions.
What Stays
✅ Complete Memory Pipeline
✅ FTS5 full-text search (SQLite built-in)
✅ Temporal decay with reinforcement
✅ Automatic salience detection
✅ STM → LTM consolidation
✅ Project auto-scoping
✅ Memory relationships (links)
✅ Enrichment (context accumulation)
✅ Hebbian learning (co-access strengthening)
Intended workflow
Proactive Manual Saving:
After making a decision → remember({ title: "...", content: "..." })
After fixing a bug → remember({ title: "...", content: "..." })
After learning something → remember({ title: "...", content: "..." })
At session start → get_context() to restore context
The trade-off is: more control, less magic. You decide what's worth remembering, rather than relying on automatic heuristics.
Installation & Setup
# Clone or download the repository
git clone https://github.com/michaelv2/claude-cortex-core.git
cd claude-cortex-core
# Install dependencies
npm install
# Build the project
npm run build
# Add MCP server to Claude Code (use absolute path)
claude mcp add memory node $(pwd)/dist/index.js
# Verify it's connected
claude mcp list
# Should show: memory: ... - ✓ ConnectedImportant: Use the claude mcp add command rather than manually editing config files. Claude Code stores MCP servers in ~/.claude.json and the CLI command ensures proper registration.
Automated Memory Hooks (Optional)
Claude Cortex Core now includes optional automated memory hooks that were inspired by the original claude-cortex. These hooks can automatically extract and restore memories without manual tool calls.
Available Hooks
1. PreCompact Hook
Automatically extracts memories before context compaction:
Scans conversation for high-salience content
Auto-extracts decisions, fixes, learnings, patterns
Saves up to 5 memories per compaction
Tags with "auto-extracted"
2. SessionStart Hook
Automatically restores context at session start:
Loads project-specific context
Shows architecture decisions, patterns, preferences
Displays up to 15 high-salience memories
Setup
Build the project (hooks are compiled with the main server):
npm run buildAdd the MCP server (if not already done):
claude mcp add memory node $(pwd)/dist/index.jsConfigure hooks in Claude Code by editing
~/.claude/settings.json:
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "node /path/to/claude-cortex-core/dist/bin/session-start.js"
}
]
}
],
"PreCompact": [
{
"hooks": [
{
"type": "command",
"command": "node /path/to/claude-cortex-core/dist/bin/pre-compact.js"
}
]
}
]
}
}Note: Replace /path/to/claude-cortex-core with your actual installation path. The MCP server should be added using claude mcp add (step 2), not manually in settings.json.
Optional: Customize hook behavior (
~/.claude-cortex/hooks.json):
{
"preCompact": {
"enabled": true,
"minSalience": 0.30,
"maxMemoriesPerCompact": 5,
"categories": ["architecture", "pattern", "error", "learning"],
"autoTag": "auto-extracted",
"timeout": 5000
},
"sessionStart": {
"enabled": true,
"maxMemories": 15,
"minSalience": 0.5,
"categories": ["architecture", "pattern", "preference"],
"format": "summary",
"timeout": 3000
}
}Copy hooks.json.example to ~/.claude-cortex/hooks.json as a starting point.
Hook Configuration Options
PreCompact Hook:
enabled- Enable/disable the hook (default: true)minSalience- Minimum importance threshold (default: 0.30)maxMemoriesPerCompact- Max memories to save per compaction (default: 5)categories- Which categories to auto-extract (default: architecture, pattern, error, learning)autoTag- Tag added to auto-extracted memories (default: "auto-extracted")timeout- Max processing time in ms (default: 5000)
SessionStart Hook:
enabled- Enable/disable the hook (default: true)maxMemories- Max context items to load (default: 15)minSalience- Minimum importance threshold (default: 0.5)categories- Which categories to include (default: architecture, pattern, preference)format- Output format: "summary", "detailed", or "minimal" (default: "summary")timeout- Max processing time in ms (default: 3000)
Benefits & Trade-offs
Benefits:
Automatic memory saving without manual
remember()callsContext automatically restored at session start
Configurable behavior per project
Fail-safe: Hook failures never break Claude Code
Trade-offs:
Pattern matching may extract false positives
Adds 1-3s latency to compaction
Requires Claude Code hooks support
Less control vs manual saving
Disabling Hooks
To disable without removing from Claude Code config, set enabled: false in ~/.claude-cortex/hooks.json:
{
"preCompact": { "enabled": false },
"sessionStart": { "enabled": false }
}Or remove the hooks section from ~/.claude/settings.json entirely.
Troubleshooting
MCP Server Not Connecting
If you see "No MCP servers configured" after setup:
Verify the server was added correctly:
claude mcp list
# Should show: memory: ... - ✓ ConnectedIf not listed, add it using the CLI (don't edit config files manually):
cd /path/to/claude-cortex-core
claude mcp add memory node $(pwd)/dist/index.jsCheck server health:
claude mcp get memory
# Should show: Status: ✓ ConnectedTest server manually:
cd /path/to/claude-cortex-core
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}' | node dist/index.js
# Should return JSON response with server infoRebuild if needed:
npm run build
claude mcp remove memory
claude mcp add memory node $(pwd)/dist/index.jsCommon Issues
"No MCP server found": Use
claude mcp addinstead of manually editing config filesServer not in list: MCP servers are stored in
~/.claude.json(project-specific) or global config, not~/.claude/settings.jsonBuild errors: Ensure you have Node.js ≥18.0.0 and ran
npm installPermission denied: Make sure
dist/index.jsis readable (chmod +r dist/index.js)
Usage Examples
Basic Memory Operations
# Store a memory
remember({
title: "Authentication uses JWT tokens",
content: "The auth system uses JWT tokens with 24h expiry. Refresh tokens stored in httpOnly cookies.",
category: "architecture",
importance: "high"
})
# Search memories
recall({
query: "authentication",
limit: 5
})
# Get context at session start
get_context({
query: "What was I working on?"
})
# Delete old memories
forget({
olderThan: 30, // days
dryRun: true // preview first
})
# Run consolidation (like brain sleep)
consolidate({
dryRun: false
})
# View statistics
memory_stats()Project Scoping
Memories are automatically scoped to the project detected from process.cwd():
# Current project
get_project()
# → "claude-cortex-core" (detected from /path/to/claude-cortex-core)
# Switch to global scope
set_project({ project: "*" })
# Recall across all projects
recall({
query: "typescript patterns",
project: "*"
})Advanced Features
Memory Links - Automatically detected relationships:
# View related memories
get_related({ id: 42 })
# Manually create a link
link_memories({
sourceId: 42,
targetId: 87,
relationship: "references",
strength: 0.8
})Sessions - Track work periods:
start_session({ project: "my-app" })
# → Returns session ID + context summary
# ... do work, create memories ...
end_session({
sessionId: 123,
summary: "Implemented user authentication"
})
# → Triggers consolidationExport/Import - Backup or transfer:
# Export
export_memories({ project: "my-app" })
# → Returns JSON
# Import
import_memories({ data: "[...]" })How It Works
Memory Types
Short-term (STM) - Recent, working memories (max 250)
Long-term (LTM) - Consolidated, important memories (max 5000)
Episodic - Session markers and timestamps
Categories
architecture, pattern, preference, error, context, learning, todo, note, relationship, custom
Salience (Importance)
Auto-calculated from content (0.0 - 1.0)
Based on: explicit requests, architecture keywords, error patterns, code references, emotional markers
Reinforced on access with diminishing returns
Temporal Decay
Memories fade over time (exponential decay)
LTM decays slower than STM (daily vs hourly)
Access count slows decay (up to 30% slower)
Category-specific deletion thresholds (architecture harder to delete)
Consolidation
Runs automatically every 4 hours + on server startup:
Promotes high-salience STM → LTM
Deletes decayed memories below threshold
Enforces memory limits (250 STM, 5000 LTM)
Updates decay scores
Boosts hub memories (highly linked)
Search
FTS5 full-text search with relevance scoring:
Keyword match (30%)
Decay score (25%)
Priority score (10%)
Recency boost (0-10%)
Category match (0-10%)
Link boost (0-15%)
Tag match (0-10%)
Top 5 results are automatically reinforced.
Database Location
~/.claude-cortex/memories.db (SQLite with WAL mode)
Legacy path ~/.claude-memory/ still works for backward compatibility.
Tables
memories- Core memory storagememories_fts- Full-text search index (FTS5)sessions- Session trackingmemory_links- Relationships between memories
Anti-Bloat Safeguards
10KB per-memory content limit (with truncation warning)
100MB database hard limit
Auto-consolidation every 4 hours
Auto-vacuum after deletions
250 STM / 5000 LTM enforced limits
Development
# Watch mode
npm run dev
# Build
npm run build
# Custom database path
node dist/index.js --db /path/to/custom.dbKey Differences from Original
Feature | claude-cortex | claude-cortex-core |
Dependencies | 7 prod | 3 prod |
node_modules | ~150MB+ | 75MB |
Network | HTTP/WS server | None |
Embeddings | Yes (100MB+) | No (FTS5 only) |
Dashboard | 3D visualization | None |
Attack surface | High | Minimal |
Startup time | ~3-5s | <1s |
Complexity | High | Low |
When to Use Which
Use claude-cortex-core if:
You want minimal dependencies
You don't need a dashboard
You trust FTS5 keyword search
You want fast startup
You're deploying in production
Use claude-cortex if:
You want semantic search (embeddings)
You want the 3D brain visualization
You want the dashboard API
You're exploring/experimenting
Notes
All 15 MCP tools work identically to the original
Existing databases are compatible (unused columns ignored)
Project auto-detection works the same way
Memory format is unchanged
No breaking changes to the MCP interface
The system is production-ready and optimized for speed, simplicity, and security.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Persistent AI memory shared across Claude, ChatGPT, coding agents, and compatible MCP clients.
Persistent memory for Claude Code and Cursor. Stop re-explaining your project every session.
Persistent memory for AI agents across Claude, ChatGPT and any MCP client.
Private persistent memory for Claude, ChatGPT & Gemini via MCP - semantic search, zero-code setup.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides persistent, searchable memory for Claude Code using local SQLite, semantic embeddings, and full-text search, enabling Claude to recall and retrieve context across sessions and projects without external services.4MIT
- FlicenseNot gradedqualityDmaintenanceProvides memory and project tracking for Claude Code via MCP, enabling semantic search over past transcripts, durable notes, and structured project management with milestones, epics, tickets, and todos.-
- AlicenseNot gradedqualityAmaintenanceEnables Claude Code to retain identity, memories, and behavioral frameworks across sessions — saving facts and decisions for later semantic search, detecting and classifying user corrections, and evolving learned frameworks over time. Everything runs locally through a SQLite-backed engine with 15 MCP tools plus hooks, requiring no cloud service or API key.6 npmMIT
- AlicenseNot gradedqualityAmaintenanceGives Claude Code persistent cross-session memory with semantic search over facts, decisions, and lessons, plus automatic tracking of user corrections and behavioral patterns. Enables a Claude that evolves reusable frameworks over time — promoting what works and retiring what doesn't — all locally through MCP tools and hooks.6 npmMIT