{"id":28918324,"url":"https://github.com/mkreyman/mcp-memory-keeper","last_synced_at":"2026-05-01T08:31:47.463Z","repository":{"id":299746998,"uuid":"1004052039","full_name":"mkreyman/mcp-memory-keeper","owner":"mkreyman","description":"MCP server for persistent context management in AI coding assistants","archived":false,"fork":false,"pushed_at":"2026-04-07T17:30:37.000Z","size":823,"stargazers_count":113,"open_issues_count":0,"forks_count":24,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-04-07T18:07:09.163Z","etag":null,"topics":["ai-assistant","claude-ai","claude-code","context-management","context-persistence","mcp","mcp-server","sqlite"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mkreyman.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-18T03:44:13.000Z","updated_at":"2026-04-07T17:30:41.000Z","dependencies_parsed_at":"2025-06-18T05:22:34.641Z","dependency_job_id":"50d7b39d-f9cf-41f6-a58f-82fc1733cb58","html_url":"https://github.com/mkreyman/mcp-memory-keeper","commit_stats":null,"previous_names":["mkreyman/mcp-memory-keeper"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/mkreyman/mcp-memory-keeper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkreyman%2Fmcp-memory-keeper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkreyman%2Fmcp-memory-keeper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkreyman%2Fmcp-memory-keeper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkreyman%2Fmcp-memory-keeper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkreyman","download_url":"https://codeload.github.com/mkreyman/mcp-memory-keeper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkreyman%2Fmcp-memory-keeper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32490810,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-assistant","claude-ai","claude-code","context-management","context-persistence","mcp","mcp-server","sqlite"],"created_at":"2025-06-22T02:02:41.166Z","updated_at":"2026-05-01T08:31:47.456Z","avatar_url":"https://github.com/mkreyman.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MCP Memory Keeper - Claude Code Context Management\n\n[![npm version](https://img.shields.io/npm/v/mcp-memory-keeper.svg)](https://www.npmjs.com/package/mcp-memory-keeper)\n[![npm downloads](https://img.shields.io/npm/dm/mcp-memory-keeper.svg)](https://www.npmjs.com/package/mcp-memory-keeper)\n[![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)\n[![codecov](https://codecov.io/gh/mkreyman/mcp-memory-keeper/branch/main/graph/badge.svg)](https://codecov.io/gh/mkreyman/mcp-memory-keeper)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nA 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.\n\n## 🚀 Quick Start\n\nGet started in under 30 seconds:\n\n```bash\n# Add memory-keeper to Claude\nclaude mcp add memory-keeper npx mcp-memory-keeper\n\n# Start a new Claude session and use it!\n# Try: Analyze the current repo and save your analysis in memory-keeper\n```\n\nThat'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.\n\n## 🚀 Practical Memory Keeper Workflow Example\n\n### **Custom Command + CLAUDE.md = Automatic Context Management**\n\n#### **CLAUDE.md** (condensed example)\n\n```markdown\n# Project Configuration\n\n## Development Rules\n\n- Always use memory-keeper to track progress\n- Save architectural decisions and test results\n- Create checkpoints before context limits\n\n## Quality Standards\n\n- All tests must pass before marking complete\n- Document actual vs claimed results\n```\n\n#### **Custom Command Example: `/my-dev-workflow`**\n\n```markdown\n# My Development Workflow\n\nWhen working on the provided project:\n\n- Use memory-keeper with channel: \u003cproject_name\u003e\n- Save progress at every major milestone\n- Document all decisions with category: \"decision\"\n- Track implementation status with category: \"progress\"\n- Before claiming anything is complete, save test results\n\n## Workflow Steps\n\n1. Initialize session with project name as channel\n2. Save findings during investigation\n3. Create checkpoint before major changes\n4. Document what actually works vs what should work\n```\n\n#### **Usage Example**\n\n```\nUser: /my-dev-workflow authentication-service\n\nAI: Setting up workflow for authentication-service.\n[Uses memory-keeper with channel \"authentication-service\"]\n\n[... AI works, automatically saving context ...]\n\nUser: \"Getting close to context limit. Create checkpoint and give me a key\"\n\nAI: \"Checkpoint created: authentication-service-checkpoint-20250126-143026\"\n\n[Continue working until context reset or compact manually]\n\nUser: \"Restore from key: authentication-service-checkpoint-20250126-143026\"\n\nAI: \"Restored! Continuing OAuth implementation. We completed the token validation, working on refresh logic...\"\n```\n\n**The Pattern:**\n\n1. Custom command includes instructions to use memory-keeper\n2. AI follows those instructions automatically\n3. **When you notice the conversation getting long, YOU ask Claude to save a checkpoint** (like saving your game before a boss fight!)\n4. **When Claude runs out of space and starts fresh, YOU tell it to restore using the checkpoint key**\n\n**🎯 Key Feature:** Memory Keeper is a shared board! You can:\n\n- Continue in the same session after reset\n- Start a completely new session and restore\n- Have multiple Claude sessions running in parallel, all sharing the same memory\n- One session can save context that another session retrieves\n\nThis enables powerful workflows like having one Claude session doing research while another implements code, both sharing discoveries through Memory Keeper!\n\n## Why MCP Memory Keeper?\n\nClaude 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.\n\n### Perfect for:\n\n- Long coding sessions with Claude Code\n- Complex projects requiring context preservation\n- Teams using Claude AI for collaborative development\n- Developers who want persistent context across Claude sessions\n\n## Features\n\n- 🔄 Save and restore context between Claude Code sessions\n- 📁 File content caching with change detection\n- 🏷️ Organize context with categories and priorities\n- 📺 **Channels** - Persistent topic-based organization (auto-derived from git branch)\n- 📸 Checkpoint system for complete context snapshots\n- 🤖 Smart compaction helper that never loses critical info\n- 🔍 Full-text search across all saved context\n- 🕐 **Enhanced filtering** - Time-based queries, regex patterns, pagination\n- 📊 **Change tracking** - See what's been added, modified, or deleted since any point\n- 💾 Export/import for backup and sharing\n- 🌿 Git integration with automatic context correlation\n- 📊 AI-friendly summarization with priority awareness\n- 🚀 Fast SQLite-based storage optimized for Claude\n- 🔁 **Batch operations** - Save, update, or delete multiple items atomically\n- 🔄 **Channel reassignment** - Move items between channels based on patterns\n- 🔗 **Context relationships** - Link related items with typed relationships\n- 👁️ **Real-time monitoring** - Watch for context changes with filters\n\n## Installation\n\n### Recommended: NPX Installation\n\n```bash\nclaude mcp add memory-keeper npx mcp-memory-keeper\n```\n\nThis single command:\n\n- ✅ Always uses the latest version\n- ✅ Handles all dependencies automatically\n- ✅ Works across macOS, Linux, and Windows\n- ✅ No manual building or native module issues\n\n### Alternative Installation Methods\n\n\u003cdetails\u003e\n\u003csummary\u003eGlobal Installation\u003c/summary\u003e\n\n```bash\nnpm install -g mcp-memory-keeper\nclaude mcp add memory-keeper mcp-memory-keeper\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eFrom Source (for development)\u003c/summary\u003e\n\n```bash\n# 1. Clone the repository\ngit clone https://github.com/mkreyman/mcp-memory-keeper.git\ncd mcp-memory-keeper\n\n# 2. Install dependencies\nnpm install\n\n# 3. Build the project\nnpm run build\n\n# 4. Add to Claude\nclaude mcp add memory-keeper /absolute/path/to/mcp-memory-keeper/bin/mcp-memory-keeper\n```\n\n\u003c/details\u003e\n\n## Configuration\n\n### Environment Variables\n\n#### Storage and Installation\n\n- `DATA_DIR` - Directory for database storage (default: `~/mcp-data/memory-keeper/`)\n- `MEMORY_KEEPER_INSTALL_DIR` - Installation directory (default: `~/.local/mcp-servers/memory-keeper/`)\n- `MEMORY_KEEPER_AUTO_UPDATE` - Set to `1` to enable auto-updates\n\n#### Token Limit Configuration\n\n- `MCP_MAX_TOKENS` - Maximum tokens allowed in responses (default: `25000`, range: `1000-100000`)\n  - Adjust this if your MCP client has different limits\n- `MCP_TOKEN_SAFETY_BUFFER` - Safety buffer percentage (default: `0.8`, range: `0.1-1.0`)\n  - Uses only this fraction of the max tokens to prevent overflows\n- `MCP_MIN_ITEMS` - Minimum items to return even if exceeding limits (default: `1`, range: `1-100`)\n  - Ensures at least some results are returned\n- `MCP_MAX_ITEMS` - Maximum items allowed per response (default: `100`, range: `10-1000`)\n  - Upper bound for result sets regardless of token limits\n- `MCP_CHARS_PER_TOKEN` - Characters per token ratio (default: `3.5`, range: `2.5-5.0`) **[Advanced]**\n  - Adjusts token estimation accuracy for different content types\n  - Lower values = more conservative (safer but returns fewer items)\n  - Higher values = more aggressive (returns more items but risks overflow)\n\nExample configuration for stricter token limits:\n\n```bash\nexport MCP_MAX_TOKENS=20000        # Lower max tokens\nexport MCP_TOKEN_SAFETY_BUFFER=0.7  # More conservative buffer\nexport MCP_MAX_ITEMS=50             # Fewer items per response\nexport MCP_CHARS_PER_TOKEN=3.0      # More conservative estimation (optional)\n```\n\n#### Tool Profiles\n\nBy 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.\n\n**Quick usage:**\n\n```bash\n# Essential tools only (8 tools)\nTOOL_PROFILE=minimal npx mcp-memory-keeper\n\n# Standard workflow set (22 tools)\nTOOL_PROFILE=standard npx mcp-memory-keeper\n\n# All tools (default)\nTOOL_PROFILE=full npx mcp-memory-keeper\n```\n\n**Built-in profiles:**\n\n| Profile    | Tools | Description                                                    |\n| ---------- | ----- | -------------------------------------------------------------- |\n| `minimal`  | 8     | Core persistence: save, get, search, status, checkpoint        |\n| `standard` | 22    | Daily workflow: core + git, batch ops, channels, export/import |\n| `full`     | 38    | All tools (default, backwards compatible)                      |\n\n**Custom profiles via config file:**\n\nCreate `~/.mcp-memory-keeper/config.json` to define or override profiles:\n\n```json\n{\n  \"profiles\": {\n    \"my_workflow\": [\n      \"context_session_start\",\n      \"context_save\",\n      \"context_get\",\n      \"context_search\",\n      \"context_checkpoint\",\n      \"context_restore_checkpoint\",\n      \"context_diff\",\n      \"context_timeline\"\n    ]\n  }\n}\n```\n\nThen activate it: `TOOL_PROFILE=my_workflow npx mcp-memory-keeper`\n\nConfig file profiles take precedence over built-in defaults with the same name.\n\n**Profile resolution precedence:**\n\n| `TOOL_PROFILE` | Config file has profile? | Built-in exists? | Result                           |\n| -------------- | ------------------------ | ---------------- | -------------------------------- |\n| Set            | Yes                      | —                | Uses config file definition      |\n| Set            | No                       | Yes              | Uses built-in definition         |\n| Set            | No                       | No               | Warning + falls back to `full`   |\n| Not set        | —                        | —                | Uses built-in `full` (all tools) |\n\n**Environment variables:**\n\n| Variable              | Description                                                               |\n| --------------------- | ------------------------------------------------------------------------- |\n| `TOOL_PROFILE`        | Profile name to activate (e.g., `minimal`, `standard`, `full`, or custom) |\n| `TOOL_PROFILE_CONFIG` | Override config file path (default: `~/.mcp-memory-keeper/config.json`)   |\n\n\u003e Note: Profile resolution happens once at server startup. Changes to the env var or config file take effect on the next server restart.\n\n**Claude Code / Claude Desktop configuration:**\n\n```json\n{\n  \"mcpServers\": {\n    \"memory-keeper\": {\n      \"command\": \"npx\",\n      \"args\": [\"mcp-memory-keeper\"],\n      \"env\": {\n        \"TOOL_PROFILE\": \"minimal\"\n      }\n    }\n  }\n}\n```\n\nSee `examples/config.json` for a complete example config file.\n\n### Claude Code (CLI)\n\n#### Configuration Scopes\n\nChoose where to save the configuration:\n\n```bash\n# Project-specific (default) - only for you in this project\nclaude mcp add memory-keeper npx mcp-memory-keeper\n\n# Shared with team via .mcp.json\nclaude mcp add --scope project memory-keeper npx mcp-memory-keeper\n\n# Available across all your projects\nclaude mcp add --scope user memory-keeper npx mcp-memory-keeper\n```\n\n#### Verify Configuration\n\n```bash\n# List all configured servers\nclaude mcp list\n\n# Get details for Memory Keeper\nclaude mcp get memory-keeper\n```\n\n### Claude Desktop App\n\n1. Open Claude Desktop settings\n2. Navigate to \"Developer\" → \"Model Context Protocol\"\n3. Click \"Add MCP Server\"\n4. Add the following configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"memory-keeper\": {\n      \"command\": \"npx\",\n      \"args\": [\"mcp-memory-keeper\"]\n    }\n  }\n}\n```\n\nThat's it! No paths needed - npx automatically handles everything.\n\n### Verify Installation\n\n#### For Claude Code:\n\n1. Restart Claude Code or start a new session\n2. The Memory Keeper tools should be available automatically\n3. Test with: `mcp_memory_save({ key: \"test\", value: \"Hello Memory Keeper!\" })`\n4. If not working, check server status:\n   ```bash\n   claude mcp list  # Should show memory-keeper as \"running\"\n   ```\n\n#### For Claude Desktop:\n\n1. Restart Claude Desktop after adding the configuration\n2. In a new conversation, the Memory Keeper tools should be available\n3. Test with the same command above\n\n### Troubleshooting\n\nIf Memory Keeper isn't working:\n\n```bash\n# Remove and re-add the server\nclaude mcp remove memory-keeper\nclaude mcp add memory-keeper npx mcp-memory-keeper\n\n# Check logs for errors\n# The server output will appear in Claude Code's output panel\n```\n\n### Updating to Latest Version\n\nWith the npx installation method, you automatically get the latest version every time! No manual updates needed.\n\nIf you're using the global installation method:\n\n```bash\n# Update to latest version\nnpm update -g mcp-memory-keeper\n\n# Start a new Claude session\n# The updated features will be available immediately\n```\n\n**Note**: You don't need to reconfigure the MCP server in Claude after updating. Just start a new session!\n\n## Usage\n\n### Session Management\n\n```javascript\n// Start a new session\nmcp_context_session_start({\n  name: 'Feature Development',\n  description: 'Working on user authentication',\n});\n\n// Start a session with project directory for git tracking\nmcp_context_session_start({\n  name: 'Feature Development',\n  description: 'Working on user authentication',\n  projectDir: '/path/to/your/project',\n});\n\n// Start a session with a default channel\nmcp_context_session_start({\n  name: 'Feature Development',\n  description: 'Working on user authentication',\n  projectDir: '/path/to/your/project',\n  defaultChannel: 'auth-feature', // Will auto-derive from git branch if not specified\n});\n\n// Set project directory for current session\nmcp_context_set_project_dir({\n  projectDir: '/path/to/your/project',\n});\n\n// List recent sessions\nmcp_context_session_list({ limit: 5 });\n\n// Continue from a previous session\nmcp_context_session_start({\n  name: 'Feature Dev Continued',\n  continueFrom: 'previous-session-id',\n});\n```\n\n### Working with Channels (NEW in v0.10.0)\n\nChannels provide persistent topic-based organization that survives session crashes and restarts:\n\n```javascript\n// Channels are auto-derived from git branch (if projectDir is set)\n// Branch \"feature/auth-system\" becomes channel \"feature-auth-system\" (20 chars max)\n\n// Save to a specific channel\nmcp_context_save({\n  key: 'auth_design',\n  value: 'Using JWT with refresh tokens',\n  category: 'decision',\n  priority: 'high',\n  channel: 'auth-feature', // Explicitly set channel\n});\n\n// Get items from a specific channel\nmcp_context_get({ channel: 'auth-feature' });\n\n// Get items across all channels (default behavior)\nmcp_context_get({ category: 'task' });\n\n// Channels persist across sessions - perfect for:\n// - Multi-branch development\n// - Feature-specific context\n// - Team collaboration on different topics\n```\n\n### Enhanced Context Storage\n\n```javascript\n// Save with categories and priorities\nmcp_context_save({\n  key: 'current_task',\n  value: 'Implement OAuth integration',\n  category: 'task',\n  priority: 'high',\n});\n\n// Save decisions\nmcp_context_save({\n  key: 'auth_strategy',\n  value: 'Using JWT tokens with 24h expiry',\n  category: 'decision',\n  priority: 'high',\n});\n\n// Save progress notes\nmcp_context_save({\n  key: 'progress_auth',\n  value: 'Completed user model, working on token generation',\n  category: 'progress',\n  priority: 'normal',\n});\n\n// Retrieve by category\nmcp_context_get({ category: 'task' });\n\n// Retrieve specific item\nmcp_context_get({ key: 'current_task' });\n\n// Get context from specific session\nmcp_context_get({\n  sessionId: 'session-id-here',\n  category: 'decision',\n});\n\n// Enhanced filtering (NEW in v0.10.0)\nmcp_context_get({\n  category: 'task',\n  priorities: ['high', 'normal'],\n  includeMetadata: true, // Get timestamps, size info\n  sort: 'created_desc', // created_asc/desc, updated_asc/desc, priority\n  limit: 10, // Pagination\n  offset: 0,\n});\n\n// Time-based queries (NEW in v0.10.0)\nmcp_context_get({\n  createdAfter: '2025-01-20T00:00:00Z',\n  createdBefore: '2025-01-26T23:59:59Z',\n  includeMetadata: true,\n});\n\n// Pattern matching (NEW in v0.10.0)\nmcp_context_get({\n  keyPattern: 'auth_.*', // Regex to match keys\n  category: 'decision',\n});\n```\n\n### File Caching\n\n```javascript\n// Cache file content for change detection\nmcp_context_cache_file({\n  filePath: '/src/auth/user.model.ts',\n  content: fileContent,\n});\n\n// Check if file has changed\nmcp_context_file_changed({\n  filePath: '/src/auth/user.model.ts',\n  currentContent: newFileContent,\n});\n\n// Get current session status\nmcp_context_status();\n```\n\n### Complete Workflow Example\n\n```javascript\n// 1. Start a new session\nmcp_context_session_start({\n  name: 'Settings Refactor',\n  description: 'Refactoring settings module for better performance',\n});\n\n// 2. Save high-priority task\nmcp_context_save({\n  key: 'main_task',\n  value: 'Refactor Settings.Context to use behaviors',\n  category: 'task',\n  priority: 'high',\n});\n\n// 3. Cache important files\nmcp_context_cache_file({\n  filePath: 'lib/settings/context.ex',\n  content: originalFileContent,\n});\n\n// 4. Save decisions as you work\nmcp_context_save({\n  key: 'architecture_decision',\n  value: 'Split settings into read/write modules',\n  category: 'decision',\n  priority: 'high',\n});\n\n// 5. Track progress\nmcp_context_save({\n  key: 'progress_1',\n  value: 'Completed behavior definition, 5 modules remaining',\n  category: 'progress',\n  priority: 'normal',\n});\n\n// 6. Before context window fills up\nmcp_context_status(); // Check what's saved\n\n// 7. After Claude Code restart\nmcp_context_get({ category: 'task', priority: 'high' }); // Get high priority tasks\nmcp_context_get({ key: 'architecture_decision' }); // Get specific decisions\nmcp_context_file_changed({ filePath: 'lib/settings/context.ex' }); // Check for changes\n```\n\n### Checkpoints (Phase 2)\n\nCreate named snapshots of your entire context that can be restored later:\n\n```javascript\n// Create a checkpoint before major changes\nmcp_context_checkpoint({\n  name: 'before-refactor',\n  description: 'State before major settings refactor',\n  includeFiles: true, // Include cached files\n  includeGitStatus: true, // Capture git status\n});\n\n// Continue working...\n// If something goes wrong, restore from checkpoint\nmcp_context_restore_checkpoint({\n  name: 'before-refactor',\n  restoreFiles: true, // Restore cached files too\n});\n\n// Or restore the latest checkpoint\nmcp_context_restore_checkpoint({});\n```\n\n### Context Summarization (Phase 2)\n\nGet AI-friendly summaries of your saved context:\n\n```javascript\n// Get a summary of all context\nmcp_context_summarize();\n\n// Get summary of specific categories\nmcp_context_summarize({\n  categories: ['task', 'decision'],\n  maxLength: 2000,\n});\n\n// Summarize a specific session\nmcp_context_summarize({\n  sessionId: 'session-id-here',\n  categories: ['progress'],\n});\n```\n\nExample summary output:\n\n```markdown\n# Context Summary\n\n## High Priority Items\n\n- **main_task**: Refactor Settings.Context to use behaviors\n- **critical_bug**: Fix memory leak in subscription handler\n\n## Task\n\n- implement_auth: Add OAuth2 authentication flow\n- update_tests: Update test suite for new API\n\n## Decision\n\n- architecture_decision: Split settings into read/write modules\n- db_choice: Use PostgreSQL for better JSON support\n```\n\n### Batch Operations\n\nPerform multiple operations atomically:\n\n```javascript\n// Save multiple items at once\nmcp_context_batch_save({\n  items: [\n    { key: 'config_api_url', value: 'https://api.example.com', category: 'note' },\n    { key: 'config_timeout', value: '30000', category: 'note' },\n    { key: 'config_retries', value: '3', category: 'note' },\n  ],\n});\n\n// Update multiple items\nmcp_context_batch_update({\n  updates: [\n    { key: 'task_1', priority: 'high' },\n    { key: 'task_2', priority: 'high' },\n    { key: 'task_3', value: 'Updated task description' },\n  ],\n});\n\n// Delete by pattern\nmcp_context_batch_delete({\n  keyPattern: 'temp_*',\n  dryRun: true, // Preview first\n});\n```\n\n### Channel Management\n\nReorganize context items between channels:\n\n```javascript\n// Move items to a new channel\nmcp_context_reassign_channel({\n  keyPattern: 'auth_*',\n  toChannel: 'feature-authentication',\n});\n\n// Move from one channel to another\nmcp_context_reassign_channel({\n  fromChannel: 'sprint-14',\n  toChannel: 'sprint-15',\n  category: 'task',\n  priorities: ['high'],\n});\n```\n\n### Context Relationships\n\nBuild a graph of related items:\n\n```javascript\n// Link related items\nmcp_context_link({\n  sourceKey: 'epic_user_management',\n  targetKey: 'task_create_user_api',\n  relationship: 'contains',\n});\n\n// Find related items\nmcp_context_get_related({\n  key: 'epic_user_management',\n  relationship: 'contains',\n  depth: 2,\n});\n```\n\n### Real-time Monitoring\n\nWatch for context changes:\n\n```javascript\n// Create a watcher\nconst watcher = await mcp_context_watch({\n  action: 'create',\n  filters: {\n    categories: ['task'],\n    priorities: ['high'],\n  },\n});\n\n// Poll for changes\nconst changes = await mcp_context_watch({\n  action: 'poll',\n  watcherId: watcher.watcherId,\n});\n```\n\n### Smart Compaction (Phase 3)\n\nNever lose critical context when Claude's window fills up:\n\n```javascript\n// Before context window fills\nmcp_context_prepare_compaction();\n\n// This automatically:\n// - Creates a checkpoint\n// - Identifies high-priority items\n// - Captures unfinished tasks\n// - Saves all decisions\n// - Generates a summary\n// - Prepares restoration instructions\n```\n\n### Git Integration (Phase 3)\n\nTrack git changes in your project directory and save context with commits:\n\n```javascript\n// First, set your project directory (if not done during session start)\nmcp_context_set_project_dir({\n  projectDir: '/path/to/your/project',\n});\n\n// Commit with auto-save\nmcp_context_git_commit({\n  message: 'feat: Add user authentication',\n  autoSave: true, // Creates checkpoint with commit\n});\n\n// Context is automatically linked to the commit\n// Note: If no project directory is set, you'll see a helpful message\n// explaining how to enable git tracking for your project\n```\n\n### Context Search (Phase 3)\n\nFind anything in your saved context:\n\n```javascript\n// Search in keys and values\nmcp_context_search({ query: 'authentication' });\n\n// Search only in keys\nmcp_context_search({\n  query: 'config',\n  searchIn: ['key'],\n});\n\n// Search in specific session\nmcp_context_search({\n  query: 'bug',\n  sessionId: 'session-id',\n});\n```\n\n### Export/Import (Phase 3)\n\nShare context or backup your work:\n\n```javascript\n// Export current session\nmcp_context_export(); // Creates memory-keeper-export-xxx.json\n\n// Export specific session\nmcp_context_export({\n  sessionId: 'session-id',\n  format: 'json',\n});\n\n// Import from file\nmcp_context_import({\n  filePath: 'memory-keeper-export-xxx.json',\n});\n\n// Merge into current session\nmcp_context_import({\n  filePath: 'backup.json',\n  merge: true,\n});\n```\n\n### Knowledge Graph (Phase 4)\n\nAutomatically extract entities and relationships from your context:\n\n```javascript\n// Analyze context to build knowledge graph\nmcp_context_analyze();\n\n// Or analyze specific categories\nmcp_context_analyze({\n  categories: ['task', 'decision'],\n});\n\n// Find related entities\nmcp_context_find_related({\n  key: 'AuthService',\n  maxDepth: 2,\n});\n\n// Generate visualization data\nmcp_context_visualize({\n  type: 'graph',\n});\n\n// Timeline view\nmcp_context_visualize({\n  type: 'timeline',\n});\n\n// Category/priority heatmap\nmcp_context_visualize({\n  type: 'heatmap',\n});\n```\n\n### Semantic Search (Phase 4.2)\n\nFind context using natural language queries:\n\n```javascript\n// Search with natural language\nmcp_context_semantic_search({\n  query: 'how are we handling user authentication?',\n  topK: 5,\n});\n\n// Find the most relevant security decisions\nmcp_context_semantic_search({\n  query: 'security concerns and decisions',\n  minSimilarity: 0.5,\n});\n\n// Search with specific similarity threshold\nmcp_context_semantic_search({\n  query: 'database performance optimization',\n  topK: 10,\n  minSimilarity: 0.3,\n});\n```\n\n### Multi-Agent System (Phase 4.3)\n\nDelegate complex analysis tasks to specialized agents:\n\n```javascript\n// Analyze patterns in your context\nmcp_context_delegate({\n  taskType: 'analyze',\n  input: {\n    analysisType: 'patterns',\n    categories: ['task', 'decision'],\n  },\n});\n\n// Get comprehensive analysis\nmcp_context_delegate({\n  taskType: 'analyze',\n  input: {\n    analysisType: 'comprehensive',\n  },\n});\n\n// Analyze relationships between entities\nmcp_context_delegate({\n  taskType: 'analyze',\n  input: {\n    analysisType: 'relationships',\n    maxDepth: 3,\n  },\n});\n\n// Create intelligent summaries\nmcp_context_delegate({\n  taskType: 'synthesize',\n  input: {\n    synthesisType: 'summary',\n    maxLength: 1000,\n  },\n});\n\n// Get actionable recommendations\nmcp_context_delegate({\n  taskType: 'synthesize',\n  input: {\n    synthesisType: 'recommendations',\n    analysisResults: {}, // Can pass previous analysis results\n  },\n});\n\n// Chain multiple agent tasks\nmcp_context_delegate({\n  chain: true,\n  taskType: ['analyze', 'synthesize'],\n  input: [{ analysisType: 'comprehensive' }, { synthesisType: 'recommendations' }],\n});\n```\n\nAgent Types:\n\n- **Analyzer Agent**: Detects patterns, analyzes relationships, tracks trends\n- **Synthesizer Agent**: Creates summaries, merges insights, generates recommendations\n\n### Session Branching \u0026 Merging (Phase 4.4)\n\nExplore alternatives without losing your original work:\n\n```javascript\n// Create a branch to try something new\nmcp_context_branch_session({\n  branchName: 'experimental-refactor',\n  copyDepth: 'shallow', // Only copy high-priority items\n});\n\n// Or create a full copy\nmcp_context_branch_session({\n  branchName: 'feature-complete-copy',\n  copyDepth: 'deep', // Copy everything\n});\n\n// Later, merge changes back\nmcp_context_merge_sessions({\n  sourceSessionId: 'branch-session-id',\n  conflictResolution: 'keep_newest', // or \"keep_current\", \"keep_source\"\n});\n```\n\n### Journal Entries (Phase 4.4)\n\nTrack your thoughts and progress with timestamped journal entries:\n\n```javascript\n// Add a journal entry\nmcp_context_journal_entry({\n  entry: 'Completed the authentication module. Tests are passing!',\n  tags: ['milestone', 'authentication'],\n  mood: 'accomplished',\n});\n\n// Entries are included in timeline views\nmcp_context_timeline({\n  groupBy: 'day',\n});\n```\n\n### Timeline \u0026 Activity Tracking (Phase 4.4)\n\nVisualize your work patterns over time:\n\n```javascript\n// Get activity timeline\nmcp_context_timeline({\n  startDate: '2024-01-01',\n  endDate: '2024-01-31',\n  groupBy: 'day', // or \"hour\", \"week\"\n});\n\n// Enhanced timeline (NEW in v0.10.0)\nmcp_context_timeline({\n  groupBy: 'hour',\n  includeItems: true, // Show actual items, not just counts\n  categories: ['task', 'progress'], // Filter by categories\n  relativeTime: true, // Show \"2 hours ago\" format\n  itemsPerPeriod: 10, // Limit items shown per time period\n});\n\n// Shows:\n// - Context items created per day/hour\n// - Category distribution over time\n// - Journal entries with moods and tags\n// - Actual item details when includeItems: true\n```\n\n### Progressive Compression (Phase 4.4)\n\nSave space by intelligently compressing old context:\n\n```javascript\n// Compress items older than 30 days\nmcp_context_compress({\n  olderThan: '2024-01-01',\n  preserveCategories: ['decision', 'critical'], // Keep these\n  targetSize: 1000, // Target size in KB (optional)\n});\n\n// Compression summary shows:\n// - Items compressed\n// - Space saved\n// - Compression ratio\n// - Categories affected\n```\n\n### Cross-Tool Integration (Phase 4.4)\n\nTrack events from other MCP tools:\n\n```javascript\n// Record events from other tools\nmcp_context_integrate_tool({\n  toolName: 'code-analyzer',\n  eventType: 'security-scan-complete',\n  data: {\n    vulnerabilities: 0,\n    filesScanned: 150,\n    important: true, // Creates high-priority context item\n  },\n});\n```\n\n## Documentation\n\n- **[Quick Start Examples](./EXAMPLES.md)** - Real-world scenarios and workflows\n- **[API Reference](./API.md)** - Complete tool documentation with all parameters and examples\n- **[Recipe Book](./RECIPES.md)** - Common patterns and best practices for daily development\n- **[Troubleshooting Guide](./TROUBLESHOOTING.md)** - Common issues and solutions\n- **[Architecture Overview](./ARCHITECTURE.md)** - System design and technical details\n- **[Contributing Guide](./CONTRIBUTING.md)** - How to contribute to the project\n- **[Changelog](./CHANGELOG.md)** - Version history and release notes\n\n## Development\n\n### Running in Development Mode\n\n```bash\n# Install dependencies\nnpm install\n\n# Run tests\nnpm test\n\n# Run tests with coverage\nnpm run test:coverage\n\n# Run with auto-reload\nnpm run dev\n\n# Build for production\nnpm run build\n\n# Start production server\nnpm start\n```\n\n### Project Structure\n\n```\nmcp-memory-keeper/\n├── src/\n│   ├── index.ts           # Main MCP server implementation\n│   ├── utils/             # Utility modules\n│   │   ├── database.ts    # Database management\n│   │   ├── validation.ts  # Input validation\n│   │   ├── git.ts         # Git operations\n│   │   ├── knowledge-graph.ts # Knowledge graph management\n│   │   ├── vector-store.ts    # Vector embeddings\n│   │   └── agents.ts      # Multi-agent system\n│   └── __tests__/         # Test files\n├── dist/                  # Compiled JavaScript (generated)\n├── context.db             # SQLite database (auto-created)\n├── EXAMPLES.md            # Quick start examples\n├── TROUBLESHOOTING.md     # Common issues and solutions\n├── package.json           # Project configuration\n├── tsconfig.json          # TypeScript configuration\n├── jest.config.js         # Test configuration\n└── README.md              # This file\n```\n\n### Testing\n\nThe project includes comprehensive test coverage:\n\n```bash\n# Run all tests\nnpm test\n\n# Run tests in watch mode\nnpm run test:watch\n\n# Generate coverage report\nnpm run test:coverage\n\n# Run specific test file\nnpm test -- summarization.test.ts\n```\n\nTest categories:\n\n- **Unit Tests**: Input validation, database operations, git integration\n- **Integration Tests**: Full tool workflows, error scenarios, edge cases\n- **Coverage**: 97%+ coverage on critical modules\n\n## Feature Status\n\n| Feature          | Maturity  | Version | Use Case                   |\n| ---------------- | --------- | ------- | -------------------------- |\n| Basic Save/Get   | ✅ Stable | v0.1+   | Daily context management   |\n| Sessions         | ✅ Stable | v0.2+   | Multi-project work         |\n| File Caching     | ✅ Stable | v0.2+   | Track file changes         |\n| Checkpoints      | ✅ Stable | v0.3+   | Context preservation       |\n| Smart Compaction | ✅ Stable | v0.3+   | Pre-compaction prep        |\n| Git Integration  | ✅ Stable | v0.3+   | Commit context tracking    |\n| Search           | ✅ Stable | v0.3+   | Find saved items           |\n| Export/Import    | ✅ Stable | v0.3+   | Backup \u0026 sharing           |\n| Knowledge Graph  | ✅ Stable | v0.5+   | Code relationship analysis |\n| Visualization    | ✅ Stable | v0.5+   | Context exploration        |\n| Semantic Search  | ✅ Stable | v0.6+   | Natural language queries   |\n| Multi-Agent      | ✅ Stable | v0.7+   | Intelligent processing     |\n\n### Current Features (v0.10.0)\n\n- ✅ **Session Management**: Create, list, and continue sessions with branching support\n- ✅ **Channels**: Persistent topic-based organization (auto-derived from git branch)\n- ✅ **Context Storage**: Save/retrieve context with categories (task, decision, progress, note) and priorities\n- ✅ **Enhanced Filtering**: Time-based queries, regex patterns, sorting, pagination\n- ✅ **File Caching**: Track file changes with SHA-256 hashing\n- ✅ **Checkpoints**: Create and restore complete context snapshots\n- ✅ **Smart Compaction**: Never lose critical context when hitting limits\n- ✅ **Git Integration**: Auto-save context on commits with branch tracking\n- ✅ **Search**: Full-text search across all saved context\n- ✅ **Export/Import**: Backup and share context as JSON\n- ✅ **SQLite Storage**: Persistent, reliable data storage with WAL mode\n- ✅ **Knowledge Graph**: Automatic entity and relationship extraction from context\n- ✅ **Visualization**: Generate graph, timeline, and heatmap data for context exploration\n- ✅ **Semantic Search**: Natural language search using lightweight vector embeddings\n- ✅ **Multi-Agent System**: Intelligent analysis with specialized analyzer and synthesizer agents\n- ✅ **Session Branching**: Create branches to explore alternatives without losing original context\n- ✅ **Session Merging**: Merge branches back with conflict resolution options\n- ✅ **Journal Entries**: Time-stamped entries with tags and mood tracking\n- ✅ **Enhanced Timeline**: Activity patterns with item details and relative time\n- ✅ **Progressive Compression**: Intelligently compress old context to save space\n- ✅ **Cross-Tool Integration**: Track events from other MCP tools\n\n### Roadmap\n\n#### Phase 4: Advanced Features (In Development)\n\n- 🚧 **Knowledge Graph**: Entity-relation tracking for code understanding\n- 🚧 **Vector Search**: Semantic search using natural language\n- 📋 **Multi-Agent Processing**: Intelligent analysis and synthesis\n- 📋 **Time-Aware Context**: Timeline views and journal entries\n\n#### Phase 5: Documentation \u0026 Polish\n\n- ✅ **Examples**: Comprehensive quick-start scenarios\n- ✅ **Troubleshooting**: Common issues and solutions\n- 🚧 **Recipes**: Common patterns and workflows\n- 📋 **Video Tutorials**: Visual guides for key features\n\n#### Future Enhancements\n\n- [ ] Web UI for browsing context history\n- [ ] Multi-user/team collaboration features\n- [ ] Cloud sync and sharing\n- [ ] Integration with other AI assistants\n- [ ] Advanced analytics and insights\n- [ ] Custom context templates\n- [ ] Automatic retention policies\n\n## Upgrading\n\n### Database path change (v0.12.x+)\n\nPrior to this release, the server resolved `context.db` relative to the process's current working directory. The database now lives at an absolute path:\n\n- **Default:** `~/mcp-data/memory-keeper/context.db`\n- **Custom:** set `DATA_DIR=/your/path` — the server will use `$DATA_DIR/context.db`\n\nIf you have existing data in a `context.db` in your old working directory, move it to the new location before restarting the server:\n\n```bash\nmkdir -p ~/mcp-data/memory-keeper\ncp /path/to/old/context.db ~/mcp-data/memory-keeper/context.db\n```\n\nIf `DATA_DIR` is set, use that path as the destination instead of `~/mcp-data/memory-keeper/`.\n\nThe 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.\n\n### From-source install command change\n\nIf you registered memory-keeper using `node dist/index.js` directly, update your MCP config to use the bin wrapper instead:\n\n```bash\n# remove the old entry\nclaude mcp remove memory-keeper\n\n# add the updated entry\nclaude mcp add memory-keeper /absolute/path/to/mcp-memory-keeper/bin/mcp-memory-keeper\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Author\n\nMark Kreyman\n\n## Acknowledgments\n\n- Built for the Claude Code community\n- Inspired by the need for better context management in AI coding sessions\n- Thanks to Anthropic for the MCP protocol\n\n## Support\n\nIf you encounter any issues or have questions:\n\n- Open an issue on [GitHub](https://github.com/mkreyman/mcp-memory-keeper/issues)\n- Check the [MCP documentation](https://modelcontextprotocol.io/)\n- Join the Claude Code community discussions\n\n## Keywords\n\nClaude 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\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkreyman%2Fmcp-memory-keeper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkreyman%2Fmcp-memory-keeper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkreyman%2Fmcp-memory-keeper/lists"}