memoir-mcp
Structured session journals for AI agents. Persistent memory across sessions -- no more repeating dead ends.
When a session ends, all reasoning is lost -- what was tried, what failed, what's blocked. The next session starts from scratch and repeats the same mistakes. memoir logs it all and hands it off so the next session picks up where the last one left off.
Works with any MCP client: Claude Code, Cursor, Codex, Windsurf, and more.
Install
Claude Code
claude mcp add memoir -s user -- npx -y memoir-mcpOther MCP clients
npx -y memoir-mcpHow it works
Automatic project detection -- identifies the project by its git root, so logs stay scoped without any configuration.
Implicit sessions -- a session is created automatically on first log. No setup step.
Rolling retention -- keeps the last 20 sessions per project (configurable). Old sessions are pruned automatically.
Tools
Write
Tool | Description |
| Record something that was tried and its outcome. |
| Flag something that's stuck and why. |
| Mark a blocker as resolved with what fixed it. |
| Record a design or architecture choice and its rationale. |
| Close the current session with an optional summary. |
Read
Tool | Description |
| Structured summary of the last session -- what was attempted, what's blocked, what was decided. |
| Query past sessions (default: last 3, max 20). |
| List unresolved (or resolved) blockers across all sessions. |
Storage
Single SQLite file at ~/.memoir/memoir.db. No API keys, no external services.
Configuration
All limits are configurable via environment variables:
Variable | Default | Description |
| 500 | Max characters for content fields |
| 300 | Max characters for outcome/resolution fields |
| 50 | Max entries per session |
| 20 | Max sessions per project (rolling) |
Example with custom limits:
claude mcp add memoir -s user -e MEMOIR_MAX_CONTENT=1000 -e MEMOIR_MAX_ENTRIES=100 -- npx -y memoir-mcpHandoff output uses a compact format to keep context window usage low.
License
MIT