sessionmem

by catfish-1234

Not rated
GitHub

About

Local-first MCP server that gives AI coding assistants persistent session memory. 85.6% token reduction, no cloud.

Details

Author
catfish-1234
Categories
AI, Developer Tools, Productivity

Setup

Install sessionmem in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/catfish-1234/sessionmem

Follow the installation instructions in the repository README, then restart your MCP client.

85.6% fewer tokens. Every session starts knowing your codebase. Stored entirely on your machine.

New session. Claude starts fresh. WITHOUT sessionmem: You explain the stack. The JWT bug from last week. The Stripe migration that's halfway done. The billing code to stay away from. Same questions. Different day. WITH sessionmem: [warning] JWT blacklist must be checked before issuing new tokens. Fixed PR #47. [decision] Stripe migration ~50% done. Do NOT use /lib/billing-v1. [fact] Stack: TypeScript, Next.js, Postgres. Claude: "Looks like you're mid-Stripe migration. Where do you want to pick up?"

sessionmemis an MCP server that watches your coding sessions and stores what actually mattered -- decisions, warnings, things that would bite you if Claude forgot them. At the start of each new session it injects the relevant bits automatically. Works with Claude Code, Cursor, Cline, Codex, Windsurf, and anything that speaksMCP.

Everything stays on your machine. No account, no cloud, no data leaving your computer unless you explicitly turn that on.

No programming experience needed. You just need a terminal (Command Prompt, Terminal, or PowerShell) andNode.jsinstalled.

Run this inside the project folder you're working on, with your AI tool (Claude Code, Cursor, etc.) configured:

- Tells your AI tool's MCP host aboutsessionmemso it can be launched automatically.
- Creates a config file at~/.sessionmem/config.jsonwith safe, privacy-respecting defaults, but only if one doesn't already exist.
- Injects instructions into~/.claude/CLAUDE.mdso Claude Code knows about sessionmem's tools and uses them proactively (idempotent, so safe to re-run).

