Commit Graph

52 Commits

Author SHA1 Message Date
Alex Newman f7f62ef3f3 feat(SessionStore): auto-create session records if missing
- Added functionality to automatically create a session record in the database if it does not exist when storing observations or session summaries.
- Updated `storeObservation` and `storeSummary` methods to include checks for existing session records and insert new records as needed.
- Added logging for auto-created session records for better traceability.
2025-10-21 22:13:13 -04:00
Alex Newman e073c0b75f chore: Release v4.1.1 - Remove redundant advanced_search and fix MCP bugs
Version bump to 4.1.1 with critical bug fixes and API simplification.

Removed:
- Redundant advanced_search MCP tool (no unique functionality)
- advancedSearch method from SessionSearch class

Fixed:
- findByConcept, findByType, findByFile now respect limit/offset
- Parser validation prevents observation types in concepts array
- Added token limit warnings to tool descriptions

Changed:
- Simplified MCP API from 7 to 6 tools
- Enhanced SDK prompts to prevent AI data contamination

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-21 19:15:19 -04:00
Alex Newman fe861a85bd Refactor PM2 commands in package.json for worker management; add CLAUDE.md documentation 2025-10-21 16:19:27 -04:00
Alex Newman 1ea692e0b0 chore: Update license information and add user settings manager script 2025-10-21 15:12:34 -04:00
Alex Newman d275715974 Release v4.1.0 - Graceful session cleanup and MCP search server restoration
### Changed
- Graceful session cleanup: Cleanup hook now marks sessions as completed instead of sending DELETE requests to worker
- Natural worker shutdown: Workers now finish pending operations (like summary generation) before terminating
- Restored MCP search server: Re-enabled full-text search capabilities from backup

### Fixed
- Session summaries no longer interrupted by aggressive cleanup during session end
- Workers can now complete final operations before shutdown

### Dependencies
- Updated @anthropic-ai/claude-agent-sdk to ^0.1.23
- Added @modelcontextprotocol/sdk ^1.20.1
- Added zod-to-json-schema ^3.24.6

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-21 01:07:56 -04:00
Alex Newman 9dd8b180ac fix: Use dynamic imports in hooks to fix better-sqlite3 loading
Changed all hook entry points to use dynamic imports after bootstrap runs. This ensures that better-sqlite3 is installed before Node.js attempts to resolve the import.

