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
-115
View File
@@ -1,115 +0,0 @@
<claude-mem-context>
# Recent Activity
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
### Dec 18, 2025
**README.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #29649 | 6:08 PM | 🟣 | Created ragtime README with dual-license documentation | ~304 |
**LICENSE**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #29648 | 6:08 PM | ✅ | Added PolyForm Non-commercial LICENSE to ragtime | ~172 |
### Dec 19, 2025
**context-builder.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #30238 | 8:44 PM | 🔵 | Context builder creates investigation-style prompts from observations and summaries | ~441 |
| #30215 | 8:38 PM | 🟣 | RAGTIME Agent SDK Plugin Loading Implementation | ~388 |
| #30194 | 8:34 PM | 🟣 | Progressive Context Builder for Email Analysis | ~400 |
| #30139 | 8:18 PM | 🟣 | RAGTIME Plugin Loading Implementation Committed | ~382 |
| #30138 | " | ✅ | RAGTIME Scripts Reorganized into Dedicated Directory | ~254 |
**email-loader.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #30235 | 8:43 PM | 🔵 | Email loader supports JSONL, index.json, and legacy JSON formats | ~393 |
| #30230 | 8:41 PM | 🔵 | Email Loader Multi-Format Parser Architecture | ~362 |
| #30193 | 8:33 PM | 🟣 | Multi-Format Email Corpus Loader | ~347 |
**ragtime.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #30234 | 8:43 PM | 🔵 | RAGTIME uses Agent SDK query API with plugin loading | ~359 |
| #30228 | 8:41 PM | 🔵 | Per-Session Mode System Integration Architecture Mapped | ~735 |
| #30227 | " | 🟣 | RAGTIME Email Processing with Temp File Strategy | ~463 |
| #30221 | 8:39 PM | 🟣 | Email Investigation Mode for RAGTIME | ~502 |
| #30214 | 8:38 PM | 🔵 | RAGTIME Plugin Configuration Pattern | ~303 |
| #30189 | 8:33 PM | 🔵 | RAGTIME Email Processor Core Implementation | ~420 |
| #30143 | 8:20 PM | ✅ | Modified RAGTIME to write emails to temp files for Read tool access | ~319 |
| #30141 | 8:19 PM | ⚖️ | Simplified RAGTIME Prompt to Minimal Recursive Form | ~443 |
| #30136 | 8:17 PM | 🔄 | Switched Email Processor from Session API to Query API | ~334 |
| #30134 | 8:16 PM | ✅ | Switched RAGTIME from V2 unstable_v2_createSession to V1 query API | ~377 |
| #30126 | 8:15 PM | 🔄 | RAGTIME Migrated from Agent SDK v1 query() to v2 createSession() API | ~413 |
| #30125 | " | 🔄 | Ragtime Scripts Moved to Dedicated Ragtime Directory | ~230 |
**README.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #30195 | 8:34 PM | 🔵 | RAGTIME Module Licensed Under PolyForm Noncommercial | ~232 |
| #30122 | 8:14 PM | 🔵 | RAGTIME README Content Defines Noncommercial License Boundaries | ~380 |
**LICENSE**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #30120 | 8:14 PM | 🔵 | Complete RAGTIME Dual-License Implementation Timeline | ~513 |
| #30119 | 8:13 PM | 🔵 | RAGTIME Dual-License Architecture with PolyForm Non-Commercial | ~345 |
### Dec 20, 2025
**ragtime.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #31289 | 9:40 PM | 🔵 | Memory System Contains 50 Architectural Decisions Across Multiple Initiatives | ~419 |
| #30377 | 4:04 PM | ✅ | Added debugging output to RAGTIME email processor | ~327 |
| #30376 | 4:03 PM | 🔵 | RAGTIME email investigation script architecture | ~437 |
| #30349 | 3:50 PM | 🔄 | ProcessEmail Function Simplified to Use File Path Prompt | ~304 |
| #30348 | " | 🔄 | Ragtime Script Refactored to Use Directory-Based Markdown Emails | ~298 |
| #30343 | 3:43 PM | ✅ | Removed Progress Logging from Email Processing Loop | ~233 |
| #32278 | 3:37 PM | ✅ | Project name configured for email investigation | ~197 |
| #30253 | 3:17 PM | 🔵 | Agent SDK Integration Throughout Codebase | ~402 |
| #32277 | 8:04 PM | 🔵 | Email Processing Pipeline in Ragtime | ~308 |
**export-to-markdown.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #30345 | 3:46 PM | 🟣 | Email to Markdown Export Script | ~182 |
**email-loader.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #30344 | 3:44 PM | 🔵 | Email Loader Supports Three Format Types | ~388 |
| #30246 | 3:12 PM | 🔵 | Email Corpus Loader With Multiple Format Support | ~502 |
### Dec 22, 2025
**README.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #31865 | 6:56 PM | ✅ | 開発ドキュメントのクリーンアップをコミット | ~150 |
| #31864 | " | ✅ | 計画ドキュメントと分析ファイルの削除 | ~142 |
| #31863 | " | ✅ | Ragtime READMEに未実装状態と前提条件を文書化 | ~181 |
| #31861 | 6:55 PM | 🔵 | ragtimeディレクトリのライセンス構造の確認 | ~126 |
| #31858 | " | ✅ | 計画ドキュメントの削除とragtimeスタブの整理 | ~110 |
### Dec 24, 2025
**ragtime.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #32211 | 8:17 PM | 🔵 | RAGTIME batch processing script for sequential file analysis | ~421 |
| #32310 | 3:54 PM | 🔴 | Fixed email processing order in ragtime script | ~274 |
### Dec 25, 2025
**ragtime.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #32456 | 5:41 PM | ✅ | Completed merge of main branch into feature/titans-phase1-3 | ~354 |
</claude-mem-context>