From 12603a1a5c978638a4fb794bd667f4fec7778933 Mon Sep 17 00:00:00 2001 From: Alex Newman Date: Fri, 12 Dec 2025 21:22:00 -0500 Subject: [PATCH] docs: add PM2 to Bun migration documentation to Mintlify MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add comprehensive technical documentation explaining the v7.1.0 migration from PM2 to Bun-based process management and better-sqlite3 to bun:sqlite database driver. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../architecture/pm2-to-bun-migration.mdx | 551 ++++++++++++++++++ docs/public/docs.json | 3 +- 2 files changed, 553 insertions(+), 1 deletion(-) create mode 100644 docs/public/architecture/pm2-to-bun-migration.mdx diff --git a/docs/public/architecture/pm2-to-bun-migration.mdx b/docs/public/architecture/pm2-to-bun-migration.mdx new file mode 100644 index 00000000..01ba4582 --- /dev/null +++ b/docs/public/architecture/pm2-to-bun-migration.mdx @@ -0,0 +1,551 @@ +--- +title: "PM2 to Bun Migration" +description: "Complete technical documentation for the process management and database driver migration in v7.1.0" +--- + +# 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) + +## Executive Summary + +Claude-mem version 7.1.0 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.1.0+, 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) + + + +**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