Skip to main content
Glama
leesgit

claude-session-continuity-mcp

claude-session-continuity-mcp (v1.13.0)

Claude Code를 위한 재설명 없는 세션 연속성 — 자동 컨텍스트 캡처 + 의미론적 검색 + 자동 오류→해결 파이프라인

npm version License: MIT Tests Node claude-session-continuity-mcp MCP server

문제점

Claude Code 세션을 새로 시작할 때마다:

"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분씩 컨텍스트를 설정해야 합니다.

해결책

완전 자동화. Claude Hooks가 수동 호출 없이 모든 것을 처리합니다:

# 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

수동 작업 제로. 컨텍스트가 당신을 따라다닙니다.


빠른 시작

한 줄 설치 명령어

npm install claude-session-continuity-mcp

이게 전부입니다! postinstall 스크립트가 자동으로 다음을 수행합니다:

  1. ~/.claude.json에 MCP 서버 등록

  2. ~/.claude/settings.json에 Claude Hooks 설치

설치되는 항목

MCP 서버 (~/.claude.json):

{
  "mcpServers": {
    "project-manager": {
      "command": "npx",
      "args": ["claude-session-continuity-mcp"]
    }
  }
}

Claude Hooks (~/.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" }] }]
  }
}

참고 (v1.5.0+): 5개의 훅으로 전체 수명 주기를 커버합니다. 로컬 node_modules/.bin을 먼저 찾는 npm exec --를 사용합니다.

설치된 훅 (v1.5.0+)

명령어

기능

SessionStart

claude-hook-session-start

세션 시작 시 프로젝트 컨텍스트 자동 로드

UserPromptSubmit

claude-hook-user-prompt

관련 메모리 자동 주입 + 과거 참조 검색

PostToolUse

claude-hook-post-tool

활성 파일 추적(Edit, Write) + 오류 해결책 자동 주입(Bash)

PreCompact

claude-hook-pre-compact

압축 전 구조화된 핸드오버 컨텍스트 생성

Stop

claude-hook-session-end

트랜스크립트에서 커밋, 결정, 오류-해결 쌍 추출

수동 훅 관리

# Check hook status
npx claude-session-hooks status

# Reinstall hooks
npx claude-session-hooks install

# Remove hooks
npx claude-session-hooks uninstall

3. Claude Code 재시작

설치 후 Claude Code를 재시작하여 훅을 활성화하세요.


주요 기능

기능

설명

🤖 수동 작업 제로

Claude Hooks가 모든 컨텍스트 캡처/로드 자동화

🎯 고품질 메모리만

(v1.10.0) 결정, 학습, 오류만 저장 — 파일 변경 노이즈 제거

🧠 의미론적 검색

multilingual-e5-small 임베딩 (94개 이상 언어, 384d)

🌍 다국어 지원

한국어/영어/일본어 + 교차 언어 검색 (영→한, 한→영)

🔗 Git 통합

트랜스크립트에서 커밋 메시지 자동 추출

🕸️ 지식 그래프

메모리 관계 (해결, 원인, 확장 등)

📊 메모리 분류

5가지 유형: 관찰, 결정, 학습, 오류, 패턴

통합 검증

원클릭 빌드/테스트/린트 실행

📋 작업 관리

우선순위 기반 작업 관리

🔧 자동 오류→해결

(v1.12.0) Bash 오류 자동 감지 → 과거 해결책 주입; 세션 종료 시 오류-해결 쌍 자동 기록

💰 토큰 효율성

(v1.11.0) UserPromptSubmit에서 loadContext 제거 (세션당 24-60K 토큰 절약)

📑 점진적 공개

(v1.11.0) memory_search는 인덱스만 반환, memory_get으로 전체 내용 조회

시간적 감쇠

(v1.11.0) 유형별 반감기를 적용한 메모리 점수 산정

📝 구조화된 핸드오버

(v1.10.0) PreCompact가 작업 요약, 활성 파일, 보류 중인 작업 저장

🚪 스마트 세션 종료

(v1.10.0) 트랜스크립트에서 커밋, 결정, 오류-해결 쌍 추출

🗑️ 자동 노이즈 정리

(v1.10.0) 오래된 관찰 메모리 자동 삭제 (3일 이상)

🔍 과거 참조 감지

(v1.8.0) "저번에 X 어떻게 했어?" 질문 시 DB 자동 검색

