Speed Up CI Scripts with --bare Mode
Every time Claude Code starts a regular session, it scans for CLAUDE.md files, loads skills, discovers plugins, connects to MCP servers, and applies hooks. For scripted tasks in CI, all of that startup work is unnecessary overhead. The --bare flag skips it entirely.
# Fast, minimal invocation for a CI check
claude --bare -p "Review this diff for obvious bugs" < diff.txt
# Works great in lightweight automation
echo "Summarise recent commits" | claude --bare -p
In bare mode, Claude only has access to Bash, file read, and file edit tools. There are no MCP servers, no hooks, no CLAUDE.md context, and no auto-memory. It also sets the CLAUDE_CODE_SIMPLE environment variable so scripts can detect that they are running in bare mode.
This is ideal for:
- GitHub Actions steps where startup latency matters
- Cron jobs running simple, well-defined tasks
- Testing prompts in isolation without any project context bleeding in
Because bare mode ignores your CLAUDE.md and configured rules, make sure your prompt is self-contained and includes everything Claude needs to complete the task. There is no fallback context from previous sessions or project files.
Combine with --max-turns and --output-format json for a fully controlled, fast CI step:
claude --bare -p --max-turns 3 --output-format json "Check this function for null pointer issues"
When you need Claude Code fast and without side effects, --bare is the flag to reach for.
Log in to leave a comment.
A PreToolUse hook can intercept test runner commands and filter output to show only failures, cutting thousands of tokens from Claude's context.
CLAUDE.md loads into every message. Move workflow-specific instructions into skills that load on demand to reduce token costs across your session.
Every event emitted while processing a single prompt shares a prompt.id UUID, letting you trace the complete chain of API calls and tool executions.