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
-58
View File
@@ -1,58 +0,0 @@
<claude-mem-context>
# Recent Activity
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
### Nov 5, 2025
**data.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #4057 | 10:48 PM | 🟣 | Web-Based Viewer UI for Real-Time Memory Stream | ~610 |
| #3956 | 9:10 PM | 🔄 | Extracted mergeAndDeduplicateByProject helper function to eliminate duplicate filtering logic | ~404 |
**formatters.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #3960 | 9:11 PM | 🟣 | Added formatDate utility function to formatters.ts | ~268 |
| #3865 | 7:17 PM | 🔄 | Extracted formatting utilities into shared module | ~337 |
### Nov 7, 2025
**data.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #4726 | 8:28 PM | ✅ | Merged PR #70 with project filter improvements to main branch | ~382 |
| #4715 | 8:04 PM | ✅ | Committed PR feedback fixes to bugfix/project-filter branch | ~337 |
| #4712 | " | 🔄 | Simplified validation in data.ts mergeAndDeduplicateByProject | ~249 |
| #4692 | 7:44 PM | 🔴 | Fixed Critical Project Filter Synchronization Issues in Viewer UI | ~435 |
| #4690 | " | 🟣 | Enhanced Session and Summary Handling with Filtering and Pagination | ~420 |
| #4667 | 7:32 PM | 🔵 | Examined Data Utility for Merging SSE and Paginated Items | ~422 |
| #4660 | 7:29 PM | 🔴 | Fixed project filtering in UI header | ~328 |
### Dec 2, 2025
**formatNumber.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #19683 | 11:53 PM | 🔵 | PR Diff Shows 3,140 Insertions Across 17 Files | ~331 |
| #19220 | 6:06 PM | ✅ | GitHub Stars Button Component Deployed to Production | ~256 |
| #19214 | 6:03 PM | 🟣 | Number Formatting Utility Created | ~402 |
**textDiff.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #19556 | 10:54 PM | 🟣 | Implemented prefix/suffix token diff algorithm | ~364 |
**ansiTokenizer.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #19555 | 10:54 PM | 🟣 | ANSI Tokenizer Utility Created | ~447 |
### Dec 11, 2025
**data.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #23959 | 1:58 PM | 🔵 | TypeScript Codebase Architecture Mapped | ~337 |
</claude-mem-context>