Skip to main content
← Back to list
01Issue
BugOpenSwamp CLIPublic
AssigneesNone

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

Open

11/5/2026, 8:10:07 PM

No activity in this phase yet.

03Sludge Pulse

Sign in to post a ripple.