Problem
After using claude-mem for a while, I noticed my machine slowing down significantly. Checked ps aux and found 14+ orphaned claude subagent processes still running in the background, some dating back 3 days.
All of them were children of the worker-service.cjs --daemon process (bun), each consuming 300-600MB of memory.
PID 1172 - started Monday (3 days ago)
PID 51407 - started Tuesday
PID 51593 - started Tuesday
...total 14 orphaned processes
Root cause (what I found)
The Stop hook flow queues /api/sessions/summarize but doesn't call session complete or delete. So from the daemon's perspective, the session stays "active" and the spawned claude subprocess just sits there waiting for more queue input forever.
The internal reaper also skips these because they're tied to "active" sessions.
Steps to reproduce
- Use claude-mem normally across multiple sessions
- Close terminal / end sessions
- After a day or two, run
ps aux | grep claude
- Observe accumulated background claude processes under the worker-service daemon
Workaround
I set up a SessionEnd hook in ~/.claude/settings.json that kills background claude subagent processes older than 5 minutes on session end. Works fine as a band-aid but the daemon itself should handle cleanup.
Suggestion
- Call session complete/delete after summarize finishes in the Stop flow
- Add an idle TTL so stale sessions get cleaned up automatically
- Reconcile orphaned child processes on daemon startup
Environment
- claude-mem 9.0.12
- macOS (Apple Silicon)
- Claude Code CLI
Problem
After using claude-mem for a while, I noticed my machine slowing down significantly. Checked
ps auxand found 14+ orphaned claude subagent processes still running in the background, some dating back 3 days.All of them were children of the
worker-service.cjs --daemonprocess (bun), each consuming 300-600MB of memory.Root cause (what I found)
The Stop hook flow queues
/api/sessions/summarizebut doesn't call session complete or delete. So from the daemon's perspective, the session stays "active" and the spawned claude subprocess just sits there waiting for more queue input forever.The internal reaper also skips these because they're tied to "active" sessions.
Steps to reproduce
ps aux | grep claudeWorkaround
I set up a
SessionEndhook in~/.claude/settings.jsonthat kills background claude subagent processes older than 5 minutes on session end. Works fine as a band-aid but the daemon itself should handle cleanup.Suggestion
Environment