
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
claude-cortex
Advanced tools
Brain-like memory system for Claude Code - solves context compaction and memory persistence
Brain-like memory system for Claude Code — Solves context compaction and memory persistence.
Claude Code forgets everything when context compacts or sessions end. Cortex fixes that with automatic memory extraction, temporal decay, and consolidation — like a human brain.
# Step 1: Install
npm install -g claude-cortex
# Step 2: Configure hooks + Claude Code (REQUIRED — this makes memory automatic)
npx claude-cortex setup
# Step 3: Restart Claude Code and approve the MCP server when prompted
That's it. Cortex now automatically:
You don't need to manually "remember" anything. The hooks handle it.
Verify your install: Run
npx claude-cortex doctorto check everything is configured correctly.
When you run npx claude-cortex setup, three hooks are installed:
| Hook | Fires When | What It Does |
|---|---|---|
| SessionStart | Session begins | Loads project context from memory |
| PreCompact | Before context compaction | Extracts important content before it's lost |
| SessionEnd | Session exits | Saves decisions, fixes, and learnings |
What gets auto-extracted:
Cortex doesn't just store text — it thinks like a brain:
Not everything is worth remembering. The system scores content automatically:
| Factor | Weight | Example |
|---|---|---|
| Explicit request | 1.0 | "Remember this" |
| Architecture decision | 0.9 | "We're using microservices" |
| Error resolution | 0.8 | "Fixed by updating X" |
| Code pattern | 0.7 | "Use this approach for auth" |
| User preference | 0.7 | "Always use strict mode" |
Like human memory, unused memories fade:
score = base_salience × (0.995 ^ hours_since_access)
Each access boosts the score by 1.2×. Frequently accessed short-term memories consolidate into long-term storage.
Cortex provides these MCP tools to Claude Code:
| Tool | Description |
|---|---|
remember | Manually store a memory (optional — hooks do this automatically) |
recall | Search memories by query, category, or tags |
forget | Delete memories (with safety confirmations) |
get_context | Get relevant project context — key after compaction |
start_session / end_session | Session lifecycle management |
consolidate | Manually trigger memory consolidation |
memory_stats | View memory statistics |
export_memories / import_memories | Backup and restore |
| Resource | Description |
|---|---|
memory://context | Current memory context summary |
memory://important | High-priority memories |
memory://recent | Recently accessed memories |
Cortex includes a visual dashboard with a knowledge graph, memory cards, insights, and a 3D brain view.
# Start the dashboard
npx claude-cortex --dashboard
npx claude-cortex service install # Enable
npx claude-cortex service uninstall # Disable
npx claude-cortex service status # Check
Works on macOS (launchd), Linux (systemd), and Windows (Startup folder).
| Color | Category |
|---|---|
| Blue | Architecture |
| Purple | Pattern |
| Green | Preference |
| Red | Error |
| Yellow | Learning |
| Cyan | Context |
npx claude-cortex setup # Configure Claude Code + hooks + Clawdbot
npx claude-cortex setup --with-stop-hook # Also install real-time Stop hook
npx claude-cortex doctor # Check installation health
npx claude-cortex --dashboard # Start dashboard + API
npx claude-cortex --version # Show version
npx claude-cortex hook pre-compact # Run hook manually
npx claude-cortex hook session-start
npx claude-cortex hook session-end
npx claude-cortex hook stop
npx claude-cortex service install # Auto-start dashboard on login
npx claude-cortex graph backfill # Extract entities from existing memories
npx claude-cortex clawdbot install # Install Clawdbot/Moltbot hook
npx claude-cortex clawdbot status # Check Clawdbot hook status
Create .mcp.json in your project directory:
{
"mcpServers": {
"memory": {
"type": "stdio",
"command": "npx",
"args": ["-y", "claude-cortex"]
}
}
}
For global config, create ~/.claude/.mcp.json with the same content.
git clone https://github.com/mkdelta221/claude-cortex.git
cd claude-cortex
npm install
npm run build
If you prefer to configure hooks manually instead of using npx claude-cortex setup, add to ~/.claude/settings.json:
{
"hooks": {
"PreCompact": [
{
"hooks": [
{
"type": "command",
"command": "npx -y claude-cortex hook pre-compact",
"timeout": 10
}
]
}
],
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "npx -y claude-cortex hook session-start",
"timeout": 5
}
]
}
],
"SessionEnd": [
{
"hooks": [
{
"type": "command",
"command": "npx -y claude-cortex hook session-end",
"timeout": 10
}
]
}
]
}
}
Default: ~/.claude-cortex/memories.db
npx claude-cortex --db /path/to/custom.db
Or in MCP config:
{
"mcpServers": {
"memory": {
"command": "node",
"args": ["/path/to/dist/index.js", "--db", "/path/to/custom.db"]
}
}
}
| Variable | Default | Description |
|---|---|---|
PORT | 3001 | API server port |
CORTEX_CORS_ORIGINS | localhost:3030,localhost:3000 | Comma-separated allowed CORS origins |
CORTEX_GRAPH_EXTRACTION | pattern | Entity extraction mode (currently only pattern) |
In src/memory/types.ts:
export const DEFAULT_CONFIG = {
decayRate: 0.995, // Per-hour decay factor
reinforcementFactor: 1.2, // Access boost
salienceThreshold: 0.3, // Min score to keep
consolidationThreshold: 0.6, // Min for STM→LTM
maxShortTermMemories: 100,
maxLongTermMemories: 1000,
autoConsolidateHours: 4,
};
Cortex works with Clawdbot and Moltbot via mcporter.
# Automatic (recommended)
npx claude-cortex clawdbot install
# Or: npx claude-cortex setup (auto-detects Clawdbot/Moltbot)
The cortex-memory hook provides:
/new — Extracts decisions, fixes, learnings from ending sessionsnpx mcporter call --stdio "npx -y claude-cortex" remember title:"API uses JWT" content:"Auth uses JWT with 15-min expiry"
npx mcporter call --stdio "npx -y claude-cortex" recall query:"authentication"
npx mcporter call --stdio "npx -y claude-cortex" get_context
Memories are shared between Claude Code and Clawdbot — same SQLite database.
Claude Cortex automatically extracts entities (tools, languages, files, concepts, people) and relationships from your memories, building a knowledge graph you can query.
| Tool | Description |
|---|---|
graph_query | Traverse from an entity — returns connected entities up to N hops |
graph_entities | List known entities, filter by type |
graph_explain | Find paths between two entities with source memories |
npx claude-cortex graph backfill
Extracts entities and relationships from all existing memories. Safe to run multiple times.
GET /api/graph/entities — List entities (filterable by type)
GET /api/graph/entities/:id/triples — Triples for an entity
GET /api/graph/triples — All triples (with pagination)
GET /api/graph/search?q=auth — Search entities by name
GET /api/graph/paths?from=X&to=Y — Shortest path between entities
| Feature | Claude Cortex | Other MCP Memory Tools |
|---|---|---|
| Automatic extraction | ✅ Hooks save context for you | ❌ Manual only |
| Salience detection | ✅ Auto-detects importance | ❌ Everything is equal |
| Temporal decay | ✅ Memories fade naturally | ❌ Static storage |
| Consolidation | ✅ STM → LTM promotion | ❌ Flat storage |
| Context injection | ✅ Auto-loads on session start | ❌ Manual recall |
| Knowledge graph | ✅ Visual dashboard | ❌ Usually missing |
Cortex isn't remembering anything automatically
→ Did you run npx claude-cortex setup? This installs the hooks that make memory automatic. Run npx claude-cortex doctor to verify.
Dashboard doesn't load
→ Run npx claude-cortex doctor to check status. The dashboard requires a one-time build — if it fails, try cd $(npm root -g)/claude-cortex/dashboard && npm install && npm run build.
Memories show 0 in the dashboard
→ Memories are created during compaction and session events. Use Claude Code for a while — memories build up naturally over time. You can also manually save with the remember tool.
"No cortex entry found in .mcp.json"
→ Create .mcp.json in your project root (see Advanced Configuration) or run npx claude-cortex setup to configure automatically.
If you find this project useful, consider supporting its development:
MIT
FAQs
Brain-like memory system for Claude Code - solves context compaction and memory persistence
We found that claude-cortex demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.