Commit Graph

508 Commits

Author SHA1 Message Date
Alex Newman 9855ccf66d Refactor context-hook to use execSync for fetching context and simplify output structure; migrate from bun:sqlite to better-sqlite3 in Database and migrations; update SearchRoutes to dynamically import context generator for improved context handling. 2025-12-07 17:23:30 -05:00
claude[bot] 85f30126aa fix: Remove stderr output from context hook to fix session start injection
The dual stderr/stdout pattern was breaking context injection in Claude Code sessions.
Claude Code expects clean JSON on stdout only. Stderr output was interfering with
JSON parsing, causing context to fail loading even though the hook worked from CLI.

Changes:
- Remove process.stderr.write() when running as hook
- Add --colors flag support (matching main branch behavior)
- Output only JSON to stdout for hook execution
- Keep formatted output for manual terminal runs (TTY or --colors)

Co-authored-by: Alex Newman <thedotmack@users.noreply.github.com>
2025-12-06 22:30:14 +00:00
claude[bot] 2e67821445 fix: Correct context-generator import path in SearchRoutes
The /api/context/inject endpoint was using an incorrect relative import
path for context-generator.cjs. Since SearchRoutes is in
src/services/worker/http/routes/, the correct path to reach
src/services/context-generator.ts is ../../../context-generator.js

This fixes the session start context injection issue where the hook
would print correctly but no context would load in the session.

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

Co-authored-by: Alex Newman <thedotmack@users.noreply.github.com>
2025-12-06 22:25:58 +00:00
Alex Newman bbed39c71b Merge branch 'feat/tests' into refactor/hooks-to-worker 2025-12-05 20:43:14 -05:00
Alex Newman 3aaee6f13a refactor: Organize worker into clean route-based HTTP architecture
Major architectural improvements to the worker service:

- Extracted monolithic WorkerService (~1900 lines) into organized route classes
- New HTTP layer with dedicated route handlers:
  - SessionRoutes: Session lifecycle operations
  - DataRoutes: Data retrieval endpoints
  - SearchRoutes: Search/MCP proxy operations
  - SettingsRoutes: Settings and configuration
  - ViewerRoutes: Health, UI, and SSE streaming
- Added comprehensive README documenting worker architecture
- Improved build script to handle worker service compilation
- Added context-generator for hook context operations

This is Phase 1 of worker refactoring - pure code reorganization with zero
functional changes. All existing behavior preserved while improving
maintainability and code organization.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 20:27:49 -05:00
Alex Newman 795a430f1a feat(tests): add comprehensive happy path tests for session lifecycle
- Implemented session cleanup tests to ensure proper handling of session completions and cleanup operations.
- Added session initialization tests to verify session creation and observation queuing on first tool use.
- Created session summary tests to validate summary generation from conversation context upon session pause or stop.
- Developed integration tests to cover the full observation lifecycle, including context injection, observation queuing, and error recovery.
- Introduced reusable mock factories and scenarios for consistent testing across different test files.
2025-12-05 19:40:48 -05:00
Alex Newman 0a667afc0f built files for plugin 2025-12-05 19:11:33 -05:00
Alex Newman 8e0b1ee4e1 refactor: Convert all hooks to HTTP clients (remove all SQL)
Architecture transformation: Hooks → HTTP → Worker → Database

**context-hook.ts** (843 → 104 lines, 88% reduction)
- Remove all database imports and raw SQL queries
- HTTP GET to /api/context/inject
- Returns both formatted (stderr) and unformatted (stdout) context
- Dual output: colored display for users, plain text for model

**user-message-hook.ts** (updated, 113 lines)
- HTTP GET to /api/context/inject with colors=true
- Displays formatted context to users via stderr
- No database dependencies

**save-hook.ts** (418 → 99 lines, 76% reduction)
- Remove all SessionStore database methods
- HTTP POST to /api/sessions/observations
- Worker handles privacy checks and observation creation
- Fire-and-forget pattern with 2s timeout

