fix(uninstall): memorable_recall goes off whether or not state is kept

gstack-config resolves its root through GSTACK_STATE_ROOT/GSTACK_HOME, which
can differ from the STATE_DIR uninstall removes; a full uninstall could leave
memorable_recall=on in a config that survived. Flipped only when currently on.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-09-09 03:19:04 +00:00
co-authored by Claude Fable 5.1
parent 391bc8445f
commit 16af019e42
+7 -3
View File
@@ -138,6 +138,7 @@ fi
# `rm -rf ~/.claude/skills/gstack` silently no-ops and orphans every hook. # `rm -rf ~/.claude/skills/gstack` silently no-ops and orphans every hook.
SETTINGS_HOOK="$(dirname "$0")/gstack-settings-hook" SETTINGS_HOOK="$(dirname "$0")/gstack-settings-hook"
SESSION_UPDATE="$(dirname "$0")/gstack-session-update" SESSION_UPDATE="$(dirname "$0")/gstack-session-update"
GSTACK_CONFIG="$(dirname "$0")/gstack-config"
if [ -x "$SETTINGS_HOOK" ]; then if [ -x "$SETTINGS_HOOK" ]; then
"$SETTINGS_HOOK" remove "$SESSION_UPDATE" && REMOVED+=("SessionStart hook") || true "$SETTINGS_HOOK" remove "$SESSION_UPDATE" && REMOVED+=("SessionStart hook") || true
# Cathedral T8 cleanup: also remove plan-tune PreToolUse + PostToolUse hooks. # Cathedral T8 cleanup: also remove plan-tune PreToolUse + PostToolUse hooks.
@@ -163,9 +164,12 @@ if [ -x "$SETTINGS_HOOK" ]; then
if "$SETTINGS_HOOK" remove-source --source gstack-memorable | grep -q "removed [1-9]"; then if "$SETTINGS_HOOK" remove-source --source gstack-memorable | grep -q "removed [1-9]"; then
REMOVED+=("Memorable UserPromptSubmit hook (Memorable's own consent is unchanged: memorable disable | memorable forget)") REMOVED+=("Memorable UserPromptSubmit hook (Memorable's own consent is unchanged: memorable disable | memorable forget)")
fi fi
# A kept config must never say memorable_recall=on with no hook behind it. # The consent key must never outlive the hook, kept state or not: gstack-config
if [ "$KEEP_STATE" -eq 1 ] && [ -x "$(dirname "$0")/gstack-config" ]; then # resolves its root through GSTACK_STATE_ROOT/GSTACK_HOME, which can be a
"$(dirname "$0")/gstack-config" set memorable_recall off >/dev/null 2>&1 || true # different directory from the STATE_DIR removed below. Only flipped when it
# is actually on, so no config file is created just to say off.
if [ -x "$GSTACK_CONFIG" ] && [ "$("$GSTACK_CONFIG" get memorable_recall 2>/dev/null)" = "on" ]; then
"$GSTACK_CONFIG" set memorable_recall off >/dev/null 2>&1 || true
fi fi
# Identity sweep for untagged strays (Claude Code strips _gstack_source # Identity sweep for untagged strays (Claude Code strips _gstack_source
# tags; pre-v1.67 setups baked worktree paths). Removes every gstack-owned # tags; pre-v1.67 setups baked worktree paths). Removes every gstack-owned