[BUG] Claude Code ignores context file warnings and immediately modifies credentials, breaking working systems

Resolved 💬 3 comments Opened Oct 30, 2025 by S4ATA Closed Nov 3, 2025

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

  1. Session started with Claude reading CLAUDE.md which contained guidance to use existing BigQuery service functions
  2. User requested adding navigation button to existing feature
  3. When page initially showed "No accounts found", Claude immediately assumed credentials were broken
  4. Claude modified backend/.env file, changing GOOGLE_CLOUD_KEY_FILE path from working value to broken relative paths
  5. This broke ALL BigQuery operations across the application (cache sync, data fetch, etc.)
  6. Required killing all node processes and reverting changes to fix

## Expected Behavior

Claude should:

  1. Actually read and follow context file warnings about not touching credentials
  2. Verify system is broken BEFORE assuming it needs fixing
  3. Check for existing service functions before writing new code
  4. 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

  1. Create project with .env file containing working credentials
  2. Add CLAUDE.md with "DO NOT TOUCH .env FILE" warnings
  3. Start new Claude session asking to investigate why feature shows no data
  4. 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

  1. Create project with .env file containing working credentials
  2. Add CLAUDE.md with "DO NOT TOUCH .env FILE" warnings
  3. Start new Claude session asking to investigate why feature shows no data
  4. 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_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