Server data from the Official MCP Registry
Temporal memory for AI with decay and reinforcement. Two-layer storage (JSONL + Markdown).
Temporal memory for AI with decay and reinforcement. Two-layer storage (JSONL + Markdown).
Valid MCP server (2 strong, 1 medium validity signals). 4 known CVEs in dependencies (0 critical, 3 high severity) ⚠️ Package registry links to a different repository than scanned source. Imported from the Official MCP Registry.
6 files analyzed · 5 issues found
Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.
This plugin requests these system permissions. Most are normal for its category.
Set these up before or after installing:
Environment variable: MNEMEX_STORAGE_PATH
Environment variable: LTM_VAULT_PATH
Environment variable: MNEMEX_DECAY_MODEL
Environment variable: MNEMEX_PL_HALFLIFE_DAYS
Add this to your MCP configuration file:
{
"mcpServers": {
"io-github-simplemindedbot-mnemex": {
"env": {
"LTM_VAULT_PATH": "your-ltm-vault-path-here",
"MNEMEX_DECAY_MODEL": "your-mnemex-decay-model-here",
"MNEMEX_STORAGE_PATH": "your-mnemex-storage-path-here",
"MNEMEX_PL_HALFLIFE_DAYS": "your-mnemex-pl-halflife-days-here"
},
"args": [
"cortexgraph"
],
"command": "uvx"
}
}
}From the project's GitHub README.
A Model Context Protocol (MCP) server providing human-like memory dynamics for AI assistants. Memories naturally fade over time unless reinforced through use, mimicking the Ebbinghaus forgetting curve.
[!NOTE] About the Name & Version
This project was originally developed as mnemex (published to PyPI up to v0.6.0). In November 2025, it was transferred to Prefrontal Systems and renamed to CortexGraph to better reflect its role within a broader cognitive architecture for AI systems.
Version numbering starts at 0.1.0 for the cortexgraph package to signal a fresh start under the new name, while acknowledging the mature, well-tested codebase (791 tests, 98%+ coverage) inherited from mnemex. The mnemex package remains frozen at v0.6.0 on PyPI.
This versioning approach:
- Signals "new package" to PyPI users discovering cortexgraph
- Gives room to evolve the brand, API, and organizational integration before 1.0
- Maintains continuity: users can migrate from
pip install mnemex→pip install cortexgraph- Reflects that while the code is mature, the cortexgraph identity is just beginning
[!IMPORTANT] 🔬 RESEARCH ARTIFACT - NOT FOR PRODUCTION
This software is a Proof of Concept (PoC) and reference implementation for research purposes. It exists to validate theoretical frameworks in cognitive architecture and AI safety (specifically the STOPPER Protocol and CortexGraph).
It is NOT a commercial product. It is not maintained for general production use, may contain breaking changes, and offers no guarantees of stability or support. Use it to study the concepts, but build your own production implementations.
📖 New to this project? Start with the ELI5 Guide for a simple explanation of what this does and how to use it.
CortexGraph gives AI assistants like Claude a human-like memory system.
When you chat with Claude, it forgets everything between conversations. You tell it "I prefer TypeScript" or "I'm allergic to peanuts," and three days later, you have to repeat yourself. This is frustrating and wastes time.
CortexGraph makes AI assistants remember things naturally, just like human memory:
No flashcards. No explicit review. Just natural conversation.
Most memory systems are dumb:
CortexGraph is smart:
This repository contains research, design, and a complete implementation of a short-term memory system that combines:
CortexGraph follows a modular architecture:
cortexgraph.core: Foundational algorithms (decay, similarity, clustering, consolidation, search validation)cortexgraph.agents: Multi-agent consolidation pipeline and storage utilitiescortexgraph.storage: JSONL and SQLite storage backends with batch operationscortexgraph.tools: MCP tool implementationsAll data stored locally on your machine - no cloud services, no tracking, no data sharing.
Short-term memory:
~/.config/cortexgraph/jsonl/)~/.config/cortexgraph/cortexgraph.db)Long-term memory: Markdown files optimized for Obsidian
Export: Built-in utility to export memories to Markdown for portability.
You own your data. You can read it, edit it, delete it, or version control it - all without any special tools.
The temporal decay scoring function:
$$ \Large \text{score}(t) = (n_{\text{use}})^\beta \cdot e^{-\lambda \cdot \Delta t} \cdot s $$
Where:
Thresholds:
Decay Models:
See detailed parameter reference, model selection, and worked examples in docs/scoring_algorithm.md.
Decision thresholds:
Unlike traditional caching (TTL, LRU), Mnemex scores memories continuously by combining recency (exponential decay), frequency (sub-linear use count), and importance (adjustable strength). See Core Algorithm for the mathematical formula. This creates memory dynamics that closely mimic human cognition.
Patterns for making AI assistants use memory naturally, now enhanced with automatic entity extraction and importance scoring:
Auto-Enrichment (NEW in v0.6.0)
When you save memories, CortexGraph automatically:
# Before v0.6.0 - manual entity specification
save_memory(content="Use JWT for auth", entities=["JWT", "auth"])
# v0.6.0+ - automatic extraction
save_memory(content="Use JWT for auth")
# Entities auto-extracted: ["jwt", "auth"]
# Strength auto-calculated based on content
Auto-Save
User: "Remember: I prefer TypeScript over JavaScript"
→ Detected save phrase: "Remember"
→ Automatically saved with:
- Entities: [typescript, javascript]
- Strength: 1.5 (importance marker detected)
- Tags: [preferences, programming]
Auto-Recall
User: "What did I say about TypeScript?"
→ Detected recall phrase: "what did I say about"
→ Automatically searches for TypeScript memories
→ Retrieves preferences and conventions
Auto-Reinforce
User: "Yes, still using TypeScript"
→ Memory strength increased, decay slowed
Decision Support Tools (v0.6.0+)
Two new tools help Claude decide when to save/recall:
analyze_message - Detects memory-worthy content, suggests entities and strengthanalyze_for_recall - Detects recall intent, suggests search queriesNo explicit memory commands needed - just natural conversation.
Inspired by how concepts naturally reinforce across different contexts (the "Maslow effect" - remembering Maslow's hierarchy better when it appears in history, economics, and sociology classes).
No flashcards. No explicit review sessions. Just natural conversation.
How it works:
Usage pattern:
User: "Can you help with authentication in my API?"
→ System searches, retrieves JWT preference memory
→ System uses memory to answer question
→ System calls observe_memory_usage with context tags [api, auth, backend]
→ Cross-domain usage detected (original tags: [security, jwt, preferences])
→ Memory automatically reinforced, strength boosted
→ Next search naturally surfaces memories needing review
Configuration:
CORTEXGRAPH_REVIEW_BLEND_RATIO=0.3 # 30% review candidates in search
CORTEXGRAPH_REVIEW_DANGER_ZONE_MIN=0.15 # Lower bound of danger zone
CORTEXGRAPH_REVIEW_DANGER_ZONE_MAX=0.35 # Upper bound of danger zone
CORTEXGRAPH_AUTO_REINFORCE=true # Auto-reinforce on observe
See docs/prompts/ for LLM system prompt templates that enable natural memory usage.
graph TD
STM["<b>Short-Term Memory</b><br/>- JSONL storage<br/>- Temporal decay<br/>- Hours to weeks retention"]
LTM["<b>LTM (Long-Term Memory)</b><br/>- Markdown files Obsidian<br/>- Permanent storage<br/>- Git version control"]
STM -->|Automatic promotion| LTM
style STM fill:#e1f5ff,stroke:#01579b,stroke-width:2px
style LTM fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
Automated memory maintenance through five specialized agents:
graph LR
decay["<b>DecayAnalyzer</b><br/>Find at-risk<br/>memories"]
cluster["<b>ClusterDetector</b><br/>Find similar<br/>groups"]
merge["<b>SemanticMerge</b><br/>Combine<br/>similar groups"]
promote["<b>LTMPromoter</b><br/>Promote<br/>to LTM"]
relations["<b>RelationshipDiscovery</b><br/>Discover cross-<br/>domain links"]
decay --> cluster
cluster --> merge
merge --> promote
promote --> relations
relations -.->|feedback| decay
style decay fill:#ffebee,stroke:#b71c1c,stroke-width:2px
style cluster fill:#fff3e0,stroke:#e65100,stroke-width:2px
style merge fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
style promote fill:#e8f5e9,stroke:#1b5e20,stroke-width:2px
style relations fill:#e1f5fe,stroke:#01579b,stroke-width:2px
The Five Agents:
| Agent | Purpose |
|---|---|
| DecayAnalyzer | Find memories at risk of being forgotten (danger zone: 0.15-0.35) |
| ClusterDetector | Group similar memories using embedding similarity |
| SemanticMerge | Intelligently combine clustered memories, preserving unique info |
| LTMPromoter | Move high-value memories to permanent Obsidian storage |
| RelationshipDiscovery | Find cross-domain connections via shared entities |
Key Features:
Usage:
from cortexgraph.agents import Scheduler
# Preview what would change (dry run)
scheduler = Scheduler(dry_run=True)
preview = scheduler.run_pipeline()
# Run full pipeline
scheduler = Scheduler(dry_run=False)
results = scheduler.run_pipeline()
# Run single agent
decay_results = scheduler.run_agent("decay")
CLI:
# Dry run (preview)
cortexgraph-consolidate --dry-run
# Run specific agent
cortexgraph-consolidate --agent decay --dry-run
# Scheduled execution (with interval)
cortexgraph-consolidate --scheduled --interval-hours 1
See docs/agents.md for complete documentation including configuration, beads integration, and troubleshooting.
Recommended: UV Tool Install (from PyPI)
# Install from PyPI (recommended - fast, isolated, includes all 7 CLI commands)
uv tool install cortexgraph
This installs cortexgraph and all 7 CLI commands in an isolated environment.
Alternative Installation Methods
# Using pipx (similar isolation to uv)
pipx install cortexgraph
# Using pip (traditional, installs in current environment)
pip install cortexgraph
# From GitHub (latest development version)
uv tool install git+https://github.com/simplemindedbot/cortexgraph.git
For Development (Editable Install)
# Clone and install in editable mode
git clone https://github.com/simplemindedbot/cortexgraph.git
cd cortexgraph
uv pip install -e ".[dev]"
IMPORTANT: Configuration location depends on installation method:
Method 1: .env file (Works for all installation methods)
Create ~/.config/cortexgraph/.env:
# Create config directory
mkdir -p ~/.config/cortexgraph
# Option A: Copy from cloned repo
cp .env.example ~/.config/cortexgraph/.env
# Option B: Download directly
curl -o ~/.config/cortexgraph/.env https://raw.githubusercontent.com/simplemindedbot/cortexgraph/main/.env.example
Edit ~/.config/cortexgraph/.env with your settings:
# Storage
CORTEXGRAPH_STORAGE_PATH=~/.config/cortexgraph/jsonl
# Decay model (power_law | exponential | two_component)
CORTEXGRAPH_DECAY_MODEL=power_law
# Power-law parameters (default model)
CORTEXGRAPH_PL_ALPHA=1.1
CORTEXGRAPH_PL_HALFLIFE_DAYS=3.0
# Exponential (if selected)
# CORTEXGRAPH_DECAY_LAMBDA=2.673e-6 # 3-day half-life
# Two-component (if selected)
# CORTEXGRAPH_TC_LAMBDA_FAST=1.603e-5 # ~12h
# CORTEXGRAPH_TC_LAMBDA_SLOW=1.147e-6 # ~7d
# CORTEXGRAPH_TC_WEIGHT_FAST=0.7
# Common parameters
CORTEXGRAPH_DECAY_LAMBDA=2.673e-6
CORTEXGRAPH_DECAY_BETA=0.6
# Thresholds
CORTEXGRAPH_FORGET_THRESHOLD=0.05
CORTEXGRAPH_PROMOTE_THRESHOLD=0.65
# Long-term memory (optional)
LTM_VAULT_PATH=~/Documents/Obsidian/Vault
Where cortexgraph looks for .env files:
~/.config/cortexgraph/.env ← Use this for uv tool install / uvx./.env (current directory) ← Only works for editable installsRecommended: Use absolute path (works everywhere)
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"cortexgraph": {
"command": "/Users/yourusername/.local/bin/cortexgraph"
}
}
}
Find your actual path:
which cortexgraph
# Example output: /Users/yourusername/.local/bin/cortexgraph
Use that path in your config. Replace yourusername with your actual username.
Why absolute path? GUI apps like Claude Desktop don't inherit your shell's PATH configuration (.zshrc, .bashrc). Using the full path ensures it always works.
For development (editable install):
{
"mcpServers": {
"cortexgraph": {
"command": "uv",
"args": ["--directory", "/path/to/cortexgraph", "run", "cortexgraph"],
"env": {"PYTHONPATH": "/path/to/cortexgraph/src"}
}
}
}
Configuration can be loaded from ./.env in the project directory OR ~/.config/cortexgraph/.env.
If Claude Desktop shows spawn cortexgraph ENOENT errors, the cortexgraph command isn't in Claude Desktop's PATH.
macOS/Linux: GUI apps don't inherit shell PATH
GUI applications on macOS and Linux don't see your shell's PATH configuration (.zshrc, .bashrc, etc.). Claude Desktop only searches:
/usr/local/bin/opt/homebrew/bin (macOS)/usr/bin/bin/usr/sbin/sbinIf uv tool install placed cortexgraph in ~/.local/bin/ or another custom location, Claude Desktop can't find it.
Solution: Use absolute path
# Find where cortexgraph is installed
which cortexgraph
# Example output: /Users/username/.local/bin/cortexgraph
Update your Claude config with the absolute path:
{
"mcpServers": {
"cortexgraph": {
"command": "/Users/username/.local/bin/cortexgraph"
}
}
}
Replace /Users/username/.local/bin/cortexgraph with your actual path from which cortexgraph.
Use the maintenance CLI to inspect and compact JSONL storage:
# Show storage stats (active counts, file sizes, compaction hints)
cortexgraph-maintenance stats
# Compact JSONL (rewrite without tombstones/duplicates)
cortexgraph-maintenance compact
If you're currently using an editable install (uv pip install -e .), you can switch to the simpler UV tool install:
# 1. Uninstall editable version
uv pip uninstall cortexgraph
# 2. Install as UV tool
uv tool install git+https://github.com/simplemindedbot/cortexgraph.git
# 3. Update Claude Desktop config to just:
# {"command": "cortexgraph"}
# Remove the --directory, run, and PYTHONPATH settings
Your data is safe! This only changes how the command is installed. Your memories in ~/.config/cortexgraph/ are untouched.
The server includes 7 command-line tools:
cortexgraph # Run MCP server
cortexgraph-migrate # Migrate from old STM setup
cortexgraph-index-ltm # Index Obsidian vault
cortexgraph-backup # Git backup operations
cortexgraph-vault # Vault markdown operations
cortexgraph-search # Unified STM+LTM search
cortexgraph-maintenance # JSONL storage stats and compaction
Interactive graph visualization using PyVis:
# Install visualization dependencies
pip install "cortexgraph[visualization]"
# or with uv
uv pip install "cortexgraph[visualization]"
# Or install dependencies manually
pip install pyvis networkx
# Generate interactive HTML visualization
python scripts/visualize_graph.py
# Custom output location
python scripts/visualize_graph.py --output ~/Desktop/memory_graph.html
# Custom data paths
python scripts/visualize_graph.py --memories ~/data/memories.jsonl --relations ~/data/relations.jsonl
Features:
The visualization reads directly from your JSONL files and creates a standalone HTML file you can open in any browser.
13 tools for AI assistants to manage memories:
| Tool | Purpose |
|---|---|
save_memory | Save new memory with tags, entities (auto-enrichment in v0.6.0+) |
search_memory | Search with filters and scoring (includes review candidates) |
search_unified | Unified search across STM + LTM |
touch_memory | Reinforce memory (boost strength) |
observe_memory_usage | Record memory usage for natural spaced repetition |
analyze_message | ✨ NEW v0.6.0 - Detect memory-worthy content, suggest entities/strength |
analyze_for_recall | ✨ NEW v0.6.0 - Detect recall intent, suggest search queries |
gc | Garbage collect low-scoring memories |
promote_memory | Move to long-term storage |
cluster_memories | Find similar memories |
consolidate_memories | Merge similar memories (algorithmic) |
read_graph | Get entire knowledge graph |
open_memories | Retrieve specific memories |
create_relation | Link memories explicitly |
Search across STM and LTM with the CLI:
cortexgraph-search "typescript preferences" --tags preferences --limit 5 --verbose
Boost a memory's recency/use count to slow decay:
{
"memory_id": "mem-123",
"boost_strength": true
}
Sample response:
{
"success": true,
"memory_id": "mem-123",
"old_score": 0.41,
"new_score": 0.78,
"use_count": 5,
"strength": 1.1
}
Suggest and promote high-value memories to the Obsidian vault.
Auto-detect (dry run):
{
"auto_detect": true,
"dry_run": true
}
Promote a specific memory:
{
"memory_id": "mem-123",
"dry_run": false,
"target": "obsidian"
}
As an MCP tool (request body):
{
"query": "typescript preferences",
"tags": ["preferences"],
"limit": 5,
"verbose": true
}
Find and merge duplicate or highly similar memories to reduce clutter:
Auto-detect candidates (preview):
{
"auto_detect": true,
"mode": "preview",
"cohesion_threshold": 0.75
}
Apply consolidation to detected clusters:
{
"auto_detect": true,
"mode": "apply",
"cohesion_threshold": 0.80
}
The tool will:
created_at and latest last_used timestampsFor a memory with $n_{\text{use}}=1$, $s=1.0$, and $\lambda = 2.673 \times 10^{-6}$ (3-day half-life):
| Time | Score | Status |
|---|---|---|
| 0 hours | 1.000 | Fresh |
| 12 hours | 0.917 | Active |
| 1 day | 0.841 | Active |
| 3 days | 0.500 | Half-life |
| 7 days | 0.210 | Decaying |
| 14 days | 0.044 | Near forget |
| 30 days | 0.001 | Forgotten |
With $\beta = 0.6$ (sub-linear weighting):
| Use Count | Boost Factor |
|---|---|
| 1 | 1.0× |
| 5 | 2.6× |
| 10 | 4.0× |
| 50 | 11.4× |
Frequent access significantly extends retention.
AGPL-3.0 License - See LICENSE for details.
This project uses the GNU Affero General Public License v3.0, which requires that modifications to this software be made available as source code when used to provide a network service.
If you use this work in research, please cite:
@software{cortexgraph_2025,
title = {Mnemex: Temporal Memory for AI},
author = {simplemindedbot},
year = {2025},
url = {https://github.com/simplemindedbot/cortexgraph},
version = {0.5.3}
}
Contributions are welcome! See CONTRIBUTING.md for detailed instructions.
I develop on macOS and need help testing on Windows and Linux. If you have access to these platforms, please:
See the Help Needed section in CONTRIBUTING.md for details.
For all contributors, see CONTRIBUTING.md for:
Quick start:
Version: 1.0.0 Status: Research implementation - functional but evolving
Built with Claude Code 🤖
Be the first to review this server!
by Modelcontextprotocol · Developer Tools
Read, search, and manipulate Git repositories programmatically
by Toleno · Developer Tools
Toleno Network MCP Server — Manage your Toleno mining account with Claude AI using natural language.
by mcp-marketplace · Developer Tools
Create, build, and publish Python MCP servers to PyPI — conversationally.
by Microsoft · Content & Media
Convert files (PDF, Word, Excel, images, audio) to Markdown for LLM consumption
by mcp-marketplace · Developer Tools
Scaffold, build, and publish TypeScript MCP servers to npm — conversationally
by mcp-marketplace · Finance
Free stock data and market news for any MCP-compatible AI assistant.