[Bug] Claude ignores CLAUDE.md virtual environment directives despite loading file at session start
Bug Description
Context:
CLAUDE.md file is configured with clear Python virtual environment rules (Part 2)
File is automatically loaded at session start (confirmed by Claude)
Rules explicitly state priority order and explicitly prohibit system Python usage
Issue:
Despite having read CLAUDE.md at session start, Claude proceeded to execute python regression-4/src/01_regression4_train_predict.py directly without activating any virtual environment.
Result:
text
Error: Exit code 127
/bin/bash: line 1: python: command not found
Claude's Response When Confronted:
Initially claimed instructions were "not forceful enough"
Suggested rewording to "reduce the likelihood" of recurrence
Implicitly admitted that reading CLAUDE.md does not guarantee compliance
Core Problem:
This is not a documentation issue. It is an execution failure.
The CLAUDE.md file is read at session start. Its contents are in context. The instruction is unambiguous: use virtual environments, never system Python. Yet Claude still attempted to run Python directly — an action that has zero valid scenarios in this project context.
Why This Matters:
CLAUDE.md exists precisely to prevent this class of errors
If reading the file at session start does not ensure compliance, its value is severely diminished
This is equivalent to a professional footballer "forgetting" their position mid-match
Basic reasoning should have prevented this: data science script → requires dependencies → dependencies in venv → activate venv first
Expectation:
CLAUDE.md instructions must be followed, not merely "considered"
Reading a file at session start should translate to action, not optional reference
"Probabilistic" cannot be an excuse for fundamental operational failures
Request:
This needs to be treated as a high-severity behavioral bug, not a documentation refinement task.
Environment Info
- Platform: linux
- Terminal: gnome-terminal
- Version: 2.1.39
- Feedback ID: 1cbb1414-bf3e-4ec6-b920-a1ed4bd181cc
Errors
[{"error":"Error: Request was aborted.\n at u26 (file:///home/haris-subrata/.nvm/versions/node/v22.22.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:905:99129)\n at u26.next (<anonymous>)\n at G_q (file:///home/haris-subrata/.nvm/versions/node/v22.22.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:5780:4477)\n at G_q.next (<anonymous>)\n at f_q (file:///home/haris-subrata/.nvm/versions/node/v22.22.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:5785:7758)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async file:///home/haris-subrata/.nvm/versions/node/v22.22.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:5780:3930\n at async yOA (file:///home/haris-subrata/.nvm/versions/node/v22.22.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:961:2399)\n at async qG1 (file:///home/haris-subrata/.nvm/versions/node/v22.22.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:5780:3900)\n at async fR (file:///home/haris-subrata/.nvm/versions/node/v22.22.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:3556:8808)","timestamp":"2026-02-12T02:34:17.034Z"}]This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