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>
-65
View File
@@ -1,65 +0,0 @@
<claude-mem-context>
# Recent Activity
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
### Jan 3, 2026
**MarkdownFormatter.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36562 | 9:49 PM | 🟣 | Phase 4 Context Generation Tests Completed | ~524 |
| #36561 | " | 🟣 | Phase 4 Context Generation Test Suite Completion | ~606 |
| #36557 | 9:47 PM | 🟣 | MarkdownFormatter Test Suite Created | ~520 |
| #36553 | 9:43 PM | 🔵 | MarkdownFormatter Rendering Functions | ~445 |
| #36552 | " | 🔵 | Context Generation API Documentation for Phase 4 | ~496 |
| #36292 | 8:04 PM | 🔄 | Phase 4 Module Inventory: 12 Files Created in Context Architecture | ~571 |
**ColorFormatter.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36390 | 8:50 PM | 🔄 | Comprehensive Monolith Refactor with Modular Architecture | ~724 |
### Jan 4, 2026
**ColorFormatter.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36949 | 2:45 AM | 🟣 | Added Timestamp to Empty State Context Header | ~268 |
| #36947 | 2:44 AM | 🔵 | ColorFormatter Header Rendering Location Found | ~235 |
| #36946 | " | 🟣 | Context Header Timestamp Display | ~322 |
| #36944 | " | 🔵 | ColorFormatter Architecture - Terminal Context Display | ~374 |
**MarkdownFormatter.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36948 | 2:44 AM | 🔴 | Add Timestamp to Empty State Context Header | ~270 |
| #36945 | " | 🟣 | Context Header Now Displays Current Date and Time | ~303 |
| #36943 | 2:43 AM | 🔵 | MarkdownFormatter Structure for Context Injection | ~346 |
| #36942 | " | 🔵 | Recent Context Feature Architecture | ~300 |
### Jan 5, 2026
**ColorFormatter.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #38048 | 9:45 PM | 🔴 | PR #558 - Comprehensive Bug Fix and Test Quality Improvement | ~585 |
| #37582 | 4:53 PM | 🔴 | Updated ColorFormatter Second mem-search Reference - Phase 2 Complete | ~398 |
| #37581 | " | 🔴 | Updated ColorFormatter First mem-search Reference | ~362 |
| #37577 | 4:52 PM | 🔵 | ColorFormatter Contains Outdated mem-search References | ~395 |
| #37530 | 4:43 PM | 🔵 | Issue #544 Confirmed in ColorFormatter Second Location | ~344 |
**MarkdownFormatter.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #37617 | 5:32 PM | ⚖️ | PR #558 Review Requirements Categorized by Priority | ~637 |
| #37613 | 5:31 PM | 🔵 | PR #558 Review Feedback Analysis | ~544 |
| #37586 | 4:54 PM | 🔴 | Phase 2 Committed - mem-search Hint Messages Fixed | ~375 |
| #37583 | 4:53 PM | 🔴 | Phase 2 Complete - All mem-search References Updated | ~394 |
| #37580 | " | 🔴 | Updated MarkdownFormatter Second mem-search Reference | ~360 |
| #37579 | " | 🔴 | Updated MarkdownFormatter First mem-search Reference | ~350 |
| #37576 | 4:52 PM | 🔵 | MarkdownFormatter Contains Outdated mem-search References | ~372 |
| #37555 | 4:49 PM | 🔵 | Issue #544 Message Locations and Fix Pattern Documented | ~463 |
| #37545 | 4:47 PM | ✅ | Issue #544 Analysis Report Created for mem-search Skill Messaging Problem | ~480 |
| #37529 | 4:42 PM | 🔵 | Issue #544 Misleading mem-search Skill Reference Located | ~368 |
</claude-mem-context>
-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 3, 2026
**FooterRenderer.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36390 | 8:50 PM | 🔄 | Comprehensive Monolith Refactor with Modular Architecture | ~724 |
| #36283 | 8:02 PM | 🔄 | Phase 4: FooterRenderer Extracted with Conditional Display Logic | ~464 |
**TimelineRenderer.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36292 | 8:04 PM | 🔄 | Phase 4 Module Inventory: 12 Files Created in Context Architecture | ~571 |
| #36281 | 8:01 PM | 🔄 | Phase 4: TimelineRenderer Extracted with Dual Format Support | ~531 |
### Jan 5, 2026
**FooterRenderer.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #37545 | 4:47 PM | ✅ | Issue #544 Analysis Report Created for mem-search Skill Messaging Problem | ~480 |
</claude-mem-context>