"Don't read .env" in CLAUDE.md isn't enforcement: out-of-scope reads hit 27.7%

Worried-Addition-836 · reddit · 2026-12-03

An analysis of how coding agents (Claude Code, Codex) pull files into context shows that prompt-based rules like "don't read .env" are not enforcement: agents still grep live tokens, .claudeignore is bypassed, and MCP servers provide a second door that path-based deny rules don't cover. A May paper across 7,500 agent sessions found out-of-scope actions in 5.4%–27.7% of normal tasks, with stronger models reading more. The author proposes per-session read logging (observe, not block) as a mitigation.

Original post →

More from coding & agent

coding & agent channel →