`if` property on hooks stripped when settings.json is rewritten by `/model`
Resolved 💬 3 comments Opened Apr 1, 2026 by maxcollie-mavencare Closed Apr 5, 2026
Description
The if property on hook entries (introduced as a performance optimization to conditionally gate hook execution) is silently removed whenever Claude Code rewrites settings.json via the /model command.
Steps to Reproduce
- Add
ifconditions to hook entries insettings.json:
``json``
{
"type": "command",
"command": "~/.claude/hooks/pre-git-lock-cleanup.sh",
"if": "Bash(*git *)",
"timeout": 2
}
- Run
/modelto switch models - Inspect
settings.json— alliffields have been removed
Expected Behavior
Fields not managed by Claude Code (or newly-added schema fields like if) should be preserved during settings rewrites.
Actual Behavior
All if properties are silently stripped. This defeats the performance benefit of conditional hook execution — every hook fires on every Bash call rather than only when the command matches.
Environment
- Claude Code version: 2.1.89
- Platform: macOS
Related Issues
- #22659 / #17982 — general "settings.json rewrite strips manually-added fields" (closed as duplicate)
- #36124 / #24995 — hook schema on SchemaStore is out of sync with supported hook properties
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