📝 사용자 지침 추출

(v1.8.0) 프롬프트에서 "항상/절대" 규칙 자동 추출


Claude Hooks - 자동 컨텍스트 시스템

작동 방식

SessionStart 훅 (npx claude-hook-session-start):

  • 프로젝트 자동 감지: 모노레포(apps/project-name/) 또는 단일 프로젝트(package.json 루트 폴더명)

  • .claude/sessions.db에서 컨텍스트 로드

  • 주입: 현재 상태, 커밋/결정이 포함된 최근 3개 세션, 지침, 보류 중인 작업, 필터링된 핵심 메모리

  • 오래된 노이즈 메모리 자동 정리 (3일 이상 자동 추적, 14일 이상 자동 압축)

UserPromptSubmit 훅 (npx claude-hook-user-prompt):

  • 모든 프롬프트 제출 시 실행

  • (v1.11.0) 더 이상 loadContext()를 호출하지 않음 — 세션당 24-60K 토큰 절약

  • 관련 컨텍스트 주입 (필터링: 결정, 학습, 오류만)

PostToolUse 훅 (npx claude-hook-post-tool):

  • 핫 파일 경로 추적 및 active_context.recent_files 업데이트

  • (v1.12.0) Bash 오류 자동 감지 → 해결책 DB 검색 → 과거 해결책을 컨텍스트에 주입

  • 더 이상 관찰 메모리를 생성하지 않음 (v1.10.0 — [File Change] 노이즈 제거)

PreCompact 훅 (npx claude-hook-pre-compact):

  • 구조화된 핸드오버 컨텍스트 구축: 작업 요약, 활성 파일, 보류 중인 작업, 핵심 사실, 최근 오류

  • 더 이상 자동 압축 메모리를 저장하지 않음 (v1.10.0)

Stop 훅 (npx claude-hook-session-end):

  • JSONL 트랜스크립트에서 커밋 메시지 추출 (git commit -m 패턴)

  • 오류-해결 쌍 추출 (3개 메시지 이내의 오류 → 해결)

  • (v1.12.0) 향후 재사용을 위해 오류→해결 쌍을 해결책 테이블에 자동 기록

  • 결정 사항 추출 ("because", "instead of", "chose" 패턴)

  • (v1.11.0) 단일 패스 트랜스크립트 파싱 (4번의 JSONL 읽기를 1번으로)

  • sessions.issues 컬럼에 구조화된 메타데이터를 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

과거 참조 감지 (v1.8.0)

과거 작업에 대해 질문하면 UserPromptSubmit 훅이 자동으로 데이터베이스를 검색합니다:

You: "저번에 인앱결제 어떻게 했어?"
→ Hook detects "저번에" + extracts keyword "인앱결제"
→ Searches sessions, memories (FTS5), and solutions
→ Injects matching results into context automatically

지원되는 패턴 (한국어 & 영어):

패턴

예시

저번에/전에/이전에 ... 어떻게

"저번에 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?"

출력 예시:

## Related Past Work (auto-detected from your question)

### Sessions
- [2/14] 카카오 로그인 앱키 수정, 인앱결제 IAP 플로우 수정

### Memories
- 🎯 [decision] 테스트: 인앱결제 상품 등록 완료

### Solutions
- **IAP_BILLING_ERROR**: StoreKit 2 migration으로 해결

왜 npm exec인가? (v1.4.3+)

이전 버전에서는 절대 경로 또는 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"

이제는 npm exec --를 사용합니다:

"command": "npm exec -- claude-hook-session-start"

npm exec --는 로컬 node_modules/.bin을 먼저 찾고, 없으면 전역을 찾습니다. npm 레지스트리에 접근하지 않고도 로컬 및 전역 설치 모두에서 작동합니다.


도구 (v5 API) - 25개의 집중 도구

1. 세션 수명 주기 (4) ⭐

// 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" })

2. 프로젝트 관리 (4)

// 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()

3. 작업 관리 (4)

// 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" })

4. 해결책 아카이브 (3)

// 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'" })

5. 검증 (3)

// Run build
verify_build({ project: "my-app" })

// Run tests
verify_test({ project: "my-app" })

// Run all (build + test + lint)
verify_all({ project: "my-app" })

6. 메모리 시스템 (5)

// 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" })

7. 지식 그래프 (2)

// 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
})

메모리 유형

유형

