cc-bare-auth-gotcha

cc-bare-auth-gotcha is a cursor rule for Cursor from yonatangross/orchestkit. It costs 28 tokens per session (1,750 once invoked), scanned C, original, MIT.

A warning about a known authentication failure when running Claude Code with the `--bare` option in continuous integration (CI), an automated build and test environment.

In plain words
What is it for?
Use it when configuring automated Claude Code runs: avoid `--bare` and use the documented file-backed key-helper approach described by the rule.
Why use it?
It prevents CI jobs from silently failing to log in even when an API key appears to be configured.

Cursor rule for Cursor

Written for Cursor: a Cursor plugin manifest. Also seen: reads .claude/ paths.

Good fit Use it when configuring automated Claude Code runs: avoid --bare and use the documented file-backed key-helper approach described by the rule.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/yonatangross/orchestkit/cc-bare-auth-gotcha
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/yonatangross/orchestkit

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cc-bare-auth-gotcha

README.md
[![agentmods](https://agentmods.dev/badge/rules/yonatangross/orchestkit/cc-bare-auth-gotcha/github.svg)](https://agentmods.dev/rules/yonatangross/orchestkit/cc-bare-auth-gotcha)
Your own site
<a href="https://agentmods.dev/rules/yonatangross/orchestkit/cc-bare-auth-gotcha"><img src="https://agentmods.dev/badge/rules/yonatangross/orchestkit/cc-bare-auth-gotcha/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cc-bare-auth-gotcha

Your own site · 80×15
<a href="https://agentmods.dev/rules/yonatangross/orchestkit/cc-bare-auth-gotcha"><img src="https://agentmods.dev/badge/rules/yonatangross/orchestkit/cc-bare-auth-gotcha.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 28 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,750 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 2 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00028 $0.01750
Opus 5 $0.00014 $0.00875
Sonnet 5 $0.00006 $0.00350
Haiku 4.5 $0.00003 $0.00175

Measured 3d ago against content hash fdf0734720a7, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade C, and why

cc-bare-auth-gotcha scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

chmod 600 ~/.claude/.api-key

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

> ~/.claude/settings.json
plugins/ork/.cursor-plugin/rules/cc-bare-auth-gotcha.mdc · 157 lines

How it starts

The opening of the file, as written. The whole thing — 157 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Rule: claude --bare auth is broken — never use it in CI

Status: confirmed CC 2.1.81–2.1.143 · upstream bug filed anthropics/claude-code#60155 · prior incident orchestkit#1629

The trap

The --bare flag's --help text promises:

Anthropic auth is strictly ANTHROPIC_API_KEY or apiKeyHelper via --settings (OAuth and keychain are never read).

All three documented paths fail. Every invocation in --bare mode returns:

{"is_error":true, "result":"Not logged in · Please run /login"}

regardless of whether the API key is supplied via env var, --settings.apiKey, or --settings.apiKeyHelper.

Don't do this

# WRONG — will silently fail every claude invocation
- env:
    ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
  run: |
    claude -p --bare --max-turns 4 --output-format json "..."

Do this

# RIGHT — FILE-BACKED apiKeyHelper + plain `claude -p`
#
# Critical: the helper script does NOT inherit $ANTHROPIC_API_KEY from
# the parent step's env. CC strips env before spawning the helper.
# Verified locally 2026-05-18 (CC 2.1.143): "apiKeyHelper failed: did
# not return a value". The helper must read from a file the workflow
# writes.
- name: Configure Claude apiKeyHelper
  env:
    ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
  run: |
    mkdir -p ~/.claude
    umask 077
    printf '%s' "$ANTHROPIC_API_KEY" > ~/.claude/.api-key
    chmod 600 ~/.claude/.api-key
    printf '#!/bin/sh\ncat %s/.claude/.api-key\n' "$HOME" \
      > ~/.claude/api-key-helper.sh
    chmod +x ~/.claude/api-key-helper.sh
    printf '{"apiKeyHelper":"%s/.claude/api-key-helper.sh"}\n' "$HOME" \
      > ~/.claude/settings.json

- name: Analyze
  run: |
    claude -p --max-turns 4 --output-format json --no-session-persistence "..."

Read the full file on GitHub · 157 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 157 lines · 28 tokens per session scan C fdf0734720a7

Subscribe to this mod's changes

cc-bare-auth-gotcha is a cursor rule published in the GitHub repository yonatangross/orchestkit (264 stars, last pushed today), licensed MIT. It adds 28 tokens to every session and 1,750 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it C with 2 findings (asks for root, reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-09.