claude-memory-layer 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/commands/memory-forget.md +42 -0
- package/.claude-plugin/commands/memory-history.md +34 -0
- package/.claude-plugin/commands/memory-import.md +56 -0
- package/.claude-plugin/commands/memory-list.md +37 -0
- package/.claude-plugin/commands/memory-search.md +36 -0
- package/.claude-plugin/commands/memory-stats.md +34 -0
- package/.claude-plugin/hooks.json +59 -0
- package/.claude-plugin/plugin.json +24 -0
- package/.history/package_20260201112328.json +45 -0
- package/.history/package_20260201113602.json +45 -0
- package/.history/package_20260201113713.json +45 -0
- package/.history/package_20260201114110.json +45 -0
- package/Memo.txt +558 -0
- package/README.md +520 -0
- package/context.md +636 -0
- package/dist/.claude-plugin/commands/memory-forget.md +42 -0
- package/dist/.claude-plugin/commands/memory-history.md +34 -0
- package/dist/.claude-plugin/commands/memory-import.md +56 -0
- package/dist/.claude-plugin/commands/memory-list.md +37 -0
- package/dist/.claude-plugin/commands/memory-search.md +36 -0
- package/dist/.claude-plugin/commands/memory-stats.md +34 -0
- package/dist/.claude-plugin/hooks.json +59 -0
- package/dist/.claude-plugin/plugin.json +24 -0
- package/dist/cli/index.js +3539 -0
- package/dist/cli/index.js.map +7 -0
- package/dist/core/index.js +4408 -0
- package/dist/core/index.js.map +7 -0
- package/dist/hooks/session-end.js +2971 -0
- package/dist/hooks/session-end.js.map +7 -0
- package/dist/hooks/session-start.js +2969 -0
- package/dist/hooks/session-start.js.map +7 -0
- package/dist/hooks/stop.js +3123 -0
- package/dist/hooks/stop.js.map +7 -0
- package/dist/hooks/user-prompt-submit.js +2960 -0
- package/dist/hooks/user-prompt-submit.js.map +7 -0
- package/dist/services/memory-service.js +2931 -0
- package/dist/services/memory-service.js.map +7 -0
- package/package.json +45 -0
- package/plan.md +1642 -0
- package/scripts/build.ts +102 -0
- package/spec.md +624 -0
- package/specs/citations-system/context.md +243 -0
- package/specs/citations-system/plan.md +495 -0
- package/specs/citations-system/spec.md +371 -0
- package/specs/endless-mode/context.md +305 -0
- package/specs/endless-mode/plan.md +620 -0
- package/specs/endless-mode/spec.md +455 -0
- package/specs/entity-edge-model/context.md +401 -0
- package/specs/entity-edge-model/plan.md +459 -0
- package/specs/entity-edge-model/spec.md +391 -0
- package/specs/evidence-aligner-v2/context.md +401 -0
- package/specs/evidence-aligner-v2/plan.md +303 -0
- package/specs/evidence-aligner-v2/spec.md +312 -0
- package/specs/mcp-desktop-integration/context.md +278 -0
- package/specs/mcp-desktop-integration/plan.md +550 -0
- package/specs/mcp-desktop-integration/spec.md +494 -0
- package/specs/post-tool-use-hook/context.md +319 -0
- package/specs/post-tool-use-hook/plan.md +469 -0
- package/specs/post-tool-use-hook/spec.md +364 -0
- package/specs/private-tags/context.md +288 -0
- package/specs/private-tags/plan.md +412 -0
- package/specs/private-tags/spec.md +345 -0
- package/specs/progressive-disclosure/context.md +346 -0
- package/specs/progressive-disclosure/plan.md +663 -0
- package/specs/progressive-disclosure/spec.md +415 -0
- package/specs/task-entity-system/context.md +297 -0
- package/specs/task-entity-system/plan.md +301 -0
- package/specs/task-entity-system/spec.md +314 -0
- package/specs/vector-outbox-v2/context.md +470 -0
- package/specs/vector-outbox-v2/plan.md +562 -0
- package/specs/vector-outbox-v2/spec.md +466 -0
- package/specs/web-viewer-ui/context.md +384 -0
- package/specs/web-viewer-ui/plan.md +797 -0
- package/specs/web-viewer-ui/spec.md +516 -0
- package/src/cli/index.ts +570 -0
- package/src/core/canonical-key.ts +186 -0
- package/src/core/citation-generator.ts +63 -0
- package/src/core/consolidated-store.ts +279 -0
- package/src/core/consolidation-worker.ts +384 -0
- package/src/core/context-formatter.ts +276 -0
- package/src/core/continuity-manager.ts +336 -0
- package/src/core/edge-repo.ts +324 -0
- package/src/core/embedder.ts +124 -0
- package/src/core/entity-repo.ts +342 -0
- package/src/core/event-store.ts +672 -0
- package/src/core/evidence-aligner.ts +635 -0
- package/src/core/graduation.ts +365 -0
- package/src/core/index.ts +32 -0
- package/src/core/matcher.ts +210 -0
- package/src/core/metadata-extractor.ts +203 -0
- package/src/core/privacy/filter.ts +179 -0
- package/src/core/privacy/index.ts +20 -0
- package/src/core/privacy/tag-parser.ts +145 -0
- package/src/core/progressive-retriever.ts +415 -0
- package/src/core/retriever.ts +235 -0
- package/src/core/task/blocker-resolver.ts +325 -0
- package/src/core/task/index.ts +9 -0
- package/src/core/task/task-matcher.ts +238 -0
- package/src/core/task/task-projector.ts +345 -0
- package/src/core/task/task-resolver.ts +414 -0
- package/src/core/types.ts +841 -0
- package/src/core/vector-outbox.ts +295 -0
- package/src/core/vector-store.ts +182 -0
- package/src/core/vector-worker.ts +488 -0
- package/src/core/working-set-store.ts +244 -0
- package/src/hooks/post-tool-use.ts +127 -0
- package/src/hooks/session-end.ts +78 -0
- package/src/hooks/session-start.ts +57 -0
- package/src/hooks/stop.ts +78 -0
- package/src/hooks/user-prompt-submit.ts +54 -0
- package/src/mcp/handlers.ts +212 -0
- package/src/mcp/index.ts +47 -0
- package/src/mcp/tools.ts +78 -0
- package/src/server/api/citations.ts +101 -0
- package/src/server/api/events.ts +101 -0
- package/src/server/api/index.ts +18 -0
- package/src/server/api/search.ts +98 -0
- package/src/server/api/sessions.ts +111 -0
- package/src/server/api/stats.ts +97 -0
- package/src/server/index.ts +91 -0
- package/src/services/memory-service.ts +626 -0
- package/src/services/session-history-importer.ts +367 -0
- package/tests/canonical-key.test.ts +101 -0
- package/tests/evidence-aligner.test.ts +152 -0
- package/tests/matcher.test.ts +112 -0
- package/tsconfig.json +24 -0
- package/vitest.config.ts +15 -0
package/README.md
ADDED
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
# Code Memory
|
|
2
|
+
|
|
3
|
+
Claude Code 플러그인으로, 대화 내용을 기억하여 사용할수록 똑똑해지는 AI 어시스턴트를 만듭니다.
|
|
4
|
+
|
|
5
|
+
## 개요
|
|
6
|
+
|
|
7
|
+
Code Memory는 Claude Code에서 사용자와 AI 간의 모든 대화를 저장하고, 새로운 질문을 할 때 관련된 과거 대화를 자동으로 검색하여 컨텍스트로 제공합니다. 이를 통해:
|
|
8
|
+
|
|
9
|
+
- **연속성 있는 대화**: 이전 세션에서 논의한 내용을 기억
|
|
10
|
+
- **프로젝트 맥락 이해**: 프로젝트별로 축적된 지식 활용
|
|
11
|
+
- **개인화된 응답**: 사용자의 선호도와 패턴 학습
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
### Core Features
|
|
16
|
+
|
|
17
|
+
- **Conversation Memory**: 사용자 프롬프트와 AI 응답 저장
|
|
18
|
+
- **Semantic Search**: 벡터 임베딩을 통한 의미 기반 검색
|
|
19
|
+
- **AXIOMMIND Architecture**: 7가지 원칙 기반 안정적 메모리 관리
|
|
20
|
+
- **Memory Graduation**: L0→L4 단계별 메모리 승격
|
|
21
|
+
- **Evidence Alignment**: 응답이 실제 기억에 기반했는지 검증
|
|
22
|
+
- **History Import**: 기존 Claude Code 세션 기록 임포트
|
|
23
|
+
|
|
24
|
+
### Advanced Features
|
|
25
|
+
|
|
26
|
+
- **Citations System**: 메모리 출처 추적 (`[mem:abc123]` 형식)으로 검색 결과의 원본 확인 가능
|
|
27
|
+
- **Endless Mode**: 세션 경계 없는 연속적 메모리 스트림, Biomimetic Memory Architecture 기반
|
|
28
|
+
- **Entity-Edge Model**: entries/entities/edges 3-layer 모델로 데이터 관계 명시적 모델링
|
|
29
|
+
- **Evidence Aligner V2**: Quote 기반 3단계 정렬 (exact → normalized → fuzzy)
|
|
30
|
+
- **MCP Desktop Integration**: Claude Desktop용 MCP 서버로 CLI와 동일한 메모리 공유
|
|
31
|
+
- **PostToolUse Hook**: 도구 실행 결과 (Read, Write, Bash 등) 캡처 및 저장
|
|
32
|
+
- **Private Tags**: `<private>` 태그로 민감 정보를 명시적으로 제외
|
|
33
|
+
- **Progressive Disclosure**: 3-Layer 검색 (인덱스 → 타임라인 → 상세)으로 토큰 효율화
|
|
34
|
+
- **Task Entity System**: Task를 Entity로 승격하여 세션 간 상태 추적
|
|
35
|
+
- **Vector Outbox V2**: Transactional Outbox 패턴으로 DuckDB-LanceDB 정합성 보장
|
|
36
|
+
- **Web Viewer UI**: localhost:37777 대시보드로 실시간 메모리 모니터링
|
|
37
|
+
|
|
38
|
+
## 설치 방법
|
|
39
|
+
|
|
40
|
+
### 1. 의존성 설치
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
cd code-memory
|
|
44
|
+
npm install
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 2. 빌드
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm run build
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 3. Claude Code에 플러그인 등록
|
|
54
|
+
|
|
55
|
+
빌드된 플러그인을 Claude Code 설정에 추가합니다:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Claude Code 설정 디렉토리에 플러그인 복사
|
|
59
|
+
cp -r dist/.claude-plugin ~/.claude/plugins/code-memory/
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 사용 방법
|
|
63
|
+
|
|
64
|
+
### 자동 동작 (Hooks)
|
|
65
|
+
|
|
66
|
+
플러그인은 Claude Code 세션에 자동으로 연결되어 동작합니다:
|
|
67
|
+
|
|
68
|
+
| Hook | 동작 |
|
|
69
|
+
|------|------|
|
|
70
|
+
| **SessionStart** | 세션 시작 시 프로젝트 관련 컨텍스트 로드 |
|
|
71
|
+
| **UserPromptSubmit** | 프롬프트 입력 시 관련 기억 검색 및 저장 |
|
|
72
|
+
| **Stop** | AI 응답 완료 시 응답 내용 저장 |
|
|
73
|
+
| **SessionEnd** | 세션 종료 시 요약 생성 및 저장 |
|
|
74
|
+
|
|
75
|
+
### Slash 명령어
|
|
76
|
+
|
|
77
|
+
Claude Code 내에서 사용할 수 있는 명령어:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# 메모리 검색 - 관련 기억 찾기
|
|
81
|
+
/memory-search "authentication 구현 방법"
|
|
82
|
+
|
|
83
|
+
# 대화 기록 보기
|
|
84
|
+
/memory-history
|
|
85
|
+
/memory-history --limit 50
|
|
86
|
+
/memory-history --session <session-id>
|
|
87
|
+
|
|
88
|
+
# 통계 확인
|
|
89
|
+
/memory-stats
|
|
90
|
+
|
|
91
|
+
# 기존 대화 기록 임포트
|
|
92
|
+
/memory-import # 현재 프로젝트
|
|
93
|
+
/memory-import --all # 모든 프로젝트
|
|
94
|
+
/memory-import --project /path/to/project # 특정 프로젝트
|
|
95
|
+
|
|
96
|
+
# 임포트 가능한 세션 목록
|
|
97
|
+
/memory-list
|
|
98
|
+
|
|
99
|
+
# 메모리 삭제
|
|
100
|
+
/memory-forget --session <id> --confirm
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### CLI 명령어
|
|
104
|
+
|
|
105
|
+
터미널에서 직접 사용:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# 메모리 검색
|
|
109
|
+
npx code-memory search "React 컴포넌트 패턴"
|
|
110
|
+
npx code-memory search "API 에러 처리" --top-k 10
|
|
111
|
+
|
|
112
|
+
# 대화 기록 조회
|
|
113
|
+
npx code-memory history
|
|
114
|
+
npx code-memory history --limit 50 --type user_prompt
|
|
115
|
+
|
|
116
|
+
# 통계 확인
|
|
117
|
+
npx code-memory stats
|
|
118
|
+
|
|
119
|
+
# 기존 세션 임포트
|
|
120
|
+
npx code-memory import # 현재 프로젝트
|
|
121
|
+
npx code-memory import --all # 모든 프로젝트
|
|
122
|
+
npx code-memory import --all --verbose # 상세 로그
|
|
123
|
+
|
|
124
|
+
# 임포트 가능한 세션 목록
|
|
125
|
+
npx code-memory list
|
|
126
|
+
npx code-memory list --project /path/to/project
|
|
127
|
+
|
|
128
|
+
# 임베딩 수동 처리
|
|
129
|
+
npx code-memory process
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Privacy 기능
|
|
133
|
+
|
|
134
|
+
### Private Tags
|
|
135
|
+
|
|
136
|
+
민감한 정보를 메모리에서 제외하려면 `<private>` 태그를 사용합니다:
|
|
137
|
+
|
|
138
|
+
```markdown
|
|
139
|
+
이 부분은 저장됩니다.
|
|
140
|
+
|
|
141
|
+
<private>
|
|
142
|
+
API_KEY=sk-xxxx
|
|
143
|
+
SECRET_TOKEN=abc123
|
|
144
|
+
이 내용은 메모리에 저장되지 않습니다.
|
|
145
|
+
</private>
|
|
146
|
+
|
|
147
|
+
이 부분도 저장됩니다.
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
저장 결과:
|
|
151
|
+
```
|
|
152
|
+
이 부분은 저장됩니다.
|
|
153
|
+
[PRIVATE]
|
|
154
|
+
이 부분도 저장됩니다.
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### 자동 필터링
|
|
158
|
+
|
|
159
|
+
다음 패턴은 자동으로 마스킹됩니다:
|
|
160
|
+
- `password`, `api_key`, `secret`, `token`
|
|
161
|
+
- Bearer 토큰
|
|
162
|
+
- Private Key 블록
|
|
163
|
+
|
|
164
|
+
## Citations (인용 시스템)
|
|
165
|
+
|
|
166
|
+
검색 결과에는 인용 ID가 포함됩니다:
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
🔍 Search Results:
|
|
170
|
+
|
|
171
|
+
#1 [mem:a7Bc3x] (score: 0.94)
|
|
172
|
+
"DuckDB를 사용하여 이벤트 소싱 패턴을..."
|
|
173
|
+
📅 2026-01-30 | 🔗 Session abc123
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
원본 확인:
|
|
177
|
+
```bash
|
|
178
|
+
code-memory show mem:a7Bc3x
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Endless Mode
|
|
182
|
+
|
|
183
|
+
세션 경계 없이 연속적인 메모리 스트림을 유지합니다:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
# Endless Mode 활성화
|
|
187
|
+
code-memory config set mode endless
|
|
188
|
+
|
|
189
|
+
# 상태 확인
|
|
190
|
+
code-memory status
|
|
191
|
+
|
|
192
|
+
# 출력 예시:
|
|
193
|
+
# Mode: Endless
|
|
194
|
+
# Working Set: 47 events (last 18 hours)
|
|
195
|
+
# Continuity Score: 0.85 (seamless)
|
|
196
|
+
# Consolidated: 23 memories
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### 모드 비교
|
|
200
|
+
|
|
201
|
+
| 기존 세션 모드 | Endless Mode |
|
|
202
|
+
|---------------|-------------|
|
|
203
|
+
| 명확한 시작/끝 | 연속적 스트림 |
|
|
204
|
+
| 세션별 요약 | 점진적 통합 |
|
|
205
|
+
| 재시작 시 빈 상태 | 이전 컨텍스트 유지 |
|
|
206
|
+
|
|
207
|
+
## MCP Desktop Integration
|
|
208
|
+
|
|
209
|
+
Claude Desktop에서 메모리 검색을 사용하려면:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# MCP 서버 설치
|
|
213
|
+
code-memory mcp install
|
|
214
|
+
|
|
215
|
+
# 또는 수동 설정: ~/Library/Application Support/Claude/claude_desktop_config.json
|
|
216
|
+
{
|
|
217
|
+
"mcpServers": {
|
|
218
|
+
"code-memory": {
|
|
219
|
+
"command": "npx",
|
|
220
|
+
"args": ["code-memory-mcp"]
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### 제공되는 MCP 도구
|
|
227
|
+
|
|
228
|
+
| 도구 | 설명 |
|
|
229
|
+
|------|------|
|
|
230
|
+
| `mem-search` | 메모리 검색 |
|
|
231
|
+
| `mem-timeline` | 타임라인 조회 |
|
|
232
|
+
| `mem-details` | 상세 정보 조회 |
|
|
233
|
+
| `mem-stats` | 통계 조회 |
|
|
234
|
+
|
|
235
|
+
## Web Viewer
|
|
236
|
+
|
|
237
|
+
브라우저에서 메모리 대시보드를 확인할 수 있습니다:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
# 웹 서버 시작
|
|
241
|
+
code-memory web
|
|
242
|
+
|
|
243
|
+
# 브라우저에서 접속
|
|
244
|
+
# http://localhost:37777
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### 주요 기능
|
|
248
|
+
- 실시간 이벤트 스트림
|
|
249
|
+
- 세션/프로젝트별 탐색
|
|
250
|
+
- 벡터 검색 인터페이스
|
|
251
|
+
- 저장소 통계 대시보드
|
|
252
|
+
- Outbox 상태 모니터링
|
|
253
|
+
|
|
254
|
+
## 기존 대화 기록 임포트
|
|
255
|
+
|
|
256
|
+
이미 Claude Code를 사용해왔다면, 기존 대화 기록을 임포트하여 바로 활용할 수 있습니다:
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
# 1. 먼저 임포트 가능한 세션 확인
|
|
260
|
+
npx code-memory list
|
|
261
|
+
|
|
262
|
+
# 2. 현재 프로젝트의 모든 세션 임포트
|
|
263
|
+
npx code-memory import
|
|
264
|
+
|
|
265
|
+
# 3. 또는 모든 프로젝트의 세션 임포트
|
|
266
|
+
npx code-memory import --all --verbose
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### 임포트 결과 예시
|
|
270
|
+
|
|
271
|
+
```
|
|
272
|
+
📥 Importing all sessions from all projects
|
|
273
|
+
|
|
274
|
+
⏳ Processing embeddings...
|
|
275
|
+
|
|
276
|
+
✅ Import Complete
|
|
277
|
+
|
|
278
|
+
Sessions processed: 15
|
|
279
|
+
Total messages: 342
|
|
280
|
+
Imported prompts: 156
|
|
281
|
+
Imported responses: 186
|
|
282
|
+
Skipped duplicates: 0
|
|
283
|
+
Embeddings processed: 342
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### 중복 처리
|
|
287
|
+
|
|
288
|
+
임포트는 콘텐츠 해시 기반으로 중복을 자동 감지합니다. 여러 번 실행해도 같은 내용이 중복 저장되지 않습니다.
|
|
289
|
+
|
|
290
|
+
## 동작 원리
|
|
291
|
+
|
|
292
|
+
### 1. 메모리 저장
|
|
293
|
+
|
|
294
|
+
```
|
|
295
|
+
사용자 프롬프트 입력
|
|
296
|
+
↓
|
|
297
|
+
EventStore에 저장 (DuckDB, append-only)
|
|
298
|
+
↓
|
|
299
|
+
Outbox에 임베딩 요청 등록
|
|
300
|
+
↓
|
|
301
|
+
Vector Worker가 임베딩 생성
|
|
302
|
+
↓
|
|
303
|
+
VectorStore에 저장 (LanceDB)
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### 2. 메모리 검색
|
|
307
|
+
|
|
308
|
+
```
|
|
309
|
+
새 프롬프트 입력
|
|
310
|
+
↓
|
|
311
|
+
임베딩 생성
|
|
312
|
+
↓
|
|
313
|
+
VectorStore에서 유사 벡터 검색
|
|
314
|
+
↓
|
|
315
|
+
AXIOMMIND Matcher로 신뢰도 계산
|
|
316
|
+
↓
|
|
317
|
+
컨텍스트로 Claude에 제공
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### 3. 메모리 승격 (Graduation)
|
|
321
|
+
|
|
322
|
+
자주 참조되는 메모리는 더 높은 레벨로 승격됩니다:
|
|
323
|
+
|
|
324
|
+
| Level | 이름 | 설명 | 승격 조건 |
|
|
325
|
+
|-------|------|------|-----------|
|
|
326
|
+
| L0 | EventStore | 원본 이벤트 | 기본 저장 |
|
|
327
|
+
| L1 | Structured | 구조화된 패턴 | 3회 이상 접근 |
|
|
328
|
+
| L2 | Candidates | 검증된 스키마 | 5회 이상, 다중 세션 참조 |
|
|
329
|
+
| L3 | Verified | 교차 검증됨 | 높은 신뢰도 |
|
|
330
|
+
| L4 | Active | 활성 지식 | 10회 이상, 3개 이상 세션 |
|
|
331
|
+
|
|
332
|
+
## 매칭 신뢰도
|
|
333
|
+
|
|
334
|
+
검색 결과는 신뢰도에 따라 분류됩니다:
|
|
335
|
+
|
|
336
|
+
| 신뢰도 | 점수 | Gap | 동작 |
|
|
337
|
+
|--------|------|-----|------|
|
|
338
|
+
| **High** | ≥0.92 | ≥0.03 | 자동으로 컨텍스트에 포함 |
|
|
339
|
+
| **Suggested** | ≥0.75 | <0.03 | 대안 제시 |
|
|
340
|
+
| **None** | <0.75 | - | 매칭 없음 |
|
|
341
|
+
|
|
342
|
+
## Architecture
|
|
343
|
+
|
|
344
|
+
### System Overview
|
|
345
|
+
|
|
346
|
+
```
|
|
347
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
348
|
+
│ Claude Code Hooks │
|
|
349
|
+
│ SessionStart │ UserPromptSubmit │ Stop │ PostToolUse │ End │
|
|
350
|
+
└──────────────────────────┬──────────────────────────────────┘
|
|
351
|
+
│
|
|
352
|
+
▼
|
|
353
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
354
|
+
│ Memory Service │
|
|
355
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
356
|
+
│ │ Retriever │ │ Matcher │ │ Graduation │ │
|
|
357
|
+
│ │ Progressive│ │ Evidence │ │ L0 → L4 │ │
|
|
358
|
+
│ └─────────────┘ └─────────────┘ └─────────────┘ │
|
|
359
|
+
└──────────────────────────┬──────────────────────────────────┘
|
|
360
|
+
│
|
|
361
|
+
┌──────────────────┴──────────────────┐
|
|
362
|
+
▼ ▼
|
|
363
|
+
┌───────────────┐ ┌───────────────┐
|
|
364
|
+
│ EventStore │ ──── Outbox ────▶ │ VectorStore │
|
|
365
|
+
│ (DuckDB) │ (V2 Pattern) │ (LanceDB) │
|
|
366
|
+
└───────────────┘ └───────────────┘
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### Entity-Edge Model (3-Layer)
|
|
370
|
+
|
|
371
|
+
```
|
|
372
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
373
|
+
│ edges │
|
|
374
|
+
│ ┌──────────┐ evidence_of ┌──────────┐ │
|
|
375
|
+
│ │ Entry │ ─────────────────▶│ Entity │ │
|
|
376
|
+
│ │ (Fact, │ │ (Task, │ │
|
|
377
|
+
│ │ Decision)│ │ Artifact)│ │
|
|
378
|
+
│ └──────────┘ └──────────┘ │
|
|
379
|
+
│ │ │ │
|
|
380
|
+
│ │ derived_from │ blocked_by │
|
|
381
|
+
│ ▼ ▼ │
|
|
382
|
+
│ ┌──────────┐ ┌──────────┐ │
|
|
383
|
+
│ │ Entry │ │ Entity │ │
|
|
384
|
+
│ └──────────┘ └──────────┘ │
|
|
385
|
+
└─────────────────────────────────────────────────────────────┘
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### Progressive Disclosure (토큰 효율화)
|
|
389
|
+
|
|
390
|
+
```
|
|
391
|
+
Layer 1: Search Index (~50-100 tokens/result)
|
|
392
|
+
│ { id, summary, score }
|
|
393
|
+
│
|
|
394
|
+
└──▶ Layer 2: Timeline Context (~200 tokens)
|
|
395
|
+
│ 시간순 전후 맥락
|
|
396
|
+
│
|
|
397
|
+
└──▶ Layer 3: Full Details (~500-1000 tokens)
|
|
398
|
+
선택된 항목만 전체 로드
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### MCP Integration
|
|
402
|
+
|
|
403
|
+
```
|
|
404
|
+
┌─────────────────────┐ ┌─────────────────────┐
|
|
405
|
+
│ Claude Desktop │◀────────│ code-memory-mcp │
|
|
406
|
+
│ (MCP Client) │ stdio │ (MCP Server) │
|
|
407
|
+
└─────────────────────┘ └──────────┬──────────┘
|
|
408
|
+
│
|
|
409
|
+
▼
|
|
410
|
+
┌─────────────────────┐
|
|
411
|
+
│ Shared Storage │
|
|
412
|
+
│ ~/.claude-code/ │
|
|
413
|
+
└─────────────────────┘
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
## AXIOMMIND 7 원칙
|
|
417
|
+
|
|
418
|
+
1. **Single Source of Truth**: DuckDB EventStore가 유일한 진실의 원천
|
|
419
|
+
2. **Append-Only**: 이벤트는 수정/삭제 없이 추가만
|
|
420
|
+
3. **Idempotency**: dedupe_key로 중복 이벤트 감지
|
|
421
|
+
4. **Evidence Alignment**: 주장이 실제 소스에 기반했는지 검증
|
|
422
|
+
5. **Entity-Based Tasks**: canonical_key로 일관된 엔티티 식별
|
|
423
|
+
6. **Vector Store Consistency**: DuckDB → LanceDB 단방향 흐름
|
|
424
|
+
7. **Standard JSON**: 모든 데이터는 이식 가능한 JSON 형식
|
|
425
|
+
|
|
426
|
+
## 저장 위치
|
|
427
|
+
|
|
428
|
+
메모리는 기본적으로 다음 위치에 저장됩니다:
|
|
429
|
+
|
|
430
|
+
```
|
|
431
|
+
~/.claude-code/memory/
|
|
432
|
+
├── events.duckdb # 이벤트 저장소
|
|
433
|
+
└── vectors/ # 벡터 임베딩
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
Claude Code 세션 기록 위치:
|
|
437
|
+
|
|
438
|
+
```
|
|
439
|
+
~/.claude/projects/<project-hash>/<session-id>.jsonl
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
## 개발
|
|
443
|
+
|
|
444
|
+
```bash
|
|
445
|
+
# 의존성 설치
|
|
446
|
+
npm install
|
|
447
|
+
|
|
448
|
+
# 빌드
|
|
449
|
+
npm run build
|
|
450
|
+
|
|
451
|
+
# 테스트
|
|
452
|
+
npm test
|
|
453
|
+
|
|
454
|
+
# 타입 체크
|
|
455
|
+
npm run typecheck
|
|
456
|
+
|
|
457
|
+
# 개발 모드 실행
|
|
458
|
+
npm run dev
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
## 기술 스택
|
|
462
|
+
|
|
463
|
+
- **DuckDB**: 이벤트 저장소 (append-only SQL)
|
|
464
|
+
- **LanceDB**: 벡터 저장소 (고성능 벡터 검색)
|
|
465
|
+
- **@xenova/transformers**: 로컬 임베딩 생성
|
|
466
|
+
- **Zod**: 런타임 타입 검증
|
|
467
|
+
- **Commander**: CLI 인터페이스
|
|
468
|
+
- **TypeScript**: 타입 안전한 코드
|
|
469
|
+
- **Bun**: HTTP 서버 (Web Viewer)
|
|
470
|
+
- **Hono**: 경량 라우터
|
|
471
|
+
- **MCP SDK**: Claude Desktop 통합
|
|
472
|
+
|
|
473
|
+
## Specification Documents
|
|
474
|
+
|
|
475
|
+
상세 설계 문서는 `specs/` 디렉토리에서 확인할 수 있습니다:
|
|
476
|
+
|
|
477
|
+
| 문서 | 설명 |
|
|
478
|
+
|------|------|
|
|
479
|
+
| [citations-system](specs/citations-system/spec.md) | 메모리 인용 시스템 |
|
|
480
|
+
| [endless-mode](specs/endless-mode/spec.md) | 연속 세션 모드 |
|
|
481
|
+
| [entity-edge-model](specs/entity-edge-model/spec.md) | 3-Layer 데이터 모델 |
|
|
482
|
+
| [evidence-aligner-v2](specs/evidence-aligner-v2/spec.md) | 증거 정렬 시스템 |
|
|
483
|
+
| [mcp-desktop-integration](specs/mcp-desktop-integration/spec.md) | MCP 서버 통합 |
|
|
484
|
+
| [post-tool-use-hook](specs/post-tool-use-hook/spec.md) | 도구 사용 기록 |
|
|
485
|
+
| [private-tags](specs/private-tags/spec.md) | 프라이버시 태그 |
|
|
486
|
+
| [progressive-disclosure](specs/progressive-disclosure/spec.md) | 토큰 효율화 검색 |
|
|
487
|
+
| [task-entity-system](specs/task-entity-system/spec.md) | Task Entity 관리 |
|
|
488
|
+
| [vector-outbox-v2](specs/vector-outbox-v2/spec.md) | Transactional Outbox |
|
|
489
|
+
| [web-viewer-ui](specs/web-viewer-ui/spec.md) | 웹 대시보드 |
|
|
490
|
+
|
|
491
|
+
## Roadmap
|
|
492
|
+
|
|
493
|
+
### Phase 1: Core (완료)
|
|
494
|
+
- [x] Event Store (DuckDB)
|
|
495
|
+
- [x] Vector Store (LanceDB)
|
|
496
|
+
- [x] Memory Graduation (L0→L4)
|
|
497
|
+
- [x] Evidence Alignment
|
|
498
|
+
- [x] History Import
|
|
499
|
+
|
|
500
|
+
### Phase 2: Advanced Features (진행 중)
|
|
501
|
+
- [ ] Citations System
|
|
502
|
+
- [ ] Endless Mode
|
|
503
|
+
- [ ] Entity-Edge Model
|
|
504
|
+
- [ ] Evidence Aligner V2
|
|
505
|
+
- [ ] Private Tags
|
|
506
|
+
|
|
507
|
+
### Phase 3: Integration
|
|
508
|
+
- [ ] MCP Desktop Integration
|
|
509
|
+
- [ ] Web Viewer UI
|
|
510
|
+
- [ ] PostToolUse Hook
|
|
511
|
+
- [ ] Progressive Disclosure
|
|
512
|
+
|
|
513
|
+
### Phase 4: Optimization
|
|
514
|
+
- [ ] Vector Outbox V2
|
|
515
|
+
- [ ] Task Entity System
|
|
516
|
+
- [ ] Performance Tuning
|
|
517
|
+
|
|
518
|
+
## License
|
|
519
|
+
|
|
520
|
+
MIT
|