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
-26
View File
@@ -1,26 +0,0 @@
<claude-mem-context>
# Recent Activity
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
### Jan 5, 2026
**CLAUDE.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #38082 | 10:13 PM | ✅ | Merge Conflict Resolution - Kept Feature Branch Versions | ~431 |
**settings-defaults-manager.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #37811 | 6:43 PM | 🔵 | SettingsDefaultsManager Tests Still Fail With Gemini Test Due to Mock | ~384 |
| #37797 | 6:41 PM | 🔴 | Logger Coverage Test Now Passes With Other Tests After Exclusion | ~311 |
| #37796 | 6:40 PM | 🔴 | Utils and Shared Tests Pass When Run Together | ~342 |
| #37787 | 6:38 PM | 🔴 | SettingsDefaultsManager Tests Pass When Run In Isolation | ~356 |
| #37782 | 6:36 PM | 🔵 | SettingsDefaultsManager Methods Appear Undefined in Tests | ~325 |
| #37777 | " | 🔴 | Phase 1 Test Cleanup Completed - 6 Low-Quality Test Files Deleted | ~430 |
| #37770 | 6:34 PM | 🔵 | Settings-defaults-manager test file contains tests for methods that don't exist on implementation | ~491 |
| #37657 | 5:51 PM | 🔵 | SettingsDefaultsManager test imports SettingsDefaultsManager creating circular dependency trigger | ~434 |
| #37640 | 5:40 PM | 🟣 | SettingsDefaultsManager Test Suite Passes All 27 Tests With Expected Warnings | ~577 |
| #37636 | 5:39 PM | 🟣 | Created Comprehensive SettingsDefaultsManager Test Suite | ~577 |
</claude-mem-context>