CLAUDE.md 'Hard gate' rules are ignored despite being loaded and visible in context
Summary
Rules explicitly labelled "Hard gate — no exceptions:" in CLAUDE.md files are being ignored repeatedly within the same session, even though the files are confirmed loaded and visible in the system prompt context.
Rules affected (examples from today)
From Development/CLAUDE.md:
- Branch before editing — "Before creating a branch: always run
git branch -ato check existing branches and confirm with the user which branch to use... propose the name and wait for explicit approval before runninggit checkout -b." Files were edited directly onmainwithout creating a branch first. - Verify after every change command — "After every command that makes a change... a verification command must follow before the next change step. Chaining change commands without a check in between is not permitted." Multiple write/edit/delete operations were chained with no verification between them.
- Terraform plan before commit — "Always run
terraform plan... and verify the output before committing any.tffile changes. Do not commit Terraform files on the basis that they 'look correct' — the plan is the confirmation.".tffiles were committed without running the plan first.
From the global CLAUDE.md:
- Diff approval before overwriting — "generate a unified diff of the proposed change and show it to the user. Then wait for explicit approval before writing or pushing." Files were written immediately after diffs were shown, without waiting for a clear approval signal.
Why this matters
The user has invested significant effort encoding these rules precisely because past sessions went wrong without them. When Claude ignores them, the user is forced to audit every action — which defeats the entire purpose of having the rules.
The rules are not ambiguous or buried. They are at the top level of loaded CLAUDE.md files, use strong language ("Hard gate — no exceptions"), and were previously discussed and refined with Claude in earlier sessions. They are still being bypassed.
Expected behaviour
"Hard gate — no exceptions" should mean exactly that. If Claude cannot reliably enforce these constraints on itself, there should be a mechanism (hooks, pre-flight checks, or model-level instruction weighting) that makes compliance structural rather than dependent on the model remembering to apply it.
Environment
- Claude Code CLI on Windows 11
- Model: claude-sonnet-4-6
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