Claude CLI silently loads CLAUDE.md on every bare -p call, inflating token costs
A developer discovered that invoking Anthropic's Claude CLI with the bare `-p` flag automatically loads the project's CLAUDE.md file from the current working directory, even for narrow, self-contained tasks. The finding came while reviewing a 20-line Python script that converts staged git diffs into Conventional Commit messages using a single LLM call. Because the script inherits the caller's working directory and passes no explicit path override, Claude's auto-discovery picks up the full CLAUDE.md — in this case 79 lines and roughly a thousand tokens of unrelated routing rules. Beyond the silent token overhead, the developer flagged a deeper concern: any future edits to CLAUDE.md could alter the script's output without any code changes or visible explanation. The issue can be avoided by passing the `--bare` flag, which explicitly disables CLAUDE.md auto-discovery along with several other background processes.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in