Skip to content

Commit 9149456

Browse files
jpheinclaude
andcommitted
fix(hooks): honor silent_save when stop_hook_active is set
Claude Code 2.1.114 passes stop_hook_active:true on every Stop fire after the first in a session (plugin-dispatched hooks in particular). The legacy guard at line 426 was written for block-mode, where a re-fire with the flag set meant "you already blocked, don't block again" — correct loop prevention when the hook returns {"decision":"block"}. Silent-save mode (default since MemPalace#673) never blocks — it saves directly and returns. The flag is meaningless there, so the old guard was suppressing every auto-save after the first one in a Claude Code session. Symptom: terminal never shows the "✦ N memories woven" notification again, hook.log stays silent, save marker stuck. Fix: only skip on stop_hook_active when block mode is configured. Silent mode runs through as normal — the save is deterministic and idempotent, no loop risk. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 109d7f2 commit 9149456

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

mempalace/hooks_cli.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,19 @@ def hook_stop(data: dict, harness: str):
209209
stop_hook_active = parsed["stop_hook_active"]
210210
transcript_path = parsed["transcript_path"]
211211

212-
# If already in a save cycle, let through (infinite-loop prevention)
212+
# If already in a block-mode save cycle, let through (infinite-loop prevention).
213+
# Silent mode saves directly without returning {"decision":"block"}, so there's
214+
# no loop to prevent — and Claude Code's plugin dispatch sets this flag on every
215+
# fire after the first, which would otherwise suppress all subsequent auto-saves.
213216
if str(stop_hook_active).lower() in ("true", "1", "yes"):
214-
_output({})
215-
return
217+
try:
218+
from .config import MempalaceConfig
219+
silent_guard = MempalaceConfig().hook_silent_save
220+
except Exception:
221+
silent_guard = True
222+
if not silent_guard:
223+
_output({})
224+
return
216225

217226
# Count human messages
218227
exchange_count = _count_human_messages(transcript_path)

0 commit comments

Comments
 (0)