Changes:
- Modified src/bin/hooks/*.ts to call ensureDependencies() before dynamic import
- Moved from static `import { hook } from '...'` to `const { hook } = await import('...')`
- This delays module resolution until after npm install completes
- Bumped version to 4.0.6

The previous approach failed because static imports are resolved at module link time, before any runtime code (including ensureDependencies) executes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 16:54:28 -04:00
Alex Newman 6fb9570291 feat: Release v4.0.5 - Auto-install dependencies via bootstrap hooks
Fixed better-sqlite3 distribution by implementing self-bootstrapping hooks
that auto-install dependencies on first run. This eliminates the need for
users to have native compilation tools or manually install dependencies.

## Solution

Instead of bundling 25MB of better-sqlite3 binaries in git or requiring
manual npm install, hooks now bootstrap themselves on first execution:

1. Created `src/shared/bootstrap.ts` with `ensureDependencies()` function
2. Added bootstrap calls to all hook entry points (context, new, save, summary, cleanup)
3. Created `plugin/scripts/package.json` declaring better-sqlite3 dependency
4. Bootstrap checks if `node_modules` exists, runs `npm install` if missing
5. npm automatically downloads prebuilt better-sqlite3 binary for user's platform

## Changes

**Core Bootstrap System:**
- Added src/shared/bootstrap.ts: Auto-install dependencies using npm
- Modified all hooks (context, new, save, summary, cleanup) to call ensureDependencies()
- Created plugin/scripts/package.json with better-sqlite3 dependency

**Build & Distribution:**
- Removed node_modules copying logic from build script
- Build output is now compact (hooks + package.json, no binaries)
- Updated marketplace.json to point to GitHub for direct installation

**Documentation:**
- Updated README: GitHub Marketplace installation is now recommended method
- Installation instructions emphasize no compilation needed
- Version bumped to 4.0.5 throughout

## Benefits

-  No git bloat (repo stays small, no 25MB binaries committed)
-  No compilation needed (npm downloads prebuilt binaries)
-  Works on all platforms (npm handles platform-specific binaries)
-  Zero manual steps (hooks bootstrap themselves automatically)
-  Idempotent (skips install if dependencies already exist)

Installation now works via simple:
```
/plugin marketplace add https://github.com/thedotmack/claude-mem
/plugin install claude-mem
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 16:44:26 -04:00
Alex Newman ae90b26995 chore: Release v4.0.4 - Revert to local marketplace installation
Reverted from GitHub-hosted marketplace to local marketplace file installation method. This allows us to resolve issues with better-sqlite3 native module builds before enabling GitHub marketplace distribution.

Changes:
- Simplified .claude-plugin/marketplace.json (removed metadata, version fields)
- Updated README installation instructions to use local .claude-plugin/marketplace.json
- Bumped version to 4.0.4

Installation now requires cloning the repo and using:
/plugin marketplace add .claude-plugin/marketplace.json

Will restore GitHub marketplace method once native module issues are resolved.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-19 02:13:00 -04:00
Alex Newman 3b0cd0b3f6 chore: Release v4.0.3
Marketplace release for Claude Code plugin
https://github.com/thedotmack/claude-mem
2025-10-19 02:01:58 -04:00
Alex Newman daf368e343 Refactor code structure for improved readability and maintainability 2025-10-19 01:45:51 -04:00
Alex Newman b44359c136 chore: Update version to 4.0.2 and enhance changelog with dependency management improvements 2025-10-19 01:15:41 -04:00
Alex Newman be0ab12789 Refactor worker startup logic to use PM2 with improved error handling
- Updated `new-hook.js` to streamline logging and session management.
- Enhanced database schema initialization and migration processes.
- Improved error handling for worker startup in `worker-utils.ts`, ensuring PM2 binary and ecosystem config existence before spawning.
- Added detailed error messages for missing dependencies and spawn failures.
2025-10-19 01:13:20 -04:00
Alex Newman 7ff611feb5 Refactor hooks and worker service for improved error handling and initialization
- Removed try-catch blocks in new-hook, save-hook, and summary-hook for cleaner flow.
- Enhanced error handling in save and summary hooks to throw errors instead of logging and returning.
- Introduced ensureWorkerRunning utility to manage worker service lifecycle and health checks.
- Replaced dynamic port allocation with a fixed port for the worker service.
- Simplified path management and removed unused port allocator utility.
- Added database schema initialization for fresh installations and improved migration handling.
2025-10-19 00:57:49 -04:00
Alex Newman 002f7a94b8 feat: Release v4.0.0 - Plugin data directory and auto-starting worker
BREAKING CHANGES:
- Data directory moved from ~/.claude-mem/ to ${CLAUDE_PLUGIN_ROOT}/data/
- Fresh start required - no migration from v3.x databases
- Worker service now auto-starts on SessionStart hook

New Features:
- MCP Search Server with 6 specialized search tools
- FTS5 full-text search across observations and sessions
- Auto-starting worker service in SessionStart hook
- Citation support for search results (claude-mem:// URIs)

Changes:
- Updated paths.ts to use CLAUDE_PLUGIN_ROOT for data directory
- Added worker auto-start logic to context hook
- Updated worker service to write port file to plugin data dir
- Bumped version to 4.0.0 in package.json and plugin.json
- Created comprehensive CHANGELOG.md documenting v4.0.0 changes
- Updated README.md with v4.0.0 breaking changes and features
- Rebuilt all hooks and worker service

Technical Improvements:
- Improved error handling and graceful degradation
- Structured logging across all components
- Enhanced plugin integration with Claude Code

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-19 00:05:56 -04:00
Alex Newman 6d68fd44ca feat: Add XML extraction and import scripts for observations and summaries 2025-10-18 23:34:53 -04:00
Alex Newman d4a71c994d feat: Enhance session management with prompt tracking
- Added prompt_number to observations and session summaries for better tracking.
- Implemented prompt counter in SDK sessions to manage user prompts effectively.
- Updated database schema to include prompt tracking columns and removed unique constraints on session summaries.
- Modified hooks to utilize prompt_number in observations and summaries.
- Changed worker service to handle summarize requests instead of finalize, keeping the SDK agent active.
- Improved logging for better debugging and tracking of prompt numbers across sessions.
2025-10-17 16:23:11 -04:00
Alex Newman 372854948c feat: Implement Worker Service with session management and SDK integration
- Added WorkerService to handle long-running HTTP service with session management.
- Implemented endpoints for initializing, observing, finalizing, checking status, and deleting sessions.
- Integrated with Claude SDK for processing observations and generating responses.
- Added port allocator utility to dynamically find available ports for the service.
- Configured TypeScript settings for the project.
2025-10-17 15:59:36 -04:00
Alex Newman cedb635176 Refactor hooks to standardize response format and improve error handling
- Introduced a new `hook-response.ts` module to create standardized hook responses.
- Updated `context-hook.ts`, `new.ts`, `save.ts`, and `summary.ts` to utilize the new response format.
- Enhanced error handling in `context-hook.ts` to check for input from stdin.
- Refactored database interaction in hooks to ensure consistent session management.
- Improved readability and maintainability of hook implementations by restructuring code.
- Updated database queries to use consistent variable naming and formatting.
- Modified the handling of socket connections in `save.ts` and `summary.ts` to ensure proper response on close and error events.
2025-10-16 20:50:04 -04:00
Alex Newman 8e460a8c2a feat: remove install, logs, restore, status, trash, and uninstall commands
- Deleted the install.ts command file, removing the installation logic for the Claude Memory System.
- Removed logs.ts command file, eliminating the log viewing functionality.
- Deleted restore.ts command file, which handled restoring files from trash.
- Removed status.ts command file, which provided system status checks.
- Deleted trash-empty.ts and trash-view.ts command files, removing trash management features.
- Removed trash.ts command file, which handled moving files to trash.
- Deleted uninstall.ts command file, eliminating the uninstallation process for the memory system.
- Updated new.ts hook to enforce plugin mode for Claude Code integration.
- Cleaned up config.ts by removing unused export for CLI_NAME.
2025-10-16 19:57:54 -04:00
Alex Newman 3e617a8b1e Refactor code structure for improved readability and maintainability 2025-10-16 19:50:24 -04:00
Alex Newman 834cf4095e Add standalone hook entry points for context, new, save, summary, and worker
- Implemented context-hook.ts for handling session start events.
- Created new-hook.ts for user prompt submission events.
- Developed save-hook.ts for post tool use events.
- Added summary-hook.ts for handling stop events.
- Introduced worker.ts as a standalone background process for the SDK agent.
- Each hook reads input from stdin, processes it, and handles errors gracefully.
2025-10-16 15:39:30 -04:00
Alex Newman 5f05f991bc refactor: add hooks configuration and plugin installation documentation 2025-10-16 15:09:40 -04:00
Alex Newman 2608fb180e Refactor: Remove hook-templates and related functionality
- Updated the published package contents to exclude `hook-templates`.
- Removed references to the hooks directory and related scripts in the installation and uninstallation processes.
- Simplified the status command by eliminating checks for runtime hook scripts.
- Adjusted the path discovery service to remove methods related to hook templates.
- Updated the installation logic to directly configure hooks using CLI commands.
- Cleaned up the uninstall process to remove claude-mem hooks from settings.
2025-10-15 20:38:11 -04:00
Alex Newman edeed2ee2c refactor: remove deprecated hook templates and related utilities
- Deleted hook-prompt-renderer.js and hook-prompts.config.js as they are no longer needed.
- Removed path-resolver.js, stop.js, and user-prompt-submit.js for streamlining the codebase.
- Updated package.json scripts to point to new build and publish scripts.
- Adjusted test imports to reflect new directory structure after removing unnecessary files.
2025-10-15 20:24:08 -04:00
Alex Newman 2663121d9f Refactor database integration to use bun:sqlite instead of better-sqlite3
- Updated import statements across multiple files to use bun:sqlite.
- Changed database query methods from `prepare` to `query` for consistency.
- Removed dependency on better-sqlite3 from package.json and adjusted package.json to specify bun as the engine.
- Modified hook installation process to eliminate unnecessary dependency installation.
- Updated migration scripts to align with bun:sqlite's API.
2025-10-15 15:03:43 -04:00
Alex Newman 5886fe7d8f feat: add publish script for claude-mem
- Implemented a CLI tool for version bumping, building, and publishing to npm.
- Added checks for uncommitted changes and current version retrieval.
- Included options for patch, minor, major, and custom version bumps.
- Integrated git commit and tagging after version update.
- Added npm publish functionality and git push after successful publish.
- Implemented error handling and user confirmations throughout the process.
2025-10-14 19:26:11 -04:00
Alex Newman 5f15695c3f Release v3.9.16
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-10-06 22:55:16 -04:00
Alex Newman c49533c250 Release v3.9.14
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-10-03 21:47:35 -04:00
Alex Newman 4f49cb1bc9 Release v3.9.13
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-10-03 21:45:36 -04:00
Alex Newman 874726b193 Release v3.9.12
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-10-03 21:09:11 -04:00
Alex Newman 5244a12422 Release v3.9.11
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-10-03 20:55:36 -04:00
Alex Newman 5b30764fa8 Release v3.9.10
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-10-03 18:27:36 -04:00
Alex Newman 85ed7c3d2f Release v3.9.9
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-10-03 18:20:47 -04:00
Alex Newman 4d5b307a74 Release v3.7.2
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-09-22 14:14:51 -04:00
Alex Newman 68566b556c Release v3.7.1
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-09-17 21:20:36 -04:00
Alex Newman b0032c1745 Release v3.7.0
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-09-17 20:19:19 -04:00
Alex Newman 35b7aab174 Release v3.6.10
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-09-16 20:20:56 -04:00
Alex Newman 2601215c91 Release v3.6.9
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-09-14 23:57:39 -04:00
Alex Newman 4ebf0cad6b Release v3.6.8
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-09-14 19:38:27 -04:00
Alex Newman 98d959112c Release v3.6.6
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-09-14 18:48:58 -04:00
Alex Newman d01c2afaa6 Release v3.6.5
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-09-14 14:36:54 -04:00
Alex Newman 8ebcb55b0d Release v3.6.4
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-09-13 22:54:41 -04:00
Alex Newman 97807494fd Release v3.6.3
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-09-11 17:15:50 -04:00
Alex Newman f0c3bf18b0 Release v3.6.2
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-09-10 22:15:14 -04:00
Alex Newman 3eaae66bc4 Release v3.6.1
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-09-10 17:30:06 -04:00
Alex Newman 27d1cd405f Release v3.6.0
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-09-10 15:02:40 -04:00
Alex Newman 181aca0215 Release v3.5.9
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-09-10 01:04:38 -04:00
Alex Newman b6eef0145f Release v3.5.8
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-09-09 22:41:45 -04:00
Alex Newman a1bc421fea Release v3.5.7
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-09-09 22:09:44 -04:00
Alex Newman 502b3894d7 Release v3.5.6
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-09-09 02:54:32 -04:00