Relationships
#4447 repo upgrade: drop stale Claude audit hooks when claude leaves the tool set
Opened by maphew · 11/5/2026· Shipped 11/6/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.
Shipped
Click a lifecycle step above to view its details.
zack commented 11/6/2026, 4:11:33 PM
Thanks @maphew for reporting this! We shipped: Add swamp repo prune, a separate deliberate command that removes the settings swamp manages (audit hook entries, managed plugin files, the Kiro swamp agent) for built-in tools no longer enrolled, keeping every user entry and permissions. repo upgrade and repo init with force keep deleting nothing, but where they report that a dropped tool's files were not deleted they now name the stale settings files and suggest swamp repo prune.. The fix has been merged and a release is on its way. We appreciate your contribution to swamp.
Sign in to post a ripple.