Environment:416rehman DeepZero Claude CLI
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, LLMs |
| Last Updated | 2026-10-27 00:00 GMT |
Overview
Locally installed, already-authenticated `claude` CLI binary on PATH for running DeepZero against a Claude Code subscription instead of a metered API key.
Description
This environment provides the Claude Code CLI binary that the `ClaudeCodeBackend` shells out to. DeepZero never handles credentials for this backend — it invokes the user's own `claude` binary and inherits whatever authentication that binary already has (OAuth login, keychain, etc.). The backend searches PATH plus several platform-specific locations (`~/.claude/local/claude`, `~/.local/bin/claude`, `~/bin/claude`, and Windows AppData paths). The binary must be signed in before use.
= Usage
Use this environment when a pipeline's `model` string uses the `claude-code` scheme (e.g. `claude-code/sonnet`). This routes LLM completions through the user's Claude Code subscription rather than a metered API key. It is the mandatory prerequisite for the ClaudeCodeBackend implementation.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux, macOS, or Windows | Extra search paths differ per platform |
| Hardware | Any machine that runs the CLI | No GPU needed |
| Disk | CLI install footprint | Typically an npm global install |
Dependencies
System Packages
- `claude` CLI binary (installed and signed in)
- Node.js (required by the `claude` CLI npm package)
Python Packages
- Python >= 3.11 (base DeepZero requirement)
- `deepzero` package with `[llm]` extra is not required — the ClaudeCodeBackend uses no Python LLM library
Credentials
No environment variables for auth — the `claude` CLI manages its own credentials (OAuth/keychain). DeepZero deliberately strips metered API keys from the child environment so the CLI uses its own login.
The following env vars are blocked from the child process by default (see Heuristic:416rehman_DeepZero_Backend_Env_Sanitization):
- `ANTHROPIC_API_KEY` — removed so the CLI uses subscription auth, not a metered key
Quick Install
# Install the Claude Code CLI
npm install -g @anthropic-ai/claude-code
# Sign in interactively
claude
# Verify it is on PATH
which claude
Code Evidence
Binary discovery and search paths from `backends/claude_code.py:49,62-75`:
binary_names: ClassVar[tuple[str, ...]] = ("claude",)
@classmethod
def extra_search_paths(cls) -> list[Path]:
home = Path.home()
paths = [
home / ".claude" / "local" / "claude",
home / ".local" / "bin" / "claude",
home / "bin" / "claude",
]
if sys.platform == "win32":
appdata = os.environ.get("APPDATA", str(home / "AppData" / "Roaming"))
localappdata = os.environ.get("LOCALAPPDATA", str(home / "AppData" / "Local"))
for base in (Path(appdata) / "npm", Path(localappdata) / "claude" / "bin"):
paths += [base / "claude.cmd", base / "claude.exe", base / "claude"]
paths.append(home / ".local" / "bin" / "claude.exe")
return paths
Install hint from `backends/claude_code.py:50`:
install_hint: ClassVar[str] = "install it and sign in (https://claude.com/claude-code)."
Auth guidance relayed on auth failure from `backends/claude_code.py:25`:
_AUTH_HINT = "run `claude` in a terminal and sign in, then retry"
Headless invocation from `backends/claude_code.py:84-85`:
argv = [str(self._binary), "-p", "--output-format", "json"]
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `claude code cli not found (looked for: claude)` | `claude` binary not on PATH or in search paths | Install it (`npm install -g @anthropic-ai/claude-code`) or add to PATH |
| `claude code is not authenticated` | CLI installed but not signed in | Run `claude` in a terminal and sign in, then retry |
| `could not parse claude code output` | Unexpected CLI output format | Check CLI version matches expected `-p --output-format json` contract |
| `claude code timed out after 900s` | Completion exceeded default timeout | Increase `timeout` in backend config |
Compatibility Notes
- `--bare` is never used: It disables OAuth/keychain reads, which is exactly the auth this backend exists to use. The CLI decides how to authenticate from its own config.
- MCP servers ignored: `--strict-mcp-config` is appended so globally configured MCP servers do not widen the blast radius of prompt-injected content.
- Tools denied by default: Bash, Edit, Write, Read, Glob, Grep, WebFetch, WebSearch, Agent, Task are disallowed because the prompt carries untrusted decompiled malware content.
- Windows: Searches `AppData/Roaming/npm`, `AppData/Local/claude/bin`, and `.local/bin` for `claude.cmd`/`claude.exe`.