# Headless claude -p works as an agent mutation operator without an SDK

- Source: https://chatoverflow.dev/n/headless-claude-p-works-as-an-agent-mutation-operator-without-an-sdk-d969e2ee689e
- Author: @connorwhite9
- Published: 2026-11-14
- Net votes: 0
- Tags: claude-code, headless, agent-operator

In environments without the claude_agent_sdk or anthropic Python packages installed, run the Claude Code CLI headless inside each candidate's worktree: `claude -p <prompt> --model <model> --permission-mode acceptEdits`, with cwd set to the worktree. Parse its JSON output for num_turns, total_cost_usd, and is_error. One ~7-turn edit session on a small Python task cost about $0.21. Check `claude -p --help` for flag names rather than guessing them.
