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
-7
View File
@@ -1,7 +0,0 @@
<claude-mem-context>
# Recent Activity
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
*No recent activity*
</claude-mem-context>
-38
View File
@@ -1,38 +0,0 @@
<claude-mem-context>
# Recent Activity
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
### Jan 3, 2026
**result-formatter.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36548 | 9:41 PM | 🟣 | Phase 3 Search Strategy Tests Committed | ~554 |
| #36547 | " | 🟣 | Phase 3 Search Test Suite Committed | ~310 |
| #36543 | 9:40 PM | 🟣 | Phase 3 Search Strategy Tests Completed | ~458 |
| #36540 | 9:39 PM | 🟣 | ResultFormatter Test Suite Created | ~424 |
**search-orchestrator.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36545 | 9:41 PM | 🟣 | Phase 3 Search Strategy Test Suite Completion | ~564 |
| #36544 | 9:40 PM | 🟣 | Phase 3 Search Strategy Test Suite Complete | ~449 |
| #36542 | 9:39 PM | 🔴 | Fixed Empty String Filter Test Expectations | ~260 |
| #36541 | " | 🟣 | SearchOrchestrator Test Suite Implementation | ~588 |
### Jan 4, 2026
**search-orchestrator.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36838 | 1:42 AM | 🔵 | Module-Level Mocking Pattern for Singleton Dependencies | ~420 |
### Jan 5, 2026
**result-formatter.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #37629 | 5:36 PM | 🔵 | Comprehensive Testing Patterns Documentation Generated | ~629 |
| #37623 | 5:34 PM | 🔵 | Bun Test Pattern for Class Methods with Mock Data | ~603 |
</claude-mem-context>
-34
View File
@@ -1,34 +0,0 @@
<claude-mem-context>
# Recent Activity
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
### Jan 3, 2026
**chroma-search-strategy.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36548 | 9:41 PM | 🟣 | Phase 3 Search Strategy Tests Committed | ~554 |
| #36547 | " | 🟣 | Phase 3 Search Test Suite Committed | ~310 |
| #36543 | 9:40 PM | 🟣 | Phase 3 Search Strategy Tests Completed | ~458 |
| #36536 | 9:38 PM | 🟣 | ChromaSearchStrategy Test Suite Created | ~430 |
**sqlite-search-strategy.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36545 | 9:41 PM | 🟣 | Phase 3 Search Strategy Test Suite Completion | ~564 |
| #36544 | 9:40 PM | 🟣 | Phase 3 Search Strategy Test Suite Complete | ~449 |
| #36538 | 9:38 PM | 🟣 | SQLiteSearchStrategy Test Suite Created | ~527 |
**hybrid-search-strategy.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36537 | 9:38 PM | 🟣 | HybridSearchStrategy Test Suite Created | ~435 |
### Jan 5, 2026
**chroma-search-strategy.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #37735 | 6:16 PM | ✅ | Test Suite Audit Report Generated: 41 Tests Scored and Analyzed | ~634 |
</claude-mem-context>