Skip to content

feat(pip): add a Claude quip backend and an explicit backend chooser - #334

Merged
maxthomas95 merged 1 commit into
mainfrom
feat/pip-claude-backend
Nov 12, 2026
Merged

maxthomas95 merged 1 commit into
mainfrom
feat/pip-claude-backend

Conversation

@maxthomas95

Copy link
Copy Markdown
Owner

Pip plan PR 6: backend interface, Claude backend, and the chooser.

What changes

  • Chooser. The "AI quips through Codex" checkbox becomes an AI quips select: Off, Codex (ChatGPT sign-in), Claude (Claude subscription). Off keeps the last backend (aiBackend, default codex, so existing users are unchanged). The expander is renamed Pip options.
  • Status on pick. A new pip:backend-status IPC checks sign-in and model when a backend is chosen or the options open. It makes no model request, and picking another backend abandons the previous check. Account identifiers never leave main.
  • Try a quip. Sends a new hello event right away. Main lets it skip the cooldown but counts it toward the hourly cap.
  • Consent. Share submitted prompts names the recipient (OpenAI or Anthropic). Changing backend turns it off, and main discards an in-flight reply if the backend changed.
  • Structure. src/main/pip/backends/ adds PipCommentBackend plus Codex and Claude adapters. Shared instructions and reply checks live in src/main/pip/instructions.ts. Recipient and account facts are in cli-tools.ts (pipQuips).

Claude backend

claude -p --model haiku --effort low --tools "" --no-session-persistence --setting-sources "" --strict-mcp-config --disable-slash-commands --system-prompt … --output-format json. The request goes on stdin.

  • Requires authMethod: "claude.ai" on the first-party provider. ANTHROPIC_API_KEY, the auth token, base URL, model overrides and Bedrock/Vertex/Foundry switches are stripped, case-insensitively on Windows. ENABLE_CLAUDEAI_MCP_SERVERS=false.
  • A reply counts only if type: result, subtype: success, is_error: false, num_turns: 1, permission_denials is empty, and every modelUsage key is claude-haiku-*. Same 180-character and control-character limits as Codex. 20 s timeout with a process-tree kill, 1 MB output cap.

Plan items verified live (Claude Code 2.1.322)

  • Hooks: the debug log shows Registered 0 hooks. User settings, including Tether's hook overlay, are not loaded.
  • History: ~/.claude/projects is unchanged after runs.
  • --effort low: thinking_tokens: 0 (the spike without it spent 59).
  • End to end through the new module: the status check and a quip, about 2 s, on claude-haiku-5-5. Codex status was also checked live: "GPT-6 Luna".

Known limits, documented in the docs: Claude Code still adds its own environment context (account email and the neutral folder), and quips don't appear in usage totals because no transcript is saved.

Docs

src/docs/settings.md (Pip + Optional AI quips), src/docs/sessions.md, README.md privacy table, docs/ARCHITECTURE.md.

Tests

New: Claude client (args, env stripping, account parsing, result validation, stdin, timeout/abort/exit/oversize), Codex status, handler routing and status IPC, service cooldown and backend-change rules, settings consent reset, panel chooser, status line and Try a quip. Full vitest passes (2792), as do tsc --noEmit and test:security. Lint finds nothing new in the changed files.

🤖 Generated with Claude Code

Pip's AI quips can now come from Claude Code as well as Codex. The
backend is an explicit choice in Pip options (Off / Codex / Claude),
never the focused session's CLI, because it decides which company
receives the request.

- src/main/pip/backends/ holds a PipCommentBackend interface. The Codex
  client moves behind it; its instructions and reply normalisation are
  shared through src/main/pip/instructions.ts.
- The Claude backend runs one Haiku prompt at low effort in Tether's
  neutral folder: no tools, no settings sources (so no hooks, Tether's
  included), strict MCP with claude.ai connectors off, no skills, and no
  saved session. The request goes on stdin, so the prompt excerpt never
  crosses a command line or cmd.exe shim. A reply counts only if every
  modelUsage key is a Haiku model, it took one turn, and no permission
  was denied.
- Subscription sign-in is required: `claude auth status --json` must
  report claude.ai on the first-party provider. API keys, proxies and
  cloud-provider switches are removed from the child environment.
- Choosing a backend checks its sign-in and model right away and shows
  the result. Try a quip asks for one immediately; it skips the
  cooldown but counts toward the hourly cap.
- Prompt-sharing consent names the recipient (OpenAI or Anthropic), and
  choosing another backend withdraws it. The main process discards a
  reply if the backend changed while the request was in flight.
- "Personality & comments" is renamed "Pip options".

Verified live on Claude Code 2.1.322: the debug log shows 0 hooks
registered, ~/.claude/projects is unchanged after a run, --effort low
spends 0 thinking tokens, and a quip took about 2 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@maxthomas95
maxthomas95 merged commit f9a9b82 into main Nov 12, 2026
11 checks passed
@maxthomas95
maxthomas95 deleted the feat/pip-claude-backend branch November 12, 2026 21:51
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