@smallironman/mcp-memory-keeper 0.12.2-fork1

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.
Files changed (110) hide show
  1. package/CHANGELOG.md +542 -0
  2. package/LICENSE +21 -0
  3. package/README.md +1281 -0
  4. package/bin/mcp-memory-keeper +54 -0
  5. package/dist/__tests__/e2e/issue33-reproduce.test.js +234 -0
  6. package/dist/__tests__/e2e/server-e2e.test.js +341 -0
  7. package/dist/__tests__/helpers/database-test-helper.js +160 -0
  8. package/dist/__tests__/helpers/test-server.js +92 -0
  9. package/dist/__tests__/integration/advanced-features.test.js +614 -0
  10. package/dist/__tests__/integration/backward-compatibility.test.js +245 -0
  11. package/dist/__tests__/integration/batchOperationsE2E.test.js +396 -0
  12. package/dist/__tests__/integration/batchOperationsHandler.test.js +1230 -0
  13. package/dist/__tests__/integration/channelManagementHandler.test.js +1291 -0
  14. package/dist/__tests__/integration/channels.test.js +376 -0
  15. package/dist/__tests__/integration/checkpoint.test.js +251 -0
  16. package/dist/__tests__/integration/concurrent-access.test.js +190 -0
  17. package/dist/__tests__/integration/context-operations.test.js +243 -0
  18. package/dist/__tests__/integration/contextDiff.test.js +852 -0
  19. package/dist/__tests__/integration/contextDiffHandler.test.js +976 -0
  20. package/dist/__tests__/integration/contextExportHandler.test.js +510 -0
  21. package/dist/__tests__/integration/contextGetPaginationDefaults.test.js +298 -0
  22. package/dist/__tests__/integration/contextReassignChannelHandler.test.js +908 -0
  23. package/dist/__tests__/integration/contextRelationshipsHandler.test.js +1151 -0
  24. package/dist/__tests__/integration/contextSearch.test.js +1054 -0
  25. package/dist/__tests__/integration/contextSearchHandler.test.js +552 -0
  26. package/dist/__tests__/integration/contextWatchActual.test.js +165 -0
  27. package/dist/__tests__/integration/contextWatchHandler.test.js +1500 -0
  28. package/dist/__tests__/integration/database-initialization.test.js +134 -0
  29. package/dist/__tests__/integration/enhanced-context-operations.test.js +1082 -0
  30. package/dist/__tests__/integration/enhancedContextGetHandler.test.js +915 -0
  31. package/dist/__tests__/integration/enhancedContextTimelineHandler.test.js +716 -0
  32. package/dist/__tests__/integration/error-cases.test.js +411 -0
  33. package/dist/__tests__/integration/export-import.test.js +367 -0
  34. package/dist/__tests__/integration/feature-flags.test.js +542 -0
  35. package/dist/__tests__/integration/file-operations.test.js +264 -0
  36. package/dist/__tests__/integration/filterBySessionId.test.js +251 -0
  37. package/dist/__tests__/integration/git-integration.test.js +241 -0
  38. package/dist/__tests__/integration/index-tools.test.js +496 -0
  39. package/dist/__tests__/integration/issue11-actual-bug-demo.test.js +304 -0
  40. package/dist/__tests__/integration/issue11-search-filters-bug.test.js +561 -0
  41. package/dist/__tests__/integration/issue12-checkpoint-restore-behavior.test.js +621 -0
  42. package/dist/__tests__/integration/issue13-key-validation.test.js +433 -0
  43. package/dist/__tests__/integration/issue24-final-fix.test.js +241 -0
  44. package/dist/__tests__/integration/issue24-fix-validation.test.js +158 -0
  45. package/dist/__tests__/integration/issue24-reproduce.test.js +225 -0
  46. package/dist/__tests__/integration/issue24-token-limit.test.js +199 -0
  47. package/dist/__tests__/integration/issue33-array-items-schema.test.js +165 -0
  48. package/dist/__tests__/integration/knowledge-graph.test.js +338 -0
  49. package/dist/__tests__/integration/migrations.test.js +528 -0
  50. package/dist/__tests__/integration/multi-agent.test.js +546 -0
  51. package/dist/__tests__/integration/pagination-critical-fix.test.js +296 -0
  52. package/dist/__tests__/integration/paginationDefaultsHandler.test.js +600 -0
  53. package/dist/__tests__/integration/project-directory.test.js +291 -0
  54. package/dist/__tests__/integration/resource-cleanup.test.js +149 -0
  55. package/dist/__tests__/integration/retention.test.js +513 -0
  56. package/dist/__tests__/integration/search.test.js +333 -0
  57. package/dist/__tests__/integration/semantic-search.test.js +266 -0
  58. package/dist/__tests__/integration/server-initialization.test.js +305 -0
  59. package/dist/__tests__/integration/session-management.test.js +219 -0
  60. package/dist/__tests__/integration/simplified-sharing.test.js +346 -0
  61. package/dist/__tests__/integration/smart-compaction.test.js +230 -0
  62. package/dist/__tests__/integration/summarization.test.js +308 -0
  63. package/dist/__tests__/integration/tokenLimitEnforcement.test.js +134 -0
  64. package/dist/__tests__/integration/tool-profiles-integration.test.js +150 -0
  65. package/dist/__tests__/integration/watcher-migration-validation.test.js +544 -0
  66. package/dist/__tests__/security/input-validation.test.js +115 -0
  67. package/dist/__tests__/utils/agents.test.js +473 -0
  68. package/dist/__tests__/utils/database.test.js +177 -0
  69. package/dist/__tests__/utils/git.test.js +122 -0
  70. package/dist/__tests__/utils/knowledge-graph.test.js +297 -0
  71. package/dist/__tests__/utils/migrationHealthCheck.test.js +302 -0
  72. package/dist/__tests__/utils/project-directory-messages.test.js +192 -0
  73. package/dist/__tests__/utils/timezone-safe-dates.js +119 -0
  74. package/dist/__tests__/utils/token-limits.test.js +225 -0
  75. package/dist/__tests__/utils/tool-profiles.test.js +374 -0
  76. package/dist/__tests__/utils/validation.test.js +200 -0
  77. package/dist/__tests__/utils/vector-store.test.js +231 -0
  78. package/dist/handlers/contextWatchHandlers.js +206 -0
  79. package/dist/index.js +4425 -0
  80. package/dist/migrations/003_add_channels.js +174 -0
  81. package/dist/migrations/004_add_context_watch.js +151 -0
  82. package/dist/migrations/005_add_context_watch.js +98 -0
  83. package/dist/migrations/simplify-sharing.js +117 -0
  84. package/dist/repositories/BaseRepository.js +30 -0
  85. package/dist/repositories/CheckpointRepository.js +140 -0
  86. package/dist/repositories/ContextRepository.js +2017 -0
  87. package/dist/repositories/FileRepository.js +104 -0
  88. package/dist/repositories/RepositoryManager.js +62 -0
  89. package/dist/repositories/SessionRepository.js +66 -0
  90. package/dist/repositories/WatcherRepository.js +252 -0
  91. package/dist/repositories/index.js +15 -0
  92. package/dist/test-helpers/database-helper.js +128 -0
  93. package/dist/types/entities.js +3 -0
  94. package/dist/utils/agents.js +791 -0
  95. package/dist/utils/channels.js +150 -0
  96. package/dist/utils/database.js +780 -0
  97. package/dist/utils/feature-flags.js +476 -0
  98. package/dist/utils/git.js +145 -0
  99. package/dist/utils/knowledge-graph.js +264 -0
  100. package/dist/utils/migrationHealthCheck.js +373 -0
  101. package/dist/utils/migrations.js +452 -0
  102. package/dist/utils/retention.js +460 -0
  103. package/dist/utils/timestamps.js +112 -0
  104. package/dist/utils/token-limits.js +350 -0
  105. package/dist/utils/tool-profiles.js +242 -0
  106. package/dist/utils/validation.js +296 -0
  107. package/dist/utils/vector-store.js +247 -0
  108. package/examples/config.json +31 -0
  109. package/examples/project-directory-setup.md +114 -0
  110. package/package.json +85 -0
