v8.2.3
76 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a7a7187b83 |
refactor: remove obsolete build steps for deleted files
Remove build configurations for worker-wrapper.cjs and worker-cli.js since these files were consolidated into worker-service.ts with the self-spawn pattern implementation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
266c746d50 |
feat: Fix observation timestamps, refactor session management, and enhance worker reliability (#437)
* Refactor worker version checks and increase timeout settings - Updated the default hook timeout from 5000ms to 120000ms for improved stability. - Modified the worker version check to log a warning instead of restarting the worker on version mismatch. - Removed legacy PM2 cleanup and worker start logic, simplifying the ensureWorkerRunning function. - Enhanced polling mechanism for worker readiness with increased retries and reduced interval. * feat: implement worker queue polling to ensure processing completion before proceeding * refactor: change worker command from start to restart in hooks configuration * refactor: remove session management complexity - Simplify createSDKSession to pure INSERT OR IGNORE - Remove auto-create logic from storeObservation/storeSummary - Delete 11 unused session management methods - Derive prompt_number from user_prompts count - Keep sdk_sessions table schema unchanged for compatibility * refactor: simplify session management by removing unused methods and auto-creation logic * Refactor session prompt number retrieval in SessionRoutes - Updated the method of obtaining the prompt number from the session. - Replaced `store.getPromptCounter(sessionDbId)` with `store.getPromptNumberFromUserPrompts(claudeSessionId)` for better clarity and accuracy. - Adjusted the logic for incrementing the prompt number to derive it from the user prompts count instead of directly incrementing a counter. * refactor: replace getPromptCounter with getPromptNumberFromUserPrompts in SessionManager Phase 7 of session management simplification. Updates SessionManager to derive prompt numbers from user_prompts table count instead of using the deprecated prompt_counter column. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * refactor: simplify SessionCompletionHandler to use direct SQL query Phase 8: Remove call to findActiveSDKSession() and replace with direct database query in SessionCompletionHandler.completeByClaudeId(). This removes dependency on the deleted findActiveSDKSession() method and simplifies the code by using a straightforward SELECT query. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * refactor: remove markSessionCompleted call from SDKAgent - Delete call to markSessionCompleted() in SDKAgent.ts - Session status is no longer tracked or updated - Part of phase 9: simplifying session management 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * refactor: remove markSessionComplete method (Phase 10) - Deleted markSessionComplete() method from DatabaseManager - Removed markSessionComplete call from SessionCompletionHandler - Session completion status no longer tracked in database - Part of session management simplification effort 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * refactor: replace deleted updateSDKSessionId calls in import script (Phase 11) - Replace updateSDKSessionId() calls with direct SQL UPDATE statements - Method was deleted in Phase 3 as part of session management simplification - Import script now uses direct database access consistently 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * test: add validation for SQL updates in sdk_sessions table * refactor: enhance worker-cli to support manual and automated runs * Remove cleanup hook and associated session completion logic - Deleted the cleanup-hook implementation from the hooks directory. - Removed the session completion endpoint that was used by the cleanup hook. - Updated the SessionCompletionHandler to eliminate the completeByClaudeId method and its dependencies. - Adjusted the SessionRoutes to reflect the removal of the session completion route. * fix: update worker-cli command to use bun for consistency * feat: Implement timestamp fix for observations and enhance processing logic - Added `earliestPendingTimestamp` to `ActiveSession` to track the original timestamp of the earliest pending message. - Updated `SDKAgent` to capture and utilize the earliest pending timestamp during response processing. - Modified `SessionManager` to track the earliest timestamp when yielding messages. - Created scripts for fixing corrupted timestamps, validating fixes, and investigating timestamp issues. - Verified that all corrupted observations have been repaired and logic for future processing is sound. - Ensured orphan processing can be safely re-enabled after validation. * feat: Enhance SessionStore to support custom database paths and add timestamp fields for observations and summaries * Refactor pending queue processing and add management endpoints - Disabled automatic recovery of orphaned queues on startup; users must now use the new /api/pending-queue/process endpoint. - Updated processOrphanedQueues method to processPendingQueues with improved session handling and return detailed results. - Added new API endpoints for managing pending queues: GET /api/pending-queue and POST /api/pending-queue/process. - Introduced a new script (check-pending-queue.ts) for checking and processing pending observation queues interactively or automatically. - Enhanced logging and error handling for better monitoring of session processing. * updated agent sdk * feat: Add manual recovery guide and queue management endpoints to documentation --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
3ea0b60b9f |
feat: Mode system with inheritance and multilingual support (#412)
* feat: add domain management system with support for multiple domain profiles
- Introduced DomainManager class for loading and managing domain profiles.
- Added support for a default domain ('code') and fallback mechanisms.
- Implemented domain configuration validation and error handling.
- Created types for domain configuration, observation types, and concepts.
- Added new directory for domain profiles and ensured its existence.
- Updated SettingsDefaultsManager to include CLAUDE_MEM_DOMAIN setting.
* Refactor domain management to mode management
- Removed DomainManager class and replaced it with ModeManager for better clarity and functionality.
- Updated types from DomainConfig to ModeConfig and DomainPrompts to ModePrompts.
- Changed references from domains to modes in the settings and paths.
- Ensured backward compatibility by maintaining the fallback mechanism to the 'code' mode.
* feat: add migration 008 to support mode-agnostic observations and refactor service layer references in documentation
* feat: add new modes for code development and email investigation with detailed observation types and concepts
* Refactor observation parsing and prompt generation to incorporate mode-specific configurations
- Updated `parseObservations` function to use 'observation' as a universal fallback type instead of 'change', utilizing active mode's valid observation types.
- Modified `buildInitPrompt` and `buildContinuationPrompt` functions to accept a `ModeConfig` parameter, allowing for dynamic prompt content based on the active mode.
- Enhanced `ModePrompts` interface to include additional guidance for observers, such as recording focus and skip guidance.
- Adjusted the SDKAgent to load the active mode and pass it to prompt generation functions, ensuring prompts are tailored to the current mode's context.
* fix: correct mode prompt injection to preserve exact wording and type list visibility
- Add script to extract prompts from main branch prompts.ts into code.yaml
- Fix prompts.ts to show type list in XML template (e.g., "[ bugfix | feature | ... ]")
- Keep 'change' as fallback type in parser.ts (maintain backwards compatibility)
- Regenerate code.yaml with exact wording from original hardcoded prompts
- Build succeeds with no TypeScript errors
* fix: update ModeManager to load JSON mode files and improve validation
- Changed ModeManager to load mode configurations from JSON files instead of YAML.
- Removed the requirement for an "observation" type and updated validation to require at least one observation type.
- Updated fallback behavior in the parser to use the first type from the active mode's type list.
- Added comprehensive tests for mode loading, prompt injection, and parser integration, ensuring correct behavior across different modes.
- Introduced new mode JSON files for "Code Development" and "Email Investigation" with detailed observation types and prompts.
* Add mode configuration loading and update licensing information for Ragtime
- Implemented loading of mode configuration in WorkerService before database initialization.
- Added PolyForm Noncommercial License 1.0.0 to Ragtime directory.
- Created README.md for Ragtime with licensing details and usage guidelines.
* fix: add datasets directory to .gitignore to prevent accidental commits
* refactor: remove unused plugin package.json file
* chore: add package.json for claude-mem plugin with version 7.4.5
* refactor: remove outdated tests and improve error handling
- Deleted tests for ChromaSync error handling, smart install, strip memory tags, and user prompt tag stripping due to redundancy or outdated logic.
- Removed vitest configuration as it is no longer needed.
- Added a comprehensive implementation plan for fixing the modes system, addressing critical issues and improving functionality.
- Created a detailed test analysis report highlighting the quality and effectiveness of the current test suite, identifying areas for improvement.
- Introduced a new plugin package.json for runtime dependencies related to claude-mem hooks.
* refactor: remove parser regression tests to streamline codebase
* docs: update CLAUDE.md to clarify test management and changelog generation
* refactor: remove migration008 for mode-agnostic observations
* Refactor observation type handling to use ModeManager for icons and emojis
- Removed direct mappings of observation types to icons and work emojis in context-generator, FormattingService, SearchManager, and TimelineService.
- Integrated ModeManager to dynamically retrieve icons and emojis based on the active mode.
- Improved maintainability by centralizing the logic for observation type representation.
* Refactor observation metadata constants and update context generator
- Removed the explicit declaration of OBSERVATION_TYPES and OBSERVATION_CONCEPTS from observation-metadata.ts.
- Introduced fallback default strings for DEFAULT_OBSERVATION_TYPES_STRING and DEFAULT_OBSERVATION_CONCEPTS_STRING.
- Updated context-generator.ts to utilize observation types and concepts from ModeManager instead of constants.
* refactor: remove intermediate error handling from hooks (Phase 1)
Apply "fail fast" error handling strategy - errors propagate and crash loud
instead of being caught, wrapped, and re-thrown at intermediate layers.
Changes:
- Remove try/catch around fetch calls in all hooks - let errors throw
- Add try/catch ONLY around JSON.parse at entry points
- Delete error-handler.ts and hook-error-handler.ts (no longer needed)
- Update worker-utils.ts: functions now throw instead of returning null
- Update transcript-parser.ts: throw on missing path, empty file, malformed JSON
- Remove all handleWorkerError, handleFetchError imports
Philosophy: If something breaks, we KNOW it broke. No silent failures.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor: remove intermediate error handling from worker service (Phase 2)
Apply "fail fast" error handling strategy to worker service layer.
Changes:
- worker-service.ts: Remove try/catch from version endpoint, cleanup,
MCP close, process enumeration, force kill, and isAlive check
- SessionRoutes.ts: Remove try/catch from JSON.stringify calls, remove
.catch() from Chroma sync and SDK agent calls
- SettingsRoutes.ts: Remove try/catch from toggleMcp()
- DatabaseManager.ts: Remove .catch() from backfill and close operations
- SDKAgent.ts: Keep outer try/catch (top-level), remove .catch() from
Chroma sync operations
- SSEBroadcaster.ts: Remove try/catch from broadcast and sendToClient
Philosophy: Errors propagate and crash loud. BaseRouteHandler.wrapHandler
provides top-level catching for HTTP routes.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor: remove error swallowing from SQLite services (Phase 3)
Apply "fail fast" error handling strategy to database layer.
SessionStore.ts migrations:
- ensureWorkerPortColumn(): Remove outer try/catch, let it throw
- ensurePromptTrackingColumns(): Remove outer try/catch, let it throw
- removeSessionSummariesUniqueConstraint(): Keep inner transaction
rollback, remove outer catch
- addObservationHierarchicalFields(): Remove outer try/catch
- makeObservationsTextNullable(): Keep inner transaction rollback,
remove outer catch
- createUserPromptsTable(): Keep inner transaction rollback, remove
outer catch
- getFilesForSession(): Remove try/catch around JSON.parse
SessionSearch.ts:
- ensureFTSTables(): Remove try/catch, let it throw
Philosophy: Migration errors that are swallowed mean we think the
database is fine when it's not. Keep only inner transaction rollback
try/catch blocks.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor: remove error hiding from utilities (Phase 4)
Apply "fail fast" error handling strategy to utility layer.
logger.ts:
- formatTool(): Remove try/catch, let JSON.parse throw on malformed input
context-generator.ts:
- loadContextConfig(): Remove try/catch, let parseInt throw on invalid settings
- Transcript extraction: Remove try/catch, let file read errors propagate
ChromaSync.ts:
- close(): Remove nested try/catch blocks, let close errors propagate
Philosophy: No silent fallbacks or hidden defaults. If something breaks,
we know it broke immediately.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: serve static UI assets and update package root path
- Added middleware to serve static UI assets (JS, CSS, fonts, etc.) in ViewerRoutes.
- Updated getPackageRoot function to correctly return the package root directory as one level up from the current directory.
* feat: Enhance mode loading with inheritance support
- Introduced parseInheritance method to handle parent--override mode IDs.
- Added deepMerge method for recursively merging mode configurations.
- Updated loadMode method to support inheritance, loading parent modes and applying overrides.
- Improved error handling for missing mode files and logging for better traceability.
* fix(modes): correct inheritance file resolution and path handling
* Refactor code structure for improved readability and maintainability
* feat: Add mode configuration documentation and examples
* fix: Improve concurrency handling in translateReadme function
* Refactor SDK prompts to enhance clarity and structure
- Updated the `buildInitPrompt` and `buildContinuationPrompt` functions in `prompts.ts` to improve the organization of prompt components, including the addition of language instructions and footer messages.
- Removed redundant instructions and emphasized the importance of recording observations.
- Modified the `ModePrompts` interface in `types.ts` to include new properties for system identity, language instructions, and output format header, ensuring better flexibility and clarity in prompt generation.
* Enhance prompts with language instructions and XML formatting
- Updated `buildInitPrompt`, `buildSummaryPrompt`, and `buildContinuationPrompt` functions to include detailed language instructions in XML comments.
- Ensured that language instructions guide users to keep XML tags in English while writing content in the specified language.
- Modified the `buildSummaryPrompt` function to accept `mode` as a parameter for consistency.
- Adjusted the call to `buildSummaryPrompt` in `SDKAgent` to pass the `mode` argument.
* Refactor XML prompt generation in SDK
- Updated the buildInitPrompt, buildSummaryPrompt, and buildContinuationPrompt functions to use new placeholders for XML elements, improving maintainability and readability.
- Removed redundant language instructions in comments for clarity.
- Added new properties to ModePrompts interface for better structure and organization of XML placeholders and section headers.
* feat: Update observation prompts and structure across multiple languages
* chore: Remove planning docs and update Ragtime README
Remove ephemeral development artifacts:
- .claude/plans/modes-system-fixes.md
- .claude/test-analysis-report.md
- PROMPT_INJECTION_ANALYSIS.md
Update ragtime/README.md to explain:
- Feature is not yet implemented
- Dependency on modes system (now complete in PR #412)
- Ready to be scripted out in future release
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* fix: Move summary prompts to mode files for multilingual support
Summary prompts were hardcoded in English in prompts.ts, breaking
multilingual support. Now properly mode-based:
- Added summary_instruction, summary_context_label,
summary_format_instruction, summary_footer to code.json
- Updated buildSummaryPrompt() to use mode fields instead of hardcoded text
- Added summary_footer with language instructions to all 10 language modes
- Language modes keep English prompts + language requirement footer
This fixes the gaslighting where we claimed full multilingual support
but summaries were still generated in English.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* chore: Clean up README by removing local preview instructions and streamlining beta features section
* Add translated README files for Ukrainian, Vietnamese, and Chinese languages
* Add new language modes for code development in multiple languages
- Introduced JSON configurations for Code Development in Greek, Finnish, Hebrew, Hindi, Hungarian, Indonesian, Italian, Dutch, Norwegian, Polish, Brazilian Portuguese, Romanian, Swedish, Turkish, and Ukrainian.
- Each configuration includes prompts for observations, summaries, and instructions tailored to the respective language.
- Ensured that all prompts emphasize the importance of generating observations without referencing the agent's actions.
* Add multilingual support links to README files in various languages
- Updated README.id.md, README.it.md, README.ja.md, README.ko.md, README.nl.md, README.no.md, README.pl.md, README.pt-br.md, README.ro.md, README.ru.md, README.sv.md, README.th.md, README.tr.md, README.uk.md, README.vi.md, and README.zh.md to include links to other language versions.
- Each README now features a centered paragraph with flags and links for easy navigation between different language documents.
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
|
||
|
|
a537433eae |
Code quality: comprehensive nonsense audit cleanup (20 issues) (#400)
* fix: prevent initialization promise from resolving on failure Background initialization was resolving the promise even when it failed, causing the readiness check to incorrectly indicate the worker was ready. Now the promise stays pending on failure, ensuring /api/readiness continues returning 503 until initialization succeeds. Fixes critical issue #1 from nonsense audit. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fix: improve error handling in context inject and settings update routes * Enhance error handling for ChromaDB failures in SearchManager - Introduced a flag to track ChromaDB failure states. - Updated logging messages to provide clearer feedback on ChromaDB initialization and failure. - Modified the response structure to inform users when semantic search is unavailable due to ChromaDB issues, including installation instructions for UVX/Python. * refactor: remove deprecated silent-debug utility functions * Enhance error handling and validation in hooks - Added validation for required fields in `summary-hook.ts` and `save-hook.ts` to ensure necessary inputs are provided before processing. - Improved error messages for missing `cwd` in `save-hook.ts` and `transcript_path` in `summary-hook.ts`. - Cleaned up code by removing unnecessary error handling logic and directly throwing errors when required fields are missing. - Updated binary file `mem-search.zip` to reflect changes in the plugin. * fix: improve error handling in summary hook to ensure errors are not masked * fix: add error handling for unknown message content format in transcript parser * fix: log error when failing to notify worker of session end * Refactor date formatting functions: move to shared module - Removed redundant date formatting functions from SearchManager.ts. - Consolidated date formatting logic into shared timeline-formatting.ts. - Updated functions to accept both ISO date strings and epoch milliseconds. * Refactor tag stripping functions to extract shared logic - Introduced a new internal function `stripTagsInternal` to handle the common logic for stripping memory tags from both JSON and prompt content. - Updated `stripMemoryTagsFromJson` to utilize the new internal function, simplifying its implementation. - Modified `stripMemoryTagsFromPrompt` to also call `stripTagsInternal`, reducing code duplication and improving maintainability. - Removed redundant type checks and logging from both functions, as they now rely on the internal function for processing. * Refactor settings validation in SettingsRoutes - Consolidated multiple individual setting validations into a single validateSettings method. - Updated handleUpdateSettings to use the new validation method for improved maintainability. - Each setting now has its validation logic encapsulated within validateSettings, ensuring a single source of truth for validation rules. * fix: add error logging to ProcessManager.getPidInfo() Previously getPidInfo() returned null silently for three cases: 1. File not found (expected - no action needed) 2. JSON parse error (corrupted file - now logs warning) 3. Type validation failure (malformed data - now logs warning) This fix adds warning logs for cases 2 and 3 to provide visibility into PID file corruption issues. Logs include context like parsed data structure or error message with file path. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fix: remove overly defensive try-catch in SessionRoutes Remove unnecessary try-catch block that was masking potential errors when checking file paths for session-memory meta-observations. Property access on parsed JSON objects never throws - existing truthiness checks already safely handle undefined/null values. Issue #12 from nonsense audit: SessionRoutes catch-all exception masking 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fix: remove redundant try-catch from getWorkerPort() Simplified getWorkerPort() by removing unnecessary try-catch wrapper. SettingsDefaultsManager.loadFromFile() already handles missing files by returning defaults, and .get() never throws - making the catch block completely redundant. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * refactor: eliminate ceremonial wrapper in hook-response.ts Replace buildHookResponse() function with direct constant export. Most hook responses were calling a function just to return the same constant object. Only SessionStart with context needs special handling. Changes: - Export STANDARD_HOOK_RESPONSE constant directly - Simplify createHookResponse() to only handle SessionStart special case - Update all hooks to use STANDARD_HOOK_RESPONSE instead of function call - Eliminate buildHookResponse() function with redundant branching Files modified: - src/hooks/hook-response.ts: Export constant, simplify function - src/hooks/new-hook.ts: Use STANDARD_HOOK_RESPONSE - src/hooks/save-hook.ts: Use STANDARD_HOOK_RESPONSE - src/hooks/summary-hook.ts: Use STANDARD_HOOK_RESPONSE 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fix: make getWorkerHost() consistent with getWorkerPort() - Use SettingsDefaultsManager.get('CLAUDE_MEM_DATA_DIR') for path resolution instead of hardcoded ~/.claude-mem (supports custom data directories) - Add caching to getWorkerHost() (same pattern as getWorkerPort()) - Update clearPortCache() to also clear host cache - Both functions now have identical patterns: caching, consistent path resolution, and same error handling via SettingsDefaultsManager 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * refactor: inline single-use timeout constants in ProcessManager Remove 6 timeout constants used only once each, inlining their values directly at the point of use. Following YAGNI principle - constants should only exist when used multiple times. Removed constants: - PROCESS_STOP_TIMEOUT_MS (5000ms) - HEALTH_CHECK_TIMEOUT_MS (10000ms) - HEALTH_CHECK_INTERVAL_MS (200ms) - HEALTH_CHECK_FETCH_TIMEOUT_MS (1000ms) - PROCESS_EXIT_CHECK_INTERVAL_MS (100ms) - HTTP_SHUTDOWN_TIMEOUT_MS (2000ms) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fix: replace overly broad path filter in HTTP logging middleware Replace `req.path.includes('.')` with explicit static file extension checking to prevent incorrectly skipping API endpoint logging. - Add `staticExtensions` array with legitimate asset types - Use `.endsWith()` matching instead of `.includes()` - API endpoints containing periods (if any) now logged correctly - Static assets (.js, .css, .svg, etc.) still skip logging as intended 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * refactor: expand logger.formatTool() to handle all tool types Replace hard-coded tool formatting for 4 tools with comprehensive coverage: File operations (Read, Edit, Write, NotebookEdit): - Consolidated file_path handling for all file operations - Added notebook_path support for NotebookEdit - Shows filename only (not full path) Search tools (Glob, Grep): - Glob: shows pattern - Grep: shows pattern (truncated if > 30 chars) Network tools (WebFetch, WebSearch): - Shows URL or query (truncated if > 40 chars) Meta tools (Task, Skill, LSP): - Task: shows subagent_type or description - Skill: shows skill name - LSP: shows operation type This eliminates the "hard-coded 4 tools" limitation and provides meaningful log output for all tool types. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fix: remove all truncation from logger.formatTool() Truncation hides critical debugging information. Show everything: - Bash: full command (was truncated at 50 chars) - File operations: full path (was showing filename only) - Grep: full pattern (was truncated at 30 chars) - WebFetch/WebSearch: full URL/query (was truncated at 40 chars) - Task: full description (was truncated at 30 chars) Logs exist to provide complete information. Never hide details. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * refactor: replace array indexing with regex capture for drive letter Use explicit regex capture group to extract Windows drive letter instead of assuming cwd[0] is always the first character. Safer and more explicit. - Changed cwd.match(/^[A-Z]:\\/i) to cwd.match(/^([A-Z]):\\/i) - Extract drive letter from driveMatch[1] instead of cwd[0] - Restructured control flow to avoid nested conditionals 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fix: return computed values from DataRoutes processing endpoint The handleSetProcessing endpoint was computing queueDepth and activeSessions but not including them in the response. This commit includes all computed values in the API response. - Return queueDepth and activeSessions in /api/processing response - Eliminates dead code pattern where values are computed but unused - API callers can now access these metrics 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fix: move error handling into SettingsDefaultsManager.loadFromFile() Wrap the entire loadFromFile() method in try-catch so it handles ALL error cases (missing file, corrupted JSON, permission errors, I/O failures) instead of forcing every caller to add redundant try-catch blocks. This follows DRY principle: one function owns error handling, all callers stay simple and clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Refactor hook response handling and optimize token estimation - Removed the HookType and HookResponse types and the createHookResponse function from hook-response.ts to simplify the response handling for hooks. - Introduced a standardized hook response for all hooks in hook-response.ts. - Moved the estimateTokens function from SearchManager.ts to timeline-formatting.ts for better reusability and clarity. - Cleaned up redundant estimateTokens function definitions in SearchManager.ts. --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
84f2061d8f |
chore: bump version to 7.4.3
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
dea67c0d86 |
fix: MCP server compatibility and web UI path resolution
Fixes #371, #369 **Issue #371: MCP server fails when Bun not in PATH** - Changed MCP server shebang from `#!/usr/bin/env bun` to `#!/usr/bin/env node` - MCP server now works regardless of whether Bun is in PATH - Worker service correctly uses getBunPath() to find Bun in common install locations **Issue #369: Web UI returns ENOENT error** - Fixed hardcoded 'plugin/' path in ViewerRoutes - Now checks both cache structure (ui/viewer.html) and marketplace structure (plugin/ui/viewer.html) - Web UI now works from both ~/.claude/plugins/cache and ~/.claude/plugins/marketplaces **Technical Details:** - Updated build-hooks.js to use Node shebang for MCP server (line 169) - Enhanced ViewerRoutes.handleViewerUI() to try multiple path patterns - Added existsSync check to find viewer.html in either location 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
a5bf653a47 |
fix(windows): solve zombie port problem with wrapper architecture (#372)
On Windows, Bun doesn't properly release socket handles when the worker process exits, causing "zombie ports" that remain bound even after all processes are dead. This required a system reboot to clear. Solution: Introduce a wrapper process (worker-wrapper.cjs) that: - Spawns the actual worker as a child with IPC channel - On restart/shutdown, uses `taskkill /T /F` to kill the entire process tree - Exits itself, allowing hooks to start fresh The wrapper has no sockets, so Bun's socket cleanup bug doesn't affect it. When the wrapper kills the inner worker tree and exits, the port is properly released and can be immediately reused. Key changes: - New worker-wrapper.ts for Windows process lifecycle management - ProcessManager starts wrapper on Windows, worker directly on Unix - Worker sends IPC messages to wrapper for restart/shutdown - Health endpoint now includes debug info (build ID, managed status, hasIpc) Tested: Restart API now properly releases port and new worker binds to same port. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
db3794762f |
chore: remove all better-sqlite3 references from codebase (#357)
* fix: export/import scripts now use API instead of direct DB access Export script fix: - Add format=json parameter to SearchManager for raw data output - Add getSdkSessionsBySessionIds method to SessionStore - Add POST /api/sdk-sessions/batch endpoint to DataRoutes - Refactor export-memories.ts to use HTTP API Import script fix: - Add import methods to SessionStore with duplicate detection - Add POST /api/import endpoint to DataRoutes - Refactor import-memories.ts to use HTTP API 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: update analyze-transformations-smart.js to use bun:sqlite Replace better-sqlite3 import with bun:sqlite to align with v7.1.0 migration. * chore: remove all better-sqlite3 references from codebase - Updated scripts/analyze-transformations-smart.js to use bun:sqlite - Merged PR #332: Refactored import/export scripts to use worker API instead of direct DB access - Updated PM2-to-Bun migration documentation All better-sqlite3 references have been removed from source code. Documentation references remain as appropriate historical context. * build: update plugin artifacts with merged changes Include built artifacts from PR #332 merge and analyze-transformations-smart.js update. --------- Co-authored-by: lee <loyalpartner@163.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
32be34505a |
refactor: consolidate mem-search skill, remove desktop-skill duplication
- Delete separate desktop-skill/ directory (was outdated) - Generate mem-search.zip during build from plugin/skills/mem-search/ - Update docs with correct MCP tool list and new download path - Single source of truth for Claude Desktop skill 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
4ddc5a01bb |
feat: cherry-pick translation script improvements from PR #250
Add caching, parallel processing, and tier-based translation scripts: - Caching system via .translation-cache.json to skip unchanged content - --force flag to override cache and re-translate - --parallel flag for concurrent translations - Tier-based npm scripts (translate:tier1-4, translate:all) - Better markdown wrapper stripping - Translation disclaimer at top of files - Uses Bun for better performance Changes cherry-picked from PR #250 while preserving current version (7.2.0) and worker scripts. Does not include translated README files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
f1da66e4f1 |
feat: add automated bug report generator with Claude Agent SDK
Add npm run bug-report command that: - Collects comprehensive system diagnostics (versions, platform, worker status, logs, config) - Prompts for issue description with multiline input support - Auto-translates foreign languages to English - Generates formatted GitHub issue using Claude Agent SDK - Streams character count with animated progress - Auto-sanitizes paths for privacy - Automatically opens GitHub issue form with pre-filled title and body - Saves timestamped report locally Usage: npm run bug-report # Interactive bug report npm run bug-report --no-logs # Skip logs for privacy npm run bug-report --verbose # Show all diagnostics npm run bug-report --help # Show help Files: - scripts/bug-report/cli.ts - Interactive CLI entry point - scripts/bug-report/index.ts - Core logic with Agent SDK - scripts/bug-report/collector.ts - System diagnostics collector - package.json - Added bug-report script 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
a0b4381dc8 | Merge feature/import-export: Add memory export/import scripts with duplicate prevention | ||
|
|
42ed414a4c |
Fix: Exclude developer-specific .mcp.json from marketplace releases (#277)
* Initial plan * Fix: Remove developer-specific .mcp.json config and exclude from sync Co-authored-by: thedotmack <683968+thedotmack@users.noreply.github.com> * Fix: Use leading slash in rsync exclude to only exclude root .mcp.json Co-authored-by: thedotmack <683968+thedotmack@users.noreply.github.com> * Complete fix for developer-specific .mcp.json config issue 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> |
||
|
|
0fb6f3cf4e | refactor: streamline Bun and uv installation checks and paths | ||
|
|
19af455c57 |
chore: bump version to 7.1.2
🐛 Bug Fixes **Windows Installation** - Fixed Bun PATH detection on Windows after fresh install - Added fallback to check common install paths before PATH reload - Improved smart-install.js to use full Bun path when not in PATH - Added proper path quoting for Windows usernames with spaces **Worker Startup** - Fixed worker connection failures in Stop hook - Added health check retry loop (5 attempts, 500ms intervals) - Worker now waits up to 2.5s for responsiveness before returning - Improved error detection for Bun's ConnectionRefused error format 🎯 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
e896cfa0c5 | feat: add support for uv package manager installation and update documentation | ||
|
|
25684ea8f7 |
Add Chinese translation for README and implement README translation script
- Created README.zh.md for Chinese localization of the project. - Developed a README translation script to support multiple languages using Claude Agent SDK. - Implemented CLI and programmatic usage for the translation tool. - Added examples for integrating the translation tool into build scripts and CI/CD pipelines. - Enhanced error handling and logging for translation processes. - Included support for various languages and output customization options. |
||
|
|
d24d5dda04 |
refactor: require Bun globally, add auto-install, remove Windows executable approach (#243)
- Delete BinaryManager.ts - no longer needed - Simplify ProcessManager.ts - single Bun spawn path for all platforms - Update smart-install.js - auto-install Bun if missing (Windows/Unix) - Update documentation to reflect Bun requirement This simplifies the codebase by: - Using Bun consistently across all platforms (hooks + worker) - Eliminating binary download/hosting complexity - Zero native dependencies with bun:sqlite - Auto-installing Bun on first run if not present Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
807d1d6100 |
feat: migrate scripts to Bun runtime
- Updated shebangs in user-message-hook.js, worker-cli.js, and worker-service.cjs to use Bun instead of Node. - Modified build-hooks.js to generate Bun-compatible shebangs in built scripts. - Enhanced sync-marketplace.cjs to trigger a worker restart after syncing files via an HTTP request. - Improved worker-cli.ts to exit with appropriate status codes after executing commands. - Added build-worker-binary.js to create a Windows executable for the worker service using Bun's compile feature. |
||
|
|
8bf22b3dc5 | feat: implement worker CLI and process management for bun integration | ||
|
|
f8108047c4 | refactor: update hooks to use bun instead of node for script execution | ||
|
|
e4bd0ae461 |
refactor: migrate from better-sqlite3 to bun:sqlite
- Updated build-hooks.js to remove better-sqlite3 dependency and use bun:sqlite. - Modified smart-install.js to eliminate checks and installations related to better-sqlite3. - Refactored Database.ts, SessionSearch.ts, SessionStore.ts, and migrations.ts to import and utilize bun:sqlite. - Replaced exec and pragma calls with appropriate run methods for bun:sqlite compatibility. - Removed unnecessary native module verification and installation logic for better-sqlite3. |
||
|
|
4e7ed75fa9 |
Fix critical bugs in export/import feature (PR #225)
Addressed all 6 bugs identified in code reviews: CRITICAL FIXES: 1. SessionStore.ts: Fixed concepts filter bug - removed empty params.push() that was breaking SQL parameter alignment (line 849) 2. import-memories.ts: Removed worker_port and prompt_counter fields from sdk_sessions insert to fix schema mismatch with fresh databases 3. export-memories.ts: Fixed hardcoded port - now reads from settings via SettingsDefaultsManager.loadFromFile() HIGH PRIORITY: 4. export-memories.ts: Added database existence check with clear error message before opening database connection 5. export-memories.ts: Fixed variable shadowing - renamed local 'query' variable to 'sessionQuery' (line 90) MEDIUM PRIORITY: 6. export-memories.ts: Improved type safety - added ObservationRecord, SdkSessionRecord, SessionSummaryRecord, UserPromptRecord interfaces All fixes tested and verified: - Export script successfully exports with project filtering - Import script works on existing database with duplicate prevention - Port configuration read from settings.json - Type safety improvements prevent compile-time errors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
a8b84fa7b6 | Update export script and rebuild with latest changes | ||
|
|
fa93f2c1e2 | Add export/import functionality and documentation for memory management | ||
|
|
b985579959 |
Update scripts/smart-install.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> |
||
|
|
5f36d2bf9a | fix(windows): hide terminal windows when spawning child processes | ||
|
|
c3761a2204 |
Refactor silent debugging to happy path error handling
- Replaced instances of silentDebug with happy_path_error__with_fallback across multiple files to improve error logging and handling. - Updated the utility function to provide clearer semantics for error handling when expected values are missing. - Introduced a script to find potential silent failures in the codebase that may need to be addressed with the new error handling approach. |
||
|
|
d7dc29498c |
fix(cache): Add package.json to plugin directory for cache dependency resolution
The bundled hook scripts use `external: ['better-sqlite3']` during esbuild, meaning the dependency must be resolved at runtime. When hooks run from the cache directory (~/.claude/plugins/cache/thedotmack/claude-mem/X.X.X/), they couldn't find better-sqlite3 because: 1. Cache directory had no package.json 2. smart-install.js was hardcoded to install in marketplace directory only This fix: - Adds plugin/package.json declaring runtime dependencies (better-sqlite3) - Updates build-hooks.js to auto-generate plugin/package.json from main package.json - Updates smart-install.js to detect execution context (cache vs marketplace) and install dependencies in the correct location The script now detects if it's running from cache (via path pattern matching) and installs dependencies there, where the hooks actually execute. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
1f2e5f1a9c |
fix(windows): Comprehensive fixes for Windows plugin installation
This PR addresses issue #193 affecting Windows installations of claude-mem. ## Bug 1: Missing ecosystem.config.cjs in packaged plugin **Problem**: The ecosystem.config.cjs file was not included in the plugin package, causing PM2 to fail when trying to start the worker from cache. **Fix**: Added `plugin/ecosystem.config.cjs` with correct path for packaged structure (`./scripts/worker-service.cjs` instead of `./plugin/scripts/`). ## Bug 2: Incorrect MCP Server Path (src/services/worker-service.ts) **Problem**: Path `__dirname, '..', '..', 'plugin', 'scripts', 'mcp-server.cjs'` only worked in dev structure, failed in packaged plugin. **Error produced**: ``` Error: Cannot find module 'C:\Users\...\claude-mem\plugin\scripts\mcp-server.cjs' [ERROR] [SYSTEM] Background initialization failed MCP error -32000: Connection closed ``` **Fix**: Changed to `path.join(__dirname, 'mcp-server.cjs')` since mcp-server.cjs is in the same directory as worker-service.cjs after bundling. ## Bug 3: Missing smart-install.js in plugin package **Problem**: smart-install.js was referenced in hooks.json but not included in the plugin/ directory for cache deployment. **Fix**: Added `plugin/scripts/smart-install.js` that uses `createRequire()` to resolve modules from MARKETPLACE_ROOT. ## Bug 4: hooks.json incorrect path **Problem**: Referenced `/../scripts/smart-install.js` but CLAUDE_PLUGIN_ROOT points to the plugin/ directory. **Fix**: Changed to `/scripts/smart-install.js`. ## Bug 5: Windows Worker Startup - Visible Console Windows **Problem**: PM2 ignores windowsHide option on Windows, opening visible console windows when starting the worker service. **Fix**: Use PowerShell `Start-Process -WindowStyle Hidden` on Windows while keeping PM2 for Unix systems (src/shared/worker-utils.ts). ## Additional Improvements - Increased worker startup timeouts for Windows (500ms health check, 1000ms wait between retries, 15 retries = 15s total vs previous 5s) - Added `windowsHide: true` to root ecosystem.config.cjs for PM2 ## Note on Assertion Failure The Windows libuv assertion failure `!(handle->flags & UV_HANDLE_CLOSING)` at `src\win\async.c:76` is a known upstream issue in Claude Code (Issue #7579), triggered by fetch() calls on Windows. This is NOT caused by worker spawning and cannot be fixed in claude-mem. Tested on Windows 11 with Node.js v24. Fixes #193 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
06ba1cd92c |
chore: bump version to 7.0.2
Auto-start worker functionality improvements 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
5550ecf623 | fix: update scripts and hooks for improved worker management and synchronization | ||
|
|
c415ff5120 |
feat(timeline): implement TimelineService for building and formatting timeline items
- Extracted timeline-related functionality from mcp-server.ts to a dedicated TimelineService class. - Added methods to build, filter, and format timeline items based on observations, sessions, and prompts. - Introduced interfaces for TimelineItem and TimelineData to standardize data structures. - Implemented sorting and grouping of timeline items by date, with markdown formatting for output. - Included utility methods for date and time formatting, as well as token estimation. |
||
|
|
83b4806718 |
Refactor logging and improve service initialization
- Updated logging in `search-server.ts` to use `silentDebug` for non-critical messages, reducing console noise. - Added a health check endpoint in `worker-service.ts` to improve service monitoring. - Modified the worker service startup process to start the HTTP server immediately and perform slow initialization in the background. - Refactored database initialization in `Database.ts` to use the correct `Database` class. - Implemented a port availability check in `context-hook.ts` to ensure the worker service is ready before making requests. |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
4739b9e413 | Merge branch 'pr-130-source' into test-pr-130 | ||
|
|
a48a67ca76 |
fix: use spawnSync to avoid command injection risks
Replace execSync with shell string interpolation with spawnSync and array arguments. This eliminates potential command injection if paths contain special characters. |
||
|
|
29e6e026b6 | feat: Add beta channel for experimental features and update documentation | ||
|
|
2a2206d886 |
fix: add Windows compatibility for PM2 detection
- Use .cmd extension for PM2 on Windows (pm2.cmd vs pm2) - Add shell: true to execSync for proper path quoting on Windows 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
c5e68a17c8 |
refactor: Clean up search architecture, remove experimental contextualize endpoint (#133)
* Refactor code structure for improved readability and maintainability * Add test results for search API and related functionalities - Created test result files for various search-related functionalities, including: - test-11-search-server-changes.json - test-12-context-hook-changes.json - test-13-worker-service-changes.json - test-14-patterns.json - test-15-gotchas.json - test-16-discoveries.json - test-17-all-bugfixes.json - test-18-all-features.json - test-19-all-decisions.json - test-20-session-search.json - test-21-prompt-search.json - test-22-decisions-endpoint.json - test-23-changes-endpoint.json - test-24-how-it-works-endpoint.json - test-25-contextualize-endpoint.json - test-26-timeline-around-observation.json - test-27-multi-param-combo.json - test-28-file-type-combo.json - Each test result file captures specific search failures or outcomes, including issues with undefined properties and successful execution of search queries. - Enhanced documentation of search architecture and testing strategies, ensuring compliance with established guidelines and improving overall search functionality. * feat: Enhance unified search API with catch-all parameters and backward compatibility - Implemented a unified search API at /api/search that accepts catch-all parameters for filtering by type, observation type, concepts, and files. - Maintained backward compatibility by keeping granular endpoints functional while routing through the same infrastructure. - Completed comprehensive testing of search capabilities with real-world query scenarios. fix: Address missing debug output in search API query tests - Flushed PM2 logs and executed search queries to verify functionality. - Diagnosed absence of "Raw Chroma" debug messages in worker logs, indicating potential issues with logging or query processing. refactor: Improve build and deployment pipeline for claude-mem plugin - Successfully built and synced all hooks and services to the marketplace directory. - Ensured all dependencies are installed and up-to-date in the deployment location. feat: Implement hybrid search filters with 90-day recency window - Enhanced search server to apply a 90-day recency filter to Chroma results before categorizing by document type. fix: Correct parameter handling in searchUserPrompts method - Added support for filter-only queries and improved dual-path logic for clarity. refactor: Rename FTS5 method to clarify fallback status - Renamed escapeFTS5 to escapeFTS5_fallback_when_chroma_unavailable to indicate its temporary usage. feat: Introduce contextualize tool for comprehensive project overview - Added a new tool to fetch recent observations, sessions, and user prompts, providing a quick project overview. feat: Add semantic shortcut tools for common search patterns - Implemented 'decisions', 'changes', and 'how_it_works' tools for convenient access to frequently searched observation categories. feat: Unified timeline tool supports anchor and query modes - Combined get_context_timeline and get_timeline_by_query into a single interface for timeline exploration. feat: Unified search tool added to MCP server - New tool queries all memory types simultaneously, providing combined chronological results for improved search efficiency. * Refactor search functionality to clarify FTS5 fallback usage - Updated `worker-service.cjs` to replace FTS5 fallback function with a more descriptive name and improved error handling. - Enhanced documentation in `SKILL.md` to specify the unified API endpoint and clarify the behavior of the search engine, including the conditions under which FTS5 is used. - Modified `search-server.ts` to provide clearer logging and descriptions regarding the fallback to FTS5 when UVX/Python is unavailable. - Renamed and updated the `SessionSearch.ts` methods to reflect the conditions for using FTS5, emphasizing the lack of semantic understanding in fallback scenarios. * feat: Add ID-based fetch endpoints and simplify mem-search skill **Problem:** - Search returns IDs but no way to fetch by ID - Skill documentation was bloated with too many options - Claude wasn't using IDs because we didn't tell it how **Solution:** 1. Added three new HTTP endpoints: - GET /api/observation/:id - GET /api/session/:id - GET /api/prompt/:id 2. Completely rewrote SKILL.md: - Stripped complexity down to essentials - Clear 3-step prescriptive workflow: Search → Review IDs → Fetch by ID - Emphasized ID usage: "The IDs are there for a reason - USE THEM" - Removed confusing multi-endpoint documentation - Kept only unified search with filters **Impact:** - Token efficiency: Claude can now fetch full details only for relevant IDs - Clarity: One clear workflow instead of 10+ options to choose from - Usability: IDs are no longer wasted context - they're actionable 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: Move internal docs to private directory Moved POSTMORTEM and planning docs to ./private to exclude from PR reviews. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: Remove experimental contextualize endpoint - Removed contextualize MCP tool from search-server (saves ~4KB) - Disabled FTS5 fallback paths in SessionSearch (now vector-first) - Cleaned up CLAUDE.md documentation - Removed contextualize-rewrite-plan.md doc Rationale: - Contextualize is better suited as a skill (LLM-powered) than an endpoint - Search API already provides vector search with configurable limits - Created issue #132 to track future contextualize skill implementation Changes: - src/servers/search-server.ts: Removed contextualize tool definition - src/services/sqlite/SessionSearch.ts: Disabled FTS5 fallback, added deprecation warnings - CLAUDE.md: Cleaned up outdated skill documentation - docs/: Removed contextualize plan document 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: Complete FTS5 cleanup - remove all deprecated search code This completes the FTS5 cleanup work by removing all commented-out FTS5 search code while preserving database tables for backward compatibility. Changes: - Removed 200+ lines of commented FTS5 search code from SessionSearch.ts - Removed deprecated degraded_search_query__when_uvx_unavailable method - Updated all method documentation to clarify vector-first architecture - Updated class documentation to reflect filter-only query support - Updated CLAUDE.md to remove FTS5 search references - Clarified that FTS5 tables exist for backward compatibility only - Updated "Why SQLite FTS5" section to "Why Vector-First Search" Database impact: NONE - FTS5 tables remain intact for existing installations Search architecture: - ChromaDB: All text-based vector search queries - SQLite: Filter-only queries (date ranges, metadata, no query text) - FTS5 tables: Maintained but unused (backward compatibility) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: Remove all FTS5 fallback execution code from search-server Completes the FTS5 cleanup by removing all fallback execution paths that attempted to use FTS5 when ChromaDB was unavailable. Changes: - Removed all FTS5 fallback code execution paths - When ChromaDB fails or is unavailable, return empty results with helpful error messages - Updated all deprecated tool descriptions (search_observations, search_sessions, search_user_prompts) - Changed error messages to indicate FTS5 fallback has been removed - Added installation instructions for UVX/Python when vector search is unavailable - Updated comments from "hybrid search" to "vector-first search" - Removed ~100 lines of dead FTS5 fallback code Database impact: NONE - FTS5 tables remain intact (backward compatibility) Search behavior when ChromaDB unavailable: - Text queries: Return empty results with error explaining ChromaDB is required - Filter-only queries (no text): Continue to work via direct SQLite 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: Address PR 133 review feedback Critical fixes: - Remove contextualize endpoint from worker-service (route + handler) - Fix build script logging to show correct .cjs extension (was .mjs) Documentation improvements: - Add comprehensive FTS5 retention rationale documentation - Include v7.0.0 removal TODO for future cleanup Testing: - Build succeeds with correct output logging - Worker restarts successfully (30th restart) - Contextualize endpoint properly removed (404 response) - Search endpoint verified working This addresses all critical review feedback from PR 133. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
6c9a8d1dca |
fix: improve worker startup on fresh install
This fixes the issue where the worker service wouldn't start automatically after installing the plugin, leaving users with confusing error messages. Changes: - Update worker-utils.ts to use local PM2 from node_modules instead of requiring it in PATH - Improve error messages to suggest npx pm2 commands - Add auto-start attempt in smart-install.js after fresh installation - Fall back gracefully if worker can't start (will auto-start on first use) Fixes issue where users with PM2 not in their PATH couldn't start the worker. |
||
|
|
812de2940d |
feat: Implement Endless Mode Token Economics Calculator
- Added a new script to simulate token savings from Endless Mode using real observation data. - Introduced functions to calculate token costs with and without Endless Mode, showcasing the differences in context handling. - Enhanced output to display detailed token usage statistics and potential savings at scale. - Integrated assumptions for user activity to estimate weekly and annual token savings. - Updated worker-utils to automatically start the worker using PM2 if not running, improving service reliability. |
||
|
|
581e940659 |
Add new SVG icons for "learned" and "next steps" features (#109)
- Introduced icon-thin-learned.svg with detailed path definitions and color styling. - Added icon-thin-next-steps.svg featuring a unique design and color scheme. |
||
|
|
68290a9121 |
Performance improvements: Token reduction and enhanced summaries (#101)
* refactor: Reduce continuation prompt token usage by 95 lines Removed redundant instructions from continuation prompt that were originally added to mitigate a session continuity issue. That issue has since been resolved, making these detailed instructions unnecessary on every continuation. Changes: - Reduced continuation prompt from ~106 lines to ~11 lines (~95 line reduction) - Changed "User's Goal:" to "Next Prompt in Session:" (more accurate framing) - Removed redundant WHAT TO RECORD, WHEN TO SKIP, and OUTPUT FORMAT sections - Kept concise reminder: "Continue generating observations and progress summaries..." - Initial prompt still contains all detailed instructions Impact: - Significant token savings on every continuation prompt - Faster context injection with no loss of functionality - Instructions remain comprehensive in initial prompt Files modified: - src/sdk/prompts.ts (buildContinuationPrompt function) - plugin/scripts/worker-service.cjs (compiled output) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: Enhance observation and summary prompts for clarity and token efficiency * Enhance prompt clarity and instructions in prompts.ts - Added a reminder to think about instructions before starting work. - Simplified the continuation prompt instruction by removing "for this ongoing session." * feat: Enhance settings.json with permissions and deny access to sensitive files refactor: Remove PLAN-full-observation-display.md and PR_SUMMARY.md as they are no longer needed chore: Delete SECURITY_SUMMARY.md since it is redundant after recent changes fix: Update worker-service.cjs to streamline observation generation instructions cleanup: Remove src-analysis.md and src-tree.md for a cleaner codebase refactor: Modify prompts.ts to clarify instructions for memory processing * refactor: Remove legacy worker service implementation * feat: Enhance summary hook to extract last assistant message and improve logging - Added function to extract the last assistant message from the transcript. - Updated summary hook to include last assistant message in the summary request. - Modified SDKSession interface to store last assistant message. - Adjusted buildSummaryPrompt to utilize last assistant message for generating summaries. - Updated worker service and session manager to handle last assistant message in summarize requests. - Introduced silentDebug utility for improved logging and diagnostics throughout the summary process. * docs: Add comprehensive implementation plan for ROI metrics feature Added detailed implementation plan covering: - Token usage capture from Agent SDK - Database schema changes (migration #8) - Discovery cost tracking per observation - Context hook display with ROI metrics - Testing and rollout strategy Timeline: ~20 hours over 4 days Goal: Empirical data for YC application amendment 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: Add transcript processing scripts for analysis and formatting - Implemented `dump-transcript-readable.ts` to generate a readable markdown dump of transcripts, excluding certain entry types. - Created `extract-rich-context-examples.ts` to extract and showcase rich context examples from transcripts, highlighting user requests and assistant reasoning. - Developed `format-transcript-context.ts` to format transcript context into a structured markdown format for improved observation generation. - Added `test-transcript-parser.ts` for validating data extraction from transcript JSONL files, including statistics and error reporting. - Introduced `transcript-to-markdown.ts` for a complete representation of transcript data in markdown format, showing all context data. - Enhanced type definitions in `transcript.ts` to support new features and ensure type safety. - Built `transcript-parser.ts` to handle parsing of transcript JSONL files, including error handling and data extraction methods. * Refactor hooks and SDKAgent for improved observation handling - Updated `new-hook.ts` to clean user prompts by stripping leading slashes for better semantic clarity. - Enhanced `save-hook.ts` to include additional tools in the SKIP_TOOLS set, preventing unnecessary observations from certain command invocations. - Modified `prompts.ts` to change the structure of observation prompts, emphasizing the observational role and providing a detailed XML output format for observations. - Adjusted `SDKAgent.ts` to enforce stricter tool usage restrictions, ensuring the memory agent operates solely as an observer without any tool access. * feat: Enhance session initialization to accept user prompts and prompt numbers - Updated `handleSessionInit` in `worker-service.ts` to extract `userPrompt` and `promptNumber` from the request body and pass them to `initializeSession`. - Modified `initializeSession` in `SessionManager.ts` to handle optional `currentUserPrompt` and `promptNumber` parameters. - Added logic to update the existing session's `userPrompt` and `lastPromptNumber` if a `currentUserPrompt` is provided. - Implemented debug logging for session initialization and updates to track user prompts and prompt numbers. --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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 ( |
||
|
|
6204fe9b9d | refactor: remove startWorker function and adjust installation flow |