headless-claude-code

headless-claude-code is a skill for Claude Code, Codex from vellum-ai/vellum-assistant. It costs 53 tokens per session (4,317 once invoked), scanned C, original, MIT.

A reference guide for running Claude Code without its normal desktop terminal, such as in Docker containers, continuous-integration systems, cloud machines, or another program. It explains authentication methods, interactive-mode problems, tmux coordination, root-user workarounds, and Git access.

In plain words
What is it for?
Use it when configuring Claude Code in containers, CI pipelines, cloud virtual machines, or automated processes. It covers token and API-key setup, non-interactive operation, tmux, root execution, and Git authentication.
Why use it?
These environments often lack a browser login, keychain, SSH agent, or normal user setup, so Claude Code may fail to authenticate or access repositories. The guide explains the setup choices and common obstacles.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: reads .claude/ paths; positional $N argument; mentions Claude Code.

Good fit Use it when configuring Claude Code in containers, CI pipelines, cloud virtual machines, or automated processes. It covers token and API-key setup, non-interactive operation, tmux, root execution, and Git authentication.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/vellum-ai/vellum-assistant/headless-claude-code
About the project

Vellum Assistant is a personal AI assistant that remembers information about users, learns their preferences, and takes actions across connected apps. It is intended for people who want an assistant that can manage conversations, unfinished work, and proactive notifications over time. The catalogue skills, hooks, instruction, and setting configure or extend how the assistant works.

vellum-ai/vellum-assistant · 1,204 stars · on GitHub · vellum.ai

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.

Any agent
npx skills add vellum-ai/vellum-assistant --skill headless-claude-code
Clone the repo
git clone --depth 1 https://github.com/vellum-ai/vellum-assistant

Made for: Claude Code, Codex.

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 headless-claude-code

