pi-delegate
pi-delegate
将实现和测试委托给本地
pi 代理,并通过钩子
强制执行派发纪律。
Claude 担任技术负责人:它负责生成探针、任务书、验收脚本和裁决。pi 负责编写源代码。
Claude 从不直接说 RPC 协议——MCP 服务器持有管道,这正是运行中途 pi_steer 和 pi_abort 成为可能的原因。
安装
/plugin marketplace add LarryStanley/pi-delegate
/plugin install pi-delegate@pi-delegate在 Claude Code 中运行这两条命令。第一条命令将此仓库注册为插件
市场;第二条命令从中安装插件。如果安装摘要显示
Run /reload-plugins to activate.,也请运行该命令。
需要 Node ≥ 22 以及一个已经配置好的 pi 安装。依赖项会
自动从已提交的 lockfile 中安装——无需自己执行 npm install。
之后要更新:
/plugin marketplace update pi-delegate要运行工作副本而不是已发布版本:
claude --plugin-dir /path/to/pi-delegate--plugin-dir 副本在该会话中优先于已安装的版本,因此你可以在不卸载的情况下
测试更改。
然后运行 /pi-delegate:setup 进行引导式首次运行演练:它会检查 pi 及其
提供商,解释纪律模式并询问你想要哪一种,提供修复任何可修复问题的选项,
并在你真正开始使用这些工具之前提供一次验证性派发。
Related MCP server: Claude Code Manager WAN
配置:默认情况下无需任何配置
pi_dispatch 不指定提供商或模型,因此 pi 使用你自己的默认配置
(~/.pi/agent/settings.json 中的 defaultProvider / defaultModel)。换句话说:
无论你当前将 pi 指向哪个模型,派发也会去往那里——anthropic、openai、litellm、
ollama、LM Studio 或本地 OpenAI 兼容服务器(例如 omlx)都以相同方式工作,
无需为此插件专门配置任何内容。
如果你想长期固定使用不同的模型(例如,一个专用的廉价本地模型用于
派发,而交互式 pi 使用其他模型),请写入
~/.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"]
}每个字段都是可选的。解析顺序是 pi_dispatch 调用参数 → 此文件 → pi 自身的
默认值。
/pi-delegate:doctor 会告诉你一次派发实际会到达哪个模型,并且只在
条件确实成立时才提出问题。
以下默认值是实测得出的,而非猜测
参数 | 默认值 | 原因 |
|
| 小型本地模型会耗尽整个思考预算却从不发出一次工具调用。强大的托管模型在难题上确实受益于思考,因此它是可覆盖的。 |
|
| 授予 |
|
| 实测:没有它,43 次读取 / 0 次写入 / 超时;有了它,93 秒内完成。 |
要覆盖,请在 pi_dispatch 调用中直接指定(thinking、tools、
no_context_files、append_system_prompt、provider、model、timeout_s)。
--mode rpc、--session-id、--no-skills 和 --no-extensions 是结构性的,不可
覆盖;--no-session 是故意从不传递的(省略它才能使会话
落到磁盘上,这正是 pi_transcript 有东西可读的原因)。
模式
模式 | 行为 |
| 完全不干预 |
| 在触碰现有产品代码时给出提示(默认) |
| 阻止编辑现有产品代码 |
使用 /pi-delegate:mode <mode> 切换模式;状态保存在 ~/.claude/pi-delegate/modes.json 中,
按项目记忆。"现有产品代码"指项目根目录 src/ 下已存在的源文件;
tasks/、scripts/、docs/、markdown、配置文件和全新文件
都允许通过。
strict 是纪律护栏,而非强制措施:钩子只连接到 Write|Edit,因此
用 Bash(sed -i、heredoc、python - <<EOF 等)编辑同一文件
永远不会被拦截。总有办法绕过它——它阻止的是你出于习惯自己编辑文件,而不是
蓄意的变通方法。
要手动编辑一次(探针),请先运行 /pi-delegate:probe 获得一次性绕过。
MCP 工具
工具 | 用途 |
| 派发任务书。 |
| 检查进度 |
| 在运行中途偏离方向时插话 |
| 中止。原样重新派发已中止的任务;只有在真正失败后才重写任务书 |
| 收集异步派发的裁决 |
| 仅在裁决不够时深入查看 |
| 检查令牌使用情况 |
一次派发如何工作
MCP 服务器的激活跨越整个会话;这就是为什么它仍然可以在运行中途将 steer 投递到 pi 子进程的 stdin,也是为什么由它——而非子进程——来决定运行何时结束。
已知缺口
pi_stats 只返回裁决中已有的 tokens 和 duration_s。spec
§5 的 get_session_stats 透传(包括 cost / context 使用情况)尚未
实现。
文档
文件 | 内容 |
| 发布前一轮的更改和验证说明 |
| 设计规格(历史) |
| 实现计划(历史) |
| 派发纪律本身:四方分工、任务书、验收、模型选择 |
开发
npm test # node --test, no external dependencies
claude plugin validate .fixtures/fake-pi.mjs 代替 pi --mode rpc。它故意位于 test/ 之外——
node --test 将 **/test/**/*.{cjs,mjs,js} 下的任何文件都视为测试文件,而
把它放在 test/ 中会添加一个永久通过的幻影测试。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables MCP clients to spawn and control Codex CLI and Claude Code sessions on the host machine, with session management and filesystem access.4MIT
- FlicenseNot gradedqualityCmaintenanceEnables ISLI agents and MCP clients to dispatch natural-language coding and terminal tasks to a locally-installed Claude Code CLI, supporting both one-shot execution and persistent sessions with workspace and security controls.
- FlicenseNot gradedqualityBmaintenanceEnables Claude Code to delegate work to persistent oh-my-pi (omp) subagents via an MCP server with 7 tools (spawn, send, output, status, list, stop, prune), wrapping omp RPC mode with enforcement hooks for descriptive agent naming, model configuration, denylists, write-scope ownership, and cooperative locking.
- FlicenseNot gradedqualityBmaintenanceDelegates coding tasks to the local Claude Code CLI via MCP, offering run, review, and status tools for MCP-compatible agents.21
Related MCP Connectors
A paid remote MCP for OpenAI Codex agent coordination MCP, built to return verdicts, receipts, usage
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Project management MCP for AI agents with safe task reads and writes.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/LarryStanley/pi-delegate'
If you have feedback or need assistance with the MCP directory API, please join our Discord server