pi-claude-bridge
Pi extension that uses Claude Code (via Agent SDK) as a model provider and adds an AskClaude tool.
Package details
Install pi-claude-bridge from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-claude-bridge- Package
pi-claude-bridge- Version
0.5.0- Published
- Jun 5, 2026
- Downloads
- 1,664/mo · 852/wk
- Author
- elidickinson
- License
- MIT
- Types
- extension
- Size
- 256.7 KB
- Dependencies
- 5 dependencies · 3 peers
Pi manifest JSON
{
"extensions": [
"./src/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-claude-bridge
Pi extension that integrates Claude Code via the Agent SDK. Based initially on claude-agent-sdk-pi by Prateek Sunal. This fork adds streaming, MCP tool bridging, custom pi tool bridging, session resume/persistence, context sync, thinking support, skills forwarding, and the AskClaude tool.
- Provider — Use Opus/Sonnet/Haiku as models in pi, with all tool calls flowing through pi's TUI
- AskClaude tool — Delegate tasks or questions to Claude Code when using another provider
Important note: Starting June 15, 2026 Anthropic has announced they will no longer allow tools based on the Agent SDK (like this one) to pull from your regular subscription quota. Instead they pull from a monthly credit equal to your subscription fee (so $100 of usage credits on a $100/month Max plan). I'm not sure how valuable this extension will be once that happens. If there are easier ways to pull from that $100 bucket connecting to the API directly without the Agent SDK overhead, that's probably a better approach. (Alternatively there are other extensions focused on spoofing the official Claude Code client to keep using subscription quota.)
Install
pi install npm:pi-claude-bridge
Provider
Use /model to select claude-bridge/claude-opus-4-8, claude-bridge/claude-opus-4-7, claude-bridge/claude-opus-4-6, claude-bridge/claude-sonnet-4-6, or claude-bridge/claude-haiku-4-5.
Behind the scenes, pi's tools are bridged to Claude Code but it should all work like normal in pi. Bash commands get a 120-second default timeout (matching Claude Code's default) since pi's bash has no timeout by default. Skills in pi are copied over to Claude Code's system prompt so should work as they would with any other pi provider.
AskClaude Tool
Available when using any non-claude-bridge provider. Pi's LLM can delegate tasks to Claude Code and wait for it to answer a question or perform a task. Examples of how to use:
- "Ask Claude to plan a fix"
- "If you get stuck, ask claude for help"
- "Ask claude to review the plan in @foo.md, implement it, then ask an isolated=true claude to review the implementation"
- "Ask claude to poke holes in this theory"
- "Find all the places in the codebase that handle auth"
You could also create skills or add something to AGENTS.md to e.g. "Always call Ask Claude to review complicated feature implementations before considering the task complete."
Parameters
prompt— the question or task for Claude Codemode—read(default, read files and search/fetch on web),none, orfull(read+write+bash, disable this mode withallowFullMode: falsein config)model—opus(default),sonnet,haiku, or a full model IDthinking— effort level:off,minimal,low,medium,high,xhighisolated— whentrue, Claude gets a clean session with no conversation history (default:false)
Configuration
Config: ~/.pi/agent/claude-bridge.json (global) or .pi/claude-bridge.json (project; merged over global).
{
"askClaude": {
"enabled": true,
"allowFullMode": true,
"defaultIsolated": false,
"description": "Custom tool description override"
},
"provider": {
"strictMcpConfig": true,
"pathToClaudeCodeExecutable": "/home/you/.nix-profile/bin/claude"
}
}
askClaude:
enabled— register the AskClaude tool (defaulttrue)name,label,description— overrides for the tool's pi-side name, TUI label, and descriptiondefaultMode—"read"(default),"none", or"full"defaultIsolated— start each call in a fresh session (defaultfalse)allowFullMode— allowmode: "full"; setfalseto lock it outappendSkills— forward pi's skills block into the system prompt (defaulttrue)
provider (low-level SDK plumbing, most users can ignore):
appendSystemPrompt— append pi's AGENTS.md and skills (defaulttrue)settingSources— CC filesystem settings to load; only applied whenappendSystemPrompt: falsestrictMcpConfig— block MCP servers from~/.claude.json/.mcp.json(defaulttrue). Cloud MCP (Gmail/Drive via claude.ai OAuth) is always blocked.pathToClaudeCodeExecutable— path to theclaudebinary. Required on NixOS (and other non-FHS systems) where the SDK's bundled musl/glibc binaries can't run. Set to your Nix-installed binary, e.g."/home/you/.nix-profile/bin/claude".
Tests
npm run test:unit for offline tests (tests/unit-*.mjs: queue, import, skills).
npm test for the full suite, which adds integration tests that hit APIs (tests/int-*.{sh,mjs}: smoke, multi-turn, cache, session-resume, session-rebuild, tool-message). Set CLAUDE_BRIDGE_TESTING_ALT_MODEL in .env.test for the alt-provider smoke test (e.g. openrouter/z-ai/glm-4.7-flash).
Debugging
Set CLAUDE_BRIDGE_DEBUG=1 to enable debug output:
- Bridge log at
~/.pi/agent/claude-bridge.log— every provider call, session sync decision, tool result delivery, and CC's stderr. Override location withCLAUDE_BRIDGE_DEBUG_PATH. - Per-query Claude Code CLI logs at
~/.pi/agent/cc-cli-logs/<timestamp>-<tag>-<seq>.log— the CC subprocess's own debug stream, one file perquery()call. Tags areprovider(main turn),continuation(steer replay), oraskclaude(sub-delegation). Useful when a resume fails or CC misbehaves internally — shows the CLI's own view of session loading, API requests, and tool calls.
When filing a bug about a session-resume failure (e.g. "No conversation found"), the most useful attachments are the syncResult: lines from the bridge log plus the matching cc-cli-logs/ file for the failing query.
Maintenance
After a Claude Code release, review MODE_DISALLOWED_TOOLS in src/index.ts — it gates which CC tools the AskClaude subagent may invoke per mode (read / full / none). Add new agentic tools (PlanMode, Task spawning, etc.) to the appropriate mode lists if they shouldn't be available to subagents.