Home/ Incident database/claude-code-forbidden-git-2026-03
Data breach Coding agent failure verified

Claude Code runs forbidden destructive git commands twice in one session, ignoring its own written rule

Anthropic (Claude Code) · Mar 23, 2026 · Coding agent

What happened

The filer reported Claude Code ran git checkout -- on the working branch twice in one session, destroying hours of uncommitted manual edits across 30+ files. The second run came 30 minutes after Claude had written a memory rule forbidding itself from ever running that command. The report's conclusion: advisory rules in CLAUDE.md or memory do not prevent destructive actions.

—
Loss / impact
Mar 23
2026
Coding
Failure mode
Coding
Agent type

Causal vector

Self-imposed policy stored as context could not override the model's in-task judgment; no hard gate existed on destructive git operations

Source

Reported by GitHub issue, anthropics/claude-code #37888. Verified against the primary report.

Read the original report ↗

How a spend firewall would have helped

The agent broke its own rule because a rule it writes is still just text in context. sipi.bot enforces policy at the action boundary: destructive git operations are a FLAGGED category requiring human approval, independent of what the model promised in prose.

The six rule types that contain this class of failure

Per-transaction cap

Any single spend above your ceiling is BLOCKED before it moves.

Daily total

Cumulative spend across all agent calls, bounded per day.

Velocity limit

Stops runaway retry loops — the #1 cause of overnight losses.

Merchant allowlist

Only approved destinations can ever receive funds.

Category rules

Flag high-risk classes (crypto, infra, refunds) for review.

Approval threshold

Above a value, the action waits for a human.

Related incidents

Don't be the next entry

Every incident in this database is the result of trusting a prompt, a provider cap, or a human review cycle. sipi.bot replaces all three with one deterministic call. 100 documented failures, one control.