agent-memory
Provides integration with n8n workflow automation through the Hermes bridge, enabling memory access from various platforms like Slack.
Enables two-way synchronization of memories with an Obsidian vault, allowing management of memories as Markdown notes.
Allows agents or users to store and retrieve memories via Slack through the Hermes bridge and n8n workflow.
Allows agents or users to store and retrieve memories via a Telegram bot using the Hermes bridge.
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.
Agent Memory System
Persistent memory for AI agents using SQLite + FTS5.
Single-file core Β· Zero dependencies Β· Optional MCP server and Obsidian sync.
β¨ Features
Feature | Description |
ποΈ Persistent | SQLite database survives process restarts |
π Full-text search | FTS5 engine with ranked results |
π Agent isolation | Each agent gets its own namespace automatically |
π οΈ MCP Server | 12 tools for Claude Code / Claude Desktop |
π Obsidian sync | Optional two-way Markdown bridge |
π€ CLAUDE.md generator | Auto-inject context into every session |
π Cross-platform | macOS, Linux, WSL, Windows |
β‘ Zero dependencies | Core uses only Python standard library |
Related MCP server: tartarus-mcp
ποΈ Architecture
graph TB
subgraph Clients["π₯οΈ Clients"]
CLI["π» CLI\n(memory.py)"]
MCP["π MCP Server\n(memory_mcp.py)"]
HERMES["π Hermes Bridge\n(hermes/bridge.py)"]
end
subgraph Core["βοΈ Core Engine"]
STORE["π₯ Store\nmemory_store()"]
SEARCH["π Search\nFTS5 Engine"]
ISO["π Isolation\nNamespace Handler"]
CTX["π Context\nCLAUDE.md Gen"]
end
subgraph Storage["πΎ Storage"]
DB[("ποΈ SQLite DB\nmemory.db")]
FTS[("π FTS5 Index")]
end
subgraph External["π Integrations"]
OBS["π Obsidian Vault\n(Markdown)"]
N8N["βοΈ n8n Workflow"]
TG["π± Telegram Bot"]
end
CLI --> STORE
CLI --> SEARCH
MCP --> STORE
MCP --> SEARCH
HERMES --> STORE
HERMES --> SEARCH
STORE --> ISO
SEARCH --> ISO
ISO --> DB
DB --> FTS
FTS --> SEARCH
STORE --> OBS
OBS --> STORE
N8N --> HERMES
TG --> HERMES
CTX --> DB
style Clients fill:#1f3558,stroke:#58a6ff,color:#cdd9e5
style Core fill:#2d1f58,stroke:#bc8cff,color:#cdd9e5
style Storage fill:#1f3a2d,stroke:#3fb950,color:#cdd9e5
style External fill:#3a2d1f,stroke:#d29922,color:#cdd9e5π Memory Lifecycle
sequenceDiagram
actor Agent as π€ AI Agent
participant CLI as π» CLI / MCP
participant ISO as π Namespace
participant DB as ποΈ SQLite
participant FTS as π FTS5 Index
participant OBS as π Obsidian
Agent->>CLI: memory store --type semantic --content "..."
CLI->>ISO: Resolve agent namespace (AGENT_NAME)
ISO-->>CLI: agent_id = "health" (or global)
CLI->>DB: INSERT INTO memories (agent_id, type, content, ...)
DB->>FTS: Auto-index content
DB-->>CLI: memory_id = 42
CLI-->>Agent: β
Stored (id=42)
Agent->>CLI: memory search --query "rate limit"
CLI->>ISO: Resolve agent namespace
ISO-->>CLI: agent_id
CLI->>FTS: SELECT * FROM memories_fts WHERE content MATCH "rate limit"
FTS-->>CLI: Ranked results
CLI-->>Agent: π Results (ranked by relevance)
Note over DB,OBS: Optional Obsidian Sync
DB->>OBS: Sync to Markdown vault
OBS->>DB: Sync from Markdown vaultπ§ Memory Types
mindmap
root((π§ Memory Types))
π
episodic
Events and decisions
Switched to Postgres
Deployed v2 on Monday
π semantic
Facts and knowledge
Rate limit 1000 req/min
Max upload 50 MB
βοΈ procedural
Workflows and how-tos
Steps build test deploy
Auth flow OAuth2 JWTπ Quick Start
Option 1: CLI (zero dependencies)
cp memory.py /usr/local/bin/memory
chmod +x /usr/local/bin/memory
# Store a memory
memory store --type semantic --content "Max upload: 50 MB" --project api --importance 5
# Search memories
memory search --query "upload"
# List recent
memory list --project api --recent 10
# View stats
memory statsOption 2: MCP Server (Claude Code / Claude Desktop)
pip install mcpAdd to ~/.claude/settings.json (Claude Code):
{
"mcpServers": {
"agent-memory": {
"command": "python",
"args": ["/path/to/memory_mcp.py"]
}
}
}Claude Desktop paths:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Restart and you'll see 12 tools available.
π οΈ MCP Tools
graph LR
subgraph Session["π Session"]
T1["memory_brief\nLoad context"]
T2["memory_who\nAgent identity"]
T3["memory_stats\nDB statistics"]
end
subgraph CRUD["βοΈ CRUD"]
T4["memory_store\nSave memory"]
T5["memory_update\nPatch memory"]
T6["memory_delete\nRemove by ID"]
end
subgraph Query["π Query & Export"]
T7["memory_search\nFTS5 full-text"]
T8["memory_list\nFilter and sort"]
T9["memory_export\nExport to JSON"]
T10["memory_generate_context\nBuild CLAUDE.md"]
end
subgraph Sync["π Sync"]
T11["memory_sync_to_vault\nSQLite to Obsidian"]
T12["memory_sync_from_vault\nObsidian to SQLite"]
end
style Session fill:#1f3558,stroke:#58a6ff,color:#cdd9e5
style CRUD fill:#2d1f58,stroke:#bc8cff,color:#cdd9e5
style Query fill:#1f3a2d,stroke:#3fb950,color:#cdd9e5
style Sync fill:#3a2d1f,stroke:#d29922,color:#cdd9e5π Agent Isolation
graph TD
ENV["π AGENT_NAME env var"]
ENV -->|"= 'health'"| HEALTH["π₯ health namespace\nWrite: own only\nRead: own + global"]
ENV -->|"= 'orchestrator'"| ORCH["π― orchestrator\nWrite: anywhere\nRead: everything"]
ENV -->|"not set"| GLOBAL["π global\nWrite: anywhere\nRead: everything"]
HEALTH --> DB1[("health::memories")]
HEALTH -.->|read only| DB2[("global::memories")]
ORCH --> DB1
ORCH --> DB2
ORCH --> DB3[("other::memories")]
GLOBAL --> DB2
style ENV fill:#21262d,stroke:#58a6ff,color:#cdd9e5
style HEALTH fill:#1f3558,stroke:#58a6ff,color:#cdd9e5
style ORCH fill:#2d1f58,stroke:#bc8cff,color:#cdd9e5
style GLOBAL fill:#1f3a2d,stroke:#3fb950,color:#cdd9e5export AGENT_NAME=health # Linux / macOS / WSL
$env:AGENT_NAME = "health" # Windows PowerShellRole | Write Access | Read Access |
Regular agent | Own namespace only | Own + global |
| Anywhere | Everything |
Not set | Anywhere | Everything |
π Hermes β Cross-Platform Memory
Two agents collaborate on Slack. You ask on Telegram. The memory carries.
flowchart LR
SLACK["π¬ Slack Agent"] -->|POST| N8N["βοΈ n8n"]
N8N -->|HTTP| BRIDGE["π Hermes Bridge\nbridge.py :8765"]
BRIDGE <-->|SQLite| DB[("ποΈ memory.db")]
TG["π± Telegram Bot"] <-->|HTTP| BRIDGE
MCP["π MCP Server"] <-->|SQLite| DB
CLI["π» CLI"] <-->|SQLite| DB
style SLACK fill:#1f3a2d,stroke:#3fb950,color:#cdd9e5
style N8N fill:#3a2d1f,stroke:#d29922,color:#cdd9e5
style BRIDGE fill:#2d1f58,stroke:#bc8cff,color:#cdd9e5
style DB fill:#1f3558,stroke:#58a6ff,color:#cdd9e5
style TG fill:#1f3558,stroke:#58a6ff,color:#cdd9e5
style MCP fill:#2d1f58,stroke:#bc8cff,color:#cdd9e5
style CLI fill:#1f3a2d,stroke:#3fb950,color:#cdd9e5# 1. Start the bridge
python hermes/bridge.py
# 2. Import hermes/n8n_workflow.json into your n8n instance
# 3. Start the Telegram bot
TELEGRAM_TOKEN=xxx HERMES_URL=http://your-server:8765 python hermes/telegram_bot.pySee hermes/README.md for full setup, API reference, and VPS deployment.
π¦ Obsidian Integration (Optional)
export OBSIDIAN_VAULT=/path/to/your/vault
# Auto-mirrors every store/update/delete to Markdown
memory store --type semantic --content "API uses JWT" --project api
# Bulk sync
memory sync-to-vault # SQLite β Markdown
memory sync-from-vault # Markdown β SQLiteπ CLAUDE.md Generator
memory generate-context --output CLAUDE.mdCreates a Markdown file from your most important memories. Place it in your project root and Claude Code reads it automatically every session.
π File Structure
agent-memory/
βββ memory.py # Core: CLI + library (1282 lines)
βββ memory_mcp.py # MCP server (645 lines, requires: pip install mcp)
βββ assets/
β βββ banner.svg # Repository banner image
βββ hermes/ # Cross-platform memory layer
β βββ bridge.py # HTTP gateway (zero new deps)
β βββ telegram_bot.py # Telegram recall bot (requires: requests)
β βββ n8n_workflow.json # Ready-to-import Slack β memory workflow
β βββ README.md # Hermes setup guide
βββ README.md
βββ LICENSE
βββ .gitignore
βββ requirements.txt # Runtime: empty (stdlib only)
βββ requirements-dev.txt # Dev: pytest, black, mypy, ruff
βββ tests/
βββ __init__.py
βββ test_memory.py # 58 tests across 8 classesποΈ Database Location
Platform | Default Path |
macOS / Linux |
|
Windows |
|
Override: export AGENT_MEMORY_DIR=/custom/path
π§ͺ Testing
pip install -r requirements-dev.txt
python -m pytest tests/test_memory.py -v # 58 tests
python -m pytest tests/test_memory.py -v --cov=memoryπ License
MIT Β© khaled1174
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
Related MCP Connectors
Hosted memory for AI agents over MCP. One memory shared by all your agents.
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Hosted agent memory: store, search, and recall facts across sessions from any MCP client.
Persistent memory for AI agents to retain, retrieve, and recall conversation context through MCP.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenancePersistent memory MCP server for AI coding agents. Stores, searches, and retrieves context across sessions using SQLite and FTS5.MIT
- AlicenseNot gradedqualityBmaintenanceA local-first MCP memory server providing persistent, searchable memory for AI agents, powered by SQLite.1Functional Source , Version 1.1, ALv2 Future
- AlicenseAqualityDmaintenanceA SQLite-backed MCP memory server providing persistent memory storage with full-text search and knowledge graph capabilities for AI assistants.1246 npmMIT
- AlicenseAqualityNot gradedmaintenancePersistent memory MCP server for AI agents, using SQLite with hybrid keyword and semantic search for long-term memory storage.5Do What The F*ck You Want To Public