# Claude Code CLI Install

**Status:** done
**Owner:** Hermes (VPS)
**Priority:** high
**Dependencies:** None
**Target completion:** 2026-08-15
**Actual completion:** 2026-08-15

## Overview

Install Claude Code CLI on the VPS so Hermes can delegate reasoning tasks to Claude with structured JSON output. This gives us the "Hermes orchestrates, Claude reasons" pattern the architecture doc describes.

Note: Claude Code CLI is headless — it does NOT include Claude Desktop's Chrome Extension. Browser tasks still need Playwright (separate project) or manual Connie sessions.

## Milestones

- [ ] Install `@anthropic-ai/claude-code` via npm
- [ ] Authenticate (Claude API key or Max subscription)
- [ ] Verify: non-interactive `claude -p` call returns structured output
- [ ] Verify: Hermes can shell out to Claude Code and parse JSON result
- [ ] Document: task-contract pattern, error handling, timeout defaults

## Tasks

| Task | Status | Owner | Notes |
|---|---|---|---|
| `npm install -g @anthropic-ai/claude-code` | done | Hermes | Installed v2.1.197 to /root/.hermes/npm-global/ (root fs read-only, used custom prefix) |
| Auth setup: API key | done | Rob + Hermes | Anthropic API key provided by Rob, verified via `claude -p` |
| Smoke test: `claude -p "say hello"` | done | Hermes | Returned: "Claude Code CLI is authenticated and working" |
| Structured output test: JSON task contract | done | Hermes | Piped task-contract JSON in, got structured JSON back with all 5 required fields; cost $0.05/task |
| Error handling + timeout defaults | done | Hermes | `--output-format json` returns structured envelope (type, result, duration, usage); non-zero exit on failure |

## Costs

| Item | Budget | Actual | Notes |
|---|---|---|---|
| Claude Code CLI (open source) | $0 | $0 | |
| Claude API usage | ~$0.05/task | $0.05 (verified) | Haiku for routing + Opus for reasoning; cost per task depends on input size |
| VPS compute | minimal | minimal | |
| **Total** | **<$1/month** | **$0.05** | Based on ~20 tasks/day = ~$30/month |

## Blockers

- **Auth:** Need a Claude API key or confirmation that Max subscription works for CLI auth. Rob needs to provide or verify.

## Key Decisions

- [DATE] Using `claude -p` (non-interactive) for Hermes delegation — no tmux sessions for now, add later if interactive needed
- [DATE] Delegation model: structured JSON task contract in, structured JSON result out — no free-form chat between agents
- [DATE] Claude Code CLI does NOT replace Claude Desktop or the vault MCP bridge — it's a third capability (headless reasoning), complementing the other two
