Skip to content

PoC: Claude Code subscription provider via ACP - #4398

Draft
sejas wants to merge 1 commit into
trunkfrom
acp-claude-code-engine-073011
Draft

PoC: Claude Code subscription provider via ACP#4398
sejas wants to merge 1 commit into
trunkfrom
acp-claude-code-engine-073011

Conversation

@sejas

@sejas sejas commented Jul 30, 2026

Copy link
Copy Markdown
Member

Related issues

  • Related to the ongoing effort to reduce WPcom AI proxy costs by letting users bring their own plan.

How AI was used in this PR

Research (Anthropic's 2026 third-party OAuth policy, ACP protocol surface), architecture mapping, and drafting the design doc and implementation; all code was reviewed, typechecked, linted, unit-tested, and verified manually end-to-end.

Proposed Changes

⚠️ Draft Proof of Concept — directional guidance, not merge-ready. See docs/design-docs/acp-claude-code-engine.md (in this PR) for the full design, trade-offs, and verification log.

Adds an opt-in third AI provider, "Claude Code · subscription", that runs Studio Code agent turns on the user's own Claude Pro/Max plan instead of the WPcom AI proxy — cutting proxy cost for users who already pay Anthropic.

Why this shape: since Jan–Apr 2026 Anthropic rejects subscription OAuth tokens in third-party harnesses, so Studio can't just point the existing pi runtime at a subscription token. The sanctioned path (the one Zed uses) is ACP — the Agent Client Protocol — fronting the official Claude Code / Agent SDK harness. Studio spawns the @agentclientprotocol/claude-agent-acp adapter per turn, speaks ACP to it, and translates the stream back into Studio's existing event/session format, so the transcript UI, session persistence, and replay work unchanged. Studio never sees or stores the user's Claude credentials.

User impact:

  • New /provider option "Claude Code · subscription" (CLI). Once selected, Agentic UI (studio ui) and headless turns run on the subscription.
  • Never auto-selected — a user's subscription is only used after they explicitly opt in (autoSelectable: false, unit-tested).
  • Studio's own tools reach the new engine through the existing studio mcp server.

Known trade-offs (details in the design doc): fresh ACP session per turn (long-conversation context fidelity), model picker ignored for ACP turns, tool calls auto-approved within the site directory, Electron packaging of the adapter out of scope.

Testing Instructions

  1. Prereq: Claude Code installed and logged in with a Pro/Max plan (claude/login).
  2. npm install && npm run cli:build:ui
  3. Select the provider: node apps/cli/dist/cli/main.mjs code/provider → "Claude Code · subscription" (or set "aiProvider": "claude-code" in ~/.studio/cli.json).
  4. node apps/cli/dist/cli/main.mjs ui --no-openhttp://localhost:8081 → new chat → send a prompt.
  5. Verify: response streams and renders, transcript survives a page reload, and no WPcom login or Anthropic API key is configured.
  6. Headless check: node apps/cli/dist/cli/main.mjs code "Say OK" --json emits the standard event stream ending in turn.completed with status: "success".
  7. npm run typecheck and npm test -- apps/cli/ai pass.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@sejas sejas self-assigned this Jul 30, 2026
@sejas sejas changed the title Studio Code: opt-in Claude Code subscription provider via ACP (PoC) Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

1 participant