Skip to main content
← Back to list
01Issue
BugShippedSwamp CLIPublic
Assigneeszack

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: unchanged

The 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 doctor

Expected

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:

  1. Make the upgrade warning name the exact hooks that are now inert, not just "files in .claude/".
  2. Make swamp doctor audit notice hooks wired for a tool that is no longer enrolled (today it only looks at the current tool and skips).
  • #2881 (shipped): the same settings reconciler in the opposite direction, where upgrade appends a second canonical hook alongside an existing variant.
  • #4410 (open): direct classification 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.

02Bog Flow
✓OPEN✓TRIAGED✓IN PROGRESS✓SHIPPED+ 1 MOREASSIGNED+ 8 MOREREVIEW+ 14 MOREPR_LINKED+ 2 MORESESSION_SUMMARIZED

Shipped

11/6/2026, 4:11:32 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
zack assigned zack11/6/2026, 3:01:08 PM
Editable. Press Enter to edit.

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.