memtree
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@memtreesearch memory for 'database schema'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
memtree
Codex and Claude Code session JSONL is collected outside the model context, consolidated into local SQLite memory, and exposed through MCP.
This is an intentionally small first implementation:
Codex and Claude Code Hook queueing
crash-recovery transcript scanning
byte-offset incremental JSONL collection
secret redaction and user/final-assistant filtering
deterministic per-session Sleep memory
SQLite FTS search
MCP read, search, explicit write, forget, Sleep, and status tools
stdio and Streamable HTTP transports
The current Sleep implementation creates a bounded session digest. It does not yet perform LLM-based profile/entity/decision extraction.
Setup
cd ~/repos/memtree
uv sync
uv run memtree init
uv tool install --editable .The editable tool install makes memtree available to lifecycle hooks.
Related MCP server: waypath
Configure hooks
Merge the relevant example into the user-level configuration:
Codex:
integrations/codex/hooks.json.exampleinto~/.codex/hooks.jsonClaude Code:
integrations/claude-code/settings.json.exampleinto~/.claude/settings.json
Review and trust the Codex hook through /hooks. Hooks only enqueue
session_id, transcript_path, and cwd; they do not invoke MCP or a model.
Collect and Sleep
Run manually or from cron/systemd:
memtree collect --scan all
memtree sleep
memtree status
memtree memory list --cwd "$PWD"Suggested daily command:
memtree collect --scan all && memtree sleepConfigure MCP
Codex stdio configuration:
[mcp_servers.memtree]
command = "memtree"
args = ["serve", "--transport", "stdio"]
enabled = trueClaude Code:
claude mcp add --scope user memtree -- \
memtree serve --transport stdioAvailable tools:
memory_contextmemory_searchmemory_getmemory_putmemory_forgetmemory_sleepmemory_status
Write and forget tools are annotated with their side effects. Automatic transcript ingestion is deliberately not exposed as an MCP tool.
Pass cwd to memory_context or memory_search to include the matching
project memory. Use include_all_projects=true only for an intentional
cross-project review.
Docker
Docker runs the Streamable HTTP MCP server with a private persistent volume:
docker compose up --build -dThe HTTP endpoint is http://127.0.0.1:8765/mcp. Collection normally runs on
the host because the transcript directories are private host state.
Development
uv run ruff format --check .
uv run ruff check .
uv run pyright
uv run pytestThis server cannot be deployed
Maintenance
Related MCP Connectors
Persistent AI memory shared across Claude, ChatGPT, coding agents, and compatible MCP clients.
Persistent memory for AI agents across Claude, ChatGPT and any MCP client.
Cross-tool persistent memory and context for AI assistants over MCP.
Persistent memory and cross-session learning for AI coding assistants (hosted remote MCP).
Related MCP Servers
- AlicenseAqualityAmaintenancePersistent local memory for Claude Code that indexes every session's JSONL file verbatim into SQLite + ChromaDB. Exposes 17 MCP tools for semantic recall, deterministic file replay, and fuzzy "do you remember when..." queries across your entire session history — no API calls, nothing leaves the machine.17234 PyPI14MIT
- AlicenseAqualityCmaintenanceLocal-first external brain for Claude Code, Codex, and any MCP client. Stores decisions, entities, and session artifacts in one SQLite file and exposes MCP tools for recall, page, promote, review, graph-query, and source-status.118 npm4MIT
- FlicenseNot gradedqualityDmaintenanceA lightweight MCP memory server built on SQLite + FTS5, providing cross-session long-term memory for Claude Code.-
- AlicenseBqualityAmaintenanceProvides local cross-session memory for Codex by importing transcripts, indexing in SQLite, and exposing search, context, and memory management through MCP tools.13MIT