설명

사용 사례

observation

코드베이스에서 발견된 패턴, 구조

"모든 화면은 features/ 폴더에 분리되어 있음"

decision

아키텍처, 라이브러리 선택

"캐싱을 위해 SharedPreferences를 사용하기로 결정"

learning

새로운 지식, 모범 사례

"Riverpod이 테스트에 더 좋음"

error

발생한 오류 및 해결책

"Provider.read()는 재빌드하지 않음 → watch() 사용"

pattern

반복되는 코드 패턴, 관례

"late 키워드 남용 피하기"

관계 유형

관계

설명

예시

related_to

일반적인 관계

A와 B는 관련됨

causes

A가 B를 유발

캐싱 결정 → 폴더 구조 변경

solves

A가 B를 해결

Riverpod 학습 → Provider 버그 수정

depends_on

A가 B에 의존

폴더 구조 → 캐싱 결정

contradicts

A가 B와 충돌

두 가지 설계 결정이 충돌

extends

A가 B를 확장

late 패턴 → Riverpod 학습으로 확장

example_of

A가 B의 예시

특정 코드가 패턴의 예시


데이터 저장소

~/.claude/sessions.db에 위치한 SQLite 데이터베이스:

테이블

목적

memories

분류된 메모리 (관찰, 결정, 학습, 오류, 패턴)

memories_fts

전문 검색 인덱스 (FTS5)

memory_relations

지식 그래프 관계

embeddings_v4

의미론적 검색 벡터 (multilingual-e5-small, 384d)

project_context

고정된 프로젝트 정보 (기술 스택, 결정 사항)

active_context

현재 작업 상태

tasks

작업 백로그

solutions

오류 해결책 아카이브

sessions

세션 기록


환경 변수

변수

기본값

설명

WORKSPACE_ROOT

-

워크스페이스 루트 경로 (필수)

MCP_HOOKS_DISABLED

false

Claude Hooks 비활성화

LOG_LEVEL

info

로그 레벨 (debug/info/warn/error)

LOG_FILE

-

선택적 파일 로깅 경로


개발

# 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

성능

지표

컨텍스트 로드 (캐시됨)

<5ms

메모리 검색 (FTS)

~10ms

의미론적 검색

~50ms

빌드 검증

프로젝트에 따라 다름


로드맵

  • [x] v2 API (15개의 집중 도구)

  • [x] v4 API (24개의 도구 - 메모리 + 그래프)

  • [x] v5 Claude Hooks (자동 캡처)

  • [x] 유형별 관계를 포함한 지식 그래프

  • [x] 메모리 분류 (6가지 유형)

  • [x] 의미론적 검색 (임베딩)

  • [x] 다국어 패턴 감지 (한/영/일)

  • [x] Git 커밋 통합

  • [x] 111개의 테스트 (6개의 테스트 스위트)

  • [x] GitHub Actions CI/CD

  • [x] 다국어 의미론적 검색 (v1.6.0 - multilingual-e5-small)

  • [x] 교차 언어 검색 영↔한 (v1.6.0)

  • [x] 해결책 의미론적 검색 (v1.6.0)

  • [x] 훅 설정 파일 경로 수정 (v1.6.1 - settings.local.json이 아닌 settings.json)

  • [x] 레거시 훅 자동 마이그레이션 (v1.6.1)

  • [x] PostToolUse 매처 형식을 문자열로 수정 (v1.6.3)

  • [x] 새로운 훅 형식에 대한 README 문서 수정 (v1.6.4)

  • [x] 빈 세션 건너뛰기 및 기술 스택 저장 개선 (v1.7.1)

  • [x] UserPromptSubmit 훅에서 과거 참조 자동 감지 (v1.8.0)

  • [x] 사용자 지침 추출 ("항상/절대" 규칙) (v1.8.0)

  • [x] 메모리 품질 개선 — 더 이상 [File Change] 노이즈 없음 (v1.10.0)

  • [x] PreCompact에서 구조화된 핸드오버 컨텍스트 (v1.10.0)

  • [x] 스마트 세션 종료: 트랜스크립트에서 커밋/결정/오류-해결 추출 (v1.10.0)

  • [x] 자동 노이즈 정리 (3일 이상 관찰, 14일 이상 자동

Install Server
A
security – no known vulnerabilities
A
license - permissive license
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/leesgit/claude-session-continuity-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server