Claude Code `--bare` Flag: Minimal-Footprint Mode for Scripted `-p` Calls
Claude Code 2.1.81 introduces the --bare flag, a new execution mode designed for scripted, non-interactive -p calls. When active, it skips hooks, LSP initialization, plugin synchronization, and skill directory walks β eliminating initialization overhead that is unnecessary in automation contexts. Auto-memory is fully disabled in bare mode, and authentication is restricted to ANTHROPIC_API_KEY or an apiKeyHelper via --settings; OAuth and keychain auth are not supported. This gives developers a predictable, fast, and side-effect-free way to invoke Claude Code from CI/CD pipelines and shell scripts.
Sources & Mentions
4 external resources covering this update
A Dedicated Scripting Mode for Claude Code
Claude Code's headless -p flag has long been the primary way to invoke the tool non-interactively β piping prompts in and reading output out, without a conversational interface. With version 2.1.81, Anthropic adds --bare, a companion flag that pairs with -p to strip Claude Code down to its minimal footprint for scripted use.
What --bare Disables
When --bare is active, Claude Code skips the following initialization work on every invocation:
- Hook processing β pre- and post-tool hooks do not fire, removing any side effects from user-configured hook scripts
- LSP initialization β the Language Server Protocol integration that powers IDE-aware editing is not started
- Plugin synchronization β marketplace and local plugin directories are not walked or loaded
- Skill directory scanning β
.claude/skills/directories are not read - Auto-memory β automatic memory extraction and injection is fully disabled
The result is a faster, more deterministic process that does exactly what the prompt asks and nothing else.
Authentication Requirements
Bare mode enforces a stricter authentication model. OAuth-based authentication (the standard interactive login flow) and macOS keychain credentials are both disabled. The only accepted authentication paths are:
- The
ANTHROPIC_API_KEYenvironment variable - An
apiKeyHelperfunction configured via--settings
This constraint is intentional: bare mode is designed for environments where an API key can be injected as an environment variable β such as CI runners, Docker containers, or serverless functions. Interactive credential flows have no place in those contexts.
Why This Matters for CI/CD
Before --bare, invoking claude -p in a CI environment still triggered plugin discovery, hook evaluation, and memory logic β initialization paths that are not only wasteful but potentially unpredictable when running in a sandboxed environment without the user's local configuration. Bare mode makes the contract explicit: no plugins, no memory, no hooks, just the model and the prompt.
Developers building automation workflows with Claude Code β generating changelogs, reviewing pull requests, running static analysis, or generating test cases β now have a first-class flag that signals their intent and avoids unintended side effects from any ambient configuration in the working directory.