sessionmem is a local-first MCP memory layer designed specifically for AI coding assistants, solving the problem of lost memory across sessions. It integrates with AI tools through the MCP protocol, observes coding sessions in the background, automatically records and summarizes important content, and injects relevant summaries at the start of the next session, thereby avoiding repeated explanations of project context.
Purpose
AI coding assistants usually only "know" what is in the current conversation; once the session ends, the context is lost. sessionmem runs silently between the assistant and the project: it captures session content while you work; at the end of a session, it summarizes decisions, warnings, and useful facts into short, persistent notes; at the start of the next session, it automatically reminds the assistant of the most relevant notes, using only a small amount of text.
Main Capabilities
- Persistent memory across sessions: automatically summarizes and injects relevant memories, reducing repeated explanations.
- Local-first: all storage, retrieval, and summarization run locally by default, with data kept in a single SQLite file (~/.sessionmem/memories.db), with no account, no telemetry, and no hosted memory service.
- Automatic redaction: automatically removes common secret patterns before saving (emails, API keys, Bearer tokens, JWTs, private key blocks, connection-string-style secrets, etc.), replacing them with REDACTED, enabled by default.
- Memory anti-"rot": avoids the accumulation of outdated or duplicate memories through retention-based cleanup (90 days by default), importance-weighted ranking, token-budgeted injection, and conflict resolution in team mode.
- Team mode (optional): can point to a shared folder so that team members' AI assistants share decisions and warnings, disabled by default, with no server required.
- Cloud summarization (optional, disabled by default): after explicitly enabling it and configuring ANTHROPIC_API_KEY, the Claude API can be used to generate higher-quality summaries, automatically falling back to local summarization on failure.
- Reproducible benchmark: provides npm run benchmark, demonstrating approximately 85.6% token reduction and a 100% retrieval hit rate.
How to Use
- Install sessionmem (npm i -g sessionmem).
- In the project folder, run sessionmem install to register sessionmem with the AI tool's MCP host, create ~/.sessionmem/config.json (if it does not exist), and inject instructions into ~/.claude/CLAUDE.md (idempotent, safe to run repeatedly).
- Just use the AI tool normally; sessionmem will run automatically in the background.
CLI commands are available for verification and operation, such as sessionmem savings to view saved tokens, and sessionmem retention prune to clean up old memories.
Applicable Scenarios
Suitable for developers using Claude Code, Cursor, Cline, Codex, Windsurf, Antigravity, QCoder, or any AI coding assistant that supports MCP, who want to preserve project decisions, warnings, and key facts across sessions while requiring data to be fully stored locally, inspectable, backupable, and deletable.
Limitations
Requires a terminal (Command Prompt, Terminal, or PowerShell) and installed Node.js. By default, code is not sent to the cloud; cloud summarization is optional and disabled by default. Team mode is disabled by default and requires manual configuration of a shared path. For specific platform compatibility and native module (better-sqlite3) build issues, refer to the official troubleshooting documentation.