refactor: implement in-process worker architecture for hooks (#722)

* fix: stop generating empty CLAUDE.md files

- Return empty string instead of "No recent activity" when no observations exist
- Skip writing CLAUDE.md files when formatted content is empty
- Remove redundant "auto-generated by claude-mem" HTML comment
- Clean up 98 existing empty CLAUDE.md files across the codebase
- Update tests to expect empty string for empty input

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

* build assets

* refactor: implement in-process worker architecture for hooks

Replaces spawn-based worker startup with in-process architecture:
- Hook processes now become the worker when port 37777 is free
- Eliminates Windows spawn issues (NO SPAWN rule)
- SessionStart chains: smart-install && stop && context

Key changes:
- worker-service.ts: hook case starts WorkerService in-process
- hook-command.ts: skipExit option prevents process.exit() when hosting worker
- hooks.json: single chained command replaces separate start/hook commands
- worker-utils.ts: ensureWorkerRunning() returns boolean, doesn't block
- handlers: graceful fallback when worker unavailable

All 761 tests pass. Manual verification confirms hook stays alive as worker.

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

* context

* a

* MAESTRO: Mark PR #722 test verification task complete

All 797 tests passed (3 skipped, 0 failed) after merge conflict resolution.

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

* MAESTRO: Mark PR #722 build verification task complete

* MAESTRO: Mark PR #722 code review task complete

Code review verified:
- worker-service.ts hook case starts WorkerService in-process
- hook-command.ts has skipExit option
- hooks.json uses single chained command
- worker-utils.ts ensureWorkerRunning() returns boolean

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

* MAESTRO: Mark PR #722 conflict resolution push task complete

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

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Alex Newman
2026-02-04 19:49:15 -05:00
committed by GitHub
parent 14ca7cf7d6
commit 4df9f61347
107 changed files with 804 additions and 4493 deletions
-181
View File
@@ -1,181 +0,0 @@
<claude-mem-context>
# Recent Activity
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
### Dec 13, 2025
**useSettings.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #25321 | 9:12 PM | 🔵 | Console.error Usage Found in 29 Files | ~366 |
| #25075 | 7:09 PM | ⚖️ | Complete System Analysis for Embedding Function Configuration | ~497 |
| #25059 | 7:05 PM | 🔵 | UI Settings Hook Pattern | ~320 |
**useGitHubStars.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #25319 | 9:12 PM | 🔵 | Error Throw Locations Identified Across Codebase | ~302 |
### Dec 14, 2025
**useSettings.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #26198 | 8:17 PM | 🔵 | CLAUDE_MEM_MODEL configuration found throughout codebase | ~403 |
### Dec 15, 2025
**useNotifications.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #27281 | 11:00 PM | 🟣 | Queue Monitoring System Extracted to Separate Branch | ~452 |
| #27280 | 10:59 PM | 🔵 | Queue Infrastructure Changes Staged in Branch | ~313 |
| #27279 | " | ✅ | Queue UI Components Built Successfully | ~277 |
**useQueue.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #27272 | 10:58 PM | ✅ | Queue UI Components Extracted to Working Directory | ~235 |
| #27263 | 10:55 PM | ✅ | Extracted queue-specific files from PR-335 | ~284 |
| #27247 | 10:34 PM | 🔵 | useQueue Hook API Integration | ~370 |
**useSSE.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #27248 | 10:34 PM | 🔵 | Server-Sent Events Hook for Real-Time Queue Updates | ~406 |
### Dec 19, 2025
**useContextPreview.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #29947 | 7:03 PM | 🔵 | Context injection endpoint usage across system | ~387 |
### Dec 20, 2025
**useContextPreview.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #30330 | 3:38 PM | 🔴 | TypeScript errors fixed across 21 files with type definitions added | ~378 |
| #30278 | 3:24 PM | 🔴 | Added TypeScript type assertion for projects API response | ~205 |
**usePagination.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #30312 | 3:32 PM | 🔴 | Added explicit type arguments to usePaginationFor calls | ~314 |
| #30311 | " | 🔴 | Updated JSON response type assertion to use generic type | ~317 |
| #30310 | 3:31 PM | 🔴 | Added generic type parameter to usePaginationFor hook | ~356 |
**useStats.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #30291 | 3:26 PM | 🔴 | Added TypeScript type assertion for stats API response | ~239 |
| #30290 | " | 🔵 | useStats hook fetches worker and database statistics | ~288 |
**useSSE.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #30289 | 3:26 PM | 🔴 | Added non-null assertion for data.observation in new_observation handler | ~264 |
| #30285 | 3:25 PM | 🔵 | useSSE hook manages EventSource connection with auto-reconnect capability | ~282 |
| #30284 | " | 🔵 | useSSE hook handles multiple server-sent event types | ~288 |
**useSettings.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #30283 | 3:25 PM | 🔴 | Added TypeScript type assertion for saveSettings API response | ~249 |
| #30282 | " | 🔴 | Added TypeScript type annotation for settings API response | ~82 |
| #30281 | " | 🔵 | useSettings hook lacks type safety for API responses | ~245 |
**useGitHubStars.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #30280 | 3:25 PM | ✅ | Standardized TypeScript type assertion syntax in useGitHubStars | ~204 |
| #30279 | 3:24 PM | 🔵 | useGitHubStars hook already has proper TypeScript typing | ~249 |
### Dec 21, 2025
**useContextPreview.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #31603 | 8:21 PM | 🔵 | Complete Console.* Statement Audit Across Codebase | ~813 |
| #31599 | 8:19 PM | 🔵 | 136 console logging statements found in TypeScript source files | ~538 |
**useSettings.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #31422 | 6:50 PM | 🔵 | Observation Metadata Constants Usage Across Codebase | ~366 |
| #31329 | 5:45 PM | 🔵 | Observation Metadata Integration Across Services and UI | ~403 |
### Dec 22, 2025
**useXFollowers.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #31969 | 9:32 PM | 🟣 | X (Twitter) Follower Count Hook Created | ~210 |
### Dec 25, 2025
**useSettings.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #32789 | 9:49 PM | 🟣 | Gemini AI Provider Integration Merged to Main | ~409 |
| #32559 | 8:18 PM | 🔵 | Listed files changed in the current branch | ~169 |
**useSpinningFavicon.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #32646 | 8:48 PM | 🔵 | Existing Spinning Favicon Implementation | ~297 |
| #32516 | 6:58 PM | 🟣 | Spinning favicon animation during processing | ~347 |
**useSSE.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #32580 | 8:22 PM | 🔵 | Grep for resetStuckMessages and processing | ~242 |
| #32558 | 8:18 PM | 🔵 | Identified files containing 'summary' or 'Summary' | ~167 |
### Jan 1, 2026
**useContextPreview.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #35688 | 11:49 PM | 🔵 | Context Preview Hook with Project Selection | ~472 |
**useSettings.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #35686 | 11:49 PM | 🔵 | Settings Management Hook Implementation | ~529 |
| #35485 | 9:06 PM | ⚖️ | Comprehensive error handling remediation plan completed and submitted for approval | ~555 |
| #35469 | 9:02 PM | 🔵 | Proper error handling in settings save function | ~268 |
**useSSE.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #35684 | 11:49 PM | 🔵 | Server-Sent Events Hook Implementation | ~484 |
**usePagination.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #35683 | 11:48 PM | 🔵 | Pagination Hook Implementation Structure | ~439 |
### Jan 2, 2026
**usePagination.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #35875 | 2:39 PM | 🔵 | Logging UI Architecture Mapped | ~599 |
| #35838 | 2:30 PM | 🔵 | Pagination hook pattern with offset tracking and filter reset | ~272 |
### Jan 5, 2026
**CLAUDE.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #38078 | 9:54 PM | ✅ | CLAUDE.md Documentation Cleanup - 1,233 Lines Removed Across 18 Files | ~590 |
**useSettings.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #37995 | 9:01 PM | 🔵 | CLAUDE_MEM_WORKER_HOST setting implementation pattern | ~304 |
| #37990 | 9:00 PM | 🔵 | CLAUDE_MEM_WORKER_HOST setting used across 19 files | ~289 |
</claude-mem-context>