package/README.md ADDED
@@ -0,0 +1,1281 @@
1
+ # MCP Memory Keeper - Claude Code Context Management
2
+
3
+ [![npm version](https://img.shields.io/npm/v/mcp-memory-keeper.svg)](https://www.npmjs.com/package/mcp-memory-keeper)
4
+ [![npm downloads](https://img.shields.io/npm/dm/mcp-memory-keeper.svg)](https://www.npmjs.com/package/mcp-memory-keeper)
5
+ [![CI](https://github.com/mkreyman/mcp-memory-keeper/actions/workflows/ci.yml/badge.svg)](https://github.com/mkreyman/mcp-memory-keeper/actions/workflows/ci.yml)
6
+ [![codecov](https://codecov.io/gh/mkreyman/mcp-memory-keeper/branch/main/graph/badge.svg)](https://codecov.io/gh/mkreyman/mcp-memory-keeper)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+
9
+ A Model Context Protocol (MCP) server that provides persistent context management for Claude AI coding assistants. Never lose context during compaction again! This MCP server helps Claude Code maintain context across sessions, preserving your work history, decisions, and progress.
10
+
11
+ ## 🚀 Quick Start
12
+
13
+ Get started in under 30 seconds:
14
+
15
+ ```bash
16
+ # Add memory-keeper to Claude
17
+ claude mcp add memory-keeper npx mcp-memory-keeper
18
+
19
+ # Start a new Claude session and use it!
20
+ # Try: Analyze the current repo and save your analysis in memory-keeper
21
+ ```
22
+
23
+ That's it! Memory Keeper is now available in all your Claude sessions. Your context is stored in `~/mcp-data/memory-keeper/` and persists across sessions.
24
+
25
+ ## 🚀 Practical Memory Keeper Workflow Example
26
+
27
+ ### **Custom Command + CLAUDE.md = Automatic Context Management**
28
+
29
+ #### **CLAUDE.md** (condensed example)
30
+
31
+ ```markdown
32
+ # Project Configuration
33
+
34
+ ## Development Rules
35
+
36
+ - Always use memory-keeper to track progress
37
+ - Save architectural decisions and test results
38
+ - Create checkpoints before context limits
39
+
40
+ ## Quality Standards
41
+
42
+ - All tests must pass before marking complete
43
+ - Document actual vs claimed results
44
+ ```
45
+
46
+ #### **Custom Command Example: `/my-dev-workflow`**
47
+
48
+ ```markdown
49
+ # My Development Workflow
50
+
51
+ When working on the provided project:
52
+
53
+ - Use memory-keeper with channel: <project_name>
54
+ - Save progress at every major milestone
55
+ - Document all decisions with category: "decision"
56
+ - Track implementation status with category: "progress"
57
+ - Before claiming anything is complete, save test results
58
+
59
+ ## Workflow Steps
60
+
61
+ 1. Initialize session with project name as channel
62
+ 2. Save findings during investigation
63
+ 3. Create checkpoint before major changes
64
+ 4. Document what actually works vs what should work
65
+ ```
66
+
67
+ #### **Usage Example**
68
+
69
+ ```
70
+ User: /my-dev-workflow authentication-service
71
+
72
+ AI: Setting up workflow for authentication-service.
73
+ [Uses memory-keeper with channel "authentication-service"]
74
+
75
+ [... AI works, automatically saving context ...]
76
+
77
+ User: "Getting close to context limit. Create checkpoint and give me a key"
78
+
79
+ AI: "Checkpoint created: authentication-service-checkpoint-20250126-143026"
80
+
81
+ [Continue working until context reset or compact manually]
82
+
83
+ User: "Restore from key: authentication-service-checkpoint-20250126-143026"
84
+
85
+ AI: "Restored! Continuing OAuth implementation. We completed the token validation, working on refresh logic..."
86
+ ```
87
+
88
+ **The Pattern:**
89
+
90
+ 1. Custom command includes instructions to use memory-keeper
91
+ 2. AI follows those instructions automatically
92
+ 3. **When you notice the conversation getting long, YOU ask Claude to save a checkpoint** (like saving your game before a boss fight!)
93
+ 4. **When Claude runs out of space and starts fresh, YOU tell it to restore using the checkpoint key**
94
+
95
+ **🎯 Key Feature:** Memory Keeper is a shared board! You can:
96
+
97
+ - Continue in the same session after reset
98
+ - Start a completely new session and restore
99
+ - Have multiple Claude sessions running in parallel, all sharing the same memory
100
+ - One session can save context that another session retrieves
101
+
102
+ This enables powerful workflows like having one Claude session doing research while another implements code, both sharing discoveries through Memory Keeper!
103
+
104
+ ## Why MCP Memory Keeper?
105
+
106
+ Claude Code users often face context loss when the conversation window fills up. This MCP server solves that problem by providing a persistent memory layer for Claude AI. Whether you're working on complex refactoring, multi-file changes, or long debugging sessions, Memory Keeper ensures your Claude assistant remembers important context, decisions, and progress.
107
+
108
+ ### Perfect for:
109
+
110
+ - Long coding sessions with Claude Code
111
+ - Complex projects requiring context preservation
112
+ - Teams using Claude AI for collaborative development
113
+ - Developers who want persistent context across Claude sessions
114
+
115
+ ## Features
116
+
117
+ - 🔄 Save and restore context between Claude Code sessions
118
+ - 📁 File content caching with change detection
119
+ - 🏷️ Organize context with categories and priorities
120
+ - 📺 **Channels** - Persistent topic-based organization (auto-derived from git branch)
121
+ - 📸 Checkpoint system for complete context snapshots
122
+ - 🤖 Smart compaction helper that never loses critical info
123
+ - 🔍 Full-text search across all saved context
124
+ - 🕐 **Enhanced filtering** - Time-based queries, regex patterns, pagination
125
+ - 📊 **Change tracking** - See what's been added, modified, or deleted since any point
126
+ - 💾 Export/import for backup and sharing
127
+ - 🌿 Git integration with automatic context correlation
128
+ - 📊 AI-friendly summarization with priority awareness
129
+ - 🚀 Fast SQLite-based storage optimized for Claude
130
+ - 🔁 **Batch operations** - Save, update, or delete multiple items atomically
131
+ - 🔄 **Channel reassignment** - Move items between channels based on patterns
132
+ - 🔗 **Context relationships** - Link related items with typed relationships
133
+ - 👁️ **Real-time monitoring** - Watch for context changes with filters
134
+
135
+ ## Installation
136
+
137
+ ### Recommended: NPX Installation
138
+
139
+ ```bash
140
+ claude mcp add memory-keeper npx mcp-memory-keeper
141
+ ```
142
+
143
+ This single command:
144
+
145
+ - ✅ Always uses the latest version
146
+ - ✅ Handles all dependencies automatically
147
+ - ✅ Works across macOS, Linux, and Windows
148
+ - ✅ No manual building or native module issues
149
+
150
+ ### Alternative Installation Methods
151
+
152
+ <details>
153
+ <summary>Global Installation</summary>
154
+
155
+ ```bash
156
+ npm install -g mcp-memory-keeper
157
+ claude mcp add memory-keeper mcp-memory-keeper
158
+ ```
159
+
160
+ </details>
161
+
162
+ <details>
163
+ <summary>From Source (for development)</summary>
164
+
165
+ ```bash
166
+ # 1. Clone the repository
167
+ git clone https://github.com/mkreyman/mcp-memory-keeper.git
168
+ cd mcp-memory-keeper
169
+
170
+ # 2. Install dependencies
171
+ npm install
172
+
173
+ # 3. Build the project
174
+ npm run build
175
+
176
+ # 4. Add to Claude
177
+ claude mcp add memory-keeper /absolute/path/to/mcp-memory-keeper/bin/mcp-memory-keeper
178
+ ```
179
+
180
+ </details>
181
+
182
+ ## Configuration
183
+
184
+ ### Environment Variables
185
+
186
+ #### Storage and Installation
187
+
188
+ - `DATA_DIR` - Directory for database storage (default: `~/mcp-data/memory-keeper/`)
189
+ - `MEMORY_KEEPER_INSTALL_DIR` - Installation directory (default: `~/.local/mcp-servers/memory-keeper/`)
190
+ - `MEMORY_KEEPER_AUTO_UPDATE` - Set to `1` to enable auto-updates
191
+
192
+ #### Token Limit Configuration
193
+
194
+ - `MCP_MAX_TOKENS` - Maximum tokens allowed in responses (default: `25000`, range: `1000-100000`)
195
+ - Adjust this if your MCP client has different limits
196
+ - `MCP_TOKEN_SAFETY_BUFFER` - Safety buffer percentage (default: `0.8`, range: `0.1-1.0`)
197
+ - Uses only this fraction of the max tokens to prevent overflows
198
+ - `MCP_MIN_ITEMS` - Minimum items to return even if exceeding limits (default: `1`, range: `1-100`)
199
+ - Ensures at least some results are returned
200
+ - `MCP_MAX_ITEMS` - Maximum items allowed per response (default: `100`, range: `10-1000`)
201
+ - Upper bound for result sets regardless of token limits
202
+ - `MCP_CHARS_PER_TOKEN` - Characters per token ratio (default: `3.5`, range: `2.5-5.0`) **[Advanced]**
203
+ - Adjusts token estimation accuracy for different content types
204
+ - Lower values = more conservative (safer but returns fewer items)
205
+ - Higher values = more aggressive (returns more items but risks overflow)
206
+
207
+ Example configuration for stricter token limits:
208
+
209
+ ```bash
210
+ export MCP_MAX_TOKENS=20000 # Lower max tokens
211
+ export MCP_TOKEN_SAFETY_BUFFER=0.7 # More conservative buffer
212
+ export MCP_MAX_ITEMS=50 # Fewer items per response
213
+ export MCP_CHARS_PER_TOKEN=3.0 # More conservative estimation (optional)
214
+ ```
215
+
216
+ #### Tool Profiles
217
+
218
+ By default, all 38 tools are exposed. To reduce context overhead in your AI assistant, you can activate a tool profile that limits which tools are available.
219
+
220
+ **Quick usage:**
221
+
222
+ ```bash
223
+ # Essential tools only (8 tools)
224
+ TOOL_PROFILE=minimal npx mcp-memory-keeper
225
+
226
+ # Standard workflow set (22 tools)
227
+ TOOL_PROFILE=standard npx mcp-memory-keeper
228
+
229
+ # All tools (default)
230
+ TOOL_PROFILE=full npx mcp-memory-keeper
231
+ ```
232
+
233
+ **Built-in profiles:**
234
+
235
+ | Profile | Tools | Description |
236
+ | ---------- | ----- | -------------------------------------------------------------- |
237
+ | `minimal` | 8 | Core persistence: save, get, search, status, checkpoint |
238
+ | `standard` | 22 | Daily workflow: core + git, batch ops, channels, export/import |
239
+ | `full` | 38 | All tools (default, backwards compatible) |
240
+
241
+ **Custom profiles via config file:**
242
+
243
+ Create `~/.mcp-memory-keeper/config.json` to define or override profiles:
244
+
245
+ ```json
246
+ {
247
+ "profiles": {
248
+ "my_workflow": [
249
+ "context_session_start",
250
+ "context_save",
251
+ "context_get",
252
+ "context_search",
253
+ "context_checkpoint",
254
+ "context_restore_checkpoint",
255
+ "context_diff",
256
+ "context_timeline"
257
+ ]
258
+ }
259
+ }
260
+ ```
261
+
262
+ Then activate it: `TOOL_PROFILE=my_workflow npx mcp-memory-keeper`
263
+
264
+ Config file profiles take precedence over built-in defaults with the same name.
265
+
266
+ **Profile resolution precedence:**
267
+
268
+ | `TOOL_PROFILE` | Config file has profile? | Built-in exists? | Result |
269
+ | -------------- | ------------------------ | ---------------- | -------------------------------- |
270
+ | Set | Yes | — | Uses config file definition |
271
+ | Set | No | Yes | Uses built-in definition |
272
+ | Set | No | No | Warning + falls back to `full` |
273
+ | Not set | — | — | Uses built-in `full` (all tools) |
274
+
275
+ **Environment variables:**
276
+
277
+ | Variable | Description |
278
+ | --------------------- | ------------------------------------------------------------------------- |
279
+ | `TOOL_PROFILE` | Profile name to activate (e.g., `minimal`, `standard`, `full`, or custom) |
280
+ | `TOOL_PROFILE_CONFIG` | Override config file path (default: `~/.mcp-memory-keeper/config.json`) |
281
+
282
+ > Note: Profile resolution happens once at server startup. Changes to the env var or config file take effect on the next server restart.
283
+
284
+ **Claude Code / Claude Desktop configuration:**
285
+
286
+ ```json
287
+ {
288
+ "mcpServers": {
289
+ "memory-keeper": {
290
+ "command": "npx",
291
+ "args": ["mcp-memory-keeper"],
292
+ "env": {
293
+ "TOOL_PROFILE": "minimal"
294
+ }
295
+ }
296
+ }
297
+ }
298
+ ```
299
+
300
+ See `examples/config.json` for a complete example config file.
301
+
302
+ ### Claude Code (CLI)
303
+
304
+ #### Configuration Scopes
305
+
306
+ Choose where to save the configuration:
307
+
308
+ ```bash
309
+ # Project-specific (default) - only for you in this project
310
+ claude mcp add memory-keeper npx mcp-memory-keeper
311
+
312
+ # Shared with team via .mcp.json
313
+ claude mcp add --scope project memory-keeper npx mcp-memory-keeper
314
+
315
+ # Available across all your projects
316
+ claude mcp add --scope user memory-keeper npx mcp-memory-keeper
317
+ ```
318
+
319
+ #### Verify Configuration
320
+
321
+ ```bash
322
+ # List all configured servers
323
+ claude mcp list
324
+
325
+ # Get details for Memory Keeper
326
+ claude mcp get memory-keeper
327
+ ```
328
+
329
+ ### Claude Desktop App
330
+
331
+ 1. Open Claude Desktop settings
332
+ 2. Navigate to "Developer" → "Model Context Protocol"
333
+ 3. Click "Add MCP Server"
334
+ 4. Add the following configuration:
335
+
336
+ ```json
337
+ {
338
+ "mcpServers": {
339
+ "memory-keeper": {
340
+ "command": "npx",
341
+ "args": ["mcp-memory-keeper"]
342
+ }
343
+ }
344
+ }
345
+ ```
346
+
347
+ That's it! No paths needed - npx automatically handles everything.
348
+
349
+ ### Verify Installation
350
+
351
+ #### For Claude Code:
352
+
353
+ 1. Restart Claude Code or start a new session
354
+ 2. The Memory Keeper tools should be available automatically
355
+ 3. Test with: `mcp_memory_save({ key: "test", value: "Hello Memory Keeper!" })`
356
+ 4. If not working, check server status:
357
+ ```bash
358
+ claude mcp list # Should show memory-keeper as "running"
359
+ ```
360
+
361
+ #### For Claude Desktop:
362
+
363
+ 1. Restart Claude Desktop after adding the configuration
364
+ 2. In a new conversation, the Memory Keeper tools should be available
365
+ 3. Test with the same command above
366
+
367
+ ### Troubleshooting
368
+
369
+ If Memory Keeper isn't working:
370
+
371
+ ```bash
372
+ # Remove and re-add the server
373
+ claude mcp remove memory-keeper
374
+ claude mcp add memory-keeper npx mcp-memory-keeper
375
+
376
+ # Check logs for errors
377
+ # The server output will appear in Claude Code's output panel
378
+ ```
379
+
380
+ ### Updating to Latest Version
381
+
382
+ With the npx installation method, you automatically get the latest version every time! No manual updates needed.
383
+
384
+ If you're using the global installation method:
385
+
386
+ ```bash
387
+ # Update to latest version
388
+ npm update -g mcp-memory-keeper
389
+
390
+ # Start a new Claude session
391
+ # The updated features will be available immediately
392
+ ```
393
+
394
+ **Note**: You don't need to reconfigure the MCP server in Claude after updating. Just start a new session!
395
+
396
+ ## Usage
397
+
398
+ ### Session Management
399
+
400
+ ```javascript
401
+ // Start a new session
402
+ mcp_context_session_start({
403
+ name: 'Feature Development',
404
+ description: 'Working on user authentication',
405
+ });
406
+
407
+ // Start a session with project directory for git tracking
408
+ mcp_context_session_start({
409
+ name: 'Feature Development',
410
+ description: 'Working on user authentication',
411
+ projectDir: '/path/to/your/project',
412
+ });
413
+
414
+ // Start a session with a default channel
415
+ mcp_context_session_start({
416
+ name: 'Feature Development',
417
+ description: 'Working on user authentication',
418
+ projectDir: '/path/to/your/project',
419
+ defaultChannel: 'auth-feature', // Will auto-derive from git branch if not specified
420
+ });
421
+
422
+ // Set project directory for current session
423
+ mcp_context_set_project_dir({
424
+ projectDir: '/path/to/your/project',
425
+ });
426
+
427
+ // List recent sessions
428
+ mcp_context_session_list({ limit: 5 });
429
+
430
+ // Continue from a previous session
431
+ mcp_context_session_start({
432
+ name: 'Feature Dev Continued',
433
+ continueFrom: 'previous-session-id',
434
+ });
435
+ ```
436
+
437
+ ### Working with Channels (NEW in v0.10.0)
438
+
439
+ Channels provide persistent topic-based organization that survives session crashes and restarts:
440
+
441
+ ```javascript
442
+ // Channels are auto-derived from git branch (if projectDir is set)
443
+ // Branch "feature/auth-system" becomes channel "feature-auth-system" (20 chars max)
444
+
445
+ // Save to a specific channel
446
+ mcp_context_save({
447
+ key: 'auth_design',
448
+ value: 'Using JWT with refresh tokens',
449
+ category: 'decision',
450
+ priority: 'high',
451
+ channel: 'auth-feature', // Explicitly set channel
452
+ });
453
+
454
+ // Get items from a specific channel
455
+ mcp_context_get({ channel: 'auth-feature' });
456
+
457
+ // Get items across all channels (default behavior)
458
+ mcp_context_get({ category: 'task' });
459
+
460
+ // Channels persist across sessions - perfect for:
461
+ // - Multi-branch development
462
+ // - Feature-specific context
463
+ // - Team collaboration on different topics
464
+ ```
465
+
466
+ ### Enhanced Context Storage
467
+
468
+ ```javascript
469
+ // Save with categories and priorities
470
+ mcp_context_save({
471
+ key: 'current_task',
472
+ value: 'Implement OAuth integration',
473
+ category: 'task',
474
+ priority: 'high',
475
+ });
476
+
477
+ // Save decisions
478
+ mcp_context_save({
479
+ key: 'auth_strategy',
480
+ value: 'Using JWT tokens with 24h expiry',
481
+ category: 'decision',
482
+ priority: 'high',
483
+ });
484
+
485
+ // Save progress notes
486
+ mcp_context_save({
487
+ key: 'progress_auth',
488
+ value: 'Completed user model, working on token generation',
489
+ category: 'progress',
490
+ priority: 'normal',
491
+ });
492
+
493
+ // Retrieve by category
494
+ mcp_context_get({ category: 'task' });
495
+
496
+ // Retrieve specific item
497
+ mcp_context_get({ key: 'current_task' });
498
+
499
+ // Get context from specific session
500
+ mcp_context_get({
501
+ sessionId: 'session-id-here',
502
+ category: 'decision',
503
+ });
504
+
505
+ // Enhanced filtering (NEW in v0.10.0)
506
+ mcp_context_get({
507
+ category: 'task',
508
+ priorities: ['high', 'normal'],
509
+ includeMetadata: true, // Get timestamps, size info
510
+ sort: 'created_desc', // created_asc/desc, updated_asc/desc, priority
511
+ limit: 10, // Pagination
512
+ offset: 0,
513
+ });
514
+
515
+ // Time-based queries (NEW in v0.10.0)
516
+ mcp_context_get({
517
+ createdAfter: '2025-01-20T00:00:00Z',
518
+ createdBefore: '2025-01-26T23:59:59Z',
519
+ includeMetadata: true,
520
+ });
521
+
522
+ // Pattern matching (NEW in v0.10.0)
523
+ mcp_context_get({
524
+ keyPattern: 'auth_.*', // Regex to match keys
525
+ category: 'decision',
526
+ });
527
+ ```
528
+
529
+ ### File Caching
530
+
531
+ ```javascript
532
+ // Cache file content for change detection
533
+ mcp_context_cache_file({
534
+ filePath: '/src/auth/user.model.ts',
535
+ content: fileContent,
536
+ });
537
+
538
+ // Check if file has changed
539
+ mcp_context_file_changed({
540
+ filePath: '/src/auth/user.model.ts',
541
+ currentContent: newFileContent,
542
+ });
543
+
544
+ // Get current session status
545
+ mcp_context_status();
546
+ ```
547
+
548
+ ### Complete Workflow Example
549
+
550
+ ```javascript
551
+ // 1. Start a new session
552
+ mcp_context_session_start({
553
+ name: 'Settings Refactor',
554
+ description: 'Refactoring settings module for better performance',
555
+ });
556
+
557
+ // 2. Save high-priority task
558
+ mcp_context_save({
559
+ key: 'main_task',
560
+ value: 'Refactor Settings.Context to use behaviors',
561
+ category: 'task',
562
+ priority: 'high',
563
+ });
564
+
565
+ // 3. Cache important files
566
+ mcp_context_cache_file({
567
+ filePath: 'lib/settings/context.ex',
568
+ content: originalFileContent,
569
+ });
570
+
571
+ // 4. Save decisions as you work
572
+ mcp_context_save({
573
+ key: 'architecture_decision',
574
+ value: 'Split settings into read/write modules',
575
+ category: 'decision',
576
+ priority: 'high',
577
+ });
578
+
579
+ // 5. Track progress
580
+ mcp_context_save({
581
+ key: 'progress_1',
582
+ value: 'Completed behavior definition, 5 modules remaining',
583
+ category: 'progress',
584
+ priority: 'normal',
585
+ });
586
+
587
+ // 6. Before context window fills up
588
+ mcp_context_status(); // Check what's saved
589
+
590
+ // 7. After Claude Code restart
591
+ mcp_context_get({ category: 'task', priority: 'high' }); // Get high priority tasks
592
+ mcp_context_get({ key: 'architecture_decision' }); // Get specific decisions
593
+ mcp_context_file_changed({ filePath: 'lib/settings/context.ex' }); // Check for changes
594
+ ```
595
+
596
+ ### Checkpoints (Phase 2)
597
+
598
+ Create named snapshots of your entire context that can be restored later:
599
+
600
+ ```javascript
601
+ // Create a checkpoint before major changes
602
+ mcp_context_checkpoint({
603
+ name: 'before-refactor',
604
+ description: 'State before major settings refactor',
605
+ includeFiles: true, // Include cached files
606
+ includeGitStatus: true, // Capture git status
607
+ });
608
+
609
+ // Continue working...
610
+ // If something goes wrong, restore from checkpoint
611
+ mcp_context_restore_checkpoint({
612
+ name: 'before-refactor',
613
+ restoreFiles: true, // Restore cached files too
614
+ });
615
+
616
+ // Or restore the latest checkpoint
617
+ mcp_context_restore_checkpoint({});
618
+ ```
619
+
620
+ ### Context Summarization (Phase 2)
621
+
622
+ Get AI-friendly summaries of your saved context:
623
+
624
+ ```javascript
625
+ // Get a summary of all context
626
+ mcp_context_summarize();
627
+
628
+ // Get summary of specific categories
629
+ mcp_context_summarize({
630
+ categories: ['task', 'decision'],
631
+ maxLength: 2000,
632
+ });
633
+
634
+ // Summarize a specific session
635
+ mcp_context_summarize({
636
+ sessionId: 'session-id-here',
637
+ categories: ['progress'],
638
+ });
639
+ ```
640
+
641
+ Example summary output:
642
+
643
+ ```markdown
644
+ # Context Summary
645
+
646
+ ## High Priority Items
647
+
648
+ - **main_task**: Refactor Settings.Context to use behaviors
649
+ - **critical_bug**: Fix memory leak in subscription handler
650
+
651
+ ## Task
652
+
653
+ - implement_auth: Add OAuth2 authentication flow
654
+ - update_tests: Update test suite for new API
655
+
656
+ ## Decision
657
+
658
+ - architecture_decision: Split settings into read/write modules
659
+ - db_choice: Use PostgreSQL for better JSON support
660
+ ```
661
+
662
+ ### Batch Operations
663
+
664
+ Perform multiple operations atomically:
665
+
666
+ ```javascript
667
+ // Save multiple items at once
668
+ mcp_context_batch_save({
669
+ items: [
670
+ { key: 'config_api_url', value: 'https://api.example.com', category: 'note' },
671
+ { key: 'config_timeout', value: '30000', category: 'note' },
672
+ { key: 'config_retries', value: '3', category: 'note' },
673
+ ],
674
+ });
675
+
676
+ // Update multiple items
677
+ mcp_context_batch_update({
678
+ updates: [
679
+ { key: 'task_1', priority: 'high' },
680
+ { key: 'task_2', priority: 'high' },
681
+ { key: 'task_3', value: 'Updated task description' },
682
+ ],
683
+ });
684
+
685
+ // Delete by pattern
686
+ mcp_context_batch_delete({
687
+ keyPattern: 'temp_*',
688
+ dryRun: true, // Preview first
689
+ });
690
+ ```
691
+
692
+ ### Channel Management
693
+
694
+ Reorganize context items between channels:
695
+
696
+ ```javascript
697
+ // Move items to a new channel
698
+ mcp_context_reassign_channel({
699
+ keyPattern: 'auth_*',
700
+ toChannel: 'feature-authentication',
701
+ });
702
+
703
+ // Move from one channel to another
704
+ mcp_context_reassign_channel({
705
+ fromChannel: 'sprint-14',
706
+ toChannel: 'sprint-15',
707
+ category: 'task',
708
+ priorities: ['high'],
709
+ });
710
+ ```
711
+
712
+ ### Context Relationships
713
+
714
+ Build a graph of related items:
715
+
716
+ ```javascript
717
+ // Link related items
718
+ mcp_context_link({
719
+ sourceKey: 'epic_user_management',
720
+ targetKey: 'task_create_user_api',
721
+ relationship: 'contains',
722
+ });
723
+
724
+ // Find related items
725
+ mcp_context_get_related({
726
+ key: 'epic_user_management',
727
+ relationship: 'contains',
728
+ depth: 2,
729
+ });
730
+ ```
731
+
732
+ ### Real-time Monitoring
733
+
734
+ Watch for context changes:
735
+
736
+ ```javascript
737
+ // Create a watcher
738
+ const watcher = await mcp_context_watch({
739
+ action: 'create',
740
+ filters: {
741
+ categories: ['task'],
742
+ priorities: ['high'],
743
+ },
744
+ });
745
+
746
+ // Poll for changes
747
+ const changes = await mcp_context_watch({
748
+ action: 'poll',
749
+ watcherId: watcher.watcherId,
750
+ });
751
+ ```
752
+
753
+ ### Smart Compaction (Phase 3)
754
+
755
+ Never lose critical context when Claude's window fills up:
756
+
757
+ ```javascript
758
+ // Before context window fills
759
+ mcp_context_prepare_compaction();
760
+
761
+ // This automatically:
762
+ // - Creates a checkpoint
763
+ // - Identifies high-priority items
764
+ // - Captures unfinished tasks
765
+ // - Saves all decisions
766
+ // - Generates a summary
767
+ // - Prepares restoration instructions
768
+ ```
769
+
770
+ ### Git Integration (Phase 3)
771
+
772
+ Track git changes in your project directory and save context with commits:
773
+
774
+ ```javascript
775
+ // First, set your project directory (if not done during session start)
776
+ mcp_context_set_project_dir({
777
+ projectDir: '/path/to/your/project',
778
+ });
779
+
780
+ // Commit with auto-save
781
+ mcp_context_git_commit({
782
+ message: 'feat: Add user authentication',
783
+ autoSave: true, // Creates checkpoint with commit
784
+ });
785
+
786
+ // Context is automatically linked to the commit
787
+ // Note: If no project directory is set, you'll see a helpful message
788
+ // explaining how to enable git tracking for your project
789
+ ```
790
+
791
+ ### Context Search (Phase 3)
792
+
793
+ Find anything in your saved context:
794
+
795
+ ```javascript
796
+ // Search in keys and values
797
+ mcp_context_search({ query: 'authentication' });
798
+
799
+ // Search only in keys
800
+ mcp_context_search({
801
+ query: 'config',
802
+ searchIn: ['key'],
803
+ });
804
+
805
+ // Search in specific session
806
+ mcp_context_search({
807
+ query: 'bug',
808
+ sessionId: 'session-id',
809
+ });
810
+ ```
811
+
812
+ ### Export/Import (Phase 3)
813
+
814
+ Share context or backup your work:
815
+
816
+ ```javascript
817
+ // Export current session
818
+ mcp_context_export(); // Creates memory-keeper-export-xxx.json
819
+
820
+ // Export specific session
821
+ mcp_context_export({
822
+ sessionId: 'session-id',
823
+ format: 'json',
824
+ });
825
+
826
+ // Import from file
827
+ mcp_context_import({
828
+ filePath: 'memory-keeper-export-xxx.json',
829
+ });
830
+
831
+ // Merge into current session
832
+ mcp_context_import({
833
+ filePath: 'backup.json',
834
+ merge: true,
835
+ });
836
+ ```
837
+
838
+ ### Knowledge Graph (Phase 4)
839
+
840
+ Automatically extract entities and relationships from your context:
841
+
842
+ ```javascript
843
+ // Analyze context to build knowledge graph
844
+ mcp_context_analyze();
845
+
846
+ // Or analyze specific categories
847
+ mcp_context_analyze({
848
+ categories: ['task', 'decision'],
849
+ });
850
+
851
+ // Find related entities
852
+ mcp_context_find_related({
853
+ key: 'AuthService',
854
+ maxDepth: 2,
855
+ });
856
+
857
+ // Generate visualization data
858
+ mcp_context_visualize({
859
+ type: 'graph',
860
+ });
861
+
862
+ // Timeline view
863
+ mcp_context_visualize({
864
+ type: 'timeline',
865
+ });
866
+
867
+ // Category/priority heatmap
868
+ mcp_context_visualize({
869
+ type: 'heatmap',
870
+ });
871
+ ```
872
+
873
+ ### Semantic Search (Phase 4.2)
874
+
875
+ Find context using natural language queries:
876
+
877
+ ```javascript
878
+ // Search with natural language
879
+ mcp_context_semantic_search({
880
+ query: 'how are we handling user authentication?',
881
+ topK: 5,
882
+ });
883
+
884
+ // Find the most relevant security decisions
885
+ mcp_context_semantic_search({
886
+ query: 'security concerns and decisions',
887
+ minSimilarity: 0.5,
888
+ });
889
+
890
+ // Search with specific similarity threshold
891
+ mcp_context_semantic_search({
892
+ query: 'database performance optimization',
893
+ topK: 10,
894
+ minSimilarity: 0.3,
895
+ });
896
+ ```
897
+
898
+ ### Multi-Agent System (Phase 4.3)
899
+
900
+ Delegate complex analysis tasks to specialized agents:
901
+
902
+ ```javascript
903
+ // Analyze patterns in your context
904
+ mcp_context_delegate({
905
+ taskType: 'analyze',
906
+ input: {
907
+ analysisType: 'patterns',
908
+ categories: ['task', 'decision'],
909
+ },
910
+ });
911
+
912
+ // Get comprehensive analysis
913
+ mcp_context_delegate({
914
+ taskType: 'analyze',
915
+ input: {
916
+ analysisType: 'comprehensive',
917
+ },
918
+ });
919
+
920
+ // Analyze relationships between entities
921
+ mcp_context_delegate({
922
+ taskType: 'analyze',
923
+ input: {
924
+ analysisType: 'relationships',
925
+ maxDepth: 3,
926
+ },
927
+ });
928
+
929
+ // Create intelligent summaries
930
+ mcp_context_delegate({
931
+ taskType: 'synthesize',
932
+ input: {
933
+ synthesisType: 'summary',
934
+ maxLength: 1000,
935
+ },
936
+ });
937
+
938
+ // Get actionable recommendations
939
+ mcp_context_delegate({
940
+ taskType: 'synthesize',
941
+ input: {
942
+ synthesisType: 'recommendations',
943
+ analysisResults: {}, // Can pass previous analysis results
944
+ },
945
+ });
946
+
947
+ // Chain multiple agent tasks
948
+ mcp_context_delegate({
949
+ chain: true,
950
+ taskType: ['analyze', 'synthesize'],
951
+ input: [{ analysisType: 'comprehensive' }, { synthesisType: 'recommendations' }],
952
+ });
953
+ ```
954
+
955
+ Agent Types:
956
+
957
+ - **Analyzer Agent**: Detects patterns, analyzes relationships, tracks trends
958
+ - **Synthesizer Agent**: Creates summaries, merges insights, generates recommendations
959
+
960
+ ### Session Branching & Merging (Phase 4.4)
961
+
962
+ Explore alternatives without losing your original work:
963
+
964
+ ```javascript
965
+ // Create a branch to try something new
966
+ mcp_context_branch_session({
967
+ branchName: 'experimental-refactor',
968
+ copyDepth: 'shallow', // Only copy high-priority items
969
+ });
970
+
971
+ // Or create a full copy
972
+ mcp_context_branch_session({
973
+ branchName: 'feature-complete-copy',
974
+ copyDepth: 'deep', // Copy everything
975
+ });
976
+
977
+ // Later, merge changes back
978
+ mcp_context_merge_sessions({
979
+ sourceSessionId: 'branch-session-id',
980
+ conflictResolution: 'keep_newest', // or "keep_current", "keep_source"
981
+ });
982
+ ```
983
+
984
+ ### Journal Entries (Phase 4.4)
985
+
986
+ Track your thoughts and progress with timestamped journal entries:
987
+
988
+ ```javascript
989
+ // Add a journal entry
990
+ mcp_context_journal_entry({
991
+ entry: 'Completed the authentication module. Tests are passing!',
992
+ tags: ['milestone', 'authentication'],
993
+ mood: 'accomplished',
994
+ });
995
+
996
+ // Entries are included in timeline views
997
+ mcp_context_timeline({
998
+ groupBy: 'day',
999
+ });
1000
+ ```
1001
+
1002
+ ### Timeline & Activity Tracking (Phase 4.4)
1003
+
1004
+ Visualize your work patterns over time:
1005
+
1006
+ ```javascript
1007
+ // Get activity timeline
1008
+ mcp_context_timeline({
1009
+ startDate: '2024-01-01',
1010
+ endDate: '2024-01-31',
1011
+ groupBy: 'day', // or "hour", "week"
1012
+ });
1013
+
1014
+ // Enhanced timeline (NEW in v0.10.0)
1015
+ mcp_context_timeline({
1016
+ groupBy: 'hour',
1017
+ includeItems: true, // Show actual items, not just counts
1018
+ categories: ['task', 'progress'], // Filter by categories
1019
+ relativeTime: true, // Show "2 hours ago" format
1020
+ itemsPerPeriod: 10, // Limit items shown per time period
1021
+ });
1022
+
1023
+ // Shows:
1024
+ // - Context items created per day/hour
1025
+ // - Category distribution over time
1026
+ // - Journal entries with moods and tags
1027
+ // - Actual item details when includeItems: true
1028
+ ```
1029
+
1030
+ ### Progressive Compression (Phase 4.4)
1031
+
1032
+ Save space by intelligently compressing old context:
1033
+
1034
+ ```javascript
1035
+ // Compress items older than 30 days
1036
+ mcp_context_compress({
1037
+ olderThan: '2024-01-01',
1038
+ preserveCategories: ['decision', 'critical'], // Keep these
1039
+ targetSize: 1000, // Target size in KB (optional)
1040
+ });
1041
+
1042
+ // Compression summary shows:
1043
+ // - Items compressed
1044
+ // - Space saved
1045
+ // - Compression ratio
1046
+ // - Categories affected
1047
+ ```
1048
+
1049
+ ### Cross-Tool Integration (Phase 4.4)
1050
+
1051
+ Track events from other MCP tools:
1052
+
1053
+ ```javascript
1054
+ // Record events from other tools
1055
+ mcp_context_integrate_tool({
1056
+ toolName: 'code-analyzer',
1057
+ eventType: 'security-scan-complete',
1058
+ data: {
1059
+ vulnerabilities: 0,
1060
+ filesScanned: 150,
1061
+ important: true, // Creates high-priority context item
1062
+ },
1063
+ });
1064
+ ```
1065
+
1066
+ ## Documentation
1067
+
1068
+ - **[Quick Start Examples](./EXAMPLES.md)** - Real-world scenarios and workflows
1069
+ - **[API Reference](./API.md)** - Complete tool documentation with all parameters and examples
1070
+ - **[Recipe Book](./RECIPES.md)** - Common patterns and best practices for daily development
1071
+ - **[Troubleshooting Guide](./TROUBLESHOOTING.md)** - Common issues and solutions
1072
+ - **[Architecture Overview](./ARCHITECTURE.md)** - System design and technical details
1073
+ - **[Contributing Guide](./CONTRIBUTING.md)** - How to contribute to the project
1074
+ - **[Changelog](./CHANGELOG.md)** - Version history and release notes
1075
+
1076
+ ## Development
1077
+
1078
+ ### Running in Development Mode
1079
+
1080
+ ```bash
1081
+ # Install dependencies
1082
+ npm install
1083
+
1084
+ # Run tests
1085
+ npm test
1086
+
1087
+ # Run tests with coverage
1088
+ npm run test:coverage
1089
+
1090
+ # Run with auto-reload
1091
+ npm run dev
1092
+
1093
+ # Build for production
1094
+ npm run build
1095
+
1096
+ # Start production server
1097
+ npm start
1098
+ ```
1099
+
1100
+ ### Project Structure
1101
+
1102
+ ```
1103
+ mcp-memory-keeper/
1104
+ ├── src/
1105
+ │ ├── index.ts # Main MCP server implementation
1106
+ │ ├── utils/ # Utility modules
1107
+ │ │ ├── database.ts # Database management
1108
+ │ │ ├── validation.ts # Input validation
1109
+ │ │ ├── git.ts # Git operations
1110
+ │ │ ├── knowledge-graph.ts # Knowledge graph management
1111
+ │ │ ├── vector-store.ts # Vector embeddings
1112
+ │ │ └── agents.ts # Multi-agent system
1113
+ │ └── __tests__/ # Test files
1114
+ ├── dist/ # Compiled JavaScript (generated)
1115
+ ├── context.db # SQLite database (auto-created)
1116
+ ├── EXAMPLES.md # Quick start examples
1117
+ ├── TROUBLESHOOTING.md # Common issues and solutions
1118
+ ├── package.json # Project configuration
1119
+ ├── tsconfig.json # TypeScript configuration
1120
+ ├── jest.config.js # Test configuration
1121
+ └── README.md # This file
1122
+ ```
1123
+
1124
+ ### Testing
1125
+
1126
+ The project includes comprehensive test coverage:
1127
+
1128
+ ```bash
1129
+ # Run all tests
1130
+ npm test
1131
+
1132
+ # Run tests in watch mode
1133
+ npm run test:watch
1134
+
1135
+ # Generate coverage report
1136
+ npm run test:coverage
1137
+
1138
+ # Run specific test file
1139
+ npm test -- summarization.test.ts
1140
+ ```
1141
+
1142
+ Test categories:
1143
+
1144
+ - **Unit Tests**: Input validation, database operations, git integration
1145
+ - **Integration Tests**: Full tool workflows, error scenarios, edge cases
1146
+ - **Coverage**: 97%+ coverage on critical modules
1147
+
1148
+ ## Feature Status
1149
+
1150
+ | Feature | Maturity | Version | Use Case |
1151
+ | ---------------- | --------- | ------- | -------------------------- |
1152
+ | Basic Save/Get | ✅ Stable | v0.1+ | Daily context management |
1153
+ | Sessions | ✅ Stable | v0.2+ | Multi-project work |
1154
+ | File Caching | ✅ Stable | v0.2+ | Track file changes |
1155
+ | Checkpoints | ✅ Stable | v0.3+ | Context preservation |
1156
+ | Smart Compaction | ✅ Stable | v0.3+ | Pre-compaction prep |
1157
+ | Git Integration | ✅ Stable | v0.3+ | Commit context tracking |
1158
+ | Search | ✅ Stable | v0.3+ | Find saved items |
1159
+ | Export/Import | ✅ Stable | v0.3+ | Backup & sharing |
1160
+ | Knowledge Graph | ✅ Stable | v0.5+ | Code relationship analysis |
1161
+ | Visualization | ✅ Stable | v0.5+ | Context exploration |
1162
+ | Semantic Search | ✅ Stable | v0.6+ | Natural language queries |
1163
+ | Multi-Agent | ✅ Stable | v0.7+ | Intelligent processing |
1164
+
1165
+ ### Current Features (v0.10.0)
1166
+
1167
+ - ✅ **Session Management**: Create, list, and continue sessions with branching support
1168
+ - ✅ **Channels**: Persistent topic-based organization (auto-derived from git branch)
1169
+ - ✅ **Context Storage**: Save/retrieve context with categories (task, decision, progress, note) and priorities
1170
+ - ✅ **Enhanced Filtering**: Time-based queries, regex patterns, sorting, pagination
1171
+ - ✅ **File Caching**: Track file changes with SHA-256 hashing
1172
+ - ✅ **Checkpoints**: Create and restore complete context snapshots
1173
+ - ✅ **Smart Compaction**: Never lose critical context when hitting limits
1174
+ - ✅ **Git Integration**: Auto-save context on commits with branch tracking
1175
+ - ✅ **Search**: Full-text search across all saved context
1176
+ - ✅ **Export/Import**: Backup and share context as JSON
1177
+ - ✅ **SQLite Storage**: Persistent, reliable data storage with WAL mode
1178
+ - ✅ **Knowledge Graph**: Automatic entity and relationship extraction from context
1179
+ - ✅ **Visualization**: Generate graph, timeline, and heatmap data for context exploration
1180
+ - ✅ **Semantic Search**: Natural language search using lightweight vector embeddings
1181
+ - ✅ **Multi-Agent System**: Intelligent analysis with specialized analyzer and synthesizer agents
1182
+ - ✅ **Session Branching**: Create branches to explore alternatives without losing original context
1183
+ - ✅ **Session Merging**: Merge branches back with conflict resolution options
1184
+ - ✅ **Journal Entries**: Time-stamped entries with tags and mood tracking
1185
+ - ✅ **Enhanced Timeline**: Activity patterns with item details and relative time
1186
+ - ✅ **Progressive Compression**: Intelligently compress old context to save space
1187
+ - ✅ **Cross-Tool Integration**: Track events from other MCP tools
1188
+
1189
+ ### Roadmap
1190
+
1191
+ #### Phase 4: Advanced Features (In Development)
1192
+
1193
+ - 🚧 **Knowledge Graph**: Entity-relation tracking for code understanding
1194
+ - 🚧 **Vector Search**: Semantic search using natural language
1195
+ - 📋 **Multi-Agent Processing**: Intelligent analysis and synthesis
1196
+ - 📋 **Time-Aware Context**: Timeline views and journal entries
1197
+
1198
+ #### Phase 5: Documentation & Polish
1199
+
1200
+ - ✅ **Examples**: Comprehensive quick-start scenarios
1201
+ - ✅ **Troubleshooting**: Common issues and solutions
1202
+ - 🚧 **Recipes**: Common patterns and workflows
1203
+ - 📋 **Video Tutorials**: Visual guides for key features
1204
+
1205
+ #### Future Enhancements
1206
+
1207
+ - [ ] Web UI for browsing context history
1208
+ - [ ] Multi-user/team collaboration features
1209
+ - [ ] Cloud sync and sharing
1210
+ - [ ] Integration with other AI assistants
1211
+ - [ ] Advanced analytics and insights
1212
+ - [ ] Custom context templates
1213
+ - [ ] Automatic retention policies
1214
+
1215
+ ## Upgrading
1216
+
1217
+ ### Database path change (v0.12.x+)
1218
+
1219
+ Prior to this release, the server resolved `context.db` relative to the process's current working directory. The database now lives at an absolute path:
1220
+
1221
+ - **Default:** `~/mcp-data/memory-keeper/context.db`
1222
+ - **Custom:** set `DATA_DIR=/your/path` — the server will use `$DATA_DIR/context.db`
1223
+
1224
+ If you have existing data in a `context.db` in your old working directory, move it to the new location before restarting the server:
1225
+
1226
+ ```bash
1227
+ mkdir -p ~/mcp-data/memory-keeper
1228
+ cp /path/to/old/context.db ~/mcp-data/memory-keeper/context.db
1229
+ ```
1230
+
1231
+ If `DATA_DIR` is set, use that path as the destination instead of `~/mcp-data/memory-keeper/`.
1232
+
1233
+ The server will print a warning to stderr if it detects a `context.db` in the current directory that differs from the configured data directory, including the exact `cp` command to run.
1234
+
1235
+ ### From-source install command change
1236
+
1237
+ If you registered memory-keeper using `node dist/index.js` directly, update your MCP config to use the bin wrapper instead:
1238
+
1239
+ ```bash
1240
+ # remove the old entry
1241
+ claude mcp remove memory-keeper
1242
+
1243
+ # add the updated entry
1244
+ claude mcp add memory-keeper /absolute/path/to/mcp-memory-keeper/bin/mcp-memory-keeper
1245
+ ```
1246
+
1247
+ ## Contributing
1248
+
1249
+ Contributions are welcome! Please feel free to submit a Pull Request.
1250
+
1251
+ 1. Fork the repository
1252
+ 2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
1253
+ 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
1254
+ 4. Push to the branch (`git push origin feature/AmazingFeature`)
1255
+ 5. Open a Pull Request
1256
+
1257
+ ## License
1258
+
1259
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
1260
+
1261
+ ## Author
1262
+
1263
+ Mark Kreyman
1264
+
1265
+ ## Acknowledgments
1266
+
1267
+ - Built for the Claude Code community
1268
+ - Inspired by the need for better context management in AI coding sessions
1269
+ - Thanks to Anthropic for the MCP protocol
1270
+
1271
+ ## Support
1272
+
1273
+ If you encounter any issues or have questions:
1274
+
1275
+ - Open an issue on [GitHub](https://github.com/mkreyman/mcp-memory-keeper/issues)
1276
+ - Check the [MCP documentation](https://modelcontextprotocol.io/)
1277
+ - Join the Claude Code community discussions
1278
+
1279
+ ## Keywords
1280
+
1281
+ Claude Code context management, MCP server, Claude AI memory, persistent context, Model Context Protocol, Claude assistant memory, AI coding context, Claude Code MCP, context preservation, Claude AI tools