You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After #833 and #942 (both merged 2026-04-21), the repo carries two Stop/PreCompact hook implementations doing the same job with diverging architectures:
mempalace hook run --hook {stop,precompact} --harness claude-code with 3-tier fallback (#942)
Both are user-facing — mempalace init wires one or the other depending on install flavor.
Cost of the split:
Every new knob gets written twice or applies on only one path. MEMPAL_PYTHON is inert on the plugin path; hooks.auto_save (feat: add hooks.auto_save config toggle (silent mode) #711) is only honored wherever the PR author remembers.
Forked test surface — tests/test_hooks_shell.py, tests/test_claude_plugin_hook_wrappers.py, tests/test_hooks_cli.py each cover a different slice.
Proposal:
Reshape hooks/mempal_*_hook.sh to match the plugin wrappers — a 3-tier run_mempalace_hook() function that calls mempalace hook run --hook {stop|precompact} --harness claude-code. All real logic (JSON parsing, exchange counting, 15-message block decision, background mine) already lives in mempalace/hooks_cli.py for the plugin path; any gaps get ported once.
Result: inline python3 -c disappears from bash (killing the three failure modes discussed on #833 for any future mempalace-importing addition), MEMPAL_PYTHON becomes obsolete, and MEMPAL_VERBOSE / hooks.auto_save / future toggles live in one place. Pure refactor — same exchange counts, same block text, same ~/.mempalace/hook_state/hook.log.
After #833 and #942 (both merged 2026-04-21), the repo carries two Stop/PreCompact hook implementations doing the same job with diverging architectures:
hooks/mempal_*_hook.sh(legacy)python3 -c "import json,sys; ..."+ JSONL heredoc, gated onMEMPAL_PYTHON(#833)"$MEMPALACE_BIN" mine(#340).claude-plugin/hooks/mempal-*-hook.sh(plugin)mempalace/hooks_cli.pymempalace hook run --hook {stop,precompact} --harness claude-codewith 3-tier fallback (#942)Both are user-facing —
mempalace initwires one or the other depending on install flavor.Cost of the split:
MEMPAL_PYTHONis inert on the plugin path;hooks.auto_save(feat: add hooks.auto_save config toggle (silent mode) #711) is only honored wherever the PR author remembers.find_python()into both paths rather than collapsing one; feat: add mempalace-mcp entry point for uv compatibility #805 explicitly leaves the legacypython3 -ccalls alone.tests/test_hooks_shell.py,tests/test_claude_plugin_hook_wrappers.py,tests/test_hooks_cli.pyeach cover a different slice.Proposal:
Reshape
hooks/mempal_*_hook.shto match the plugin wrappers — a 3-tierrun_mempalace_hook()function that callsmempalace hook run --hook {stop|precompact} --harness claude-code. All real logic (JSON parsing, exchange counting, 15-message block decision, background mine) already lives inmempalace/hooks_cli.pyfor the plugin path; any gaps get ported once.Result: inline
python3 -cdisappears from bash (killing the three failure modes discussed on #833 for any future mempalace-importing addition),MEMPAL_PYTHONbecomes obsolete, andMEMPAL_VERBOSE/hooks.auto_save/ future toggles live in one place. Pure refactor — same exchange counts, same block text, same~/.mempalace/hook_state/hook.log.Related: #340, #513, #670, #805, #833, #942.