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
-23
View File
@@ -1,23 +0,0 @@
<claude-mem-context>
# Recent Activity
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
### Nov 6, 2025
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #4091 | 1:12 PM | 🔵 | Claude Plugin Configuration Structure | ~170 |
### Nov 9, 2025
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #5739 | 4:43 PM | 🔵 | Plugin Metadata Configuration | ~199 |
### Dec 8, 2025
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #22284 | 9:41 PM | 🔵 | Claude Plugin Metadata Configuration | ~183 |
</claude-mem-context>
-18
View File
@@ -1,18 +0,0 @@
<claude-mem-context>
# Recent Activity
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
### Oct 25, 2025
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #2437 | 4:32 PM | 🟣 | Slash Command Files Created for Quick Settings Toggling | ~478 |
### Jan 10, 2026
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #39052 | 3:44 PM | 🟣 | Commands added to plugin distribution | ~268 |
| #39050 | " | 🔵 | Plugin commands directory is empty | ~255 |
</claude-mem-context>
-2
View File
@@ -1,8 +1,6 @@
<claude-mem-context>
# Recent Activity
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
### Oct 25, 2025
| ID | Time | T | Title | Read |
+2 -2
View File
@@ -19,8 +19,8 @@
"hooks": [
{
"type": "command",
"command": "bun \"${CLAUDE_PLUGIN_ROOT}/scripts/worker-service.cjs\" hook claude-code context",
"timeout": 60
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/smart-install.js\" && bun \"${CLAUDE_PLUGIN_ROOT}/scripts/worker-service.cjs\" stop && bun \"${CLAUDE_PLUGIN_ROOT}/scripts/worker-service.cjs\" hook claude-code context",
"timeout": 300
},
{
"type": "command",
-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>
-2
View File
@@ -1,8 +1,6 @@
<claude-mem-context>
# Recent Activity
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
### Dec 4, 2025
| ID | Time | T | Title | Read |
-17
View File
@@ -1,17 +0,0 @@
<claude-mem-context>
# Recent Activity
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
### Nov 18, 2025
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #11179 | 4:09 AM | 🔵 | Search skill uses unified endpoint but lacks ID-based lookup instructions | ~370 |
### Dec 28, 2025
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #33558 | 11:05 PM | 🔵 | Current mem-search skill workflow documentation | ~446 |
</claude-mem-context>
-62
View File
@@ -1,62 +0,0 @@
<claude-mem-context>
# Recent Activity
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
### Nov 5, 2025
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #3910 | 8:28 PM | ✅ | Refined stats counter visual design | ~343 |
| #3909 | " | 🟣 | Added clarifying descriptions to settings UI | ~335 |
| #3812 | 6:08 PM | 🟣 | Enhanced card typography and centered content layout | ~358 |
### Nov 8, 2025
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #5133 | 7:29 PM | ✅ | Version 5.2.3 Released with Build Process | ~487 |
| #4916 | 1:49 PM | ⚖️ | Claude Mem Pro Premium Offering Implementation Plan Finalized | ~946 |
| #4902 | 1:35 PM | 🟣 | Claude Mem Pro Premium Project Initialization | ~679 |
| #4901 | 1:31 PM | ⚖️ | Premium claude-mem Project Architecture and Planning | ~797 |
### Dec 1, 2025
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #18480 | 3:39 PM | ✅ | Successfully Rebuilt Plugin After Merge Conflict Resolution | ~294 |
### Dec 4, 2025
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #20052 | 3:23 PM | ✅ | Built and deployed version 6.5.2 to marketplace | ~321 |
### Dec 9, 2025
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #22557 | 1:08 AM | ✅ | Build completed for version 7.0.3 | ~342 |
### Dec 10, 2025
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #23444 | 2:25 PM | 🟣 | Build Pipeline Execution Successful | ~293 |
### Dec 16, 2025
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #27554 | 4:48 PM | ✅ | Project built successfully with version 7.3.1 | ~306 |
### Dec 26, 2025
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #32983 | 11:04 PM | 🟣 | Complete build and deployment pipeline executed | ~260 |
| #32965 | 10:53 PM | 🔵 | Found plugin/ui/viewer.html - potential styling source | ~201 |
| #32966 | " | 🔵 | viewer.html contains modal CSS including modal-header and modal-body | ~218 |
| #32967 | " | 🔵 | ContextSettingsModal.tsx uses CSS classes defined in viewer.html | ~218 |
| #32968 | " | 🔵 | Need to add CSS for footer to viewer.html | ~223 |
</claude-mem-context>
-99
View File
@@ -1,99 +0,0 @@
<claude-mem-context>
# Recent Activity
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
### Nov 7, 2025
**monaspace-radon-var.woff**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #4722 | 8:25 PM | ✅ | Rebuilt and deployed claude-mem plugin version 5.2.0 | ~324 |
| #4675 | 7:37 PM | ✅ | Claude-mem plugin v5.2.0 build and deployment | ~346 |
### Nov 9, 2025
**monaspace-radon-var.woff**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #6126 | 10:55 PM | ✅ | Deployed claude-mem plugin to marketplace and restarted worker | ~332 |
### Nov 11, 2025
**monaspace-radon-var.woff**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #7207 | 8:02 PM | ✅ | Built and Deployed claude-mem v5.5.1 to Marketplace | ~318 |
### Nov 19, 2025
**monaspace-radon-var.woff**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #11816 | 3:41 PM | ✅ | Build and deployment of claude-mem version 6.0.9 completed successfully | ~421 |
| #11786 | 3:13 PM | ✅ | Build, sync, and restart worker after UI changes | ~329 |
### Nov 21, 2025
**monaspace-radon-var.woff**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #13523 | 5:13 PM | ✅ | Claude-mem v6.0.9 built and deployed to marketplace | ~332 |
| #13143 | 1:13 AM | ✅ | Build and Sync of claude-mem Plugin Version 6.0.9 | ~365 |
| #13093 | 12:54 AM | ✅ | Build, Sync, and Restart Worker Service Deployment | ~371 |
### Dec 2, 2025
**monaspace-radon-var.woff**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #19569 | 11:01 PM | ✅ | Version 6.4.9 Build and Deployment | ~340 |
| #19566 | 10:59 PM | ✅ | Build and Deploy Complete for claude-mem 6.4.9 | ~328 |
| #19497 | 10:37 PM | ✅ | Synced UX improvements to marketplace and restarted worker | ~295 |
| #19464 | 10:04 PM | ✅ | Built and deployed claude-mem version 6.4.9 | ~284 |
### Dec 5, 2025
**monaspace-radon-var.woff**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #20972 | 11:41 PM | ✅ | Built and synced claude-mem v6.5.3 to marketplace | ~436 |
| #20923 | 11:14 PM | 🟣 | Built and deployed claude-mem v6.5.3 to marketplace | ~359 |
### Dec 7, 2025
**monaspace-radon-var.woff**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #21627 | 9:20 PM | ✅ | Claude-Mem v6.5.3 Built and Deployed to Marketplace | ~378 |
| #21424 | 7:27 PM | ✅ | Full build and deployment of claude-mem 6.5.3 completed | ~361 |
| #21174 | 4:58 PM | ✅ | Build and deployment of claude-mem v6.5.3 | ~359 |
### Dec 8, 2025
**monaspace-radon-var.woff**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #22365 | 11:52 PM | ✅ | Build and sync version 7.0.0 to marketplace | ~392 |
### Dec 10, 2025
**monaspace-radon-var.woff**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #23405 | 2:14 PM | ✅ | Claude-mem v7.0.7 Build, Sync, and Worker Restart Completed | ~380 |
### Dec 25, 2025
*****
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #32643 | 8:46 PM | ✅ | Plugin Build and Marketplace Synchronization | ~336 |
### Dec 26, 2025
**monaspace-radon-var.woff**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #32975 | 11:04 PM | ✅ | Build and sync pipeline completed successfully | ~208 |
</claude-mem-context>