Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 7 additions & 23 deletions .claude-plugin/hooks/mempal-precompact-hook.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
#!/bin/bash
# MemPalace PreCompact Hook — thin wrapper calling Python CLI
# All logic lives in mempalace.hooks_cli for cross-harness extensibility
run_mempalace_hook() {
if command -v mempalace >/dev/null 2>&1; then
mempalace hook run "$@"
return $?
fi

if command -v python3 >/dev/null 2>&1 && python3 -c "import mempalace" >/dev/null 2>&1; then
python3 -m mempalace hook run "$@"
return $?
fi

if command -v python >/dev/null 2>&1 && python -c "import mempalace" >/dev/null 2>&1; then
python -m mempalace hook run "$@"
return $?
fi

echo "MemPalace hook error: could not find a runnable mempalace command or module" >&2
return 1
}

run_mempalace_hook --hook precompact --harness claude-code
# MemPalace PreCompact Hook
# This hook MUST allow compaction to proceed. The previous implementation
# routed through `mempalace hook run --hook precompact --harness claude-code`
# which always returned a "block" decision, preventing both `/compact` and
# auto-compact from working as documented.
# Session saving is unaffected — it happens via the Stop hook (separate path).
echo '{"decision": "allow"}'