diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index e805ec37..9fa01b67 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -10,7 +10,7 @@ "plugins": [ { "name": "claude-mem", - "version": "7.0.10", + "version": "7.1.0", "source": "./plugin", "description": "Persistent memory system for Claude Code - context compression across sessions" } diff --git a/.claude/settings.json b/.claude/settings.json index be0b0d37..dba281e1 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -2,15 +2,6 @@ "env": {}, "permissions": { "deny": [ - "Read(./plugin/scripts/*.js)", - "Read(./plugin/scripts/*.cjs)", - "Read(./plugin/scripts/node_modules/**)", - "Read(./plugin/ui/viewer-bundle.js)", - "Read(./plugin/ui/viewer.html)", - "Read(./plugin/ui/assets/**)", - "Read(./plugin/ui/icon-thick-*.svg)", - "Read(./plugin/package.json)", - "Read(./plugin/ecosystem.config.cjs)", "Read(./package-lock.json)", "Read(./node_modules/**)", "Read(./.DS_Store)" diff --git a/.translation-cache.json b/.translation-cache.json new file mode 100644 index 00000000..a68cae39 --- /dev/null +++ b/.translation-cache.json @@ -0,0 +1,116 @@ +{ + "sourceHash": "9ab0d799179c66f9", + "lastUpdated": "2025-12-12T07:42:03.489Z", + "translations": { + "zh": { + "hash": "9ab0d799179c66f9", + "translatedAt": "2025-12-12T07:06:55.026Z", + "costUsd": 0.12256679999999998 + }, + "ja": { + "hash": "9ab0d799179c66f9", + "translatedAt": "2025-12-12T07:06:55.026Z", + "costUsd": 0.12973164999999998 + }, + "pt-br": { + "hash": "9ab0d799179c66f9", + "translatedAt": "2025-12-12T07:06:55.026Z", + "costUsd": 0.11508539999999999 + }, + "ko": { + "hash": "9ab0d799179c66f9", + "translatedAt": "2025-12-12T07:06:55.026Z", + "costUsd": 0.13952664999999997 + }, + "es": { + "hash": "9ab0d799179c66f9", + "translatedAt": "2025-12-12T07:06:55.026Z", + "costUsd": 0.12530165 + }, + "de": { + "hash": "9ab0d799179c66f9", + "translatedAt": "2025-12-12T07:06:55.026Z", + "costUsd": 0.12232164999999998 + }, + "fr": { + "hash": "9ab0d799179c66f9", + "translatedAt": "2025-12-12T07:06:55.026Z", + "costUsd": 0.11906665 + }, + "he": { + "hash": "9ab0d799179c66f9", + "translatedAt": "2025-12-12T07:25:00.076Z", + "costUsd": 0.151329 + }, + "ar": { + "hash": "9ab0d799179c66f9", + "translatedAt": "2025-12-12T07:25:00.076Z", + "costUsd": 0.151952 + }, + "ru": { + "hash": "9ab0d799179c66f9", + "translatedAt": "2025-12-12T07:25:00.076Z", + "costUsd": 0.13418499999999997 + }, + "pl": { + "hash": "9ab0d799179c66f9", + "translatedAt": "2025-12-12T07:25:00.076Z", + "costUsd": 0.13196799999999997 + }, + "cs": { + "hash": "9ab0d799179c66f9", + "translatedAt": "2025-12-12T07:25:00.076Z", + "costUsd": 0.12714599999999998 + }, + "nl": { + "hash": "9ab0d799179c66f9", + "translatedAt": "2025-12-12T07:25:00.076Z", + "costUsd": 0.118389 + }, + "tr": { + "hash": "9ab0d799179c66f9", + "translatedAt": "2025-12-12T07:25:00.076Z", + "costUsd": 0.13991199999999998 + }, + "uk": { + "hash": "9ab0d799179c66f9", + "translatedAt": "2025-12-12T07:25:00.076Z", + "costUsd": 0.13786 + }, + "vi": { + "hash": "9ab0d799179c66f9", + "translatedAt": "2025-12-12T07:42:03.489Z", + "costUsd": 0.15467299999999998 + }, + "id": { + "hash": "9ab0d799179c66f9", + "translatedAt": "2025-12-12T07:42:03.489Z", + "costUsd": 0.185581 + }, + "th": { + "hash": "9ab0d799179c66f9", + "translatedAt": "2025-12-12T07:42:03.489Z", + "costUsd": 0.177859 + }, + "hi": { + "hash": "9ab0d799179c66f9", + "translatedAt": "2025-12-12T07:42:03.489Z", + "costUsd": 0.17412700000000003 + }, + "bn": { + "hash": "9ab0d799179c66f9", + "translatedAt": "2025-12-12T07:42:03.489Z", + "costUsd": 0.202735 + }, + "ro": { + "hash": "9ab0d799179c66f9", + "translatedAt": "2025-12-12T07:42:03.489Z", + "costUsd": 0.12212875 + }, + "sv": { + "hash": "9ab0d799179c66f9", + "translatedAt": "2025-12-12T07:42:03.489Z", + "costUsd": 0.12143675000000001 + } + } +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 69f27439..e8ee3d7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,41 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [7.1.0] - 2025-12-13 + +## Major Architectural Migration + +This release completely replaces PM2 with native Bun-based process management and migrates from better-sqlite3 to bun:sqlite. + +### Key Changes + +**Process Management** +- Replace PM2 with custom Bun-based ProcessManager +- PID file-based process tracking +- Automatic legacy PM2 process cleanup on all platforms + +**Database Driver** +- Migrate from better-sqlite3 npm package to bun:sqlite runtime module +- Zero native compilation required +- Same API compatibility + +**Auto-Installation** +- Bun runtime auto-installed if missing +- uv (Python package manager) auto-installed for Chroma vector search +- Smart installer with platform-specific methods (curl/PowerShell) + +### Migration + +**Automatic**: First hook trigger after update performs one-time PM2 cleanup and transitions to new architecture. No user action required. + +### Documentation + +Complete technical documentation in `docs/PM2-TO-BUN-MIGRATION.md` + +## [7.0.11] - 2025-12-12 + +Patch release adding feature/bun-executable to experimental branch selector for testing Bun runtime integration. + ## [7.0.9] - 2025-12-10 ## Bug Fixes diff --git a/CLAUDE.md b/CLAUDE.md index f2cfe8f9..998224d4 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -6,7 +6,7 @@ Claude-mem is a Claude Code plugin providing persistent memory across sessions. It captures tool usage, compresses observations using the Claude Agent SDK, and injects relevant context into future sessions. -**Current Version**: 7.0.10 +**Current Version**: 7.1.0 ## Architecture @@ -14,7 +14,7 @@ Claude-mem is a Claude Code plugin providing persistent memory across sessions. **Hooks** (`src/hooks/*.ts`) - TypeScript → ESM, built to `plugin/scripts/*-hook.js` -**Worker Service** (`src/services/worker-service.ts`) - Express API on port 37777, PM2-managed, handles AI processing asynchronously +**Worker Service** (`src/services/worker-service.ts`) - Express API on port 37777, Bun-managed, handles AI processing asynchronously **Database** (`src/services/sqlite/`) - SQLite3 at `~/.claude-mem/claude-mem.db` with FTS5 full-text search @@ -75,15 +75,28 @@ Settings are managed in `~/.claude-mem/settings.json`. The file is auto-created - **Chroma**: `~/.claude-mem/chroma/` - **Usage Logs**: `~/.claude-mem/usage-logs/usage-YYYY-MM-DD.jsonl` +## Requirements + +- **Bun** >= 1.0 (all platforms - auto-installed if missing) +- **uv** (all platforms - auto-installed if missing, provides Python for Chroma) +- Node.js >= 18 (build tools only) + ## Quick Reference ```bash npm run build # Compile TypeScript npm run sync-marketplace # Copy to ~/.claude/plugins -npm run worker:restart # Restart PM2 worker +npm run worker:restart # Restart worker service +npm run worker:status # Check worker status npm run worker:logs # View worker logs -pm2 list # Check worker status -pm2 delete claude-mem-worker # Force clean start ``` **Viewer UI**: http://localhost:37777 +**Worker Logs**: `~/.claude-mem/logs/worker-YYYY-MM-DD.log` + +## Documentation + +**Public Docs**: https://docs.claude-mem.ai (Mintlify) +**Source**: `docs/public/` - MDX files, edit `docs.json` for navigation +**Deploy**: Auto-deploys from GitHub on push to main +**Local Dev**: `cd docs/public && npx mintlify dev` diff --git a/README.md b/README.md index 57e2b3e7..993aa010 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,16 @@

+

+ + + + + thedotmack/claude-mem | Trendshift + + +

+

@@ -71,6 +81,7 @@ Restart Claude Code. Context from previous sessions will automatically appear in - 📊 **Progressive Disclosure** - Layered memory retrieval with token cost visibility - 🔍 **Skill-Based Search** - Query your project history with mem-search skill (~2,250 token savings) - 🖥️ **Web Viewer UI** - Real-time memory stream at http://localhost:37777 +- 💻 **Claude Desktop Skill** - Search memory from Claude Desktop conversations - 🔒 **Privacy Control** - Use `` tags to exclude sensitive content from storage - ⚙️ **Context Configuration** - Fine-grained control over what context gets injected - 🤖 **Automatic Operation** - No manual intervention required @@ -108,7 +119,7 @@ npx mintlify dev - **[Architecture Evolution](https://docs.claude-mem.ai/architecture-evolution)** - The journey from v3 to v5 - **[Hooks Architecture](https://docs.claude-mem.ai/hooks-architecture)** - How Claude-Mem uses lifecycle hooks - **[Hooks Reference](https://docs.claude-mem.ai/architecture/hooks)** - 7 hook scripts explained -- **[Worker Service](https://docs.claude-mem.ai/architecture/worker-service)** - HTTP API & PM2 management +- **[Worker Service](https://docs.claude-mem.ai/architecture/worker-service)** - HTTP API & Bun management - **[Database](https://docs.claude-mem.ai/architecture/database)** - SQLite schema & FTS5 search - **[Search Architecture](https://docs.claude-mem.ai/architecture/search-architecture)** - Hybrid search with Chroma vector database @@ -148,7 +159,7 @@ npx mintlify dev 1. **5 Lifecycle Hooks** - SessionStart, UserPromptSubmit, PostToolUse, Stop, SessionEnd (6 hook scripts) 2. **Smart Install** - Cached dependency checker (pre-hook script, not a lifecycle hook) -3. **Worker Service** - HTTP API on port 37777 with web viewer UI and 10 search endpoints, managed by PM2 +3. **Worker Service** - HTTP API on port 37777 with web viewer UI and 10 search endpoints, managed by Bun 4. **SQLite Database** - Stores sessions, observations, summaries with FTS5 full-text search 5. **mem-search Skill** - Natural language queries with progressive disclosure (~2,250 token savings vs MCP) 6. **Chroma Vector Database** - Hybrid semantic + keyword search for intelligent context retrieval @@ -262,7 +273,8 @@ See [CHANGELOG.md](CHANGELOG.md) for complete version history. - **Node.js**: 18.0.0 or higher - **Claude Code**: Latest version with plugin support -- **PM2**: Process manager (bundled - no global install required) +- **Bun**: JavaScript runtime and process manager (auto-installed if missing) +- **uv**: Python package manager for vector search (auto-installed if missing) - **SQLite 3**: For persistent storage (bundled) --- diff --git a/desktop-skill/Skill.md b/desktop-skill/Skill.md new file mode 100644 index 00000000..40c8a098 --- /dev/null +++ b/desktop-skill/Skill.md @@ -0,0 +1,44 @@ +--- +name: mem-search +description: Search your persistent memory database from previous coding sessions. Use when asked about past work, decisions, bugs fixed, or development history. +--- + +## Overview + +Search your local memory database for past sessions, decisions, code changes, and development history. This skill uses the `mem-search` MCP server tools. + +## Available MCP tools + +Use these tools from the `mem-search` MCP server: + +| Tool | Description | +|------|-------------| +| `search` | Unified search across all memory types | +| `decisions` | Find architectural/design decisions | +| `changes` | Find code changes and refactorings | +| `timeline` | Get observations around a specific point in time | +| `find_by_file` | Find observations for specific files | +| `find_by_type` | Filter by type (decision, bugfix, feature, refactor, discovery, change) | +| `find_by_concept` | Find by concept tags | +| `how_it_works` | Understand system architecture and design patterns | + +## Common parameters + +- `query` - Natural language search query +- `limit` - Max results (1-100, default 20) +- `format` - `index` for titles only (recommended), `full` for complete content +- `type` - Filter: observations, sessions, or prompts +- `obs_type` - Filter observation type: decision, bugfix, feature, refactor, discovery, change + +## When to use + +- "Did we already solve this?" +- "How did we do X last time?" +- "Find the bug fix for..." +- "What decisions did we make about..." +- "Show me changes to [file]" +- "What work did we do on [project]?" + +## Setup requirement + +The `mem-search` MCP server must be configured in Claude Desktop settings. See MCP configuration docs. diff --git a/desktop-skill/mem-search.zip b/desktop-skill/mem-search.zip new file mode 100644 index 00000000..89573028 Binary files /dev/null and b/desktop-skill/mem-search.zip differ diff --git a/docs/PM2-TO-BUN-MIGRATION.md b/docs/PM2-TO-BUN-MIGRATION.md new file mode 100644 index 00000000..1e978cc2 --- /dev/null +++ b/docs/PM2-TO-BUN-MIGRATION.md @@ -0,0 +1,1508 @@ +# PM2 to Bun Migration: Complete Technical Documentation + +**Version**: 7.1.0 +**Date**: December 2025 +**Migration Type**: Process Management (PM2 → Bun) + Database Driver (better-sqlite3 → bun:sqlite) + +--- + +## Table of Contents + +1. [Executive Summary](#executive-summary) +2. [Architecture Comparison](#architecture-comparison) +3. [Migration Mechanics](#migration-mechanics) +4. [User Experience Timeline](#user-experience-timeline) +5. [Platform-Specific Behavior](#platform-specific-behavior) +6. [Observable Changes](#observable-changes) +7. [File System State](#file-system-state) +8. [Edge Cases and Troubleshooting](#edge-cases-and-troubleshooting) +9. [Developer Notes](#developer-notes) + +--- + +## Executive Summary + +Claude-mem version 7.0.10 introduces two major architectural migrations: + +1. **Process Management**: PM2 → Custom Bun-based ProcessManager +2. **Database Driver**: better-sqlite3 npm package → bun:sqlite runtime module + +Both migrations are **automatic** and **transparent** to end users. The first time a hook fires after updating to 7.0.10+, the system performs a one-time cleanup of legacy PM2 processes and transitions to the new architecture. + +### Key Benefits + +- **Simplified Dependencies**: Removes PM2 and better-sqlite3 npm packages +- **Improved Cross-Platform Support**: Better Windows compatibility +- **Faster Installation**: No native module compilation required +- **Built-in Runtime**: Leverages Bun's built-in process management and SQLite +- **Reduced Complexity**: Custom ProcessManager is simpler than PM2 integration + +### Migration Impact + +- **Data Preservation**: User data, settings, and database remain unchanged +- **Automatic Cleanup**: Old PM2 processes automatically terminated (all platforms) +- **No User Action Required**: Migration happens automatically on first hook trigger +- **Backward Compatible**: SQLite database format unchanged (only driver changed) + +--- + +## Architecture Comparison + +### Old System (PM2-based) + +#### Process Management (PM2) + +**Component**: PM2 (Process Manager 2) +- **Package**: `pm2` npm dependency +- **Process Name**: `claude-mem-worker` +- **Management**: External PM2 daemon manages lifecycle +- **Discovery**: `pm2 list`, `pm2 describe` commands +- **Auto-restart**: PM2 automatically restarts on crash +- **Logs**: `~/.pm2/logs/claude-mem-worker-*.log` +- **PID File**: `~/.pm2/pids/claude-mem-worker.pid` + +**Lifecycle Commands**: +```bash +pm2 start