Claude Code's --bare Flag Cuts Scripted AI Calls from 150K Tokens to Near Zero
Running Claude Code non-interactively via the -p flag silently loads an entire interactive session context — including CLAUDE.md files, MCP servers, hooks, and plugins — even for simple one-line prompts. Developers discovered this the hard way when a scheduled cold call consumed roughly 150,000 tokens before performing any actual work. The --bare flag bypasses all auto-discovery entirely, ensuring scripted and CI environments start from a clean slate with no hooks, memory, or credentials loaded automatically. In bare mode, only explicitly requested tools and configurations are added back via opt-in flags such as --mcp-config or --append-system-prompt. Anthropic's documentation now recommends --bare as the default for unattended or automated Claude Code usage to ensure reproducibility and predictable token costs.
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