loading…
Search for a command to run...
loading…
Zero-config session continuity for Claude Code. Automatically captures and restores project context across sessions using Claude Hooks.
Zero-config session continuity for Claude Code. Automatically captures and restores project context across sessions using Claude Hooks.
Zero Re-explanation Session Continuity for Claude Code — Automatic context capture + semantic search + auto error→solution pipeline
npm version License: MIT Tests Node claude-session-continuity-mcp MCP server
Every new Claude Code session:
"This is a Next.js 15 project with App Router..."
"We decided to use Server Actions because..."
"Last time we were working on the auth system..."
"The build command is pnpm build..."
5 minutes of context-setting. Every. Single. Time.
Fully automatic. Claude Hooks handle everything without manual calls:
# Session start → Auto-loads relevant context + recent session history
# When asking → Auto-injects relevant memories/solutions
# During conversation → Tracks active files + auto-injects error solutions
# On compact → Structured handover context for continuity
# On exit → Extracts commits, decisions, error-fix pairs from transcript
← Auto-output on session start:
# my-app - Session Resumed
📍 **State**: Implementing signup form
## Recent Sessions
### 2026-02-28
**Work**: Completed OAuth integration with Google provider
**Commits**: feat: add OAuth callback handler; fix: redirect URI config
**Decisions**: Use Server Actions instead of API routes
### 2026-02-27
**Work**: Set up authentication foundation
**Next**: Implement signup form validation
## Directives
- 🔴 Always use Zod for form validation
- 📎 Prefer Server Components by default
## Key Memories
- 🎯 Decided on App Router, using Server Actions
- ⚠️ OAuth redirect_uri mismatch → check env file
Zero manual work. Context follows you.
npm install -g claude-session-continuity-mcp
That's it! The postinstall script automatically:
~/.claude.json~/.claude/settings.json-g)?This tool is designed to track all your Claude Code projects in a single unified database. Global installation is strongly recommended because:
| Reason | Detail |
|---|---|
| Single source of truth | One binary serves every project — no version drift between projects |
| Hooks are user-scoped | ~/.claude/settings.json lives in your home directory, not per-project |
| Cross-project context | Sessions from app-a and app-b share the same DB and search index |
| One update = everything refreshed | npm install -g <latest> updates all projects at once; no per-project reinstall |
npm exec resolves global first |
Hooks call npm exec -- claude-hook-* which finds the global package reliably regardless of cwd |
Important: Even with global install, you can still disable the hook for specific projects (see below). Global ≠ forced on every project.
Global install does not mean "always on everywhere". You have three layers of control:
| Layer | File | Scope |
|---|---|---|
| 1. Global ON (default) | ~/.claude/settings.json |
All projects |
| 2. Project-wide OFF | <project>/.claude/settings.json |
Whole team (committed) |
| 3. Personal-only OFF | <project>/.claude/settings.local.json |
Just you (gitignored) |
To disable hooks in a specific project, create the override file with empty hook arrays:
// <project>/.claude/settings.json (or settings.local.json for personal-only)
{
"hooks": {
"SessionStart": [],
"UserPromptSubmit": [],
"PostToolUse": [],
"PreCompact": [],
"Stop": []
}
}
Empty arrays override the global setting → that project's sessions are no longer tracked.
npm install -g claude-session-continuity-mcp@latest
That's the only step — all projects pick up the new binary on next Claude Code restart. No need to reinstall in each project.
If you really want per-project install (e.g., locked version for one project):
cd <project> && npm install claude-session-continuity-mcp
Drawback: you must install separately in every project, and npm exec may not find the local copy reliably from hook context (cwd-dependent). Stick with -g unless you have a specific reason.
MCP Server (in ~/.claude.json):
{
"mcpServers": {
"project-manager": {
"command": "npx",
"args": ["claude-session-continuity-mcp"]
}
}
}
Claude Hooks (in ~/.claude/settings.json):
{
"hooks": {
"SessionStart": [{ "hooks": [{ "type": "command", "command": "npm exec -- claude-hook-session-start" }] }],
"UserPromptSubmit": [{ "hooks": [{ "type": "command", "command": "npm exec -- claude-hook-user-prompt" }] }],
"PostToolUse": [{ "matcher": "Edit", "hooks": [{ "type": "command", "command": "npm exec -- claude-hook-post-tool" }] }, { "matcher": "Write", "hooks": [{ "type": "command", "command": "npm exec -- claude-hook-post-tool" }] }],
"PreCompact": [{ "hooks": [{ "type": "command", "command": "npm exec -- claude-hook-pre-compact" }] }],
"Stop": [{ "hooks": [{ "type": "command", "command": "npm exec -- claude-hook-session-end" }] }]
}
}
Note (v1.5.0+): Full lifecycle coverage with 5 hooks. Uses npm exec -- which finds local node_modules/.bin first.
| Hook | Command | Function |
|---|---|---|
SessionStart |
claude-hook-session-start |
Auto-loads project context on session start |
UserPromptSubmit |
claude-hook-user-prompt |
Auto-injects relevant memories + past reference search |
PostToolUse |
claude-hook-post-tool |
Tracks active files (Edit, Write) + auto-injects error solutions (Bash) |
PreCompact |
claude-hook-pre-compact |
Structured handover context before compression |
Stop |
claude-hook-session-end |
Extracts commits, decisions, error-fix pairs from transcript |
# Check hook status
npx claude-session-hooks status
# Reinstall hooks
npx claude-session-hooks install
# Remove hooks
npx claude-session-hooks uninstall
After installation, restart Claude Code to activate the hooks.
| Feature | Description |
|---|---|
| 🤖 Zero Manual Work | Claude Hooks automate all context capture/load |
| 🎯 Quality Memory Only | (v1.10.0) Only decisions, learnings, errors — no file-change noise |
| 🧠 Semantic Search | multilingual-e5-small embedding (94+ languages, 384d) |
| 🌍 Multilingual | Korean/English/Japanese + cross-language search (EN→KR, KR→EN) |
| 🔗 Git Integration | Commit messages auto-extracted from transcripts |
| 🕸️ Knowledge Graph | Memory relations (solves, causes, extends...) |
| 📊 Memory Classification | 5 types: observation, decision, learning, error, pattern |
| ✅ Integrated Verification | One-click build/test/lint execution |
| 📋 Task Management | Priority-based task management |
| 🔧 Auto Error→Solution | (v1.12.0) Bash errors auto-detect → inject past solutions; session-end auto-records error-fix pairs |
| 💰 Token Efficiency | (v1.11.0) Removed loadContext from UserPromptSubmit (saves 24-60K tokens/session) |
| 📑 Progressive Disclosure | (v1.11.0) memory_search returns index first, memory_get for full content |
| ⏳ Temporal Decay | (v1.11.0) Memory scoring with type-specific half-lives for relevance |
| 📝 Structured Handover | (v1.10.0) PreCompact saves work summary, active files, pending actions |
| 🚪 Smart Session End | (v1.10.0) Extracts commits, decisions, error-fix pairs from transcript |
| 🗑️ Auto Noise Cleanup | (v1.10.0) Auto-deletes stale observation memories (3d+) |
| 🔍 Past Reference Detection | (v1.8.0) "저번에 X 어떻게 했어?" auto-searches DB |
| 📝 User Directive Extraction | (v1.8.0) Auto-extracts "always/never" rules from prompts |
SessionStart Hook (npx claude-hook-session-start):
apps/project-name/) or single project (package.json root folder name).claude/sessions.dbUserPromptSubmit Hook (npx claude-hook-user-prompt):
PostToolUse Hook (npx claude-hook-post-tool):
active_context.recent_files[File Change] noise)PreCompact Hook (npx claude-hook-pre-compact):
Stop Hook (npx claude-hook-session-end):
git commit -m patterns)sessions.issues column as JSON# my-app - Session Resumed
📍 **State**: Implementing signup form
🚧 **Blocker**: OAuth callback URL issue
## Recent Sessions
### 2026-02-28
**Work**: Completed OAuth integration
**Commits**: feat: add OAuth handler; fix: redirect config
**Decisions**: Use Server Actions over API routes
**Next**: Implement form validation
## Directives
- 🔴 Always use Zod for validation
## Pending Tasks
- 🔄 [P8] Implement form validation
- ⏳ [P5] Add error handling
## Key Memories
- 🎯 Decided on App Router, using Server Actions
- ⚠️ OAuth redirect_uri mismatch → check env file
# Check status
npx claude-session-hooks status
# Reinstall
npx claude-session-hooks install
# Remove
npx claude-session-hooks uninstall
# Temporarily disable
export MCP_HOOKS_DISABLED=true
When you ask about past work, the UserPromptSubmit hook automatically searches the database:
You: "저번에 인앱결제 어떻게 했어?"
→ Hook detects "저번에" + extracts keyword "인앱결제"
→ Searches sessions, memories (FTS5), and solutions
→ Injects matching results into context automatically
Supported patterns (Korean & English):
| Pattern | Example |
|---|---|
| 저번에/전에/이전에 ... 어떻게 | "저번에 CORS 에러 어떻게 해결했지?" |
| ~했던/만들었던/해결했던 | "수정했던 로그인 로직" |
| 지난 세션/작업에서 | "지난 세션에서 결제 구현" |
| last time/before/previously | "How did we handle auth last time?" |
| did we/did I ... before | "Did we fix the database migration before?" |
| remember when/recall when | "Remember when we set up CI?" |
Output example:
## Related Past Work (auto-detected from your question)
### Sessions
- [2/14] 카카오 로그인 앱키 수정, 인앱결제 IAP 플로우 수정
### Memories
- 🎯 [decision] 테스트: 인앱결제 상품 등록 완료
### Solutions
- **IAP_BILLING_ERROR**: StoreKit 2 migration으로 해결
Previous versions used absolute paths or npx:
// v1.3.x - absolute paths (broke on multi-project)
"command": "node \"/path/to/project-a/node_modules/.../session-start.js\""
// v1.4.0-1.4.2 - npx (required global install or hit npm registry)
"command": "npx claude-hook-session-start"
Now we use npm exec --:
"command": "npm exec -- claude-hook-session-start"
npm exec -- finds local node_modules/.bin first, then falls back to global. Works with both local and global installation without hitting npm registry.
// Start of session - auto-loads context
session_start({ project: "my-app", compact: true })
// End of session - auto-saves context
session_end({
project: "my-app",
summary: "Completed auth flow",
modifiedFiles: ["src/auth.ts", "src/login/page.tsx"]
})
// View session history
session_history({ project: "my-app", limit: 5 })
// Semantic search past sessions
search_sessions({ query: "auth work", project: "my-app" })
// Get project status with task stats
project_status({ project: "my-app" })
// Initialize new project
project_init({ project: "my-app" })
// Analyze project tech stack
project_analyze({ project: "my-app" })
// List all projects
list_projects()
// Add a task
task_add({ project: "my-app", title: "Implement signup", priority: 8 })
// Update task status
task_update({ taskId: 1, status: "done" })
// List tasks
task_list({ project: "my-app", status: "pending" })
// Suggest tasks from TODO comments
task_suggest({ project: "my-app" })
// Record an error solution
solution_record({
errorSignature: "TypeError: Cannot read property 'id'",
solution: "Use optional chaining: user?.id"
})
// Find similar solutions (keyword or semantic)
solution_find({ query: "TypeError property", semantic: true })
// AI-powered solution suggestion
solution_suggest({ errorMessage: "Cannot read property 'email'" })
// Run build
verify_build({ project: "my-app" })
// Run tests
verify_test({ project: "my-app" })
// Run all (build + test + lint)
verify_all({ project: "my-app" })
// Store a classified memory
memory_store({
content: "State management with Riverpod makes testing easier",
type: "learning", // observation, decision, learning, error, pattern
project: "my-app",
tags: ["flutter", "state-management"],
importance: 8,
relatedTo: 23 // Connect to existing memory
})
// Search memories — returns index (id, type, tags, score) for token efficiency
memory_search({
query: "state management test",
type: "learning",
semantic: true, // Use embedding similarity
limit: 10
})
// Get full memory content by ID (v1.11.0)
memory_get({ memoryId: 23 })
// Find related memories (graph + semantic)
memory_related({
memoryId: 23,
includeGraph: true,
includeSemantic: true
})
// Get memory statistics
memory_stats({ project: "my-app" })
// Connect two memories with a typed relation
graph_connect({
sourceId: 23,
targetId: 25,
relation: "solves", // related_to, causes, solves, depends_on, contradicts, extends, example_of
strength: 0.9
})
// Explore knowledge graph
graph_explore({
memoryId: 23,
depth: 2,
relation: "all", // or specific relation type
direction: "both" // outgoing, incoming, both
})
| Type | Description | Use Case |
|---|---|---|
observation |
Patterns, structures found in codebase | "All screens are separated in features/ folder" |
decision |
Architecture, library choices | "Decided to use SharedPreferences for caching" |
learning |
New knowledge, best practices | "Riverpod is better for testing" |
error |
Occurred errors and solutions | "Provider.read() doesn't rebuild → use watch()" |
pattern |
Recurring code patterns, conventions | "Avoid late keyword abuse" |
| Relation | Description | Example |
|---|---|---|
related_to |
General relation | A and B are related |
causes |
A causes B | Caching decision → folder structure change |
solves |
A solves B | Riverpod learning → Provider bug fix |
depends_on |
A depends on B | Folder structure → Caching decision |
contradicts |
A conflicts with B | Two design decisions conflict |
extends |
A extends B | late pattern → Extended to Riverpod learning |
example_of |
A is example of B | Specific code is example of pattern |
SQLite database at ~/.claude/sessions.db:
| Table | Purpose |
|---|---|
memories |
Classified memories (observation, decision, learning, error, pattern) |
memories_fts |
Full-text search index (FTS5) |
memory_relations |
Knowledge graph relations |
embeddings_v4 |
Semantic search vectors (multilingual-e5-small, 384d) |
project_context |
Fixed project info (tech stack, decisions) |
active_context |
Current work state |
tasks |
Task backlog |
solutions |
Error solution archive |
sessions |
Session history |
| Variable | Default | Description |
|---|---|---|
WORKSPACE_ROOT |
- | Workspace root path (required) |
MCP_HOOKS_DISABLED |
false |
Disable Claude Hooks |
LOG_LEVEL |
info |
Log level (debug/info/warn/error) |
LOG_FILE |
- | Optional file logging path |
# Clone
git clone https://github.com/leesgit/claude-session-continuity-mcp.git
cd claude-session-continuity-mcp
# Install
npm install
# Build
npm run build
# Test
npm test
# Test with coverage
npm run test:coverage
| Metric | Value |
|---|---|
| Context load (cached) | <5ms |
| Memory search (FTS) | ~10ms |
| Semantic search | ~50ms |
| Build verification | Project-dependent |
[File Change] noise (v1.10.0)PRs welcome! Please:
npm test passesMIT © Byeongchang Lee
Run in your terminal:
claude mcp add claude-session-continuity-mcp -- npx Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All development MCPs