User-level hooks are skipped in untrusted workspaces; they should run regardless of trust
Summary
User-level hooks (~/.claude/settings.json) are not executed in interactive sessions when the current workspace has not accepted the trust dialog. User-level hooks should always run, regardless of workspace trust.
Workspace trust exists to stop untrusted repositories from running their own code through project-level configuration (.claude/settings.json inside the repo). A user's own hooks are not untrusted code: the user wrote them, in the user's home directory, and they apply to every workspace. Many of them are safety guards — for example, a PreToolUse hook that requires confirmation before database commands. Untrusted workspaces are exactly where those guards are needed most. Skipping them there turns a safety mechanism off in the situations it exists for.
Environment
- Claude Code 2.1.284 (native install), Windows 11, Git Bash
- Interactive CLI, permission mode
auto
Steps to reproduce
- Configure a user-level hook in
~/.claude/settings.json:
``json`
"hooks": {
"PreToolUse": [
{ "matcher": "Bash",
"hooks": [{ "type": "command", "command": "python3 guard.py" }] }
]
}
guard.py
where prints {"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"ask"}}`.
- Start an interactive session in a directory whose
hasTrustDialogAcceptedisfalsein~/.claude.json:claude --debug-file debug.txt. - Ask Claude to run any Bash command.
Expected
The user-level hook runs and the permission prompt appears.
Actual
The command runs without a prompt. /hooks still lists the hook. The debug log shows the hook was never started:
[DEBUG] Skipping PreToolUse:Bash hook execution - workspace trust not accepted
[DEBUG] Skipping PostToolUse:Bash hook execution - workspace trust not accepted
[DEBUG] Skipping SessionStart:startup hook execution - workspace trust not accepted
[DEBUG] Skipping StatusLine command execution - workspace trust not accepted
The same hook works in claude -p, where trust verification is disabled: Hook PreToolUse (...) returned permissionDecision: ask.
The user-level statusLine command is skipped for the same reason, so the status line never appears.
Requested fix
Run user-level and managed hooks, and the user-level statusLine, regardless of workspace trust. Gate only project-level configuration on trust.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