@tduyng/pi-claude0.0.4
Claude Pro and Max models in Pi through the official Claude Code CLI: one warm streaming process, Pi's own prompt and tools, no credential copy.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
@tduyng/pi-claude
Claude Pro, Max, Team and Enterprise models inside pi, through the official Claude Code CLI. Pi keeps the system prompt, the tools, the approvals, compaction and the session tree. The CLI keeps authentication and billing.
No token is copied and no API is called directly.
No tools, no prompt block, no schema, since this is only a provider. What it saves is the replay: one warm process means a normal turn writes only the new user message, so the prefix stays cached between turns.
One warm process per session
--input-format stream-json keeps a process alive, and a normal turn writes only the new user message to stdin. A tool round parks the MCP calls, returns one pi assistant message with the tool calls, then the next provider call delivers the results into the same process. Nothing respawns, nothing is replayed, and the cached prefix survives.
The extension deliberately does not use --resume. Claude Code 2.1.69 changed how a resumed conversation rebuilds messages[0], which invalidates the conversation cache on every turn. A live streaming process avoids that path entirely.
An abort sends an interrupt control request instead of killing the process, so the process and its cache survive. An abort during tool execution keeps the parked calls, and pi's Operation aborted results resolve them on the next turn. An idle process lives 60 minutes, the length of the prompt cache.
When pi's history diverges from the live process, after editing an earlier message, changing the model, changing the tool set, or resuming a pi session after a restart, the extension replaces the process and replays the existing conversation once as a single user message. That turn is a cold cache, and later turns are warm again.
Pi's tools are the only tools
The extension disables Claude Code's own system prompt, CLAUDE.md, rules, skills, slash commands, hooks, plugins, project MCP servers, auto memory, git snapshot, title generation and auto compaction with flags and environment variables. What is left is a model that reaches pi's tools.
| Pi | Claude Code |
|---|---|
| Pi system prompt | --system-prompt-file, replacing the default |
| Pi tools | MCP server pi, exposed as mcp__pi__<tool> |
| Pi tool execution | The MCP call parks until pi runs the tool, then the result resolves it |
| Pi compaction | DISABLE_AUTO_COMPACT=1, so pi decides when |
| Pi approvals | Every tool call returns to pi and runs there |
Use
pi --provider claude --model claude-opus-5
Inside pi:
/model claude/claude-opus-5
The provider id is claude, and model ids are the ones pi already uses for Anthropic: claude/claude-opus-5 and anthropic/claude-opus-5 name the same model. The catalog comes from @earendil-works/pi-ai, so new Claude models appear when pi updates, with no edit here.
| Command | Effect |
|---|---|
/claude status |
Binary, login, MCP port, live processes |
/claude models |
Every model id |
/claude clear |
Close the warm processes |
Install
Requirements:
- Pi 1.4 or newer.
- Claude Code 2.1.281 or newer on
PATH. - A Claude Pro, Max, Team or Enterprise login: run
claude auth login. PI_CLAUDE_BINonly when the binary is not namedclaude.
pi install npm:@tduyng/pi-claude
Local checkout: pi install /path/to/dotfiles/pi/agent/extensions/pi-claude
The extension never reads ~/.claude/.credentials.json, never copies OAuth tokens, and never talks to the Anthropic API directly.
PI_CLAUDE_BIN=/home/you/.nix-profile/bin/claude pi
Limits
Every request counts against the subscription limits, exactly like the CLI itself.
Anthropic may treat a third-party harness prompt differently from the CLI's own prompt. A turn failing with a third-party or extra-usage message is about the prompt shape, not the transport.
One process per pi session. Subagents with a different prompt get their own, up to eight alive at once.
A model change, a thinking level change or a tool set change rebuilds the session on the next turn.
Images in replayed history are attached to the replay message, and new user images are sent normally.
Claude Code needs a model id it recognizes, so a brand new model may need a newer CLI than the one installed.
The CLI caps MCP tool output and may move very large text to a file. Pi tools normally truncate before that cap.
Usage comes from the CLI's stream events. The monetary cost is pi's API-equivalent estimate, not the subscription bill.