Skip to content

feat: add Claude Code CLI as LLM provider#10

Open
Steve wants to merge 1 commit into
chad:mainfrom
collectiveleap:feat/claude-cli-provider
Open

feat: add Claude Code CLI as LLM provider#10
Steve wants to merge 1 commit into
chad:mainfrom
collectiveleap:feat/claude-cli-provider

Conversation

@Steve

@Steve Steve commented Apr 30, 2026

Copy link
Copy Markdown

Summary

  • Adds a new claude-cli LLM provider that uses the claude CLI (claude -p) for code generation
  • Users with a Claude Pro/Max subscription can now run phoenix bootstrap without needing a separate API key — the provider auto-detects the authenticated CLI
  • Falls back gracefully: API keys are still preferred (Anthropic > OpenAI > Claude CLI > stubs)

Motivation

The quick start requires an ANTHROPIC_API_KEY or OPENAI_API_KEY, but many Claude users have a Pro/Max subscription that doesn't include API access. This removes that friction — if claude CLI is installed and authenticated, code generation just works.

Changes

  • src/llm/claude-cli.ts (new): ClaudeCliProvider implementing the LLMProvider interface. Pipes prompts via stdin to claude -p with --system-prompt for system messages.
  • src/llm/resolve.ts: Auto-detects claude CLI as third-priority fallback after Anthropic and OpenAI API keys
  • src/llm/provider.ts: Adds claude-cli to DEFAULT_MODELS
  • package.json: Adds missing @types/node dev dependency

Test plan

  • Verified claude -p works with stdin piping and --system-prompt
  • Ran phoenix bootstrap on examples/todo-app — all 3 IUs generated real code (not stubs)
  • Generated app runs and serves working web UI at localhost:3000
  • Confirmed API key providers still take priority when set

🤖 Generated with Claude Code

Users with a Claude Pro/Max subscription but no API key can now use
Phoenix code generation via the `claude` CLI. The provider auto-detects
when the CLI is available and falls back to it when no ANTHROPIC_API_KEY
or OPENAI_API_KEY is set.

- New `ClaudeCliProvider` in `src/llm/claude-cli.ts` pipes prompts via
  stdin to `claude -p` with `--system-prompt` for system messages
- Provider resolution auto-detects `claude` CLI as third-priority fallback
- Also adds missing `@types/node` dev dependency needed for build

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Steve pushed a commit to collectiveleap/phoenix that referenced this pull request Jun 7, 2026
Implements the OBSERVABILITY-HARNESS-OUTCOMES acceptance criteria so the
spec→app pipeline runs unattended and is diagnosable in seconds.

Spine (O1/O2/O8): per-call RunJournal (.phoenix/runs/<id>), streaming
provider interface (claude-cli via spawn, anthropic/openai via SSE) with
TTFB + byte counting, wall-clock watchdog + caffeinate keep-awake that
distinguishes startup-stall / stream-stall / returned-then-wedged.

Honesty (O3–O7,O10): typechecker probe (missing tool ≠ type errors, zero
phantom repairs), canonicalization reports the mode that actually ran +
per-clause classification reasons, provider/config resolution with source
and conflict warnings, tracked scaffold writer that preserves hand-edits,
plan inspection with heading→module mapping and oversize flags.

Controller (O9,O11–O16): preflight gate, pid run-lock + signal teardown +
detached process-group kill, config-driven policy + `run --dry-run`,
acceptance gate (typecheck + boot + 200), content-addressed resume, and
`phoenix run`/`runs` supervisor with a live status surface.

New CLI: run, runs, preflight. Regression suite covers appendix chad#1chad#10.
468 tests pass (49 new); tsc clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Steve pushed a commit to collectiveleap/phoenix that referenced this pull request Jun 7, 2026
The acceptance criteria (O1–O16) and reference-failure appendix (chad#1chad#10)
enforced by the harness regression suite added in fff35a0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant