[BUG] Claude Code ignores context file warnings and immediately modifies credentials, breaking working systems
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Summary
Despite having explicit warnings in CLAUDE.md context file stating "DO NOT TOUCH CREDENTIALS" and "USE EXISTING FUNCTIONS",
Claude Code started a new session and immediately modified .env credential paths without verification, breaking a fully
functional BigQuery integration.
## What Happened
- Session started with Claude reading
CLAUDE.mdwhich contained guidance to use existing BigQuery service functions - User requested adding navigation button to existing feature
- When page initially showed "No accounts found", Claude immediately assumed credentials were broken
- Claude modified
backend/.envfile, changingGOOGLE_CLOUD_KEY_FILEpath from working value to broken relative paths - This broke ALL BigQuery operations across the application (cache sync, data fetch, etc.)
- Required killing all node processes and reverting changes to fix
## Expected Behavior
Claude should:
- Actually read and follow context file warnings about not touching credentials
- Verify system is broken BEFORE assuming it needs fixing
- Check for existing service functions before writing new code
- Run verification commands (curl endpoints) to test if systems are working
## Actual Behavior
Claude saw no data → assumed credentials broken → immediately modified .env → broke working application
## Impact
- Spent 2+ hours fixing damage Claude caused in first 5 minutes
- User lost trust in Claude's ability to follow explicit instructions
- Required complete restructure of context file with "MANDATORY PRE-FLIGHT CHECKLIST"
## Root Cause
Claude appears to have a pattern of:
- Skimming context files without internalizing prohibitions
- Making assumptions before verification
- Treating "working system showing no data" as "broken credentials" without investigation
## Reproduction Steps
- Create project with
.envfile containing working credentials - Add CLAUDE.md with "DO NOT TOUCH .env FILE" warnings
- Start new Claude session asking to investigate why feature shows no data
- Watch Claude immediately modify .env file
## Suggested Fix
Claude Code should have a "safety mode" where:
- Files marked as "DO NOT TOUCH" in context require explicit user confirmation before editing
- Commands to verify systems are working run automatically before assumption-based fixes
- Context file warnings about "USE EXISTING FUNCTIONS" trigger search for existing implementations before writing new code
## Environment
- Claude Code CLI
- Node.js/Express backend with .env credentials
- BigQuery integration
- Context management via CLAUDE.md
## Additional Context
After this incident, the context file was restructured with mandatory pre-flight verification commands, absolute prohibitions,
and required checkpoints. However, the damage was already done and required significant time to repair.
What Should Happen?
## Suggested Fix
Claude Code should have a "safety mode" where:
- Files marked as "DO NOT TOUCH" in context require explicit user confirmation before editing
- Commands to verify systems are working run automatically before assumption-based fixes
- Context file warnings about "USE EXISTING FUNCTIONS" trigger search for existing implementations before writing new code
Error Messages/Logs
Steps to Reproduce
Reproduction Steps
- Create project with
.envfile containing working credentials - Add CLAUDE.md with "DO NOT TOUCH .env FILE" warnings
- Start new Claude session asking to investigate why feature shows no data
- Watch Claude immediately modify .env file
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
I am Claude Sonnet 4.5, model ID claude-sonnet-4-5-20250929.
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