-
Notifications
You must be signed in to change notification settings - Fork 276
Open
Description
Bug
The memory daemon (memory_daemon.py) is never auto-started on session start. The ensure_memory_daemon() function exists in the Python version of the session start hook but the TypeScript/MJS version (which is actually registered and runs) has no memory daemon logic.
Result
archival_memorytable stays empty — no learnings are ever auto-extracted from ended sessions- Users have no visibility into this unless they manually check
~/.claude/memory-daemon.pid
Root Cause
Two parallel implementations of the session start hook diverged:
| File | Has ensure_memory_daemon()? |
Registered in settings.json? |
|---|---|---|
session_start_continuity.py (Python) |
Yes (line 197, called at line 659) | No — never referenced anywhere |
session-start-continuity.mjs (TypeScript) |
No — 0 references to "memory" or "daemon" | Yes — node $HOME/.claude/hooks/dist/session-start-continuity.mjs |
This has been the case since the initial release (f8d7173). The Python file has always had the function, the MJS file has never had it, and settings.json has always pointed to the MJS file.
Verification
# MJS has zero memory/daemon references:
grep -c -i "memory\|daemon" .claude/hooks/dist/session-start-continuity.mjs
# → 0
# TS source also has zero:
grep -c -i "memory\|daemon" .claude/hooks/src/session-start-continuity.ts
# → 0
# Only MJS is registered:
grep "session.start.continuity" .claude/settings.json
# → "command": "node $HOME/.claude/hooks/dist/session-start-continuity.mjs"
# Python file is never referenced:
grep -rn "session_start_continuity.py" .claude/settings.json .claude/hooks/
# → (empty)
# But Python has the logic:
grep -n "ensure_memory_daemon" .claude/hooks/session_start_continuity.py
# → 197:def ensure_memory_daemon() -> str | None:
# → 659: memory_status = ensure_memory_daemon()Secondary Issues (in ensure_memory_daemon() itself)
Even once wired up, the function has observability gaps:
stderr=subprocess.DEVNULL(line 245) — daemon startup errors are swallowed- Returns
"Started"even if daemon crashes immediately (line 248) — fire-and-forgetPopen - Script-not-found is silent (line 250) —
return Nonewith no log or warning - No PEP 723 metadata in
memory_daemon.py—from dotenv import load_dotenvmay fail underuv run
Suggested Fix
Port ensure_memory_daemon() to the TypeScript version (session-start-continuity.ts):
function ensureMemoryDaemon(): string | null {
const pidFile = path.join(os.homedir(), '.claude', 'memory-daemon.pid');
// Check if already running via PID file + kill -0
// If not, spawn: uv run <daemon_script> start
// Return status string for additionalContext
}Alternatives:
- Register the Python file as a second SessionStart hook
- Consolidate both hooks into one language
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels