Commit Graph

113 Commits

Author SHA1 Message Date
Alex Newman 6cd904a81c chore: Bump version to 6.0.9
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 15:17:23 -05:00
Alex Newman d175f1759c chore: Bump version to 6.0.8
Critical hotfix for PM2 worker startup issue. The worker now correctly
starts from the marketplace directory automatically.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 14:42:16 -05:00
Alex Newman 047914d087 chore: Bump version to 6.0.7
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 13:46:12 -05:00
Alex Newman 798dec972e chore: Bump version to 6.0.6
Critical bugfix for database migration issue (Issue #121)

Changes:
- Fix migration logic to always verify column existence
- Remove early return that trusted schema_versions alone
- Ensures discovery_tokens columns exist before queries
- Prevents "no such column" errors for all users

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 13:18:49 -05:00
Alex Newman cf1c966409 chore: Bump version to 6.0.5
Automatic cleanup of orphaned MCP server processes on worker startup
Removed manual cleanup notice from session context
Self-healing maintenance on every worker restart

Generated with Claude Code
2025-11-16 22:39:06 -05:00
Alex Newman 4f1cd309fd chore: Bump version to 6.0.4
Fix memory leaks from orphaned uvx/python processes

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 22:20:57 -05:00
Alex Newman 60d5f8fbf1 chore: Bump version to 6.0.3
Version bump for patch release.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 13:37:30 -05:00
Alex Newman 9fb7383ab3 chore: bump version to 6.0.2
Updated user message hook with Claude-Mem community discussion link.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-14 15:44:02 -05:00
Alex Newman e3283c2a1d chore: bump version to 6.0.1 2025-11-14 15:06:11 -05:00
Alex Newman 8b4cc4f6bf chore: bump version to 6.0.0
Major version bump reflecting significant improvements:
- Enhanced session initialization with live userPrompt updates
- Improved transcript processing and analysis capabilities
- Refactored hooks and SDKAgent for better observation handling

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-13 18:24:59 -05:00
Alex Newman 5f7aa0710e Bump version to 5.5.1
This patch release includes:
- Summary hook enhancements to capture last user message from transcripts
- Activity indicator improvements for better user feedback
- Worker service enhancements for queue depth tracking

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-11 17:41:22 -05:00
Alex Newman ecb8b39f6d Add auto-generated CHANGELOG from GitHub releases
New Features:
- Created scripts/generate-changelog.js to auto-generate CHANGELOG.md
- Fetches all GitHub releases and formats into Keep a Changelog format
- Added npm run changelog:generate command

Version-Bump Skill Updates:
- Added Step 10: Generate CHANGELOG to workflow
- Updated verification checklist to include CHANGELOG generation
- Updated skill description and critical rules
- Single source of truth: GitHub releases

Technical Details:
- Script fetches releases via gh CLI
- Parses release bodies and formats to markdown
- Removes duplicate headers and Claude Code footers
- Sorts releases by date (newest first)
- Generates clean, consistent changelog

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-11 16:26:10 -05:00
Alex Newman 6ddef1093a Release v5.5.0: Enhanced mem-search skill
Breaking Changes: None (minor version)

Improvements:
- Merged PR #91: Replace generic "search" skill with enhanced "mem-search" skill
- Improved skill effectiveness from 67% to 100% (Anthropic standards)
- Enhanced scope differentiation to prevent confusion with native conversation memory
- Increased concrete triggers from 44% to 85%
- Added 5+ unique identifiers and explicit exclusion patterns
- Comprehensive documentation reorganization (17 total files)

Technical Changes:
- New mem-search skill with system-specific naming
- Explicit temporal keywords ("previous sessions", "weeks/months ago")
- Technical anchors referencing FTS5 full-text index and typed observations
- Documentation moved from /context/ to /docs/context/
- Detailed technical architecture documentation added
- 12 operation guides + 2 principle directories

Credits:
- Skill design and enhancement by @basher83

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-11 16:18:42 -05:00
Alex Newman eafdd6a7be Bump version to 5.4.5 2025-11-11 13:51:19 -05:00
Alex Newman 30ebe92a53 Release v5.4.4: Fix duplicate entries in viewer
Bugfix:
- Fixed duplicate observations and summaries appearing in viewer
- Root cause: handleSessionInit spawned SDK agent but didn't save promise to session.generatorPromise
- Second agent would spawn when handleObservations ran, causing duplicates
- Fix: Assign generatorPromise in handleSessionInit (matches handleSummarize pattern)

Technical changes:
- Modified src/services/worker-service.ts:265
- Now tracks promise to prevent duplicate agent spawning
- Guard condition in handleObservations (line 301) now works correctly

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 17:30:58 -05:00
Alex Newman 9f8499fe54 Bump version to 5.4.3
Release v5.4.3: Fix PM2 race condition in worker restart

Changes:
- Removed PM2 restart logic from ensureWorkerRunning()
- PM2 watch mode now exclusively handles worker restarts
- Eliminated race condition causing TypeError
- Reduced unnecessary worker restarts (39+ → minimal)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 16:53:23 -05:00
Alex Newman bbd6113f69 Release v5.4.2: CWD spatial awareness fix
Bugfix release:
- Fixed SDK agent spatial awareness by propagating CWD context from tool execution
- Prevents false "file not found" reports when working across multiple repositories
- Added comprehensive test suite for CWD propagation (8 passing tests)
- Security analysis: Zero vulnerabilities, CodeQL approved

Technical changes:
- Hook extracts CWD from PostToolUseInput and forwards to worker service
- Worker types define optional CWD fields in PendingMessage and ObservationData
- SessionManager passes CWD to SDKAgent's addObservation
- SDK agent includes CWD in tool observation objects sent to Claude API
- Prompts render tool_cwd XML elements with spatial awareness guidance
- All changes present in compiled outputs (save-hook.js, worker-service.cjs)

Documentation:
- Technical documentation: context/CWD_CONTEXT_FIX.md
- PR summary: PR_SUMMARY.md
- Security review: SECURITY_SUMMARY.md
- CHANGELOG entry added

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 15:33:14 -05:00
Alex Newman b4b90faa1e Release v5.4.1: MCP search server toggle functionality
New Features:
- REST API endpoints for MCP server status and toggle control
- UI toggle in viewer sidebar for enabling/disabling MCP search server
- File-based persistence mechanism (.mcp.json ↔ .mcp.json.disabled)
- Independent state management for MCP toggle

Technical changes:
- Added GET /api/mcp/status endpoint (returns mcpEnabled boolean)
- Added POST /api/mcp/toggle endpoint (toggles MCP server state)
- Updated Settings interface with mcpEnabled property
- Enhanced Sidebar component with MCP toggle UI and state management
- Updated worker service with MCP control logic
- Bumped version to 5.4.1 in all metadata files

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 13:48:52 -05:00
Alex Newman a367436a78 Release v5.4.0: Skill-Based Search Migration & Progressive Disclosure
Version Bump:
- package.json: 5.3.0 → 5.4.0
- .claude-plugin/marketplace.json: 5.3.0 → 5.4.0
- plugin/.claude-plugin/plugin.json: 5.3.0 → 5.4.0
- CLAUDE.md: 5.3.0 → 5.4.0

Breaking Changes:
- MCP search tools removed (replaced with skill-based search)
- No user action required - migration is transparent

Major Features:
- Skill-based search architecture (~2,250 token savings per session)
- Progressive disclosure pattern (skill frontmatter ~250 tokens)
- 10 HTTP API endpoints for search operations
- Natural language queries replace MCP tool syntax

Technical Changes:
- Removed MCP search server registration
- Added search skill with comprehensive documentation
- Updated all documentation to reflect new architecture
- HTTP API endpoints in worker service

Migration Notes:
- Users: No action required, searches work identically
- Developers: MCP server source kept for reference

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 19:15:04 -05:00
Alex Newman fda069bb07 Fix GitHub issues #76, #74, #75 + session lifecycle improvements (#77)
* Refactor context-hook: Fix anti-patterns and improve maintainability

This refactor addresses all anti-patterns documented in CLAUDE.md, improving code quality without changing behavior.

**Dead Code Removed:**
- Eliminated unused useIndexView parameter throughout
- Cleaned up entry point logic

**Magic Numbers → Named Constants:**
- CHARS_PER_TOKEN_ESTIMATE = 4 (token estimation)
- SUMMARY_LOOKAHEAD = 1 (explains +1 in query)
- Added clarifying comment for DISPLAY_SESSION_COUNT

**Code Duplication Eliminated:**
- Reduced 34 lines to 4 lines with renderSummaryField() helper
- Replaced 4 identical summary field rendering blocks

**Error Handling Added:**
- parseJsonArray() now catches JSON.parse exceptions
- Prevents session crashes from malformed data

**Type Safety Improved:**
- Added SessionSummary interface (replaced inline type cast)
- Added SummaryTimelineItem for timeline items
- Proper Map typing: Map<string, TimelineItem[]>

**Variable Naming Clarity:**
- summariesWithOffset → summariesForTimeline
- isMostRecent → shouldShowLink (explains purpose)
- dayTimelines → itemsByDay
- nextSummary → olderSummary (correct chronology)

**Better Documentation:**
- Explained confusing timeline offset logic
- Removed apologetic comments, added clarifying ones

**Impact:**
- 28 lines saved from duplication elimination
- Zero behavioral changes (output identical)
- Improved maintainability and type safety

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

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix context-hook to respect settings.json contextDepth

The context-hook was ignoring the user's contextDepth setting from the web UI (stored in ~/.claude-mem/settings.json) and always using the default of 50 observations.

**Problem:**
- Web UI sets contextDepth in ~/.claude-mem/settings.json
- Context-hook only read from process.env.CLAUDE_MEM_CONTEXT_OBSERVATIONS
- User's preference of 7 observations was ignored, always showing 50

**Solution:**
- Added getContextDepth() function following same pattern as getWorkerPort()
- Priority: settings.json > env var > default (50)
- Validates contextDepth is a positive number

**Testing:**
- Verified with contextDepth: 7 → shows 7 observations ✓
- Verified with contextDepth: 3 → shows 3 observations ✓
- Settings properly respected on every session start

**Files Changed:**
- src/hooks/context-hook.ts: Added getContextDepth() + imports
- plugin/scripts/context-hook.js: Built output

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

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix context-hook to read from correct settings file location

**Critical Bug Fix:**
Previous commit read from completely wrong location with wrong field name.

**What was wrong:**
- Reading from: ~/.claude-mem/settings.json (doesn't exist)
- Looking for: contextDepth (wrong field)
- Result: Always falling back to default of 50

**What's fixed:**
- Reading from: ~/.claude/settings.json (correct location)
- Looking for: env.CLAUDE_MEM_CONTEXT_OBSERVATIONS (correct field)
- Matches pattern used in worker-service.ts

**Testing:**
- With CLAUDE_MEM_CONTEXT_OBSERVATIONS: "15" → shows 15 observations ✓
- With CLAUDE_MEM_CONTEXT_OBSERVATIONS: "5" → shows 5 observations ✓
- Web UI settings now properly respected

**Files Changed:**
- src/hooks/context-hook.ts: Fixed path and field name in getContextDepth()
- plugin/scripts/context-hook.js: Built output

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

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix GitHub issues #76, #74, #75 + session lifecycle improvements

Bug Fixes:
- Fix PM2 'Process 0 not found' error (#76): Changed pm2 restart to pm2 start (idempotent)
- Fix troubleshooting skill distribution (#74, #75): Moved from .claude/skills/ to plugin/skills/

Session Lifecycle Improvements:
- Added session lifecycle context to SDK agent prompt
- Changed summary framing from "final report" to "progress checkpoint"
- Updated summary prompts to use progressive tense ("so far", "actively working on")
- Added buildContinuationPrompt() for prompt #2+ to avoid re-initialization
- SessionManager now restores prompt counter from database
- SDKAgent conditionally uses init vs continuation prompt based on prompt number

These changes improve context-loading task handling and reduce incorrect "file not found" reports in summaries (partial fix for #73 - awaiting user feedback).

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

Co-Authored-By: Claude <noreply@anthropic.com>

* Release v5.3.0: Session lifecycle improvements and bug fixes

Improvements:
- Session prompt counter now restored from DB on worker restart
- Continuation prompts for prompt #2+ (lightweight, avoids re-init)
- Summary framing changed from "final report" to "progress checkpoint"
- PM2 start command (idempotent, fixes "Process 0 not found" error)
- Troubleshooting skill moved to plugin/skills/ for proper distribution

Technical changes:
- SessionManager loads prompt_counter from DB on initialization
- SDKAgent uses buildContinuationPrompt() for requests #2+
- Updated summary prompt to clarify mid-session checkpoints
- Fixed worker-utils.ts to use pm2 start instead of pm2 restart
- Moved .claude/skills/troubleshoot → plugin/skills/troubleshoot

Fixes:
- GitHub issue #76: PM2 "Process 0 not found" error
- GitHub issue #74, #75: Troubleshooting skill not distributed
- GitHub issue #73 (partial): Context-loading tasks reported as failed

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

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-09 16:44:58 -05:00
Alex Newman 4c1f7b4ff1 Release v5.2.3: Added troubleshooting skill
Improvements:
- Added troubleshooting slash command skill for diagnosing claude-mem installation issues
- Comprehensive diagnostic workflow covering PM2, worker health, database, dependencies, logs, and viewer UI
- Automated fix sequences and common issue resolutions
- Full system diagnostic report generation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 19:29:26 -05:00
Alex Newman 5482052c16 Release v5.2.2: Context hook now displays investigated and learned fields
Improvements:
- Context hook now displays 'investigated' and 'learned' fields from session summaries
- Enhanced SQL query to SELECT these fields from database
- Added color-coded display formatting (blue for investigated, yellow for learned)
- Updated TypeScript types to include nullable investigated and learned fields

Technical changes:
- Updated src/hooks/context-hook.ts to query and display new fields
- Updated built plugin/scripts/context-hook.js
- Bumped version to 5.2.2 in all metadata files

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 12:55:53 -05:00
Alex Newman 9646527d66 Release v5.2.1: Fix project filter synchronization bugs
This patch release fixes critical race conditions and state synchronization
issues in the viewer UI's project filtering system.

**Bug Fixes:**
- Fixed race condition where offset wasn't reset when filter changed
- Fixed state ref synchronization causing stale hasMore values
- Fixed batched state updates mixing data from different projects
- Fixed useEffect dependency cycle causing double renders
- Combined useEffect hooks for guaranteed execution order

**Technical Changes:**
- Updated App.tsx: Fixed filter change detection and data reset logic
- Updated usePagination.ts: Improved offset and state ref handling
- Updated data.ts: Simplified mergeAndDeduplicateByProject validation
- Updated SessionStore.ts: Filter NULL/empty projects from dropdown
- Added investigated field to Summary interface

**Files Updated:**
- package.json: version 5.2.0 → 5.2.1
- .claude-plugin/marketplace.json: version 5.2.0 → 5.2.1
- plugin/.claude-plugin/plugin.json: version 5.2.0 → 5.2.1
- CLAUDE.md: version 5.2.0 → 5.2.1

All changes follow CLAUDE.md coding standards (DRY, YAGNI, fail-fast).

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 20:29:24 -05:00
Alex Newman 7f9959fdb7 Release v5.2.0: Major Worker Service Refactor & UI Improvements
This release merges PR #69, delivering a comprehensive architectural refactor
of the worker service, extensive UI enhancements, and significant code cleanup.

🏗️ Architecture Changes (Worker Service v2)

**Modular Rewrite**: Extracted monolithic worker-service.ts into focused modules:
- DatabaseManager.ts (111 lines): Centralized database initialization
- SessionManager.ts (204 lines): Complete session lifecycle management
- SDKAgent.ts (309 lines): Claude SDK interactions & observation compression
- SSEBroadcaster.ts (86 lines): Server-Sent Events broadcast management
- PaginationHelper.ts (196 lines): Reusable pagination logic
- SettingsManager.ts (68 lines): Viewer settings persistence
- worker-types.ts (176 lines): Shared TypeScript types

**Key Improvements**:
- Eliminated duplicated session logic (4 instances → 1 helper)
- Replaced magic numbers with named constants
- Removed fragile PM2 string parsing
- Fail-fast error handling instead of silent failures
- Fixed SDK agent narrative assignment (obs.title → obs.narrative)

🎨 UI/UX Improvements

**ScrollToTop Component**: GPU-accelerated smooth scrolling button
**ObservationCard Refactor**: Fixed facts toggle, improved metadata display
**Pagination Enhancements**: Better loading states, error recovery, deduplication
**Card Consistency**: Unified layout patterns across all card types

📚 Documentation

**New Files** (7,542 lines):
- context/agent-sdk-ref.md (1,797 lines): Complete Agent SDK reference
- docs/worker-service-architecture.md (1,174 lines): v2 architecture docs
- docs/worker-service-rewrite-outline.md (1,069 lines): Refactor plan
- docs/worker-service-overhead.md (959 lines): Performance analysis
- docs/processing-indicator-*.md (980 lines): Processing status docs
- docs/typescript-errors.md (180 lines): Error reference
- PLAN-full-observation-display.md (468 lines): Future UI roadmap

🧹 Code Cleanup

**Deleted Dead Code** (~2,000 lines):
- src/shared/{config.ts,storage.ts,types.ts}
- src/utils/{platform.ts,usage-logger.ts}
- src/hooks/index.ts, src/sdk/index.ts
- docs/{VIEWER.md,worker-server-architecture.md}

**Files Changed**: 70 total (11 new, 7 deleted, 52 modified)
**Net Impact**: +7,470 lines (11,105 additions, 3,635 deletions)

🐛 Bug Fixes

- Fixed SDK agent narrative assignment (e22edad)
- Corrected PostToolUse hook field name (13643a5)
- Removed unnecessary worker startup from smart-install (6204fe9)
- Simplified context-hook worker management (6204fe9)

 Testing

All systems verified:
- Worker service starts successfully
- All hooks function correctly
- Viewer UI renders properly
- Build pipeline compiles without errors

📖 Reference

PR: #69
Previous Version: 5.1.4
Semantic Version: MINOR (backward compatible features & improvements)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 18:33:28 -05:00
Alex Newman 740d65b5a5 Add TypeScript Agent SDK reference documentation
- Introduced comprehensive API reference for the TypeScript Agent SDK.
- Documented installation instructions for the SDK.
- Detailed the main functions: `query()`, `tool()`, and `createSdkMcpServer()`.
- Defined various types including `Options`, `Query`, `AgentDefinition`, and more.
- Included message types and their structures, such as `SDKMessage`, `SDKAssistantMessage`, and `SDKUserMessage`.
- Explained hook types and their usage within the SDK.
- Provided detailed documentation for tool input and output types.
- Added sections on permission types and other relevant types for better clarity.
2025-11-07 15:05:31 -05:00
Alex Newman 4bc467f7ed feat: Implement Worker Service for long-running HTTP service with PM2 management
- Introduced WorkerService class to handle HTTP requests and manage sessions.
- Added endpoints for health check, session management, and data retrieval.
- Integrated ChromaSync for background data synchronization.
- Implemented SSE for real-time updates to connected clients.
- Added error handling and logging throughout the service.
- Cached Claude executable path for improved performance.
- Included settings management for user configuration.
- Established database interactions for session and observation management.
2025-11-07 13:26:13 -05:00
Alex Newman 7fdfdd5d5e Release v5.1.4: Bugfix for PostToolUse hook schema compliance
Changes:
- Renamed tool_output to tool_response in save-hook.ts to match Claude Code PostToolUse API schema
- Updated worker-service.ts to use tool_response field consistently
- Rebuilt all hooks and worker service with corrected parameter names

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 11:53:57 -05:00
Alex Newman 13643a5b18 Release v5.1.3: Fix PostToolUse hook field name bug
Bug Fix:
- Changed tool_output to tool_response throughout PostToolUse hook chain
- PostToolUse events provide tool_response field, not tool_output
- Updated save-hook.ts to send tool_response
- Updated worker-service.ts endpoint to accept tool_response
- Updated worker-service-v2.ts for consistency
- Updated worker-types.ts interfaces (PendingMessage, ObservationData)
- Updated SessionManager.ts message queue
- Updated SDKAgent.ts observation prompt builder

Impact: Fixes observation capture for PostToolUse events. Previous version was sending undefined for tool responses, causing incomplete observations.

Files changed:
- src/hooks/save-hook.ts (interface + destructuring + fetch body)
- src/services/worker-service.ts (ObservationMessage interface + handler + SDK prompt)
- src/services/worker-service-v2.ts (handler)
- src/services/worker-types.ts (PendingMessage + ObservationData interfaces)
- src/services/worker/SessionManager.ts (queue push)
- src/services/worker/SDKAgent.ts (observation prompt)
- plugin/scripts/*.js (rebuilt)
- Version bumped to 5.1.3 (patch)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 11:47:03 -05:00
Alex Newman 980151a50e feat: Implement Worker Service v2 with improved architecture
- Complete rewrite of the Worker Service following object-oriented principles.
- Introduced a single long-lived database connection to reduce overhead.
- Implemented event-driven queues to eliminate polling.
- Added DRY utilities for pagination and settings management.
- Reduced code size significantly from 1173 lines to approximately 600-700 lines.
- Created various composed services including DatabaseManager, SessionManager, and SDKAgent.
- Enhanced SSE broadcasting capabilities for real-time client updates.
- Established a structured approach for session lifecycle management and event handling.
- Introduced type safety with shared TypeScript interfaces for better maintainability.
2025-11-06 23:56:25 -05:00
Copilot 0b476e971a Release v5.1.3: Version bump for npm install fix (#66)
* Initial plan

* Release v5.1.3: Fix npm install failures with smart caching

Co-authored-by: thedotmack <683968+thedotmack@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: thedotmack <683968+thedotmack@users.noreply.github.com>
2025-11-06 18:05:43 -05:00
Alex Newman 5e6ef4aeb1 Release v5.1.2: Add theme toggle for light/dark mode
Features:
- Theme toggle functionality with light, dark, and system preferences
- User-selectable theme with persistent settings
- Automatic system preference detection

Technical changes:
- Updated viewer UI with theme toggle controls
- Version bump across all metadata files (5.1.1 → 5.1.2)
- Rebuilt all plugin scripts

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 13:12:59 -05:00
Alex Newman 2af8db6b82 Release v5.1.1: Fix PM2 ENOENT error on Windows
Bugfix:
- Fixed PM2 ENOENT error on Windows by using full path to PM2 binary
- Improved cross-platform compatibility for PM2 process management

Technical changes:
- Updated scripts/smart-install.js to use full PM2 binary path
- Ensures PM2 commands work correctly on Windows systems
- Bumped version to 5.1.1 in all metadata files

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 12:49:41 -05:00
Alex Newman 22f4655a8c Release v5.1.0: Web-based viewer UI for real-time memory stream
Major new feature: Production-ready viewer accessible at localhost:37777

Features:
- Real-time visualization via Server-Sent Events (SSE)
- Infinite scroll pagination with deduplication
- Project filtering and settings persistence
- Auto-reconnection with exponential backoff
- GPU-accelerated animations

Technical details:
- New worker endpoints: 8 HTTP/SSE routes (+500 lines)
- Database enhancements: 5 new pagination methods (+98 lines)
- Complete React + TypeScript UI: 17 components/hooks (1,500+ lines)
- Self-contained HTML bundle via esbuild
- Monaspace Radon font and branding assets

Updated documentation in CLAUDE.md with comprehensive feature overview.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 22:58:23 -05:00
Alex Newman 79ff1849f0 feat: Add web-based viewer UI for real-time memory stream (#58)
* Add viewer HTML for claude-mem with live stream and settings interface

- Implemented a responsive layout with left and right columns for observations and settings.
- Added status indicators for connection state.
- Integrated server-sent events (SSE) for real-time updates on observations and summaries.
- Created dynamic project filter dropdown based on available observations.
- Developed settings section for environment variables and worker stats.
- Included functionality to save settings and load current stats from the server.
- Enhanced UI with custom styles for better user experience.

* Remove draft implementation plan for v5.1 web UI

* feat: Implement viewer UI with sidebar, feed, and settings management

- Add main viewer template (HTML) with styling for dark mode.
- Create App component to manage state and render Header, Feed, and Sidebar.
- Implement Feed component to display observations and summaries with filtering.
- Develop Header component for project selection and connection status.
- Create ObservationCard and SummaryCard components for displaying individual items.
- Implement Sidebar for settings management and displaying worker/database stats.
- Add hooks for managing SSE connections, settings, and stats fetching.
- Define types for observations, summaries, settings, and stats.

* Enhance UI components and improve layout

- Updated padding and layout for the feed and card components in viewer.html, viewer-template.html, and viewer.html to improve visual spacing and alignment.
- Increased card margins and padding for better readability and aesthetics.
- Adjusted font sizes, weights, and line heights for card titles and subtitles to enhance text clarity and hierarchy.
- Added a new feed-content class to center the feed items and limit their maximum width.
- Modified the Header component to improve the settings icon's SVG structure for better rendering.
- Enhanced the Sidebar component by adding a close button with an SVG icon, improving user experience for closing settings.
- Updated the Sidebar component's props to include an onClose function for handling sidebar closure.

* feat: Add user prompts feature with UI integration

- Implemented a new method in SessionStore to retrieve recent user prompts.
- Updated WorkerService to fetch and broadcast user prompts to clients.
- Enhanced the Feed component to display user prompts alongside observations and summaries.
- Created a new PromptCard component for rendering individual user prompts.
- Modified useSSE hook to handle new prompt events and processing status.
- Updated viewer templates and styles to accommodate the new prompts feature.

* feat: Add project filtering and pagination for observations

- Implemented `getAllProjects` method in `SessionStore` to retrieve unique projects from the database.
- Added `/api/observations` endpoint in `WorkerService` for paginated observations fetching.
- Enhanced `App` component to manage paginated observations and integrate with the new API.
- Updated `Feed` component to support infinite scrolling and loading more observations.
- Modified `Header` to display processing status.
- Refactored `PromptCard` to remove unnecessary processing indicator.
- Introduced `usePagination` hook to handle pagination logic for observations.
- Updated `useSSE` hook to include projects in the state.
- Adjusted types to accommodate new project data.

* Refactor viewer build process and remove deprecated HTML template

- Updated build-viewer.js to copy HTML template to build output with improved logging.
- Removed src/ui/viewer.html as it is no longer needed.
- Enhanced App component to merge observations while removing duplicates using useMemo.
- Improved Feed component to utilize a ref for onLoadMore callback and adjusted infinite scroll logic.
- Updated Sidebar component to use default settings from constants and removed redundant formatting functions.
- Refactored usePagination hook to streamline loading logic and prevent concurrent requests.
- Updated useSSE hook to use centralized API endpoints and improved reconnection logic.
- Refactored useSettings and useStats hooks to utilize constants for API endpoints and timing.
- Introduced ErrorBoundary component for better error handling in the viewer.
- Centralized API endpoint paths, default settings, timing constants, and UI-related constants into dedicated files.
- Added utility functions for formatting uptime and bytes for consistent display across components.

* feat: Enhance session management and pagination for user prompts, summaries, and observations

- Added project field to user prompts in the database and API responses.
- Implemented new API endpoints for fetching summaries and prompts with pagination.
- Updated WorkerService to handle new endpoints and filter results by project.
- Modified App component to manage paginated data for prompts and summaries.
- Refactored Feed component to remove unnecessary filtering and handle combined data.
- Improved usePagination hook to support multiple data types and project filtering.
- Adjusted useSSE hook to only load projects initially, with data fetched via pagination.
- Updated types to include project information for user prompts.

* feat: add SummarySkeleton component and data utility for merging items

- Introduced SummarySkeleton component for displaying loading state in the UI.
- Implemented mergeAndDeduplicateByProject utility function to merge real-time and paginated data while removing duplicates based on project filtering.

* Enhance UI and functionality of the viewer component

- Updated sidebar transition effects to use translate3d for improved performance.
- Added a sidebar header with title and connection status indicators.
- Modified the PromptCard to display project name instead of prompt number.
- Introduced a GitHub and X (Twitter) link in the header for easy access.
- Improved styling for setting descriptions and card hover effects.
- Enhanced Sidebar component to include connection status and updated layout.

* fix: reduce timeout for worker health checks and ensure proper responsiveness
2025-11-05 22:54:38 -05:00
Alex Newman 268b78083e Release v5.0.3: Smart caching installer for Windows compatibility
**Breaking Changes**: None (patch version)

**Fixes**:
- Fixed Windows installation with smart caching installer
- Eliminated redundant npm install on every SessionStart (2-5s → 10ms)
- Dynamic Python version detection in Windows error messages
- Comprehensive Windows troubleshooting guidance

**Improvements**:
- Smart install caches version state (.install-version file)
- Only runs npm install when needed (first time, version change, missing deps)
- Enhanced rsync to respect gitignore rules
- Better PM2 worker startup verification
- Cross-platform compatible (pure Node.js)

**Technical Details**:
- New: scripts/smart-install.js (smart caching installer)
- Modified: plugin/hooks/hooks.json (use smart-install.js)
- Modified: package.json (enhanced sync-marketplace)
- Impact: 200x faster SessionStart for cached installations

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 14:24:50 -05:00
Alex Newman a1f76af902 Fix Windows installation with smart caching installer (#54)
* Fix Windows installation with smart caching installer

Fixes #52 - Windows users getting ERR_MODULE_NOT_FOUND for better-sqlite3

## Problem
Windows users (@adrianveen and others) were experiencing installation failures
with cryptic ERR_MODULE_NOT_FOUND errors. The root cause was:
1. npm install running on EVERY SessionStart (slow, wasteful)
2. Silent logging hiding actual installation errors
3. No helpful guidance when better-sqlite3 native compilation failed

## Solution
Implemented a smart installer (scripts/smart-install.js) that:
- Caches installation state with version marker (.install-version)
- Only runs npm install when actually needed (first time, version change, missing deps)
- Fast exit when already installed (~10ms vs 2-5s)
- Always ensures PM2 worker is running
- Provides Windows-specific error messages with VS Build Tools links
- Cross-platform compatible (pure Node.js)

## Changes
- Added: scripts/smart-install.js - Smart caching installer with PM2 worker management
- Modified: plugin/hooks/hooks.json - Use smart-install.js instead of raw npm install
- Modified: .gitignore - Added .install-version cache file
- Modified: CLAUDE.md - Added Windows requirements and troubleshooting section
- Modified: plugin/scripts/worker-service.cjs - Rebuilt with latest code

## Benefits
- 95% of Windows users won't need VS Build Tools (prebuilt binaries in better-sqlite3 v12.x)
- Clear error messages for the 5% who do need build tools
- Massive performance improvement (10ms cached vs 2-5s npm install)
- Single source of truth for plugin setup and worker management

## Testing
 First run: Installs dependencies and starts worker
 Subsequent runs: Instant with caching (~10ms)
 PM2 worker: Running successfully
 Cross-platform: Pure Node.js, no shell scripts

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

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix Windows installation with smart caching installer

Improvements:
- Enhanced sync-marketplace to respect gitignore rules (package.json)
- Added dynamic Python version detection in Windows help text (scripts/smart-install.js)
- Fixed hardcoded Python version message to show actual installed version

Technical changes:
- Modified package.json sync-marketplace script to use --filter=':- .gitignore' --exclude=.git
- Added runtime Python version detection in getWindowsErrorHelp function
- Improved user experience by showing actual Python installation status

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

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-05 14:22:31 -05:00
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>
2025-11-04 21:47:38 -05: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>
2025-11-04 15:42:46 -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 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 80935fbc66 npm audit fixes #36 2025-11-03 13:42:31 -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 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>
2025-11-01 21:47:00 -04: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>
2025-10-27 01:22:47 -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
Alex Newman c75563a89b Release v4.3.1: Version bump and documentation updates
- Updated package.json version to 4.3.1
- Updated marketplace.json version to 4.3.1
- Added v4.3.1 entry to CLAUDE.md version history
- Documented SessionStart hook context injection fix
- Documented hooks architecture consolidation
- Rebuilt all executables with updated version

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 00:11:36 -04:00
Alex Newman d4d6185bb4 Release v4.3.0: Progressive Disclosure Context
Major Feature:
- Progressive Disclosure Context: 3-layer memory retrieval system
  - Layer 1 (Index): Observation titles, token costs, type indicators
  - Layer 2 (Details): Full narratives via MCP search on-demand
  - Layer 3 (Perfect Recall): Source code and original transcripts
- Context hook displays observations in table format
- Type indicators: 🔴 critical, 🟤 decision, 🔵 informational
- Token counts help Claude decide: fetch details vs read code

Added:
- Agent Skills documentation and version bump management skill
- Memory toggle feature planning document

Changed:
- Enhanced session summary handling and timeline rendering
- Context token cost increased from ~800 to ~2,500 tokens

Fixed:
- Removed hardcoded macOS-specific paths (fixes #23)
- Cross-platform path detection improvements

Files Updated:
- package.json, marketplace.json, plugin.json: version 4.3.0
- CLAUDE.md: version history and current version updated
- README.md: removed experimental section, integrated feature
- CHANGELOG.md: comprehensive v4.3.0 release entry
- Built all hooks and worker service

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 15:42:06 -04:00
Alex Newman b87654d452 Release v4.2.11: Cross-platform Claude path detection
Critical Bugfix:
- Fixed SDK auto-detection failure by implementing explicit which/where commands
- Unix/macOS: Uses 'which claude' command
- Windows: Uses 'where claude' command (CMD and PowerShell compatible)
- Fallback to CLAUDE_CODE_PATH environment variable
- Handles Windows multiple results (takes first match)

Impact:
- Before: Worker failed with "path must be string, received undefined"
- After: Worker correctly finds Claude executable on all platforms

Technical changes:
- Added findClaudePath() helper using child_process.execSync
- Platform detection via process.platform === 'win32'
- Updated src/sdk/worker.ts with explicit path detection
- Updated src/services/worker-service.ts with explicit path detection
- Bumped version to 4.2.11 in all metadata files
- Updated CLAUDE.md with v4.2.11 release notes

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 14:56:30 -04:00
Alex Newman 6131f9694a Update @anthropic-ai/claude-agent-sdk to version 0.1.27 in package.json and package-lock.json 2025-10-25 14:32:37 -04:00
Alex Newman ae2c789781 Bump version to 4.2.10 and fix Windows compatibility by removing hardcoded macOS path 2025-10-25 13:24:18 -04:00