pi-delegate

pi-delegate

Enables Claude Code to delegate coding implementation and testing to a local pi agent via MCP tools, including dispatching task books, monitoring status, steering or aborting runs mid-execution, and retrieving results and transcripts.

Category
访问服务器

README

pi-delegate

Delegate implementation and tests to a local pi agent, with hooks that enforce dispatch discipline.

Claude acts as tech lead: it produces the probe, the task book, the acceptance script, and the verdict. pi writes the source code.

Architecture: Claude calls MCP tools, the MCP server holds each pi child's stdio open, pi children call the user's own provider

Claude never speaks the RPC protocol directly — the MCP server holds the pipe, which is what makes mid-run pi_steer and pi_abort possible.

Install

/plugin marketplace add LarryStanley/pi-delegate
/plugin install pi-delegate@pi-delegate

Run both inside Claude Code. The first command registers this repository as a plugin marketplace; the second installs the plugin from it. If the install summary says Run /reload-plugins to activate., run that too.

Requires Node ≥ 22 and a pi installation that is already set up. Dependencies are installed automatically from the committed lockfile — there is nothing to npm install yourself.

To update later:

/plugin marketplace update pi-delegate

<details> <summary>Local development install</summary>

To run a working copy instead of the published version:

claude --plugin-dir /path/to/pi-delegate

A --plugin-dir copy takes precedence over the installed one for that session, so you can test changes without uninstalling.

</details>

Then run /pi-delegate:setup for a guided first-run walkthrough: it checks pi and its provider, explains the discipline modes and asks which one you want, offers to fix anything fixable, and offers a verification dispatch before you start using the tools for real.

Configuration: nothing is required by default

pi_dispatch specifies no provider or model, so pi uses your own default (defaultProvider / defaultModel in ~/.pi/agent/settings.json). In other words: whatever model you already point pi at, dispatches go there too — anthropic, openai, litellm, ollama, LM Studio, or a local OpenAI-compatible server (e.g. omlx) all work the same way, with nothing to configure for this plugin specifically.

If you want to pin a different model long-term (for example, a cheap local model dedicated to dispatches while interactive pi uses something else), write ~/.claude/pi-delegate/config.json:

{
  "provider": "ollama",
  "model": "qwen3:8b",
  "timeout_s": 1500,
  "thinking": "off",
  "tools": "read,write,edit",
  "no_context_files": true,
  "drafter_patterns": ["-draft", "_assistant", "-assistant"]
}

Every field is optional. Resolution order is pi_dispatch call arguments → this file → pi's own defaults.

/pi-delegate:doctor tells you which model a dispatch will actually reach, and raises a problem only under conditions that genuinely hold.

The defaults below were measured, not guessed

Parameter Default Why
thinking off Small local models spend their whole thinking budget and never emit a single tool call. Strong hosted models do benefit from thinking on hard problems, so it's overridable.
tools read,write,edit Granting bash made the model roam endlessly with ls / cat instead of writing anything.
no_context_files true Measured: without it, 43 reads / 0 writes / timed out; with it, finished in 93 seconds.

To override, specify it directly in the pi_dispatch call (thinking, tools, no_context_files, append_system_prompt, provider, model, timeout_s).

--mode rpc, --session-id, --no-skills, and --no-extensions are structural and not overridable; --no-session is deliberately never passed (omitting it is what makes the session land on disk, which is what gives pi_transcript something to read).

Modes

Mode Behavior
off No intervention at all
soft Nudges when existing product code is touched (default)
strict Blocks edits to existing product code

Switch modes with /pi-delegate:mode <mode>; state lives in ~/.claude/pi-delegate/modes.json, remembered per project. "Existing product code" means a source file that already exists under the project root's src/; tasks/, scripts/, docs/, markdown, config files, and brand-new files are all allowed through.

strict is a discipline guardrail, not enforcement: the hook is only wired to Write|Edit, so editing the same file with Bash (sed -i, a heredoc, python - <<EOF, …) is never intercepted. There's always a way around it — it blocks editing the file yourself out of habit, not a deliberate workaround.

To make one hand-edit (a probe), run /pi-delegate:probe first for a one-time bypass.

MCP tools

Tool Purpose
pi_dispatch Dispatch a task book. mode=sync waits for the result, mode=async runs it in the background
pi_status Check progress
pi_steer Interject mid-run when it's heading the wrong way
pi_abort Abort. Re-dispatch an aborted task unchanged; only rewrite the task book after a real failure
pi_result Collect the verdict of an async dispatch
pi_transcript Drill in only when the verdict isn't enough
pi_stats Check token usage

How a dispatch works

Sequence diagram of one pi_dispatch call followed by a mid-run pi_steer, showing Claude, the MCP server, a pi child, and the provider

The MCP server's activation spans the whole session; that's why it can still deliver a steer to the pi child's stdin mid-run, and why it — not the child process — decides when the run is over.

Known gaps

pi_stats only returns the tokens and duration_s already present in the verdict. spec §5's get_session_stats passthrough (including cost / context usage) is not yet implemented.

Documentation

File Contents
docs/publish-prep-report.md Changes and verification notes from the pre-release pass
docs/superpowers/specs/2026-08-22-pi-delegate-plugin-design.md Design spec (historical)
docs/superpowers/plans/2026-08-22-pi-delegate-plugin.md Implementation plan (historical)
skills/delegating-to-pi/ The dispatch discipline itself: the four-way split, task books, acceptance, model choice

Development

npm test                    # node --test, no external dependencies
claude plugin validate .

fixtures/fake-pi.mjs stands in for pi --mode rpc. It deliberately lives outside test/node --test treats any file under **/test/**/*.{cjs,mjs,js} as a test file, and putting it in test/ would add one permanently-passing phantom test.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选