Protects your Claude Code settings from being silently changed without your knowledge or consent.
Claude Code has settings that control output quality — effortLevel and alwaysThinkingEnabled. These settings can be changed without notification, resulting in degraded responses that are hard to trace back to a configuration change.
Three layers of protection:
- UserPromptSubmit hook — checks your settings on every prompt. If
effortLeveloralwaysThinkingEnabledhave been changed, it blocks the prompt and tells you exactly what happened. - Environment variable — sets
CLAUDE_CODE_EFFORT_LEVELin your shell config, which takes precedence oversettings.json. - Audit log — every detected change is logged with timestamps to
~/.claude/settings-guard.log.
curl -fsSL https://raw.githubusercontent.com/synthesisengineering/claude-settings-guard/main/install.sh | bashThe installer:
- Downloads
settings-guard.shto~/.claude/ - Creates a config file at
~/.claude/settings-guard.conf - Merges the hook into your existing
~/.claude/settings.json(preserves all your other settings) - Sets
effortLeveltomaxandalwaysThinkingEnabledtotrue - Adds
CLAUDE_CODE_EFFORT_LEVEL=maxto your shell rc file (supports zsh, bash, fish) - Runs a health check to verify the installation
- Claude Code (CLI or VS Code extension)
- Python 3 (used for JSON manipulation)
- curl or wget
~/.claude/settings-guard-uninstall.shRemoves the hook, script, config, and env var. Leaves effortLevel and alwaysThinkingEnabled in place (those are your preferences). Keeps the audit log.
Edit ~/.claude/settings-guard.conf:
# Minimum effort level required.
# Valid values: max, high, medium, low
MIN_EFFORT=max
# Require extended thinking to be on.
REQUIRE_THINKING=true
# Auto-fix tampered settings instead of blocking.
# true: settings are restored automatically and the change is logged.
# false: the prompt is blocked until you manually fix the settings.
AUTO_FIX=false
# Path to the audit log.
LOG_FILE=~/.claude/settings-guard.logBy default, the guard blocks your prompt when settings are wrong, requiring you to fix them manually. If you prefer automatic restoration:
AUTO_FIX=trueWith auto-fix enabled, tampered settings are silently restored to your configured values. Every change and restoration is recorded in the audit log.
# Health check — verify installation and current settings
~/.claude/settings-guard.sh --status
# Fix — restore settings to configured values
~/.claude/settings-guard.sh --fix
# Help
~/.claude/settings-guard.sh --helpThe guard runs as a Claude Code hook on the UserPromptSubmit event — before every prompt you send to Claude. It checks:
effortLevelin~/.claude/settings.jsonmatches your configured minimumalwaysThinkingEnabledistrue(if enforced)CLAUDE_CODE_EFFORT_LEVELenv var hasn't been changed- The guard's own hook is still registered (self-integrity check)
If any check fails and AUTO_FIX is off, the hook exits with code 2, which blocks the prompt. You'll see a message explaining what changed and how to fix it.
If AUTO_FIX is on, the settings are restored and the prompt proceeds. Either way, the event is logged.
Every detected change is appended to ~/.claude/settings-guard.log:
[2026-04-02 14:30:15] DETECTED effortLevel is 'high' (required: 'max')
[2026-04-02 14:30:15] AUTO-FIXED effortLevel: high -> max
The log is preserved on uninstall so you have a record of every change.
MIT