Pi Agent For Claude

pi agent for claude: a `pi` subagent type whose model steps run the pi CLI, so pi subagents and agent-team teammates live in Claude Code's own agent UI, streamed live, on any model pi can reach.

ModintegrationsMIT6 source files

Before you use this component

This is a third-party source bundle, not an installation into your account. UI Discovery has checked the available redistribution license evidence; runtime behavior has not been tested. Review all files, use a disposable project first, and do not enable scripts or hooks until you understand their permissions.

Some integrations require separately installed software, API keys or paid services. Credentials and subscriptions are not included. These are Claude Code resources; other clients may require adaptation.

Extract the ZIP into a temporary folder, inspect its entry file and supporting resources, then follow the original instructions. Do not overwrite an existing project configuration blindly. Keep the bundled license and attribution notices.

Source publisher
Claude Code Templates
Creator supplied by source
Fazal Ali
Pinned source version
a344359459263d73d8948651c789244093c02e4e
License evidence
cli-tool/components/mods/integrations/pi-agent-for-claude/LICENSE

Source preview

cli-tool/components/mods/integrations/pi-agent-for-claude/README.md

# pi-agent-for-claude

> Vendored from [FazalAAli/pi-agent-for-claude](https://github.com/FazalAAli/pi-agent-for-claude) (MIT, by Fazal Ali). Install with `npx claude-code-templates@latest --mod integrations/pi-agent-for-claude`, or from the author's marketplace as described upstream. Report issues upstream.

Runs [pi](https://pi.dev) as a native Claude Code subagent. It shows in the
agent list, streams live, takes follow-ups, and opens in a tmux pane as a
teammate, while the model behind it is anything pi can reach.

```
> Have pi run with model kimi k2 and summarize this repo.

⏺ pi-agent-for-claude:pi(Summarize repo)
  ⎿ ▸ bash: {"command":"ls -la && git log --oneline -10"}
    ▸ bash: {"command":"cat package.json"}
    This repo is an Expo/React Native calling app with a Go admin service...

    — answered by pi, openrouter/moonshotai/kimi-k2
```

Claude Code starts a real subagent. The mod replaces only its model requests
(`turn.step`) with a detached `pi --mode json` run and streams pi's text,
thinking and tool calls. Hook calls get 10 s, so long runs span several steps
chained through a no-op `pi_progress` tool. pi's final answer goes back as
text, `SubagentHandback`, or `SendMessage` for teammates, with pi's real token
usage.

## Requirements

- Claude Code 2.1.275+ (the first build that dispatches `agent.spawn` and `turn.step`)
- [pi](https://pi.dev), logged in to at least one provider
- Node.js, macOS or Linux
- tmux, for teammate panes

## Usage

Ask Claude for pi in plain language. It picks the `pi-agent-for-claude:pi` agent type.

- **Spawn:** "Have pi review the error handling in src/api."
- **Pick a model:** "Have pi run with model kimi k2 and …". Claude adds a `pi-model: <pattern>` line, passed to `pi --model`. Without it pi uses its default. `pi --list-models <search>` lists models.
- **Follow up:** messages to a running pi agent continue its pi session and model.
- **Teammate pane:** name it. "Spawn a pi agent named piper to …"

Answers end with `— answered by pi, <provider/model>`, read from pi's own
events. Trust it over what the model says about itself.

## Security

pi runs its own read/bash/edit/write tools, outside Claude Code's permission
prompts, tool policy and safety classifier. A pi agent can change files
without asking. Restrict pi in its own config if that matters.

## Limitations

- **No hooks, no pi.** With function hooks off, a "pi" agent runs as Claude Haiku and only replies that pi is not active. For teammates, the flag must be in settings `env`.
- **Relies on undocumented engine behaviour:** the 10 s hook budget, subagent transcript files under `~/.claude/projects/`, exact engine message text, and `ps` to detect teammates.
- **Cost figures** for pi agents are pi's real token counts priced as Claude tokens. pi's provider bills them; check its billing.
- **Teammate shutdown** requests go to pi as plain messages. Close the pane yourself.

## Install

```sh
npx claude-code-templates@latest --mod integrations/pi-agent-for-claude
```

Then add the flags to `~/.claude/settings.json`, since shell variables alone
don't reach teammate panes, and restart (inside tmux for teammate panes):

```json
{
  "env": {
    "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
  },
  "teammateMode": "tmux"
}
```

It is written to `.claude/skills/pi-agent-for-claude/`, which Claude Code auto-loads as `pi-agent-for-claude@skills-dir` once the workspace is trusted. For one session with hot reload: `claude --plugin-dir .claude/skills/pi-agent-for-claude`. `claude plugin validate .claude/skills/pi-agent-for-claude` prints every event it hooks and every `$` call it makes.

**Requirements.** Mods are on by default in Claude Code 2.1.287+, and this one needs 2.1.275+. Typed against Anthropic's declarations: https://github.com/anthropics/claude-code/tree/main/mods

Preview capped at 60,000 characters. Download the bundle for every original file and notice.

Read the redistribution license
MIT License

Copyright (c) 2026 Fazal Ali

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Bundle SHA-256: a8495b3e56439d3ab271014b222a4dee65990263436d039a96bfd39d85e28fc9. Files are served as downloads and are never executed by this page.