Relationships
#4009 Claude audit hook misses PowerShell tool calls and sessions started above the swamp repo
Opened by mtaylor · 10/27/2026
What happens
The agent audit hook that swamp repo init --tool claude writes records nothing in two common setups.
PowerShell on Windows. The hook in
.claude/settings.local.jsonmatches"matcher": "Bash". On Windows, Claude Code also has aPowerShelltool. Swamp commands run through it never reachswamp audit record --from-hook, so they're missing fromswamp audit.Sessions started above the swamp repo. Claude Code reads project settings, including hooks, only from the directory the session was started in. With several swamp repos in one git repo (for example
repo/swamp/<name>/, each with its own.swamp.yaml), a session started at the git root and working inswamp/<name>/never loads that repo's hook. I checked one such checkout: of more than 30 swamp repos, only three had anycommands-*.jsonl, and only for days when a session was started inside that repo.
Expected
Every swamp command an agent runs is recorded in the repo it ran in.
Suggestions
- Match
Bash|PowerShell(and normalize the PowerShell payload) in the Claude hook that init, upgrade andmergeAuditHookswrite. - Offer a user-level install, for example
swamp audit install --user, which adds the hook to~/.claude/settings.json.audit record --from-hookalready finds the repo from the payload'scwdand drops rows outside an initialized repo, so one global hook would cover every repo without writing.swamp/anywhere new. - Have
swamp doctor auditwarn when the hook can't fire for the usual way a repo is opened, such as a parent directory that is itself a git root.
Environment
swamp 20261022.021804.0-sha.983e2929, Windows 11, Claude Code with Bash and PowerShell tools.
Open
No activity in this phase yet.
Sign in to post a ripple.