**summary-hook.ts** (435 → 200 lines, 54% reduction)
- Remove all SessionStore database methods
- Keep local transcript parsing (hook has file access)
- HTTP POST to /api/sessions/summarize
- Worker handles privacy checks and summary generation

**cleanup-hook.ts** (414 → 90 lines, 78% reduction)
- Remove all SessionStore database methods
- HTTP POST to /api/sessions/complete
- Worker handles session completion and DB cleanup
- Non-fatal if worker unavailable

**Benefits:**
- Zero native module dependencies in hooks (Node.js or Bun compatible)
- Hooks can run in any runtime without recompilation
- All database operations centralized in worker service
- Simpler, more maintainable hook code
- Complete separation of concerns: I/O vs business logic
2025-12-05 19:10:51 -05:00
Alex Newman d3aaef926b feat: Add worker HTTP endpoints for hook operations
- Add /api/context/inject endpoint (uses context-generator service)
- Add /api/sessions/observations endpoint (handles observations by claudeSessionId)
- Add /api/sessions/summarize endpoint (handles summaries by claudeSessionId)
- Add /api/sessions/complete endpoint (handles cleanup by claudeSessionId)
- Import stripMemoryTagsFromJson for privacy tag handling
- All endpoints accept claudeSessionId in request body (not path params)
- Enables hooks to become pure HTTP clients with zero database dependencies
2025-12-05 19:10:38 -05:00
Alex Newman 42fde819a3 feat: Add context-generator service (ported from bun branch)
- Port context-generator.ts service (719 lines)
- Extracts all context generation logic from context-hook
- Supports formatted (ANSI colors) and unformatted output
- Uses better-sqlite3 via SessionStore (no Bun-specific code)
- Enables context generation via worker HTTP API
2025-12-05 19:10:32 -05:00
Alex Newman 4eeb8391c6 docs: Update CHANGELOG.md from releases
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 15:35:19 -05:00
Alex Newman 213557dd6e chore: Bump version to 6.5.3
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
v6.5.3
2025-12-05 15:34:39 -05:00
Alex Newman e1d2ffeb02 fix: Hide console window on Windows when spawning child processes (#166)
* fix: Hide console window on Windows when spawning child processes

Add windowsHide: true to spawnSync and execSync calls to prevent
empty console windows from appearing on Windows when hooks execute.

Fixes two spawn points:
- worker-utils.ts: PM2 spawn when starting worker service
- user-message-hook.ts: Node spawn for context display

Reference: https://nodejs.org/api/child_process.html (windowsHide option)

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

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

* fix: Add windowsHide to remaining execSync calls for complete Windows console window hiding

This completes the Windows console window fix by adding `windowsHide: true` to all remaining `execSync` calls:

- src/services/worker-service.ts:220 - pgrep command for orphaned process detection
- src/services/worker-service.ts:226 - pkill command for process cleanup
- src/services/worker/SDKAgent.ts:414 - where/which claude command for finding executable

These operations are less frequent than the user-prompt hook, but should still avoid spawning console windows on Windows for a complete fix.

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

Co-authored-by: Alex Newman <thedotmack@users.noreply.github.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Alex Newman <thedotmack@users.noreply.github.com>
2025-12-04 16:02:35 -05:00
Alex Newman 9e66a4843e docs: Update CHANGELOG.md from releases 2025-12-04 15:41:35 -05:00
Alex Newman 0a3b50c875 chore: Upgrade better-sqlite3 to v12.5.0 for Node.js 25 compatibility
Fixes #164

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

Co-Authored-By: Claude <noreply@anthropic.com>
v6.5.2
2025-12-04 15:23:24 -05:00
Copilot a8d31d465f Upgrade better-sqlite3 to ^12.5.0 for Node.js 25 compatibility (#165)
* Initial plan

* Initial plan for better-sqlite3 upgrade

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

* Upgrade better-sqlite3 to ^12.5.0 for Node.js 25 compatibility

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-12-04 15:22:30 -05:00
Alex Newman 186f54b3fd docs: Update CHANGELOG.md from releases 2025-12-04 13:31:00 -05:00
Alex Newman be28c095e2 Release v6.5.1: Product Hunt Launch Day UI Updates
- Decorative Product Hunt announcement in terminal with rocket borders
- Product Hunt badge in viewer header with theme-aware switching
- Badge uses separate tracking URL for analytics

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

Co-Authored-By: Claude <noreply@anthropic.com>
v6.5.1
2025-12-04 13:29:56 -05:00
Alex Newman 28305f73bb docs: Update CHANGELOG.md from releases
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 21:48:50 -05:00
Alex Newman c6708b3684 Release v6.5.0: Documentation Overhaul
Comprehensive documentation update with current features:
- Updated "What's New" section to highlight v6.4.x features
- Added privacy tags and context configuration to key features
- Fixed default model (claude-haiku-4-5)
- Clarified lifecycle hook count (5 events, 6 scripts)
- Removed outdated MCP server references
- Updated version numbers across all docs

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

Co-Authored-By: Claude <noreply@anthropic.com>
v6.5.0
2025-12-03 21:47:59 -05:00
Alex Newman 375dd1c3d6 feat: Add Context Settings Modal with Terminal Preview and UI Enhancements (#161)
* feat: Add Context Injection Settings modal with terminal preview

Adds a new settings modal accessible from the viewer UI header that allows users to configure context injection parameters with a live terminal preview showing how observations will appear.

Changes:
- New ContextSettingsModal component with auto-saving settings
- TerminalPreview component for live context visualization
- useContextPreview hook for fetching preview data
- Modal positioned to left of color mode button
- Settings sync with backend via worker service API

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

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

* feat: Add demo data and modify contextHook for cm_demo_content project

- Introduced DEMO_OBSERVATIONS and DEMO_SUMMARIES for the cm_demo_content project to provide mock data for testing and demonstration purposes.
- Updated contextHook to utilize demo data when the project is cm_demo_content, filtering observations based on configured types and concepts.
- Adjusted the worker service to use the contextHook with demo data, ensuring ANSI rendering for terminal output.
- Enhanced error handling and ensured proper closure of database connections.

* feat: add GitHub stars button with dynamic star count

- Implemented a new GitHubStarsButton component that fetches and displays the star count for a specified GitHub repository.
- Added useGitHubStars hook to handle API requests and state management for star count.
- Created formatStarCount utility function to format the star count into compact notation (k/M suffixes).
- Styled the GitHub stars button to match existing UI components, including hover and active states.
- Updated Header component to include the new GitHubStarsButton, replacing the static GitHub link.
- Added responsive styles to hide the GitHub stars button on mobile devices.

* feat: add API endpoint to fetch distinct projects and update context settings modal

- Implemented a new API endpoint `/api/projects` in `worker-service.ts` to retrieve a list of distinct projects from the observations.
- Modified `ContextSettingsModal.tsx` to replace the current project display with a dropdown for selecting projects, utilizing the fetched project list.
- Updated `useContextPreview.ts` to fetch projects on mount and manage the selected project state.
- Removed the `currentProject` prop from `ContextSettingsModal` and `App` components as it is now managed internally within the modal.

* Enhance Context Settings Modal and Terminal Preview

- Updated the styling of the Context Settings Modal for a modern clean design, including improved backdrop, header, and body layout.
- Introduced responsive design adjustments for smaller screens.
- Added custom scrollbar styles for better user experience.
- Refactored the TerminalPreview component to utilize `ansi-to-html` for rendering ANSI content, improving text display.
- Implemented new font variables for terminal styling across the application.
- Enhanced checkbox and input styles in the settings panel for better usability and aesthetics.
- Improved the layout and structure of settings groups and chips for a more organized appearance.

* Refactor UI components for compact design and enhance MCP toggle functionality

- Updated grid layout in viewer.html and viewer-template.html for better space utilization.
- Reduced padding and font sizes in settings groups, filter chips, and form controls for a more compact appearance.
- Implemented MCP toggle state management in ContextSettingsModal with API integration for status fetching and toggling.
- Reorganized settings groups for clarity, renaming and consolidating sections for improved user experience.
- Added feedback mechanism for MCP toggle status to inform users of changes and errors.

* feat: add collapsible sections, chip groups, form fields with tooltips, and toggle switches in settings modal

- Implemented collapsible sections for better organization of settings.
- Added chip groups with select all/none functionality for observation types and concepts.
- Enhanced form fields with optional tooltips for better user guidance.
- Introduced toggle switches for various settings, improving user interaction.
- Updated styles for new components to ensure consistency and responsiveness.
- Refactored ContextSettingsModal to utilize new components and improve readability.
- Improved TerminalPreview component styling for better layout and usability.

* Refactor modal header and preview selector styles; enhance terminal preview functionality

- Updated modal header padding and added gap for better spacing.
- Introduced a new header-controls section to include a project preview selector.
- Enhanced the preview selector styles for improved usability and aesthetics.
- Adjusted the preview column styles for a cleaner look.
- Implemented word wrap toggle functionality in the TerminalPreview component, allowing users to switch between wrapped and scrollable text.
- Improved scroll position handling in TerminalPreview to maintain user experience during content updates.

* feat: enhance modal settings with new icon links and update header controls

- Added new modal icon links for documentation and social media in ContextSettingsModal.
- Updated the header to remove sidebar toggle functionality and replaced it with context preview toggle.
- Refactored styles for modal icon links to improve UI/UX.
- Removed sidebar component from App and adjusted related state management.

* chore: remove abandoned cm_demo_content demo data approach

The demo data feature was prototyped but didn't work out. Removes:
- DEMO_OBSERVATIONS and DEMO_SUMMARIES arrays
- Conditional logic that bypassed DB for demo project
- Demo mode check in prior message extraction

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

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-03 21:34:41 -05:00
Alex Newman c78500cac2 Merge pull request #163 from thedotmack/copilot/fix-search-server-build-references 2025-12-03 17:21:04 -05:00
copilot-swe-agent[bot] 2b683f99bb fix: Update search-server references from .mjs to .cjs to match actual build output
- Update plugin/.mcp.json to reference search-server.cjs
- Update docs/public/configuration.mdx to reference search-server.cjs
- Update docs/public/development.mdx to reference search-server.cjs
- Remove stale plugin/scripts/search-server.mjs file

Co-authored-by: thedotmack <683968+thedotmack@users.noreply.github.com>
2025-12-03 22:17:12 +00:00
copilot-swe-agent[bot] 00e2b0c55f Initial plan 2025-12-03 22:13:59 +00:00
Alex Newman fbd4df4285 Merge branch 'feature/restore-when-to-skip-guidance' - Add WHEN TO SKIP guidance to observation prompt 2025-12-01 23:06:26 -05:00
Alex Newman ca24048e15 feat: Restore "WHEN TO SKIP" guidance to continuation prompt
Restores observation skip guidance that was removed in commit 68290a9
for token reduction. The removal caused the observer agent to forget
skip criteria after the first prompt, leading to more verbose
observations of routine operations.

Changes:
- Added WHEN TO SKIP section back to buildContinuationPrompt
- Added condensed CRITICAL reminder about what to record
- Maintains token efficiency by using condensed guidance vs full examples

This balances token usage with observation quality by keeping the
essential skip criteria without the full WHAT TO RECORD examples.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 23:04:51 -05:00
Alex Newman f9fd85fa4d chore: update CHANGELOG.md from releases
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 22:08:34 -05:00
Alex Newman bc7e0ba3e0 chore: bump version to 6.4.9
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
v6.4.9
2025-12-01 22:06:50 -05:00
Alex Newman cbfc94bc26 Merge pull request #160 from thedotmack/feature/context-settings
feat: Add comprehensive context configuration and display settings
2025-12-01 22:03:30 -05:00
Alex Newman c768a80bf0 Refactor context configuration and settings handling
- Updated context configuration loading path from ~/.claude/settings.json to ~/.claude-mem/settings.json.
- Modified the extractPriorMessages function to focus on retrieving the last assistant message only, removing user message extraction.
- Enhanced output formatting for displaying prior assistant messages in the context hook.
- Added new settings related to token economics and observation filtering in the useSettings hook.
2025-12-01 19:26:33 -05:00
Alex Newman 6dc648f07c feat: add functionality to extract and display prior session messages
- Implemented `cwdToDashed` helper function to format current working directory for transcript file paths.
- Added `extractPriorMessages` function to read and parse the last user and assistant messages from a transcript file.
- Enhanced `contextHook` to retrieve and display prior session messages if enabled in the configuration.
- Updated output formatting to include a "Previously" section showing last messages from the prior session.
2025-12-01 18:10:55 -05:00
Alex Newman b116681529 refactor: improve context economics display logic and logging
- Updated logging category from 'CONTEXT' to 'HOOK' for context settings loading failure.
- Simplified the display logic for the Context Economics section to show only when relevant settings are enabled.
- Enhanced readability by consolidating repeated code for displaying token savings.
- Adjusted footer logic to conditionally display token savings message based on visibility of context economics.
2025-12-01 17:43:04 -05:00
Alex Newman d1876cb6e0 Refactor observation handling: centralize constants and improve context settings
- Introduced `observation-metadata.ts` to define valid observation types and concepts, along with their corresponding emoji mappings.
- Updated `context-hook.ts` to utilize new constants for observation types and concepts, enhancing maintainability.
- Refactored `worker-service.ts` to validate observation types and concepts against the new centralized constants.
- Consolidated settings management in `Sidebar.tsx` to streamline state handling for context settings.
- Improved error handling and logging for context loading failures.
2025-12-01 17:29:48 -05:00
Alex Newman e1017b483b feat: Enhance context settings with validation and UI options
- Added ContextConfig interface and loadContextConfig function to manage context settings.
- Implemented validation for context settings in WorkerService.
- Updated Sidebar component to include new context settings for token economics, observation filtering, display configuration, and feature toggles.
- Introduced default settings for new context features.
- Adjusted types to accommodate new settings in the application state.
2025-12-01 16:53:35 -05:00
Alex Newman 8d5b886f63 docs: Update CHANGELOG.md for v6.4.1
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-30 23:30:15 -05:00
Alex Newman 6e8d823139 Release v6.4.1: Live AMA Announcement
Added dynamic announcement system to welcome users to our first-ever Live AMA event! 🎉

What's New:
• Time-aware announcement for Live AMA (Dec 1-5, 5-7pm EST)
• Live indicator (🔴) appears during active sessions
• Announcement automatically expires after event ends

Join us for our inaugural AMA! Ask questions, share ideas, and connect with the community. Whether you're a longtime user or just getting started with claude-mem, we'd love to hear from you!

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

Co-Authored-By: Claude <noreply@anthropic.com>
v6.4.1
2025-11-30 23:29:11 -05:00
Alex Newman e1212d2dd9 docs: Update CHANGELOG.md for v6.4.0 2025-11-30 23:15:55 -05:00
Alex Newman d3ae18434f Release v6.4.0: Dual-tag system, search API improvements, and privacy features
This release introduces powerful new privacy controls and search improvements:

**New Features:**
- Dual-tag system for meta-observation control
  - <private> tags for user-level privacy control
  - <claude-mem-context> tags for system-level auto-injected observations
- Privacy tag documentation and inline help in context hook

**Improvements:**
- Simplified search API parameters to eliminate bracket encoding issues
- Improved user messaging for new privacy features

**Technical:**
- Tag stripping happens at hook layer (edge processing)
- Shared utilities in src/utils/tag-stripping.ts
- Database index optimization for user prompts lookup

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

Co-Authored-By: Claude <noreply@anthropic.com>
v6.4.0
2025-11-30 23:09:51 -05:00
Alex Newman 8bdf228a92 Merge remote-tracking branch 'origin/bracket-nonsense'
# Conflicts:
#	plugin/scripts/search-server.cjs
2025-11-30 22:59:50 -05:00
Alex Newman 2b223b7cd9 feat: Add dual-tag system for meta-observation control (#153)
* feat: Add dual-tag system for meta-observation control

Implements <private> and <claude-mem-context> tag stripping at hook layer
to give users fine-grained control over what gets persisted in observations
and enable future real-time context injection without recursive storage.

**Features:**
- stripMemoryTags() function in save-hook.ts
- Strips both <private> and <claude-mem-context> tags before sending to worker
- Always active (no configuration needed)
- Comprehensive test suite (19 tests, all passing)
- User documentation for <private> tag
- Technical architecture documentation

**Architecture:**
- Edge processing pattern (filter at hook, not worker)
- Defensive type handling with silentDebug
- Supports multiline, nested, and multiple tags
- Enables strategic orchestration for internal tools

**User-Facing:**
- <private> tag for manual privacy control (documented)
- Prevents sensitive data from persisting in observations

**Infrastructure:**
- <claude-mem-context> tag ready for real-time context feature
- Prevents recursive storage when context injection ships

**Files:**
- src/hooks/save-hook.ts: Core implementation
- tests/strip-memory-tags.test.ts: Test suite (19/19 passing)
- docs/public/usage/private-tags.mdx: User guide
- docs/public/docs.json: Navigation update
- docs/context/dual-tag-system-architecture.md: Technical docs
- plugin/scripts/save-hook.js: Built hook

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

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

* fix: Strip private tags from user prompts and skip memory ops for fully private prompts

Fixes critical privacy bug where <private> tags were not being stripped from
user prompts before storage in user_prompts table, making private content
searchable via mem-search.

Changes:

1. new-hook.ts: Skip memory operations for fully private prompts
   - If cleaned prompt is empty after stripping tags, skip saveUserPrompt
   - Skip worker init to avoid wasting resources on empty prompts
   - Logs: "(fully private - skipped)"

2. save-hook.ts: Skip observations for fully private prompts
   - Check if user prompt was entirely private before creating observations
   - Respects user intent: fully private prompt = no observations at all
   - Prevents "thoughts pop up" issue where private prompts create public observations

3. SessionStore.ts: Add getUserPrompt() method
   - Retrieves prompt text by session_id and prompt_number
   - Used by save-hook to check if prompt was private

4. Tests: Added 4 new tests for fully private prompt detection (16 total, all passing)

5. Docs: Updated private-tags.mdx to reflect correct behavior
   - User prompts ARE now filtered before storage
   - Private content never reaches database or search indices

Privacy Protection:
- Fully private prompts: No user_prompt saved, no worker init, no observations
- Partially private prompts: Tags stripped, content sanitized before storage
- Zero leaks: Private content never indexed or searchable

Addresses reviewer feedback on PR #153 about user prompt filtering.

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

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

* feat: Enhance memory tag handling and indexing in user prompts

- Added a new index `idx_user_prompts_lookup` on `user_prompts` for improved query performance based on `claude_session_id` and `prompt_number`.
- Refactored memory tag stripping functionality into dedicated utility functions: `stripMemoryTagsFromJson` and `stripMemoryTagsFromPrompt` for better separation of concerns and reusability.
- Updated hooks (`new-hook.ts` and `save-hook.ts`) to utilize the new tag stripping functions, ensuring private content is not stored or searchable.
- Removed redundant inline tag stripping functions from hooks to streamline code.
- Added tests for the new tag stripping utilities to ensure functionality and prevent regressions.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-30 22:57:26 -05:00
Alex Newman 7cad4f0114 docs: Update CHANGELOG.md for v6.3.7 2025-11-30 22:54:01 -05:00
Alex Newman 41835954be fix: Remove orphaned closing brace in smart-install.js causing syntax error
Fixes a SyntaxError where an extra closing brace on line 392 was causing
"Missing catch or finally after try" error. The PM2 worker startup
try/catch block was properly formed but had an orphaned closing brace
that didn't match any opening brace.

This was breaking the SessionStart hook and preventing the plugin from
loading correctly.

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

Co-Authored-By: Claude <noreply@anthropic.com>
v6.3.7
2025-11-30 22:52:13 -05:00
Alex Newman 2431a1bd9e fix: Add 'dist/' to .gitignore to prevent built files from being tracked 2025-11-30 22:50:08 -05:00
Alex Newman 7fd0f28343 docs: Update all search API documentation for simplified parameters
Update all documentation to reflect the new simplified URL parameter format:
- Replace dateRange[start]/dateRange[end] with dateStart/dateEnd
- Clarify that concepts, files, and obs_type accept comma-separated values
- Update all code examples in skill documentation
- Update comments in search-server.ts

Files updated:
- SKILL.md - Main skill documentation
- operations/*.md - 8 operation guides (observations, prompts, sessions,
  by-file, by-type, by-concept, common-workflows, help)
- principles/progressive-disclosure.md - Design pattern doc
- src/servers/search-server.ts - Code comment

All examples now use clean URLs without bracket encoding:
- Old: ?dateRange[start]=2025-11-01&concepts[]=decision
- New: ?dateStart=2025-11-01&concepts=decision

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-30 19:03:19 -05:00
Alex Newman 50535499d9 fix: Simplify search endpoint parameters to avoid bracket encoding
Replace complex array/object parameters with simple comma-separated strings
and flat date parameters to eliminate annoying URL bracket encoding issues.

Changes:
- Add normalizeParams() helper to convert URL-friendly params to internal format
- Replace obs_type/concepts/files arrays with comma-separated strings
- Replace dateRange object with dateStart/dateEnd scalar params
- Update all tool schemas to use simplified parameters
- Add normalization to all tool handlers

Examples of new simplified URLs:
- Before: ?concepts[]=decision&concepts[]=bugfix&dateRange[start]=2024-01-01
- After: ?concepts=decision,bugfix&dateStart=2024-01-01

All endpoints tested and working correctly.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-30 18:46:39 -05:00
Alex Newman 4eb6557fbb docs: Update CHANGELOG.md for v6.3.6 2025-11-30 17:36:54 -05:00
Alex Newman a22098d661 chore: Bump version to 6.3.6 v6.3.6 2025-11-30 17:31:23 -05:00
Dmytro Gaivoronsky 69b17e15a2 feat: Auto-detect and rebuild native modules on Node.js version changes (#149)
Implements three-layer defense against native module version mismatches:

Layer 1: Node.js Version Tracking
- Track Node.js version alongside package version in .install-version marker
- Auto-trigger npm install when Node.js version changes
- Backward compatible with old plain-text version marker format

Layer 2: Native Module Verification
- Add verifyNativeModules() function to test better-sqlite3 loads correctly
- Verify after install completes to catch corrupted builds
- Retry with force flag if initial install verification fails

Layer 3: Graceful Failure
- Catch ERR_DLOPEN_FAILED in context-hook and delete version marker
- Exit cleanly to avoid error spam in Claude Code UI
- Auto-fix on next session start

Changes:
- scripts/smart-install.js: Add Node.js version tracking and verification
- src/hooks/context-hook.ts: Add graceful failure handling for native module errors
- tests/smart-install.test.js: Add tests for version marker format compatibility
- plugin/scripts/context-hook.js: Built output from TypeScript source

Fixes the issue where users see ERR_DLOPEN_FAILED errors after Node.js upgrades,
requiring manual npm install. Now automatically detects and fixes the issue.

Related design doc: docs/context/native-module-auto-fix-design.md
Implementation plan: docs/context/native-module-auto-fix-implementation.md

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

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Alex Newman <thedotmack@gmail.com>
2025-11-30 17:28:07 -05:00
Alex Newman de279ef6bf docs: Update CHANGELOG.md for v6.3.5
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-30 17:10:28 -05:00
Alex Newman c6fed386ef chore: Bump version to 6.3.5
Update version across all tracking files for patch release.

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

Co-Authored-By: Claude <noreply@anthropic.com>
v6.3.5
2025-11-30 17:08:33 -05:00