291 Commits

Author SHA1 Message Date
Alex Newman d5e392ea69 Release v5.0.2: Worker health check and async startup improvements
Fixes:
- Fixed worker startup reliability with async health checks
- Added proper error handling to PM2 process spawning
- Worker now verifies health before proceeding with hook operations
- Improved handling of PM2 failures when not yet installed

Technical changes:
- Added isWorkerHealthy() and waitForWorkerHealth() functions to src/shared/worker-utils.ts
- Changed ensureWorkerRunning() from synchronous to async with proper await
- All hooks now await ensureWorkerRunning for reliable worker communication
- Rebuilt all plugin executables with version 5.0.2
- Updated version to 5.0.2 in all metadata files

Root cause: ensureWorkerRunning was synchronous and didn't verify worker was actually responsive before proceeding, causing race conditions and startup failures.

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

Co-Authored-By: Claude <noreply@anthropic.com>
v5.0.2
2025-11-04 21:47:38 -05:00
Alex Newman 66ee9395cb Merge pull request #51 from thedotmack/copilot/fix-claude-mem-plugin-error
[WIP] Fix plugin hook error in claude-mem
2025-11-04 21:44:10 -05:00
copilot-swe-agent[bot] 7e75c0b22f Add proper error handling to PM2 process spawning
Co-authored-by: thedotmack <683968+thedotmack@users.noreply.github.com>
2025-11-05 02:42:19 +00:00
copilot-swe-agent[bot] c506390007 Make ensureWorkerRunning async with health checks
Co-authored-by: thedotmack <683968+thedotmack@users.noreply.github.com>
2025-11-05 02:38:47 +00:00
copilot-swe-agent[bot] f8695516a4 Initial analysis of worker startup issue
Co-authored-by: thedotmack <683968+thedotmack@users.noreply.github.com>
2025-11-05 02:34:35 +00:00
copilot-swe-agent[bot] 0127c7639a Initial plan 2025-11-05 02:31:56 +00:00
Alex Newman 6e66d78825 Release v5.0.1: Worker service stability and GitHub Actions
Improvements:
- Fixed worker service stability issues (PR #47)
- Added GitHub Actions workflows for automated code review (PR #48)
- Enhanced worker process management and restart reliability
- Improved session management and logging across all hooks
- Better error handling throughout hook lifecycle

Technical changes:
- Modified: src/services/worker-service.ts (stability improvements)
- Modified: src/shared/worker-utils.ts (consistent formatting)
- Modified: ecosystem.config.cjs (removed error/output redirection)
- Modified: src/hooks/*-hook.ts (ensure worker running)
- New: .github/workflows/claude-code-review.yml
- New: .github/workflows/claude.yml
- Rebuilt: plugin/scripts/*.js (all hook executables)
- Updated version to 5.0.1 in all metadata files

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

Co-Authored-By: Claude <noreply@anthropic.com>
v5.0.1
2025-11-04 15:42:46 -05:00
Alex Newman 0b4cfcbe56 Merge pull request #47 from thedotmack/bugfix/worker-service
Worker Service Refactor and Production Stability Improvements
2025-11-04 15:34:57 -05:00
Alex Newman c8a9486832 Refactor worker-utils.ts for consistent formatting and improved readability 2025-11-04 15:34:39 -05:00
Alex Newman 9fb43d8b06 Refactor hooks and worker service for improved session management and logging
- Updated new-hook.js, save-hook.js, and summary-hook.js to enhance logging and session handling.
- Simplified session auto-creation logic in worker-service.ts to prioritize observation data preservation.
- Added a blocking wait in ensureWorkerRunning function to prevent race conditions during worker startup.
- Improved error handling and logging consistency across hooks.
2025-11-04 15:28:45 -05:00
Alex Newman 1b9cec2a95 Enhance ecosystem configuration and worker service for improved stability
- Document intentional watch mode in ecosystem config for auto-restart on plugin updates.
- Implement auto-session creation in worker service to preserve observation data, ensuring no loss of valuable information during hook failures.
- Address race condition concerns in worker startup and improve error handling in hooks.
2025-11-04 15:16:28 -05:00
Alex Newman ddec9835d2 Merge pull request #48 from thedotmack/add-claude-github-actions-1762285533488
Add Claude Code GitHub Workflow
2025-11-04 14:45:48 -05:00
Alex Newman 2d97ffc9a8 "Claude Code Review workflow" 2025-11-04 14:45:35 -05:00
Alex Newman d8886619b8 "Claude PR Assistant workflow" 2025-11-04 14:45:34 -05:00
Alex Newman 280cb2fe54 Remove error and output file redirection from ecosystem configuration 2025-11-04 14:43:12 -05:00
Alex Newman c8a206b682 Enhance worker management and logging in summary-hook.js and worker-utils.ts
- Refactored logging functionality in summary-hook.js to improve clarity and consistency.
- Added checks in worker-utils.ts to prevent unnecessary restarts of the worker service, ensuring it only starts if not already running.
2025-11-04 14:40:34 -05:00
Alex Newman c03457d2d4 Refactor hooks to ensure worker is running before processing
- Updated `save-hook.js`, `summary-hook.js`, `context-hook.ts`, `new-hook.ts`, and `save-hook.ts` to include a call to `ensureWorkerRunning()` at the beginning of their main functions. This ensures that the worker is active before any operations are performed.
- Cleaned up import statements in the affected files to include the new utility function from `worker-utils.js`.
- Minor adjustments to logging and error handling to improve robustness and clarity.
2025-11-04 14:28:53 -05:00
Alex Newman a46a028ddb Refactor worker management and cleanup hooks
- Removed ensureWorkerRunning calls from multiple hooks (cleanup, context, new, save, summary) to streamline code and avoid unnecessary checks.
- Introduced fixed port usage for worker communication across hooks.
- Enhanced error handling in newHook, saveHook, and summaryHook to provide clearer messages for worker connection issues.
- Updated worker service to start without health checks, relying on PM2 for management.
- Cached Claude executable path to optimize repeated calls.
- Improved logging for better traceability of worker actions and errors.
2025-11-04 14:21:19 -05:00
Alex Newman 37f836b719 Add v5.0 announcement documentation drafts
Documentation:
- v5-reddit-post.md: v5.0-specific post focusing on hybrid search breakthrough
- v5-reddit-FINAL-DRAFT.md: General claude-mem post with timeline examples
- v5-reddit-post-story.md: Architecture evolution narrative
- v5-reddit-post-draft.md: Early draft with search examples
- v5-linkedin-post.md: Professional LinkedIn announcement
- reddit-posts.md: Research and reference materials

These are working drafts for community announcements.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 22:15:16 -05:00
Alex Newman bc8bc10b0b Merge pull request #41 from thedotmack/feature/hybrid-search
feat: Hybrid Search - Chroma Semantic + SQLite Temporal Search
2025-11-03 19:15:49 -05:00
Alex Newman 5169cfa46d Merge branch 'main' into feature/hybrid-search
Resolved conflicts by:
- Keeping feature/hybrid-search build process documentation in CLAUDE.md
- Removing deleted plugin/scripts/search-server.js (intentionally deleted in feature branch)
- Removing usage logging from worker-service.ts (telemetry captured at SDK level)
- Rebuilt worker-service.cjs after resolving source file conflicts

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 19:15:18 -05:00
Alex Newman 03ba89b703 fix: update user prompt formatting and correct 90-day cutoff logic
- Changed user prompt formatting to use full text instead of truncated version.
- Updated date filtering logic to use milliseconds instead of seconds for 90-day cutoff.
- Renamed doc_type values in ChromaSync to ensure consistency and prevent deduplication issues.
- Improved documentation for concept tags in input schema.
2025-11-03 19:05:12 -05:00
Alex Newman 263a8d4c18 Add stderr option to Chroma client initialization for better error handling
- Updated the StdioClientTransport configuration in search-server.ts to include 'stderr: ignore' for the Chroma client.
- Modified the ChromaSync class in ChromaSync.ts to also set 'stderr: ignore' when initializing the Chroma client.
2025-11-03 18:19:35 -05:00
Alex Newman b25b312bf3 feat: add get_timeline_by_query tool for enhanced observation search with timeline context
- Implemented a new tool to search for observations using natural language and retrieve timeline context around the best match.
- Introduced two modes: "auto" for automatic timeline anchor selection and "interactive" for user selection of top matches.
- Added input schema validation using zod for query parameters including depth before/after, limit, and project filtering.
- Integrated hybrid semantic search with fallback to FTS5 for observation retrieval.
- Enhanced response formatting for both modes, including detailed timeline context and observation summaries.
2025-11-03 18:15:05 -05:00
Alex Newman 633f89a5fb feat: Implement user prompt syncing to Chroma and enhance timeline querying
- Added `getObservationById` method to retrieve observations by ID in SessionStore.
- Introduced `getSessionSummariesByIds` and `getUserPromptsByIds` methods for fetching session summaries and user prompts by IDs.
- Developed `getTimelineAroundTimestamp` and `getTimelineAroundObservation` methods to provide a unified timeline of observations, sessions, and prompts around a specified anchor point.
- Enhanced ChromaSync to format and sync user prompts, including a new `syncUserPrompt` method.
- Updated WorkerService to sync the latest user prompt to Chroma after updating the worker port.
- Created tests for timeline querying and MCP handler logic to ensure functionality.
- Documented the implementation plan for user prompts and timeline context tool in the Chroma search completion plan.
2025-11-03 16:55:33 -05:00
Alex Newman c6bf72ca72 Simplify context display to type-only legend with color dots
Changes:
- Updated legend to show only observation types (bugfix, feature, refactor, change, discovery, decision)
- Mapped each type to a color dot emoji (🔴 bugfix, 🟢 feature, 🔵 refactor,  change, 🟡 discovery, 🟤 decision)
- Removed concept-based filtering and icon selection
- Simplified progressive disclosure instructions to reference types instead of concepts
- All observations now shown in timeline (no concept filtering)

Technical details:
- Modified: src/hooks/context-hook.ts:203-207 (legend)
- Modified: src/hooks/context-hook.ts:210-223 (progressive disclosure text)
- Modified: src/hooks/context-hook.ts:344-369 (icon mapping switched from concepts to types)
- Modified: src/hooks/context-hook.ts:168-173 (removed concept filtering)
- Rebuilt: plugin/scripts/context-hook.js

Rationale: Types are mutually exclusive and core to categorization, while concepts are multi-select metadata better accessed through MCP search tools. This simplifies the display and reduces visual noise.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:25:35 -05:00
Alex Newman bda39733e0 Merge remote-tracking branch 'refs/remotes/origin/main' 2025-11-03 13:43:13 -05:00
Alex Newman 80935fbc66 npm audit fixes #36 2025-11-03 13:42:31 -05:00
Alex Newman bcfd036dfe Merge pull request #38 from thedotmack/copilot/update-documentation-stop-claude-code
Clarify Stop hook is automatic, not user action
2025-11-03 13:40:00 -05:00
Alex Newman ebf53e9fb0 Merge pull request #39 from thedotmack/thedotmack-patch-1-1
Update repository link in README.md
2025-11-02 21:56:59 -05:00
Alex Newman 7133108f15 Document usage tracking feature in CLAUDE.md 2025-11-02 21:53:58 -05:00
Alex Newman f20bb5bced Add SDK usage tracking to JSONL logs
Features:
- New UsageLogger utility that writes usage metrics to daily JSONL files
- Captures token counts, costs, timing, and cache metrics from SDK result messages
- Usage logs stored in ~/.claude-mem/usage-logs/ (one file per day)
- Added analyze-usage.js script for analyzing usage patterns

Usage data captured:
- Token counts (input, output, cache creation, cache read)
- Total cost in USD per API call
- Duration metrics (total and API time)
- Number of turns per session
- Session and project attribution

Analysis script features:
- Aggregates totals by project and model
- Shows cache hit rates and savings
- Displays cost breakdowns and averages
- npm scripts: usage:analyze and usage:today

Files:
- src/utils/usage-logger.ts (new)
- src/services/worker-service.ts (modified - captures SDK result messages)
- scripts/analyze-usage.js (new)
- package.json (added usage:* npm scripts)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 21:53:42 -05:00
Alex Newman e238a81b34 Update repository link in README.md 2025-11-02 20:57:24 -05:00
Alex Newman 9215c7e1f5 Release v4.3.4: Fix SessionStart hooks on resume
Fixes:
- Fixed SessionStart hooks running on session resume
- Added matcher configuration to only run hooks on startup, clear, or compact events
- Prevents unnecessary hook execution and improves performance

Technical changes:
- Modified plugin/hooks/hooks.json (added matcher)
- Updated version to 4.3.4 in all metadata files

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

Co-Authored-By: Claude <noreply@anthropic.com>
v4.3.4
2025-11-01 21:47:00 -04:00
Alex Newman b694f233db Remove unwanted index.html file 2025-11-01 21:45:29 -04:00
Alex Newman 02130c49d1 close to win 2025-11-01 21:33:08 -04:00
Alex Newman c9e0301e3e Create index.html for landing page design 2025-11-01 20:36:58 -04:00
Alex Newman 65c89ea2f0 Update default sort order to 'date_desc' in search filters 2025-10-31 23:55:57 -04:00
Alex Newman 9a9b00c6d8 Implement hybrid search server with Chroma + SQLite
- Built search-server.mjs successfully (55KB)
- Configured with packages: 'external' to use node_modules dependencies
- MCP config points to ${CLAUDE_PLUGIN_ROOT}/scripts/search-server.mjs
- Ready for deployment to plugin directory

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-31 23:35:44 -04:00
Alex Newman 309e8a7139 Implement hybrid search: Chroma semantic + SQLite temporal
Core implementation:
- Added Chroma MCP client integration to search-server.ts
- Implemented queryChroma() helper with Python dict parsing
- Added VECTOR_DB_DIR constant to paths.ts
- Added SessionStore.getObservationsByIds() method

Search handlers updated:
- search_observations: Semantic-first with 90-day temporal filter
- find_by_concept/type/file: Metadata-first, semantic-enhanced ranking
- All handlers fall back to FTS5 if Chroma unavailable

Technical details:
- Direct MCP client usage (no abstractions)
- Regex parsing of Chroma Python dict responses
- Semantic ranking preserved in final results
- Graceful degradation to FTS5-only search

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-31 23:00:04 -04:00
Alex Newman 867226c19d Add validated Chroma search experiments 2025-10-31 22:26:55 -04:00
copilot-swe-agent[bot] 192adf5cbc Fix: /clear DOES inject context via SessionStart hook
Corrected incorrect documentation that claimed /clear doesn't inject context.
The SessionStart hook fires with source: "clear" when /clear is used, which
re-injects context from recent sessions. Updated docs to accurately reflect
that /clear both clears conversation AND re-injects fresh context.

Co-authored-by: thedotmack <683968+thedotmack@users.noreply.github.com>
2025-10-31 21:28:54 +00:00
copilot-swe-agent[bot] 140a5f3469 Clarify Stop hook behavior and /clear vs exit in docs
- Changed "Stop Claude" to "Claude finishes responding" to clarify that the Stop hook fires automatically
- Explained Stop hook triggers summary generation automatically, not as a user action
- Added detailed section explaining /clear behavior vs completely exiting Claude Code
- Clarified when new context is injected (new session start, not after /clear)
- Fixed session count: changed "last 3 sessions" to "last 10 sessions" (matches implementation)

Co-authored-by: thedotmack <683968+thedotmack@users.noreply.github.com>
2025-10-31 21:06:59 +00:00
copilot-swe-agent[bot] 5c4b44d4c7 Initial plan 2025-10-31 21:02:02 +00:00
Alex Newman 3bbacb8fa4 Release v4.3.3: Configurable session display and first-time setup UX
Improvements:
- Made session display count configurable (DISPLAY_SESSION_COUNT = 8)
- Added first-time setup detection with helpful user messaging
- Improved UX: First install message clarifies Plugin Hook Error display
- Cleaned up code comments

Technical changes:
- Updated src/hooks/context-hook.ts (configurable session count)
- Updated src/hooks/user-message-hook.ts (first-time setup detection)
- Rebuilt plugin/scripts/context-hook.js
- Rebuilt plugin/scripts/user-message-hook.js
- Bumped version to 4.3.3 in all metadata files

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

Co-Authored-By: Claude <noreply@anthropic.com>
v4.3.3
2025-10-27 01:22:47 -04:00
Alex Newman d69a95bd29 Refactor PM2 ecosystem configuration: set restart delay to 0 and reduce timeout values 2025-10-27 00:52:40 -04:00
Alex Newman 90b209081c Add GitHub release step to version-bump skill workflow 2025-10-27 00:25:44 -04:00
Alex Newman 6d145c035c Update version-bump skill to include plugin.json and git tagging workflow v4.3.2 2025-10-27 00:17:09 -04:00
Alex Newman bd5ad6e5c2 Update version-bump skill documentation and bump plugin version to 4.3.2 2025-10-27 00:14:18 -04:00
Alex Newman 28005b75af Release v4.3.2: User-facing context display via stderr hook
Improvements:
- Added user-message-hook for displaying context to users (src/hooks/user-message-hook.ts)
- Hook fires simultaneously with context injection, sending duplicate message via stderr
- Error messages don't get added to context, enabling user visibility
- Added 4 comprehensive documentation files (2500+ lines total)
- Improved cross-platform path handling in context-hook

Technical changes:
- New: src/hooks/user-message-hook.ts (stderr-based display mechanism)
- New: plugin/scripts/user-message-hook.js (built executable)
- New: docs/architecture-evolution.mdx (801 lines)
- New: docs/context-engineering.mdx (222 lines)
- New: docs/hooks-architecture.mdx (784 lines)
- New: docs/progressive-disclosure.mdx (655 lines)
- Modified: plugin/hooks/hooks.json (hook configuration)
- Modified: src/hooks/context-hook.ts (path handling)
- Modified: scripts/build-hooks.js (build support)
- Bumped version to 4.3.2 in all metadata files

Design rationale: Temporary workaround until Claude Code potentially adds ability to share messages with both user and context simultaneously.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 00:11:13 -04:00