README.md
[![agentmods](https://agentmods.dev/badge/skills/vellum-ai/vellum-assistant/headless-claude-code.svg)](https://agentmods.dev/skills/vellum-ai/vellum-assistant/headless-claude-code)
Your own site
<a href="https://agentmods.dev/skills/vellum-ai/vellum-assistant/headless-claude-code"><img src="https://agentmods.dev/badge/skills/vellum-ai/vellum-assistant/headless-claude-code.svg" alt="Measured on agentmods" height="20"></a>
Per session 53 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,317 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. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 14 findings, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Privilege Escalation · line 238
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 340
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Tool Misuse · line 313
    Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.
    Fix: Limit tool chaining depth and validate the output of each tool before passing it to the next. Require explicit user approval for multi-step chains.
  • high Privilege Escalation · line 412
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 421
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Agent Snooping · line 459
    Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.
    Fix: Remove all code or instructions that access agent configuration directories (.claude/, .codex/, .gemini/). If configuration values are needed, pass them explicitly as parameters or environment variabl
  • high Agent Snooping · line 462
    Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.
    Fix: Remove all code or instructions that access agent configuration directories (.claude/, .codex/, .gemini/). If configuration values are needed, pass them explicitly as parameters or environment variabl
  • high Agent Snooping · line 463
    Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.
    Fix: Remove all code or instructions that access agent configuration directories (.claude/, .codex/, .gemini/). If configuration values are needed, pass them explicitly as parameters or environment variabl
  • high Agent Snooping · line 466
    Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.
    Fix: Remove all code or instructions that access agent configuration directories (.claude/, .codex/, .gemini/). If configuration values are needed, pass them explicitly as parameters or environment variabl
  • medium Rogue Agent · line 243
    Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
    Fix: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.
  • medium Privilege Escalation · line 320
    Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
    Fix: Avoid sudo/root unless strictly required. Prefer least-privilege patterns. If elevation is needed, document the justification and scope.
  • medium Excessive Agency · line 386
    Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
    Fix: Add human-in-the-loop confirmation for destructive, irreversible, or high-impact operations. Never auto-execute commands that modify files, send data, or alter system state.
  • medium Excessive Agency · line 391
    Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
    Fix: Add human-in-the-loop confirmation for destructive, irreversible, or high-impact operations. Never auto-execute commands that modify files, send data, or alter system state.
  • medium Prompt Injection · line 473
    Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
    Fix: Remove the large whitespace padding (blank-line blocks or long space runs) and review any content hidden below or to the right of it. Keep skill files compact and reviewable so no instructions can be
How audits are shown
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.00053 $0.04317
Opus 5 $0.00026 $0.02159
Sonnet 5 $0.00011 $0.00863
Haiku 4.5 $0.00005 $0.00432

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

Security

Grade C, and why

headless-claude-code 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 8d 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.

Containers often run as root. CC has special behavior here that will bite you.

Reads agent configuration directoriesmediumAgent snooping

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

`--settings` doesn't replace `~/.claude/settings.json` — it deep-merges on top of it.
skills/headless-claude-code/SKILL.md · 499 lines

How it starts

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

Headless Claude Code

Running Claude Code outside a desktop terminal — in Docker containers, CI runners, cloud VMs, or orchestrated by another process — is full of undocumented friction. This guide covers everything we've learned getting CC to work reliably in these environments.


1. Authentication

CC tries multiple auth strategies in a fixed priority order. Understanding this chain is the key to headless auth.

Priority Order (highest → lowest)

  1. Cloud provider ambient credentials — AWS Bedrock, GCP Vertex (auto-detected)
  2. ANTHROPIC_AUTH_TOKEN — raw bearer token for Anthropic's API
  3. ANTHROPIC_API_KEY — direct API key (pay-per-token, no Pro subscription features)
  4. apiKeyHelper — executable that prints a token to stdout (set via --settings)
  5. CLAUDE_CODE_OAUTH_TOKEN — OAuth token (Pro/Team subscription)
  6. /login — interactive browser OAuth dance (unusable in headless)

Recommended: apiKeyHelper

The most flexible headless strategy. Point CC at a script that returns a valid token:

{
  "apiKeyHelper": "/path/to/your-auth-script"
}

Pass it via --settings /path/to/settings.json on launch. CC calls this script whenever it needs a token, so it handles rotation naturally.

Example helper (reads from a credential vault):

#!/bin/bash
# Prints the OAuth token to stdout. CC calls this on demand.
your-vault-cli get anthropic-oauth-token

The script MUST:

  • Print exactly one token to stdout (no trailing newline issues — CC trims)
  • Exit 0 on success
  • Be executable (chmod +x)

setup-token (One-Time OAuth Bootstrap)

If you have a browser somewhere (your laptop, a jump host), you can bootstrap OAuth credentials into a headless machine:

# On the headless machine:
claude setup-token
# Prints a URL and waits for a token

# Open that URL in any browser, complete the OAuth flow.
# The token is saved to ~/.claude/ and CC uses it going forward.

This is good for initial setup but tokens expire. For long-running environments, apiKeyHelper with a refresh mechanism is more robust.

Read the full file on GitHub · 499 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. 8d ago First seen · 499 lines · 53 tokens per session scan C 8ae0c0dc5685

Subscribe to this mod's changes

headless-claude-code is a skill published in the GitHub repository vellum-ai/vellum-assistant (1,204 stars, last pushed today), licensed MIT. It adds 53 tokens to every session and 4,317 once invoked, about $0.0003 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-08-30.

Related

Other skills, from other repositories

lictor-security-check

Pre-release security audit for ANY project — AI-built or hand-written, web or mobile. Scans the codebase for the full range of real-world risks that get apps breached: leaked API & AI-provider keys, exposed configs/secrets, broken auth & access control (IDOR), injection (SQL/XSS/command), SSRF, open databases & cloud…

Raffa-jarrl/Lictor-AI · 135 tokens

lictor-rotate

Walks the user through rotating a leaked API key — step by step, provider-specific. Knows the exact URL to visit, the exact button to click, and how to verify the rotation worked. Supports Stripe, OpenAI, Anthropic, Google Cloud / AI Studio, GitHub, AWS, Slack, Supabase, Firebase, Postmark, and generic OAuth providers.

Raffa-jarrl/Lictor-AI · 80 tokens

lictor-explain

Takes any security finding, error message, or jargon-heavy security advice and explains it in plain English. Use this when someone is confused by what /lictor-security-check found, or when they got a security warning from another tool and don't understand it.

Raffa-jarrl/Lictor-AI · 56 tokens

lictor-fix-it

Applies the fixes recommended by /lictor-security-check, with the user's explicit permission for each change. Walks through findings one at a time, shows the proposed change, gets approval, applies, runs tests if available, and moves on. Some fixes (rotating leaked credentials) require the user to act outside Claude …

Raffa-jarrl/Lictor-AI · 75 tokens

continual-learning

Nightly refinement of an existing per-repo review-style prompt using this reviewer's own finding outcomes. Read confirmed (resolved-by-commit / thumbs-up) and dismissed (thumbs-down) findings, promote the bug patterns the team actually fixes, demote the false-positive patterns, reconcile against the current prompt…

langchain-ai/open-swe · 89 tokens

ha-logs

A read-only troubleshooting skill for querying Hope Agent’s local SQLite databases, which store logs, conversations, and background-job status.

shiwenwen/hope-agent · 183 tokens