(Most of the time you won't run this yourself. Your AI tool's host starts it automatically once it's registered.)

- sessionmemwatches your sessions in the background.
- At the end of each session, it writes down a short summary of what mattered.
- At the start of your next session, it quietly reminds your assistant of the relevant bits.

You can verify everything is working with:

- What problem does this solve?
-
How is sessionmem different?
-
Benchmark results
-
How it works (in plain English)
-
CLI command reference
-
Privacy, secrets, and your data
-
Memory rot: keeping memory accurate over time
-
Team mode (optional)
-
Cloud summarization (optional, off by default)
-
Supported tools
-
Further documentation
-
Troubleshooting
-
FAQ
-
Contributing
-
License

If you've used an AI coding assistant for more than a day, you've probably hit this:

You spend twenty minutes explaining your project's setup, the libraries you use, a tricky bug you already fixed, and a decision you made about how authentication should work. The assistant nods along, helps you out... and then in yournext session, it has forgotten all of it. You explain everything again.

This happens because most AI assistants only "know" what's inside the current conversation. Once that conversation ends, the context is gone.

sessionmemfixes this by sitting quietly between your assistant and your project:
- While you work, itcaptureswhat happens in the session.
- When the session ends, itsummarizesthe important parts (decisions made, warnings, useful facts) into short, durable notes.
- The next time you start a session, itremindsthe assistant of the most relevant notes, automatically, in a small amount of text.

You don't run any of these steps yourself. Once installed, it just works in the background.

There are other "memory for Claude" projects out there (for example, tools likeclaude-memand similar community projects). Here's what setssessionmemapart:

In short:sessionmemis theboring, local, "just a SQLite file" option: easy to inspect, back up, and delete, with no lock-in to any one vendor's AI tool.

These numbers come fromnpm run benchmark(scripts/benchmark.mjs), which runs the real production retrieval and injection code over a fixed, synthetic set of test data with no network calls. The results are fully reproducible. Seedocs/benchmark.mdfor the full report and how to regenerate it.

~85.6% reductionin tokens compared to carrying full session history.

In practice: instead of re-reading (or re-explaining) about 1,600 tokens of past context every session, the assistant gets a 230-token summary of just the things that matter: decisions, warnings, and key facts.

100% hit-rate: every one of the 10 test queries successfully retrieved the memory it was supposed to.

Precision of 33.3% is expected here: each query retrieves the top 3 candidate memories, and only one of those three is the "expected" match for a given test query. The other two are still relevant context for the agent, just not the one being scored. The important number is recall/hit-rate:the right memory is never missed.

These benchmarks are deterministic and reproducible. Run them yourself:

npm run build # benchmark imports the compiled code from dist/ npm run benchmark # regenerates docs/benchmark.md
┌──────────────────────────────────────────────┐ │ Your AI tool │ │ (Claude Code, Cursor, Codex, Cline, ...) │ └───────────────────────┬──────────────────────┘ │ ┌───────────▼───────────┐ ┌──────────────┐ │ sessionmem adapter │ │ sessionmem │ │ (translates for your │ │ CLI │ │ specific AI tool) │ │ (you type │ └───────────┬───────────┘ │ commands) │ │ └──────┬───────┘ ▼ │ ┌──────────────────────────────────────────────┐ │ sessionmem core engine │ │ watches sessions · writes summaries · │ │ finds relevant memories · trims to fit │ └───────────────────────┬──────────────────────┘ │ ▼ ┌──────────────────────────────────────────────┐ │ One SQLite file on your computer │ │ ~/.sessionmem/memories.db │ └──────────────────────────────────────────────┘

- Adaptersare small pieces that know how to talk to each specific AI tool. This is why sessionmem can support many tools: adding a new one doesn't change how memory itself works.
- The core engineis the same no matter which tool you use. It decides what's worth remembering, how relevant it is later, and how much of it fits in a small "reminder" at the start of your next session.
- The databaseis just a file. You can back it up, move it, inspect it, or delete it like any other file on your computer.

For a deeper technical dive, seedocs/architecture.md.

Everything stays on your machine by default.No account, no telemetry, no hosted memory service. Storage, retrieval, and summarization all run locally, governed by~/.sessionmem/config.json.

Before anything is saved,sessionmemautomatically removes common secret patterns and replaces them withREDACTED:

- Email addresses
- API keys (sk-..., AWSAKIA..., GitHubghp_.../gho_..., etc.)
- Bearer tokens and JWTs
- Private key blocks (-----BEGIN ... PRIVATE KEY-----)
- Connection-string style secrets (password=...,secret=...)

This ison by default. You can scan and clean up older memories at any time:

sessionmem redact-scan # see what would be redacted sessionmem redact-scan --apply # actually redact in place

Full details:docs/privacy-and-retention.md.

Memory rot: keeping memory accurate over time

"Memory rot" is what happens when a memory system keeps accumulating notes forever. Eventually it fills up with outdated decisions, duplicate facts, and noise, and the assistant starts surfacing stale information instead of helpful information.

sessionmemis designed to avoid this in a few ways:
-

Retention pruning: memories older than a configurable window (default 90 days) are automatically eligible for cleanup. This runs as a light check at the end of every session, and can also be run manually:

sessionmem retention prune # dry run - shows what would be deleted sessionmem retention prune --force # actually deletes

Importance-weighted ranking: when memories are retrieved, they're ranked by a blend of semantic relevance, recency, and importance. Old, low-importance notes naturally sink to the bottom and stop being surfaced even before they're pruned.

Token-budgeted injection: only the top-ranked, most relevant memories are injected (trimmed to a small token budget, seebenchmarks), so even a large memory store doesn't produce bloated, noisy context.

Conflict resolution in team mode: when memories are merged from teammates, the system uses last-write-wins by id (so stale duplicates don't pile up) while preserving the higher importance score (so a critical warning doesn't get silently downgraded).

The retrieval benchmark above (100% hit-rate / 100% recall) demonstrates that even with the ranking and trimming in place, the right memory still surfaces. Accuracy is not traded away for compactness.

You're always in control: export everything first if you want a permanent record before pruning:

Want your whole team's AI assistants to share decisions and warnings? Pointsessionmemat a shared folder (a network drive, a synced directory, or any location everyone can read and write):

sessionmem team enable <shared-path> sessionmem sync

- Off by default: nothing is shared until you turn it on.
- No server needed. It's just files in a folder you already control.
- Teammates' memories show up with anauthor:prefix so you know where they came from.
- Secrets are re-redacted on every pulled memory, so a teammate's snapshot can't reintroduce something your redaction policy would have stripped.

Full details, including the trust model:docs/team-mode.md.

Cloud summarization (optional, off by default)

By default, summarization (turning a session into a short memory) happens entirely locally, with no API calls.

If you explicitly opt in (allowCloudSummarization=true) and provide anANTHROPIC_API_KEY, summarization can use Claude's API for higher-quality summaries. If that ever fails, it automatically falls back to local summarization. Your sessions are never left unsummarized.

sessionmemworks with any MCP-compatible host, including:

- Claude Code
- Cursor
- Codex
- Cline
- Windsurf
- Antigravity
- QCoder

...and any other tool that implements theModel Context Protocol.

- Architecture: how the core engine, adapters, CLI, and SQLite storage fit together.
-
Benchmark: full token-reduction and retrieval-accuracy report, and how to reproduce it.
-
Privacy and retention: secret redaction, retention pruning, and config.
-
Team mode: shared-path team memory.
-
Cloud summarization: the opt-in cloud summarization path.
-
Migration: the SQLite migration system and version-upgrade policy.
-
Troubleshooting: install failures, adapter issues, andbetter-sqlite3native-build problems.

Run into trouble installing or runningsessionmem? Start withdocs/troubleshooting.md. It covers install failures, adapter-specific issues, missing session data, and native module (better-sqlite3) build problems on different platforms.

Two quick checks that resolve most reports:

sessionmem install # idempotent — re-registers the MCP server and all three hooks sessionmem stats # memories, sessions, and session_events for the current project

Ifstatsshowssessions: 0after real work, see“0 sessions” / no session data recorded. Memories are keyed to therepository root, so every directory inside one repo shares a bucket; outside a repo the working directory itself is the key.

sessionmem ping # is the server reachable? sessionmem stats # is data being stored?

How do I give Cursor, Cline, or Windsurf memory between sessions?Install sessionmem (npm i -g sessionmem), then runsessionmem installin your project. It registers as an MCP server with any supported host automatically.

How do I give Claude Code persistent memory?Same install. sessionmem also ships as a Claude Code plugin (the.claude-pluginfile in the repo), so it works with Claude Code's native plugin system too.

Is there a local MCP memory server that works offline with no API key?Yes. sessionmem stores everything in a single SQLite file at~/.sessionmem/memories.dband works fully offline by default. Nothing leaves your machine unless you explicitly enable the optional cloud summarization path.

How is sessionmem different from claude-mem?sessionmem is not Claude-only. It works with Cursor, Cline, Codex, Windsurf, Antigravity, QCoder, and any other MCP host, not just Claude Code. It also redacts secrets (API keys, tokens, JWTs) by default, prunes stale memory automatically, and ships reproducible benchmarks you can run yourself.

Does sessionmem send my code to the cloud?No. Nothing leaves your machine by default. The optional cloud summarization path is opt-in and off by default.

How do I see how many tokens sessionmem saved me?Runsessionmem savingsto see a breakdown of storage compression (raw session tokens vs memory tokens) and injection efficiency. Add--jsonfor machine-readable output.

Issues and pull requests are welcome. The codebase is TypeScript, tested withVitest, and linted with ESLint:

npm install npm run build npm test npm run lint

MCP config for local development:Copy.mcp.json.exampleto.mcp.jsonfor local dev, or usesessionmem installto auto-configure. The.mcp.jsonfile is gitignored because it contains machine-specific paths.

Persistent memory for AI assistants and coding agents across ChatGPT, Claude, Cursor, and other MCP-compatible tools.

Shared memory layer for AI coding agents with dream pipeline distillation, session grounding, and multi-instance coherence.

Local-first AI knowledge base and LLM wiki with source-cited pages and MCP access for coding agents.

IDE Memory MCP gives AI coding agents a persistent memory layer that works across any IDE supporting the Model Context Protocol. Write project context once — the AI remembers it everywhere.

Local-first cross-agent memory MCP. 6-layer structured brain (goal/context/emotion/impl/caveat/learning) with token-saving file diff cache (86% measured savings on re-reads)

A persistent development partner that prevents context drift and maintains project memory across all development sessions.

Mnemex is a Python MCP server that provides AI assistants with human-like memory dynamics through temporal decay and natural spaced repetition, storing memories locally in human-readable JSONL and Markdown formats.

An AI capability enhancement system providing professional roles, memory management, and knowledge systems for applications like Claude and Cursor.

AI conversation memory that works everywhere — save and recall across Claude, ChatGPT, Gemini, Cursor, and all MCP-compatible platforms. 11 tools including shared community memories.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.