Claude Headless

    1

    One-shot LLM calls from scripts and hooks via headless claude -p, with a recursion guard, JSON envelope parsing, tool restriction and spend logging.

    $3

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Claude Headless

    Example session with this skill installed

    python3 claude_cli.py "reply with exactly: pong" --model haiku

    • Read your context and instructions
    • Compiled the claude headless

    pong

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Need a model call inside a hook or script (summarize, classify, score, extract JSON) without adding an SDK or API key? Claude Headless shells out to claude -p, so it uses whatever auth and provider Claude Code is already set up with.

    What you get

    • claude_cli.py: ask(), ask_json(), is_child() and a small CLI (python3 claude_cli.py "prompt" --model haiku, or - to read the prompt from stdin).
    • Recursion guard. claude -p starts a real session that fires your hooks, so a Stop hook that calls claude -p would loop forever. Every call sets CLAUDE_KIT_CHILD=1; model-calling hooks start with if is_child(): sys.exit(0).
    • Runs --no-session-persistence --output-format json: no transcript is written, and the result envelope (result, is_error, usage, modelUsage, total_cost_usd, session_id) is parsed. Envelope fields verified against current Claude Code.
    • Optional tool restriction (allowed_tools) and working directory (cwd).
    • CLAUDE_KIT_PIN_ANTHROPIC=1 to drop base-URL and key variables from the child when your main session points at a local model server.
    • Bundled spend_tracker.py logs every call's usage and cost so the Spend Tracker skill can report background spend.

    Tested: ask, ask_json with fenced JSON, stdin prompt, recursion flag and spend logging, against a live claude install.

    Each call pays Claude Code's startup context, so a trivial call costs a few cents uncached; do not call per keystroke. ask_json fails if the model wraps the JSON in prose, so ask for only JSON and catch json.JSONDecodeError. Needs claude on PATH and a working login. ask() raises RuntimeError on non-zero exit, empty output or an error envelope.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 13 days ago

    Requires

    Python 3.9+
    claude CLI on PATH with a working login
    Python

    Permissions

    Allowed Hosts

    whatever provider your claude CLI is configured for

    File Scopes

    claude
    config
    dir
    /spend/spend.db
    (read/write
    usage
    log)

    Spawns the claude CLI as a subprocess. Does not read credentials itself; with CLAUDE_KIT_PIN_ANTHROPIC=1 it only removes ANTHROPIC_* variables from the child environment.

    Listed13 days ago

    What's inside

    Frequently Asked Questions

    One-shot LLM calls from scripts and hooks via headless claude -p, with a recursion guard, JSON envelope parsing, tool restriction and spend logging.

    This skill uses the open SKILL.md standard. Use it through an MCP-compatible agent connected to Agensi, and check the compatibility information on this page for confirmed agents and required capabilities.

    Connect your AI agent to Agensi through MCP, then ask it to use Claude Headless on your task. Your agent loads the latest approved version each time. Paid skills require a purchase or active subscription. Skill files are not available for download; your licence does not allow you to save, copy or export any part of a skill.

    New in LLM Ops