Relationships
#4447 repo upgrade: drop stale Claude audit hooks when claude leaves the tool set
Opened by maphew · 11/5/2026
What
swamp repo upgrade --tool codex (any de-enrolment of claude) removes claude
from the tool list but leaves the two swamp audit record --from-hook hooks in
.claude/settings.local.json. swamp audit --json then reports
supported: false for the new tool set, so the hooks record nothing while still
spawning the swamp binary on every Bash call (~475 ms / ~207 MiB measured on
20261103; ~0.4 s in #2881).
Upgrade output:
Tools: [claude] -> [codex]
claude was dropped from the enrolled tool list. Files in .claude/ were not
deleted - remove them by hand if desired.
Settings: unchangedThe generic .claude/ warning is too broad to be the only signal: these hooks
are a swamp-generated entry in a swamp-managed settings file, not user content.
Repro (swamp 20261022.143020.0-sha.4569663b, Linux)
TMP=$(mktemp -d) && cd "$TMP" && git init -q -b main
swamp repo init --tool claude
jq -c '.hooks|keys' .claude/settings.local.json
# ["PostToolUse","PostToolUseFailure"]
swamp repo upgrade --tool codex
jq -c '.hooks|keys' .claude/settings.local.json
# ["PostToolUse","PostToolUseFailure"] (still both)
swamp audit --json
# { "supported": false, "tool": "codex", ... }
swamp doctor audit
# recording-smoke-test: tool `codex` does not have audit hooks; nothing to check
# skips, so the stale claude hooks are invisible to the doctorExpected
When claude leaves the tool set, remove the hooks whose command contains
swamp audit record --from-hook from .claude/settings.local.json, preserving
permissions.allow and every non-swamp hook.
If automatic removal is deliberately out of scope, then at minimum:
- Make the upgrade warning name the exact hooks that are now inert, not just "files in .claude/".
- Make
swamp doctor auditnotice hooks wired for a tool that is no longer enrolled (today it only looks at the current tool and skips).
Related
- #2881 (shipped): the same settings reconciler in the opposite direction, where upgrade appends a second canonical hook alongside an existing variant.
- #4410 (open):
directclassification of legitimate non-swamp commands. A different problem, but the same per-call cost. - maphew/swamp-beads-starter#1: measured hook cost and candidate fixes.
Please credit maphew as co-author if this becomes a patch.
Open
No activity in this phase yet.
Sign in to post a ripple.