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
-77
View File
@@ -1,77 +0,0 @@
<claude-mem-context>
# Recent Activity
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
### Dec 7, 2025
**PrivacyCheckValidator.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #21829 | 11:05 PM | 🔄 | Massive refactor adds 8,671 lines and removes 5,585 lines across 60 files | ~619 |
| #21820 | 10:59 PM | 🔵 | PrivacyCheckValidator used twice in SessionRoutes for observation and summarize endpoints | ~303 |
| #21814 | 10:58 PM | 🔵 | PrivacyCheckValidator centralizes user prompt privacy validation | ~359 |
| #21807 | 10:49 PM | ⚖️ | KISS Audit Identified 587 Lines of Ceremonial Complexity | ~699 |
| #21797 | 10:46 PM | 🔵 | PrivacyCheckValidator Implements Single Validation Method | ~349 |
| #21770 | 10:36 PM | 🟣 | Implemented PrivacyCheckValidator for Centralized Privacy Validation | ~318 |
### Dec 8, 2025
**PrivacyCheckValidator.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #22274 | 9:22 PM | 🔵 | Event-Driven Architecture for SDK Response Coordination Fully Mapped | ~1136 |
| #22270 | 9:12 PM | 🔵 | DRY violations identified in endless-mode-v7.1 branch | ~553 |
### Dec 9, 2025
**PrivacyCheckValidator.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #22808 | 2:01 PM | 🔵 | Logger Utility Pattern Identified | ~300 |
| #22750 | 1:27 PM | 🔵 | PrivacyCheckValidator Centralizes Privacy Logic | ~450 |
### Dec 11, 2025
**PrivacyCheckValidator.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #23962 | 1:59 PM | 🔵 | Services Layer Implements Full Backend Architecture | ~490 |
### Dec 20, 2025
**PrivacyCheckValidator.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #30609 | 5:01 PM | 🔄 | Phase 4: Eliminated Over-Engineering in Hook/Worker System | ~504 |
| #30598 | 5:00 PM | 🔄 | Removed PrivacyCheckValidator module | ~201 |
| #30549 | 4:53 PM | 🔵 | PrivacyCheckValidator for User Prompt Filtering | ~325 |
### Dec 24, 2025
**PrivacyCheckValidator.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #32153 | 6:40 PM | 🔵 | Session Identifier Architecture Across Codebase | ~529 |
### Dec 25, 2025
**PrivacyCheckValidator.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #32580 | 8:22 PM | 🔵 | Grep for resetStuckMessages and processing | ~242 |
### Dec 28, 2025
**PrivacyCheckValidator.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #33439 | 10:15 PM | 🔄 | Extended Session ID Renaming to Additional Codebase Components | ~352 |
### Jan 2, 2026
**PrivacyCheckValidator.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #35951 | 4:42 PM | 🔵 | Multi-Layer Service Architecture Discovery | ~395 |
</claude-mem-context>