Commit Graph

342 Commits

Author SHA1 Message Date
Alex Newman 5d64df2ba5 docs: Update all documentation to reflect v5.4.0 skill-based search
Documentation Updates:
- README.md: Updated version badge, What's New, and search section
- docs/usage/search-tools.mdx: Rewrote for skill-based natural language approach
- docs/architecture/mcp-search.mdx → search-architecture.mdx: Complete rewrite
- docs/architecture/overview.mdx: Updated components and search pipeline
- docs/usage/getting-started.mdx: Added skill-based search section
- docs/configuration.mdx: Updated search configuration for v5.4.0
- docs/introduction.mdx: Updated key features
- docs/docs.json: Updated navigation to search-architecture

Key Changes:
- Emphasized ~2,250 token savings per session start
- Converted all examples to natural language queries
- Documented 10 HTTP API endpoints
- Explained progressive disclosure pattern
- Added migration notes (transparent, no user action required)
- Removed outdated MCP references

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 19:14:05 -05:00
Alex Newman 22a04ac461 Merge pull request #78 from thedotmack/feature/skill-search
v5.4.0: Skill-Based Search Migration & Progressive Disclosure Pattern
2025-11-09 18:58:22 -05:00
Alex Newman 170b66f623 feat: Add documentation for project-level skills and their distinction from plugin skills 2025-11-09 18:55:09 -05:00
Alex Newman ca4f046777 feat: Add search skill with progressive disclosure and refactor existing skills
Enhancements:
- Added search skill with 10 HTTP API endpoints for memory queries
- Refactored version-bump and troubleshoot skills using progressive disclosure pattern
- Added operations/ subdirectories for detailed skill documentation
- Updated CLAUDE.md with skill-based search architecture
- Enhanced worker service with search API endpoints
- Updated CHANGELOG.md with v5.4.0 migration details

Technical changes:
- New plugin/skills/search/ directory with SKILL.md
- New .claude/skills/version-bump/operations/ (workflow.md, scenarios.md)
- New plugin/skills/troubleshoot/operations/ (common-issues.md, worker.md)
- Modified src/services/worker-service.ts (added search endpoints)
- Modified plugin/scripts/worker-service.cjs (rebuilt with search API)
- Reduced main skill files by 89% using progressive disclosure
- Token savings: ~2,250 tokens per session start

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 18:41:53 -05:00
Alex Newman 0475a57fb1 feat: Migrate to Skill-Based Search and enhance context handling
- Implemented a new skill-based search approach, replacing MCP search tools to reduce session start context from ~2,500 tokens to ~250 tokens.
- Added 10 new HTTP API endpoints to the worker service for various search functionalities.
- Created a new search skill with detailed instructions and examples for users.
- Removed MCP search server references and updated documentation to reflect the new skill-based approach.
- Enhanced context handling in the context hook to conditionally display the most recent summary based on observations.
- Introduced comprehensive documentation for Agent Skills, including creation, management, and best practices.
2025-11-09 17:34:00 -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>
v5.3.0
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>
v5.2.3
2025-11-08 19:29:26 -05:00
claude[bot] 35b98c53f0 Remove unnecessary troubleshooting checks from skill
Simplified troubleshooting diagnostics by removing checks that are:
- Too brittle (300+ packages requirement)
- Not relevant to v5.2.2 issues (version cache)
- Redundant (Node.js version checks)

Changes:
- Removed "300+ packages installed" expectation
- Removed entire "Step 5: Check Version Cache" section
- Removed dependency count check (ls node_modules/ | wc -l)
- Removed Node.js version checks from multiple sections
- Renumbered steps from 8 to 7

Result: More focused diagnostics for reported issues (memory persistence,
viewer state, observation freshness) without false positives.

