Observed since 20 Oct, 22:18 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Agentic Memory Management via MCP — Knowledge Graph for AI agents
Agentic Memory Management via MCP — Knowledge Graph for AI agents.
A Model Context Protocol (MCP) server that gives AI agents persistent, structured, and queryable memory via a Knowledge Graph. Designed to be used standalone, embedded in any agentic framework, or served as an MCP tool server.
agentic_memory/
├── core/
│ ├── graph.py # KnowledgeGraph — nodes, edges, JSON persistence
│ ├── score.py # Score & ScoreStore — reputation / relevance scoring
│ └── prune.py # AutoPruner — maintenance & auto-pruning
├── mcp/
│ └── server.py # MCP server (stdio transport)
├── cli/
│ └── main.py # Click CLI (memory-cli command)
├── api.py # MemorySkills — Python API (standalone use)
└── hermes/ # Hermes Agent plugin integration
Persistence: JSON files (memory_graph.json, memory_scores.json) — no external database required.
# From PyPI
pip install agentic-memory-mcp
# Development
git clone https://github.com/alexandrerodenas/agentic-memory-mcp.git
cd agentic-memory-mcp
uv sync
# Add a memory entry
memory-cli --graph memory.json node add --id alice --label Person --content "Alice lives in Paris"
# Search
memory-cli retrieve --query "Paris"
# Link two entries
memory-cli --graph memory.json edge add --id e1 --source alice --target paris --label lives_in
# Get stats
memory-cli --graph memory.json stats
# Prune old entries
memory-cli --graph memory.json prune --max-nodes 500 --strategy oldest
# Start the MCP server (stdio)
memory-mcp
# Or with custom paths
MEMORY_GRAPH_PATH=/data/memory.json MEMORY_SCORES_PATH=/data/scores.json memory-mcp
Then connect any MCP-compatible AI agent (Claude Code, OpenCode, etc.) to use the tools:
memory_node_add — Add a fact or entitymemory_node_update — Update an entrymemory_node_delete — Delete an entrymemory_node_get — Retrieve by IDmemory_retrieve — Token-optimized top-N retrieval by score (with optional text filter)memory_edge_add — Create a relationshipmemory_corroborate — Reinforce a memory (increases score)memory_prune — Manual pruningmemory_stats — Graph statistics# Install
hermes plugin install agentic-memory-mcp
# Use in Hermes
/memory add alice "Alice works at Acme Corp"
/memory retrieve --query Acme --limit 10
/memory retrieve --limit 10
/memory corroborate alice
/memory prune --max-nodes 500
Or import in your own agent:
from agentic_memory.hermes import setup
setup(agent=your_agent_instance)
Each memory entry gets a composite relevance score:
score = (3 × corroborations) + (1 × read_count) + (0.5 × recency_bonus)
This ensures the most relevant, most frequently accessed, and most corroborated memories bubble up to the top during retrieval, keeping LLM context windows tight.
Auto-prune runs as a background scheduler inside the MCP server process, controlled entirely via environment variables:
# Activate auto-prune: max 1000 nodes, prune when file > 5 MB, every 30 min
MEMORY_AUTO_PRUNE_ENABLED=1 \
MEMORY_AUTO_PRUNE_MAX_NODES=1000 \
MEMORY_AUTO_PRUNE_MAX_SIZE_MB=5 \
MEMORY_AUTO_PRUNE_INTERVAL_SECONDS=1800 \
memory-mcp
| Variable | Default | Description |
|---|---|---|
MEMORY_AUTO_PRUNE_ENABLED | 0 | Set to 1 to enable the background scheduler |
MEMORY_AUTO_PRUNE_MAX_NODES | None | Max nodes before pruning |
MEMORY_AUTO_PRUNE_MAX_SIZE_MB | None | Max file size (MB) before pruning |
MEMORY_AUTO_PRUNE_INTERVAL_SECONDS | 3600 | Seconds between auto-prune runs |
Manual prune is also available via CLI or memory_prune tool.
| Variable | Default | Description |
|---|---|---|
MEMORY_GRAPH_PATH | memory_graph.json | Path to graph JSON file |
MEMORY_SCORES_PATH | memory_scores.json | Path to scores JSON file |
# Install dev deps
uv sync --all-extras
# Run tests
uv run pytest tests/ -v
# Lint
uv run ruff check src/
MIT — Alexandre Rodenas
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.7.0 | 16 May 2026 | 8 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 22:18 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:8049a1fd9e83801de9c40f028e08129dca5e160b3996df8cf1634ac5289c4a9c