Give Claude Code a memory. Never re-explain architectural decisions again.
Save decisions. Auto-load context. Prove the ROI. 100% local.
Every new Claude Code session starts from scratch.
Session 1: "Let's use JWT for authentication because our microservices need stateless auth..."
Session 14: "Why are we using JWT?" β Claude has no idea.
Session 27: You're explaining the same decision for the fifth time.
CLAUDE.md helps but it's static, non-queryable, and becomes a dumping ground.
Every time Claude doesn't know your project context, you pay for it β in tokens, in time, and in wrong answers.
Without memory With memory
βββββββββββββββββ βββββββββββββββββ
You: "Add auth to /orders" You: "Add auth to /orders"
β β
βΌ βΌ
Claude: "What auth system Claude calls query_memory("auth")
do you use? JWT? Sessions? β
OAuth? What middleware?" βΌ
β Claude: "Adding JWT middleware
βΌ using your existing auth pattern
You: [5 minutes re-explaining] from decision #12..."
β β
βΌ βΌ
Claude: "Got it. And what β
Correct implementation
database? What ORM?" on first try
β
βΌ
You: [3 more minutes explaining]
β
βΌ
Claude builds it wrong anyway
because context was incomplete
|
Without memory (session 30)
|
With memory (session 30)
|
The math: If you run 3 Claude Code sessions/day and waste ~15 min each re-explaining context, that's 5+ hours/week. With a team of 4, that's 20 hours/week β gone. Project memory eliminates this entirely.
An MCP server that gives Claude Code a queryable SQLite database of your project's architectural decisions β plus automatic session intelligence that loads the right context at the right time.
| Benefit | What it means for you |
|---|---|
| π§ Auto session continuity | Claude knows what you worked on last session β branch, decisions, files changed |
| π― Smart context loading | Relevant decisions are surfaced automatically based on your current branch and files |
| π° Proven ROI | Track token savings, time saved, and hit rate β with real numbers |
| π Never re-explain decisions | Claude remembers what you decided and why, across every session |
| π Session review | Get prompted to save decisions before ending a session β nothing slips through |
| π 100% local and private | SQLite on your machine, zero network calls, zero telemetry |
npx claude-session-memory initRestart Claude Code. That's it. π
Every session is smarter than the last:
Session Start (get_stats) Session End (review_session)
βββββββββββββββββββββββββ ββββββββββββββββββββββββββββ
β
Last session context β
Decisions saved this session
Branch, decisions, files What you captured
β
Relevant decisions β
Files changed without decisions
Matched by branch + files What you might have missed
β
Token savings ROI β
Suggestions
Queries, hit rate, time saved "Consider saving for auth.ts"
How context matching works:
- File matching β decisions linked to files you're currently modifying
- Branch keywords β
feature/authβ finds decisions taggedauth - Recent fallback β always shows latest decisions if no specific match
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Claude Code Conversation β
β β
β You: "Let's use PostgreSQL with Prisma ORM" β
β β
β Claude: "That sounds like an architectural decision. β
β Want me to save it?" β
β β
β You: "Yes" β
β β β
β βΌ β
β βββββββββββββββββββ ββββββββββββββββββββββββββββ β
β β save_decision βββββΆβ .claude/project-memory.dbβ β
β βββββββββββββββββββ ββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Β·Β·Β· Next session Β·Β·Β·
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β You: "Why did we choose PostgreSQL?" β
β β β
β βΌ β
β βββββββββββββββββββ ββββββββββββββββββββββββββββ β
β β query_memory βββββ .claude/project-memory.dbβ β
β βββββββββββββββββββ ββββββββββββββββββββββββββββ β
β β β
β βΌ β
β Claude: "You chose PostgreSQL 16 with Prisma ORM β
β because of ACID compliance, JSON support, and strong β
β community. Alternatives considered: MySQL, MongoDB." β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Tool | Description |
|---|---|
save_decision |
πΎ Save an architectural decision with title, rationale, alternatives. Auto-detects duplicates via Jaccard similarity |
query_memory |
π Search decisions using natural language. Logs every query for ROI tracking |
list_recent |
π List recent decisions across sessions |
update_decision |
β»οΈ Deprecate or supersede a decision |
get_stats |
π§ Session intelligence β last session context, relevant decisions for current work, token savings ROI |
review_session |
π Review current session before ending β shows files changed without decisions, suggests what to save |
sync_claude_md |
π Export active decisions into your CLAUDE.md with auto-managed markers |
"Why did we choose JWT?"
"What decisions affect src/auth.ts?"
"Show me recent decisions"
"Compare Pinia vs Vuex"
"Show deprecated decisions"
"What are the alternatives to Redis?"
| Command | Description |
|---|---|
npx claude-session-memory init |
π Initialize project memory |
npx claude-session-memory workspace-setup [dir] |
π Share context memory across all sub-projects in a workspace |
npx claude-session-memory export |
π€ Export decisions (JSON/Markdown/CSV) |
npx claude-session-memory import <file> |
π₯ Import decisions from JSON |
npx claude-session-memory sync-claudemd |
π Sync active decisions into CLAUDE.md |
npx claude-session-memory stats |
π Show memory statistics |
If you have a monorepo or workspace with multiple sub-projects (each with their own .git), use workspace-setup to share context memory across all of them:
npx claude-session-memory workspace-setup /path/to/workspace
npx claude-session-memory workspace-setup --dry-run # Preview changes
npx claude-session-memory workspace-setup --force # Overwrite existing configsThis symlinks the root .mcp.json into every git sub-project so they all share the same decision history.
npx claude-session-memory export # JSON (default)
npx claude-session-memory export --format markdown # Human-readable
npx claude-session-memory export --format csv # Spreadsheet
npx claude-session-memory export --output ./backup.json # Custom pathWhen saving a new decision, the server automatically compares it against existing ones using Jaccard similarity on tokenized text:
| Similarity | Action |
|---|---|
| > 0.8 | Auto-supersedes the older decision β you don't need to clean up |
| 0.6 β 0.8 | Returns a warning with similar decisions so you can decide |
| < 0.6 | Saved without warnings |
No configuration needed β dedup runs on every save_decision call.
Decisions tagged temporary or experimental automatically fade over 30 days:
Day 0 β confidence 1.0 (full strength)
Day 15 β confidence 0.5 (half strength)
Day 30 β confidence 0.0 (fully faded)
Faded decisions (confidence < 0.3) are excluded from CLAUDE.md sync but remain queryable. Regular decisions never decay regardless of age.
Auto-generate a structured decisions section in your CLAUDE.md:
npx claude-session-memory sync-claudemdOr call sync_claude_md as an MCP tool during a conversation. The output is injected between markers:
<!-- DECISIONS:START -->
## Architectural Decisions
_Auto-generated from project memory β 5 active decisions_
### Auth
- **Use JWT for authentication** β Stateless and scalable [auth, security]
### Database
- **Use PostgreSQL with Prisma** β ACID compliance [database]
<!-- DECISIONS:END -->Any content outside the markers is preserved. If no markers exist, they're appended. If no CLAUDE.md exists, one is created.
Every query_memory call is tracked. The dashboard shows real metrics:
| Metric | What it measures |
|---|---|
| Total Queries | How often Claude queries your memory |
| Hit Rate | % of queries that returned useful results |
| Tokens Saved | Estimated tokens saved vs re-explaining (~300/query) |
| Time Saved | Estimated minutes saved (~2 min/query) |
View these in the web dashboard at /analytics or via get_stats in any session.
claude-session-memory
βββ Storage: SQLite + FTS5 full-text search, WAL mode
βββ Transport: MCP stdio (spawned by Claude Code)
βββ Intelligence: Session continuity, context matching, ROI tracking
βββ Dashboard: Built-in web UI with analytics and AI coach
βββ Dependencies: better-sqlite3, @modelcontextprotocol/sdk, commander
βββ Privacy: 100% local β zero network calls, zero telemetry
- Node.js >= 18
- Claude Code
Contributions are welcome! Feel free to open issues or submit pull requests.
MIT β use it however you like.
Session 1 β You save your first decision. Nothing special yet.
Session 5 β Claude stops asking what database you use. It knows.
Session 20 β Claude auto-loads your last session's context and relevant decisions before you say a word.
Session 50 β Dashboard shows 500+ tokens saved, 100+ minutes reclaimed. A new teammate asks "how does auth work?" β full history, instantly.
The more you use it, the more valuable it becomes.
Built with β€οΈ for the Claude Code community
Stop re-explaining. Start remembering.