Co-authored-by: Alex Newman <thedotmack@users.noreply.github.com>
2025-11-08 23:21:52 +00:00
copilot-swe-agent[bot] e029903a66 Add troubleshooting slash command skill
Co-authored-by: thedotmack <683968+thedotmack@users.noreply.github.com>
2025-11-08 21:47:03 +00:00
copilot-swe-agent[bot] 5666f7dd1c Initial exploration and planning for troubleshooting slash command
Co-authored-by: thedotmack <683968+thedotmack@users.noreply.github.com>
2025-11-08 21:43:06 +00:00
copilot-swe-agent[bot] 57f0c9fd92 Initial plan 2025-11-08 21:39:44 +00: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>
v5.2.2
2025-11-08 12:55:53 -05:00
Alex Newman ccb7001ff0 fix: update README to enhance image linking and improve layout consistency 2025-11-07 22:02:17 -05:00
Alex Newman edc20a12a1 fix: remove unnecessary horizontal rule from README for cleaner layout 2025-11-07 22:00:49 -05:00
Alex Newman 45c35c6bdd fix: adjust spacing and alignment in README for improved readability 2025-11-07 22:00:28 -05:00
Alex Newman 47ee0838e3 fix: update README to correct image placement for Claude-Mem preview 2025-11-07 21:52:14 -05:00
Alex Newman 809c9e6639 Implement code changes to enhance functionality and improve performance 2025-11-07 21:51:04 -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>
v5.2.1
2025-11-07 20:29:24 -05:00
Alex Newman f27c73b469 Fix project filter synchronization issues in viewer UI (#70)
* feat: Enhance session and summary handling

- Update SQL query in SessionStore to exclude null or empty projects.
- Add 'investigated' field to Summary interface for better tracking.
- Modify App component to handle pagination more efficiently based on current filters.
- Update SummaryCard to display the 'investigated' field if present.
- Refactor usePagination hook to reset pagination state when filters change.
- Adjust mergeAndDeduplicateByProject function to ensure it only merges unfiltered data.

* refactor: address PR feedback - remove redundancies and fix dependency cycles

Fixes based on PR #70 review feedback:

Required:
- Fixed useEffect dependency cycle in App.tsx (removed handleLoadMore from deps)

Recommended:
- Removed redundant filter detection from App.tsx (usePagination handles this)
- Removed redundant stateRef update effect from usePagination.ts
- Simplified mergeAndDeduplicateByProject by removing defensive validation
- Removed unused imports (useRef, useEffect)

All changes follow CLAUDE.md principles: DRY, fail-fast, no defensive programming.

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

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

* fix: Reset paginated data arrays when filter changes

Critical fix for data mixing bug identified in PR review follow-up.

Problem:
When filter changes, usePagination correctly resets its offset to 0, but
the paginated state arrays (observations, summaries, prompts) were NOT
being reset. This caused data from different projects to mix together
because setState appends to the existing array.

Example:
- User views Project A: [A1, A2, A3]
- User switches to Project B
- API fetches [B1, B2, B3]
- setState does: [...prev, ...new] = [A1, A2, A3, B1, B2, B3] 

Solution:
Added a separate useEffect that resets all three paginated arrays when
currentFilter changes. This happens BEFORE handleLoadMore fetches new
data, ensuring clean state for the new filter.

Files changed:
- src/ui/viewer/App.tsx: Added useEffect to reset arrays on filter change
- plugin/ui/viewer-bundle.js: Built UI bundle

Testing:
1. Select Project A, verify data loads
2. Switch to Project B
3. Verify ONLY Project B data is shown (no mixing)
4. Switch back to "All Projects"
5. Verify all data appears correctly

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

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

* refactor: Combine filter change useEffect hooks for guaranteed order

Merged two separate useEffect hooks into one to:
1. Guarantee execution order (reset THEN load)
2. Reduce complexity (one hook instead of two)
3. Make intent clearer with single comment

Before:
- useEffect #1: handleLoadMore() on filter change
- useEffect #2: Reset arrays on filter change
- React could run these in any order

After:
- Single useEffect: Reset arrays THEN handleLoadMore()
- Execution order is now guaranteed

Files changed:
- src/ui/viewer/App.tsx: Combined useEffect hooks
- plugin/ui/viewer-bundle.js: Built UI bundle

🤖 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-07 20:28:12 -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>
v5.2.0
2025-11-07 18:33:28 -05:00
claude[bot] 012774b83c docs: add CLAUDE.md explaining docs folder structure
Clarifies that docs/ is a Mintlify documentation site for official
user-facing documentation (.mdx files), while context/ should contain
planning documents, design docs, and internal references.

Lists files currently in docs/ that should be moved to context/:
- typescript-errors.md
- worker-service-*.md files
- processing-indicator-*.md files
- CHROMA.md and chroma-search-completion-plan.md

Co-authored-by: Alex Newman <thedotmack@users.noreply.github.com>
2025-11-07 23:23:28 +00:00
Alex Newman e22edaddf4 fix: update narrative assignment in SDKAgent to use obs.narrative 2025-11-07 18:04:57 -05:00
Alex Newman 6204fe9b9d refactor: remove startWorker function and adjust installation flow 2025-11-07 18:00:42 -05:00
Alex Newman 30a42036aa feat: add scroll-to-top button and improve pagination handling
- Implemented a scroll-to-top button in the viewer UI for better navigation.
- Added styles for the scroll-to-top button in viewer.html and viewer-template.html.
- Created a new ScrollToTop component to manage visibility and scrolling behavior.
- Updated Feed component to include the ScrollToTop component.
- Enhanced pagination logic in usePagination hook to prevent stale closures and improve performance.
- Modified SDKAgent to include additional observation fields for better data handling.
2025-11-07 17:57:54 -05:00
Alex Newman d6f1237283 Refactor ObservationCard to improve facts toggle logic and metadata display
- Introduced hasFactsContent to determine if facts, concepts, or files are present.
- Updated view-mode toggles to conditionally render based on hasFactsContent.
- Modified content rendering to show subtitle only when facts and narrative are off.
- Enhanced metadata footer to display concepts and files only when facts toggle is active, with improved styling for concepts.
2025-11-07 17:42:45 -05:00
Alex Newman 700e3253fa Refactor card components for improved layout and functionality
- Updated card styles in viewer.html and viewer-template.html to enhance padding, margins, and overall layout.
- Introduced new header structure with left-aligned type and project name, and added view mode toggle buttons for facts and narrative.
- Simplified content rendering logic in ObservationCard, allowing for toggling between facts and narrative.
- Updated metadata display in ObservationCard, PromptCard, and SummaryCard to include formatted date and improved layout.
- Removed unnecessary verbose content sections and streamlined the presentation of facts and narrative.
2025-11-07 17:03:05 -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>
v5.1.4
2025-11-07 11:53:57 -05:00
Alex Newman e872c2da38 refactor: rename tool_output to tool_response in save-hook and worker-service 2025-11-07 11:50:14 -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>
v5.1.3
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
Alex Newman 9eddc51979 feat: Conduct comprehensive overhead analysis of worker service
- Added detailed documentation on performance issues within `worker-service.ts`.
- Identified high severity issues including unnecessary polling, artificial delays, and redundant database operations.
- Provided recommendations for immediate and long-term improvements to enhance performance and reduce complexity.
- Suggested architectural changes to replace polling with event-driven patterns and optimize database connection handling.
2025-11-06 23:10:33 -05:00
Alex Newman 7c3477b7e1 Remove dead code files and update source tree documentation 2025-11-06 22:43:00 -05:00
Alex Newman f45c782c07 Refactor SDK exports and remove unused functions; update search-server formatting functions to eliminate unused parameters; adjust SQLite migration function parameter; add TypeScript error documentation with detailed fixes and priority order. 2025-11-06 22:27:12 -05:00
Alex Newman 3bdf0b41bc chore: Remove unused imports and variables
Cleanup:
- Removed unused SDKSystemMessage import
- Removed unused ensureAllDataDirs import
- Removed unused userPrompt destructuring in handleInit

All TypeScript diagnostics now clear.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 22:03:11 -05:00
Alex Newman 3030f518b5 refactor: Complete rewrite of worker-utils.ts and cleanup of worker-service.ts
- Removed fragile PM2 string parsing and replaced with direct PM2 restart logic.
- Eliminated silent error handling in worker-utils.ts for better error visibility.
- Extracted duplicated session auto-creation logic into a new helper method getOrCreateSession() in worker-service.ts.
- Centralized configuration values and replaced magic numbers with named constants.
- Updated health check logic to ensure worker is restarted if unhealthy.
- Removed unnecessary getWorkerPort() wrapper function.
- Improved overall code quality and maintainability by applying DRY and YAGNI principles.
2025-11-06 22:00:07 -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
Copilot f7b51a963e Fix npm install failures with automatic retry and silent output (#64)
* Initial plan

* Initial investigation: identified npm install failure issue

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

* Add retry logic and better error handling to smart-install

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

* Fix spacing inconsistency in log messages

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

* Refactor worker startup check for better readability

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

* Simplify npm install: use plain npm install without flags

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 17:21:44 -05:00
Alex Newman f8dc7f940f uploade 2025-11-06 15:47:16 -05:00
Alex Newman b68ea38bcc Fix all broken internal links in documentation
Changes:
- Fixed 11 broken internal links across 3 documentation files
- Updated relative paths to use correct format without /docs/ prefix
- Removed broken CHANGELOG.md anchor links (mintlify doesn't support external file anchors)
- Changed /docs/progressive-disclosure → progressive-disclosure
- Changed /docs/hooks-architecture → hooks-architecture
- Changed /docs/context-engineering → context-engineering
- Changed /docs/architecture → architecture/overview
- Changed /docs/worker-service → architecture/worker-service
- Changed /docs/viewer-ui → VIEWER
- Verified with mintlify broken-links: 0 broken links remaining

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 14:03:44 -05:00
Alex Newman 12459eab3b docs: comprehensive v5.1.2 documentation update
This commit brings all documentation up to date with the current v5.1.2
codebase, addressing 12+ critical discrepancies and adding 2 major new
documentation files.

## Files Modified (18 documentation files):

### Root Documentation:
- README.md: Updated version badge (4.3.1 → 5.1.2), tool count (7 → 9),
  added viewer UI and theme toggle features, updated "What's New" section
- CHANGELOG.md: Added 8 missing releases (v4.3.2 through v5.1.2) with
  comprehensive release notes
- CLAUDE.md: Removed hardcoded personal paths, documented all 14 worker
  endpoints (was 8), added Chroma integration overview, updated v5.x releases

### Mintlify Documentation (docs/):
- introduction.mdx: Updated search tool count to 9, added viewer UI and
  theme toggle to features
- configuration.mdx: Added smart-install.js documentation, clarified data
  directory locations, added CLAUDE_CODE_PATH env var, explained observations
  vs sessions, updated hook configuration examples
- development.mdx: Added comprehensive viewer UI development section (103 lines),
  updated build output filenames (search-server.mjs)
- usage/search-tools.mdx: Added get_context_timeline and get_timeline_by_query
  documentation with examples, updated tool count to 9
- architecture/overview.mdx: Updated to 7 hook files, 9 search tools, added
  Chroma to tech stack, enhanced component details with viewer UI
- architecture/hooks.mdx: Added smart-install.js and user-message-hook.js
  documentation, updated hook count to 7
- architecture/worker-service.mdx: Documented all 14 endpoints organized by
  category (Viewer & Health, Data Retrieval, Settings, Session Management)
- architecture/mcp-search.mdx: Added timeline tools documentation, updated
  tool count to 9, fixed filename references (search-server.mjs)
- architecture-evolution.mdx: Added complete v5.x release history (v5.0.0
  through v5.1.2), updated title to "v3 to v5"
- hooks-architecture.mdx: Updated to "Seven Hook Scripts", added smart-install
  and user-message-hook documentation
- troubleshooting.mdx: Added v5.x specific issues section (viewer, theme toggle,
  SSE, Chroma, PM2 Windows fix)

### New Documentation Files:
- docs/VIEWER.md: Complete 400+ line guide to web viewer UI including architecture,
  features, usage, development, API integration, performance considerations
- docs/CHROMA.md: Complete 450+ line guide to vector database integration including
  hybrid search architecture, semantic search explanation, performance benchmarks,
  installation, configuration, troubleshooting

## Key Corrections Made:

1.  Updated version badges and references: 4.3.1 → 5.1.2
2.  Corrected search tool count: 7 → 9 (added get_context_timeline, get_timeline_by_query)
3.  Fixed MCP server filename: search-server.js → search-server.mjs
4.  Updated hook count: 5 → 7 (added smart-install.js, user-message-hook.js)
5.  Documented all 14 worker endpoints (was 8, incorrectly claimed 6 were missing)
6.  Removed hardcoded personal file paths
7.  Added Chroma vector database documentation
8.  Added viewer UI comprehensive documentation
9.  Updated CHANGELOG with all missing v4.3.2-v5.1.2 releases
10.  Clarified data directory locations (production vs development)
11.  Added smart-install.js caching system documentation
12.  Updated SessionStart hook configuration examples

## Documentation Statistics:

- Total files modified: 18
- New files created: 2
- Lines added: ~2,000+
- Version mismatches fixed: 2 critical
- Missing features documented: 5+ major
- Missing tools documented: 2 MCP tools
- Missing endpoints documented: 6 API endpoints

## Impact:

Documentation now accurately reflects the current v5.1.2 codebase with:
- Complete viewer UI documentation (v5.1.0)
- Theme toggle feature (v5.1.2)
- Hybrid search architecture with Chroma (v5.0.0)
- Smart install caching (v5.0.3)
- All 7 hook scripts documented
- All 9 MCP search tools documented
- All 14 worker service endpoints documented
- Comprehensive troubleshooting for v5.x issues

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 13:59:10 -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>
v5.1.2
2025-11-06 13:12:59 -05:00
Alex Newman f46b5b452f feat: implement theme toggle functionality with light, dark, and system preferences
- Added theme variables for light and dark modes in viewer-template.html.
- Created a custom hook `useTheme` to manage theme preferences and resolve the current theme based on user selection or system settings.
- Introduced `ThemeToggle` component to allow users to switch between themes.
- Updated `Header` component to include the `ThemeToggle` and pass theme preference and change handler.
- Modified `App` component to integrate theme management and pass relevant props to child components.
2025-11-06 13:10:35 -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>
v5.1.1
2025-11-06 12:49:41 -05:00
Copilot 6a4fa85c10 Fix PM2 ENOENT error on Windows by using full path to binary (#60)
* Initial plan

* Initial plan for fixing PM2 path issue on Windows

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

* Fix PM2 ENOENT error on Windows by using full path to PM2 binary

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 12:06:45 -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>
v5.1.0
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 ff28db9d76 Update SKILL.md and CLAUDE.md for version bump clarity and consistency 2025-11-05 14:55:50 -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>
v5.0.3
2025-11-05 14:24:50 -05:00