Files

1 line
303 KiB
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"repo": "agents365-ai/pi-plugin-cc", "files": {"README_CN.md": {"b6a5c2dd0c19d427b3c02c2e048db2347a499804": {"t": 1785674335.297288, "n": 11645, "h": "b5dc33d29c1501ae", "c": "# pi-plugin-cc — 在 Claude Code 和 Codex 里驱动 Pi 编码 agent 🥧\n\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/network/members)\n[![Latest Release](https://img.shields.io/github/v/release/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/releases/latest)\n[![Last Commit](https://img.shields.io/github/last-commit/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/commits/main)\n\n[![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-plugin-8a2be2)](https://docs.claude.com/en/docs/claude-code/plugins)\n[![Pi Coding Agent](https://img.shields.io/badge/Pi-coding%20agent-0a7d4a)](https://github.com/earendil-works/pi)\n[![Model agnostic](https://img.shields.io/badge/Model-agnostic-555)](#选模型)\n\n[English](README.md) · **中文**\n\n外部参考:[Pi 编码 agent](https://github.com/earendil-works/pi) · [Pi RPC 模式](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md) · [Pi providers](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md)\n\n把代码评审与编码任务从 Claude Code 转交给 [Pi 编码 agent](https://github.com/earendil-works/pi) 的插件。改编自 [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc),把底层 runtime 从 Codex 换成 Pi。也可以在 OpenAI Codex CLI 里使用 —— 见[在 Codex 里使用](#-在-codex-里使用)。\n\n**硬依赖是 pi 本身,不是某个具体的大模型。** Pi 可以配置成 DeepSeek、OpenAI、Anthropic、Google、Ollama、LM Studio,或者任何 OpenAI 兼容端点 —— 通过 `~/.pi/agent/models.json`。插件默认把模型选择完全交给 pi,除非你单次 `--model` 覆盖。\n\n- **代码评审**:针对 working tree 或基于分支的 diff,输出结构化 findings\n- **对抗式评审**:质疑设计本身,而不是只挑改动里的拼写错误\n- **任务转交**:诊断、重构、长流程救援,前台或后台执行\n- **并行分发**:`/pi:parallel-rescue` 通过 [`pi-subagents`](https://github.com/nicobailon/pi-subagents) 并发跑多个独立任务\n- **分片并行评审**:`/pi:review --shards <N>` 把大 diff 改动的文件拆成 N 个并行评审任务,再合并 findings\n- **后台作业控制**:`status`、`result`、`cancel`,以及可选的 stop-time 评审守门\n- **无 OAuth 登录**:Pi 用 provider 的 API key 认证,不需要 `codex login`\n\n深度集成 [`pi-subagents`](https://github.com/nicobailon/pi-subagents)(`pi install npm:pi-subagents`):`/pi:setup` 会检测安装状态并列出 agent 档案,`/pi:rescue` 的 prompt 会告知 Pi 可用 `subagent` 工具,`/pi:parallel-rescue` 把多个任务分发给并行子代理(scout、researcher、planner、worker、reviewer 等)。\n\n## 🔄 工作流程\n\n<img src=\"docs/pi-plugin-cc-workflow_CN.png\" alt=\"pi-plugin-cc 工作流程\" width=\"80%\">\n\nCodex 的 broker 层被去掉 —— Pi 是\"一进程一会话\"模型,插件给每个任务直接 spawn 一个新的 `pi --mode rpc`。后台作业用工作区作用域的状态文件追踪。Pi 没有 `outputSchema` 这种参数,所以评审 prompt 直接把 JSON schema 内联进去。\n\n## 斜杠命令\n\n| 命令 | 作用 |\n|---|---|\n| `/pi:setup` | 检查 `pi` 是否安装、provider 是否配置;切换 stop-time 评审守门 |\n| `/pi:review` | 针对本地 git 状态的标准代码评审 |\n| `/pi:adversarial-review` | 可指定 focus 的对抗式评审 —— 质疑实现方案本身 |\n| `/pi:rescue` | 把任务转交给 `pi:pi-companion-forwarder` 子代理跑一个 Pi 会话 |\n| `/pi:parallel-rescue` | 通过 pi-subagents 并行跑多个独立任务(`subagent({ tasks })` 分发) |\n| `/pi:status [job-id]` | 列出本仓库正在运行 / 最近完成的 Pi 作业 |\n| `/pi:result <job-id>` | 查看一个已完成作业的最终输出 |\n| `/pi:cancel <job-id>` | 终止一个正在运行的后台作业 |\n\n每个命令都接受 `--model <id>` 临时指定模型。不传 `--model`、也没配 env 覆盖(见[选模型](#选模型))时,pi 用它自己默认的模型。\n\n## 快速开始\n\n```bash\n# 1. 装 pi(必需)\nnpm install -g --ignore-scripts @earendil-works/pi-coding-agent\n\n# 2. 配一个 provider —— 任选其一\nexport OPENAI_API_KEY=sk-... # OpenAI\nexport ANTHROPIC_API_KEY=sk-ant-... # Anthropic\nexport GOOGLE_API_KEY=... # Google\nexport DEEPSEEK_API_KEY=sk-... # DeepSeek\n# 或本地跑:见 https://github.com/earendil-works/pi (Ollama / LM Studio)\n\n# 3. 验证 pi 看到了模型\npi --list-models | head\n```\n\n在 Claude Code 里安装插件:\n\n```text\n> /plugin marketplace add Agents365-ai/pi-plugin-cc\n> /plugin install pi@agents365-pi\n> /reload-plugins\n> /pi:setup\n```\n\n`/pi:setup` 给出就绪报告;如果 `pi` 没装但 `npm` 在 PATH,它会问你要不要替你装。\n\n## 使用方式\n\n```text\n> /pi:review\n> /pi:review --base main\n> /pi:review --model claude-sonnet-4\n> /pi:review --out-file review.md\n> /pi:adversarial-review focus on the new auth middleware\n> /pi:rescue 调研一下 Windows CI 为什么编译失败\n> /pi:rescue --background --model gpt-4o 重构 src/payments/\n> /pi:parallel-rescue \"审计 auth 模块\" \"给 db 查询做基准测试\" \"更新 API 文档\"\n> /pi:status\n> /pi:status task-mpgyiwb9-e3k641 --wait\n> /pi:result task-mpgyiwb9-e3k641\n> /pi:cancel task-mpgyiwb9-e3k641\n```\n\n`--effort <off|minimal|low|medium|high|xhigh|max>` 会经 `set_thinking_level` 传给 Pi。不支持 thinking 的模型会静默忽略(插件会往 stderr 写一行提示)。\n\n`--out-file <path>`(用于 `/pi:review`、`/pi:adversarial-review`、`/pi:rescue`、`/pi:result`)把 Pi 的完整输出写到文件,只返回一段简短摘要——verdict、findings 计数、每条一行。繁重推理本就跑在更便宜的模型上;这一步还把大段结果挡在调用方的上下文之外,大型评审就不会在\"转述\"上烧 Claude Code 的 token。要看全文就打开那个文件。\n\n`--incremental`(用于 `/pi:review`、`/pi:adversarial-review`)只评审当前分支上自上次评审以来的新提交,靠一份按分支缓存的\"上次评审提交\"记录来实现——跳过已经审过的代码,省下 Pi 的输入 token 和时间。没有可用缓存时会自动回退为全量评审。\n\n## 🧩 在 Codex 里使用\n\n本插件的核心是一个与宿主无关的 CLI(`pi-companion.mjs`)—— 任何能跑 shell 命令的 coding agent 都能驱动它。对 OpenAI 的 Codex CLI,安装自带的 [custom prompts](codex-prompts/):\n\n```bash\n# 1. 克隆仓库(任意位置;prompts 默认假设在 ~/pi-plugin-cc)\ngit clone https://github.com/Agents365-ai/pi-plugin-cc ~/pi-plugin-cc\n\n# 2. 安装 Codex custom prompts\nmkdir -p ~/.codex/prompts\ncp ~/pi-plugin-cc/codex-prompts/*.md ~/.codex/prompts/\n\n# 3. 如果克隆到了别处,把 prompts 指向它\necho 'export PI_PLUGIN_ROOT=\"$HOME/path/to/pi-plugin-cc\"' >> ~/.zshrc\n```\n\n之后在 Codex 里用:`/pi-review`、`/pi-adversarial-review`、`/pi-rescue`、`/pi-parallel-rescue`、`/pi-status`、`/pi-result`、`/pi-cancel`、`/pi-setup`(注意是 `-` 不是 `:` —— Codex 的 prompt 名不能带冒号)。\n\nCodex 下不可用的部分:stop-time 评审守门和会话恢复询问(两者依赖 Claude Code 的 hooks / 子代理)。其余功能 —— 包括 pi-subagents 并行分发 —— 行为一致。\n\n## 🧑‍⚖️ 多模型评审团\n\n单个评审者有盲区,评审团的盲区不重叠。给任一评审命令传 `--models`,同一份 diff 会**并行**发给多个模型评审,findings 自动合并——被 2 个以上模型同时报告的问题排在最前,并带 `found by:` 标注:\n\n```text\n> /pi:review --models deepseek-v4-flash,claude-sonnet-4-6,gpt-5-mini\n> /pi:adversarial-review --models deepseek-v4-pro,o1 focus on concurrency\n```\n\n- 共识 findings(2+ 模型)排最前,单模型 findings 紧随其后。\n- 同文件 + 行区间带容差匹配去重;严重度取各模型报告的最高档,不同表述的标题会保留为备注。\n- 某个成员失败(provider 报错、返回非法 JSON)只按成员如实报告,不影响整体——只要有一个模型返回有效评审,评审团就算成功。\n- 评审团成员不走 `PI_PLUGIN_FALLBACK_MODELS` 降级链——评审团本身就是冗余机制。\n- 这个能力只有 Pi 这种多供应商 agent 才做得到:单一供应商的 CLI 无法召集跨厂商评审团。\n\n## 🛟 模型故障自动降级\n\n配置一次降级链,之后任何失败的运行——provider 宕机、鉴权错误、自动重试耗尽——都会自动换下一个模型重跑:\n\n```bash\nexport PI_PLUGIN_FALLBACK_MODELS=deepseek-v4-flash,MiniMax-M3\n```\n\n评审和 rescue 任务都生效。当结果来自降级模型时,输出末尾会附 `Model fallback:` 说明(JSON payload 里带 `modelAttempts`)。`/pi:setup` 会显示当前配置的降级链。\n\n## 🏁 模型竞速\n\n硬骨头任务可以让多个模型**并行**跑同一个任务,然后选出赢家:\n\n```text\n> /pi:rescue --race deepseek-v4-pro,claude-sonnet-4-6 fix the flaky retry logic in src/queue.mjs\n> /pi:rescue --race deepseek-v4-flash,gemini-2.5-pro why does the Windows CI build fail?\n```\n\n- **写竞速**(`--write`,`/pi:rescue` 默认带):每个 racer 在独立的 git worktree(从 `HEAD` 创建)里干活——racer 之间以及和你的工作树完全隔离。每个 racer 的成果捕获为 patch;审阅后用 `git apply <patch>` 应用其中一个。\n- **只读竞速**(排查类任务):racer 分析同一份代码,输出并排展示各自答案——多模型结论一致是强信号。\n- 某个 racer 失败或没产生改动会被如实标注;只要有一个 racer 完成,竞速就算成功。\n- 不能与 `--model` 或 `--resume` 同用(每个 racer 都是全新 session)。racer 从 `HEAD` 出发,任务涉及未提交改动时先 commit 或 stash。\n\n## 选模型\n\n模型解析三层优先级:\n\n| 优先级 | 来源 | 例子 |\n|---|---|---|\n| 1 | 斜杠命令上的 `--model <id>` | `/pi:review --model gpt-4o` |\n| 2 | Env var(仅 review / adversarial-review) | `export PI_PLUGIN_REVIEW_MODEL=deepseek-v4-flash`<br>`export PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=deepseek-v4-pro` |\n| 3 | pi 自己配置的默认模型 | 你 `~/.pi/agent/models.json` 里的,或 pi TUI `/model` 上次选的 |\n\n层 1 > 层 2 > 层 3。**三层都可以不设** —— 全空就让 pi 自己决定。\n\n### 各 provider 的建议默认\n\n只是建议,不强制。按延迟 / 成本 / 质量预算自己挑:\n\n| Provider | 日常 review(`/pi:review`) | 对抗式 review(`/pi:adversarial-review`) |\n|---|---|---|\n| DeepSeek | `deepseek-v4-flash` | `deepseek-v4-pro` |\n| OpenAI | `gpt-4o-mini` 或 `gpt-5-mini` | `o1` 或 `gpt-5` |\n| Anthropic | `claude-haiku-4-5` | `claude-sonnet-4-6` 或 `claude-opus-4-7` |\n| Google | `gemini-2.5-flash` | `gemini-2.5-pro` |\n| 本地(Ollama) | `qwen2.5-coder:7b` | `qwen2.5-coder:32b` 或 `deepseek-r1` |\n\n想让这些选择粘住:\n\n```bash\nexport PI_PLUGIN_REVIEW_MODEL=claude-haiku-4-5\nexport PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=claude-sonnet-4-6\n```\n\n### 性价比档 —— 比 Claude/GPT 便宜、依然能打\n\n驱动 Pi 的意义就在于你不被 Claude 或 GPT 锁死。下面这些模型的成本只是 Claude/GPT 顶配的零头,性能虽然没那么强,但用于日常 review 和 rescue 绰绰有余。在 `~/.pi/agent/models.json` 里配置它们(大多是 OpenAI 兼容端点),并用你的 provider 实际暴露的 id —— 用 `pi --list-models` 核对。\n\n| Provider | 建议模型 |\n|---|---|\n| DeepSeek | `deepseek-v4-flash`(日常)· `deepseek-v4-pro`(对抗式) |\n| xAI | `grok-4.5` |\n| 智谱(GLM) | `glm-5.1` · `glm-5.2`(更重) |\n| 月之暗面(Kimi) | `kimi-k3`(或 `kimi-k2.6`) |\n| MiniMax | `MiniMax-M3` |\n| 字节(Seed) | `doubao-seed-2.1-pro` |\n| 小米(MiMo) | `mimo-v2.5`(日常)· `mimo-v2.5-pro`(更重) |\n| Meta | `muse-spark-1.1` |\n\n……以及任何你配置的 OpenAI 兼容端点。可用性和确切 id 取决于你的 `~/.pi/agent/models.json`。\n\n> 不是每个模型都能为结构化 review 命令吐出干净 JSON。如果某个模型在 `/pi:review` 上解析报错,它用于 `/pi:rescue`(自由格式)仍然没问题 —— 或者把它加进 `PI_PLUGIN_FALLBACK_MODELS` 链,坏成员会自动重试下一个。(已观察到:部分 MiniMax 和本地模型会回显 prompt 而非返回 JSON。)\n\n## 配置 pi\n\n最简就是一个环境变量装 API key。要细配就写 `~/.pi/agent/models.json`:\n\n```json\n{\n \"providers\": {\n \"deepseek\": { \"apiKey\": \"sk-...\" },\n \"openai\": { \"apiKey\": \"sk-...\" },\n \"anthropic\":{ \"apiKey\": \"sk-ant-...\" },\n \"google\": { \"apiKey\": \"...\" },\n \"openrouter\": {\n \"api\": \"openai-completions\",\n \"apiKey\": \"sk-or-v1-...\",\n \"baseUrl\": \"https://openrouter.ai/api/v1\",\n \"models\": [\n {\n \"id\": \"deepseek/deepseek-chat\",\n \"name\": \"DeepSeek via OpenRouter\",\n \"contextWindow\": 128000,\n \"maxTokens\": 8192,\n \"input\": [\"text\"]\n }\n ]\n }\n }\n}\n```\n\n内置 provider(`anthropic`、`openai`、`google`、`deepseek`、`ollama`、`lmstudio`)只要 `apiKey` 和可选 `baseUrl`,pi 自带模型清单。OpenAI 兼容端点用 `api: \"openai-completions\"` 并写自定义 `models`。\n\n完整字段见 [pi providers 文档](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md)。\n\n## Stop-time 评审守门\n\n用 `/pi:setup --enable-review-gate` 开启。每次结束 Claude 会话时,插件会对上一轮 Claude 的输出做一次 Pi 对抗式评审;若发现重要问题会阻止退出。开了守门但 pi 不可用时 hook 会 block(**不会**静默放行)。用 `/pi:setup --disable-review-gate` 关闭。\n\n## 🔗 相关项目\n\n| 项目 | 定位 | 适用场景 |\n|---|---|---|\n| [codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | 同样的命令面,底层跑 Codex | 想用 OpenAI Codex agent + ChatGPT 账号时 |\n| [pi (earendil-works)](https://github.com/earendil-works/pi) | 本插件驱动的编码 agent 本体 | 想直接用 Pi、不经 Claude Code 时 |\n| [pi-subagents](https://github.com/nicobailon/pi-subagents) | Pi 扩展,加 `subagent` 工具 + `/run` / `/chain` / `/parallel` | 驱动 `/pi:parallel-rescue`,也让 `/pi:rescue` 能转交给专门的子代理 |\n\n## ❤️ 支持\n\n如果这个插件对你有帮助,欢迎打赏支持作者:\n\n<table>\n <tr>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/wechat-pay.png\" width=\"180\" alt=\"微信支付\">\n <br>\n <b>微信支付</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/alipay.png\" width=\"180\" alt=\"支付宝\">\n <br>\n <b>支付宝</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/buymeacoffee.png\" width=\"180\" alt=\"Buy Me a Coffee\">\n <br>\n <b>Buy Me a Coffee</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/awarding/award.gif\" width=\"180\" alt=\"打赏\">\n <br>\n <b>打赏</b>\n </td>\n </tr>\n</table>\n\n## 👤 作者\n\n**Agents365-ai**\n\n- GitHub: https://github.com/Agents365-ai\n- Bilibili: https://space.bilibili.com/441831884\n\n## 📄 License\n\n[Apache License 2.0](LICENSE)。改编自 [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) (Apache-2.0, OpenAI) —— 见 [NOTICE](NOTICE)。\n"}}, "README.md": {"b6a5c2dd0c19d427b3c02c2e048db2347a499804": {"t": 1785674337.1953242, "n": 16376, "h": "d67b7230bf2c4583", "c": "# pi-plugin-cc — drive the Pi coding agent from Claude Code and Codex 🥧\n\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/network/members)\n[![Latest Release](https://img.shields.io/github/v/release/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/releases/latest)\n[![Last Commit](https://img.shields.io/github/last-commit/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/commits/main)\n\n[![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-plugin-8a2be2)](https://docs.claude.com/en/docs/claude-code/plugins)\n[![Pi Coding Agent](https://img.shields.io/badge/Pi-coding%20agent-0a7d4a)](https://github.com/earendil-works/pi)\n[![Model agnostic](https://img.shields.io/badge/Model-agnostic-555)](#pick-your-model)\n\n**English** · [中文](README_CN.md)\n\nExternal references: [Pi coding agent](https://github.com/earendil-works/pi) · [Pi RPC mode](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md) · [Pi providers](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md)\n\nA Claude Code plugin that delegates reviews and coding tasks to the [Pi coding agent](https://github.com/earendil-works/pi). Adapted from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc), runtime swapped from Codex to Pi. Also usable from OpenAI's Codex CLI — see [Use from Codex](#-use-from-codex).\n\n**The hard dependency is pi, not any particular LLM.** Pi can be configured for DeepSeek, OpenAI, Anthropic, Google, Ollama, LM Studio, or any OpenAI-compatible endpoint via `~/.pi/agent/models.json`. The plugin defers all model selection to pi unless you override per command.\n\n- **Code review** against the working tree or a branch base, with structured findings\n- **Adversarial review** that challenges the design — not just spell-checks the diff\n- **Task delegation** for diagnoses, refactors, and longer rescues, foreground or background\n- **Parallel fan-out** — `/pi:parallel-rescue` runs multiple independent tasks concurrently via [`pi-subagents`](https://github.com/nicobailon/pi-subagents)\n- **Sharded parallel review** — `/pi:review --shards <N>` splits a large diff's changed files across N review jobs that run in parallel, then merges the findings\n- **Background job control** — `status`, `result`, `cancel`, and stop-time review gate\n- **No OAuth** — pi authenticates by API key (provider-specific), no `codex login` required\n\nIntegrates with [`pi-subagents`](https://github.com/nicobailon/pi-subagents) (`pi install npm:pi-subagents`): `/pi:setup` detects it and lists the agent profiles, `/pi:rescue` prompts advertise the `subagent` tool to Pi, and `/pi:parallel-rescue` fans multiple tasks out to parallel child agents (scout, researcher, planner, worker, reviewer, …).\n\n## 🔄 How it works\n\n<img src=\"docs/pi-plugin-cc-workflow.png\" alt=\"pi-plugin-cc workflow\" width=\"80%\">\n\nCodex's broker layer is gone — Pi is one-conversation-per-process, so the plugin spawns a fresh `pi --mode rpc` for each task. Background jobs are tracked in workspace-scoped state files. Review prompts inline the JSON schema since Pi has no `outputSchema` knob.\n\n## Slash commands\n\n| Command | What it does |\n|---|---|\n| `/pi:setup` | Verifies `pi` is installed + a provider is configured; toggles the stop-time review gate |\n| `/pi:review` | Standard code review of local git state |\n| `/pi:adversarial-review` | Steerable challenge review — questions the approach itself |\n| `/pi:rescue` | Delegate investigation or implementation to a Pi run via the `pi:pi-companion-forwarder` subagent |\n| `/pi:parallel-rescue` | Run multiple independent tasks in parallel via pi-subagents (`subagent({ tasks })` fan-out) |\n| `/pi:status [job-id]` | List active / recent Pi jobs in this repository |\n| `/pi:result <job-id>` | Show the stored final output for a finished job |\n| `/pi:cancel <job-id>` | Terminate a running background job |\n\nEvery command accepts `--model <id>` to pin a specific model just for that run. With no `--model` and no env override (see [Pick your model](#pick-your-model)), pi falls back to whatever it has configured by default.\n\n## Quick Start\n\n```bash\n# 1. Install pi (required)\nnpm install -g --ignore-scripts @earendil-works/pi-coding-agent\n\n# 2. Configure a provider — pick one\nexport OPENAI_API_KEY=sk-... # OpenAI\nexport ANTHROPIC_API_KEY=sk-ant-... # Anthropic\nexport GOOGLE_API_KEY=... # Google\nexport DEEPSEEK_API_KEY=sk-... # DeepSeek\n# or run a local model: see https://github.com/earendil-works/pi (Ollama / LM Studio)\n\n# 3. Verify pi sees a model\npi --list-models | head\n```\n\nInstall the plugin in Claude Code:\n\n```text\n> /plugin marketplace add Agents365-ai/pi-plugin-cc\n> /plugin install pi@agents365-pi\n> /reload-plugins\n> /pi:setup\n```\n\n`/pi:setup` returns a readiness report. If `pi` is missing and `npm` is on PATH, it offers to install it for you.\n\n## Usage\n\n```text\n> /pi:review\n> /pi:review --base main\n> /pi:review --model claude-sonnet-4\n> /pi:review --out-file review.md\n> /pi:adversarial-review focus on the new auth middleware\n> /pi:rescue investigate why the Windows CI build is failing\n> /pi:rescue --background --model gpt-4o refactor src/payments/\n> /pi:parallel-rescue \"audit the auth module\" \"benchmark the db queries\" \"update the API docs\"\n> /pi:status\n> /pi:status task-mpgyiwb9-e3k641 --wait\n> /pi:result task-mpgyiwb9-e3k641\n> /pi:cancel task-mpgyiwb9-e3k641\n```\n\n`--effort <off|minimal|low|medium|high|xhigh|max>` is passed through to Pi via `set_thinking_level`. Models that do not support thinking silently ignore it (the plugin logs a one-line note to stderr when this happens).\n\n`--out-file <path>` (on `/pi:review`, `/pi:adversarial-review`, `/pi:rescue`, `/pi:result`) writes Pi's full output to a file and returns only a short summary — verdict, finding counts, one line per finding. The heavy reasoning already runs on the cheaper model; this also keeps the large result out of the calling agent's context, so a big review doesn't burn Claude Code tokens on the relay. Open the file for the full detail.\n\n`--incremental` (on `/pi:review`, `/pi:adversarial-review`) reviews only the commits since the last review on the current branch, using a per-branch cache of the last-reviewed commit — saving Pi input tokens and time by skipping the code that was already reviewed. Falls back to a full review when there is no valid cache.\n\n## 🧩 Use from Codex\n\nThe core of this plugin is a harness-agnostic CLI (`pi-companion.mjs`) — any coding agent that can run shell commands can drive it. For OpenAI's Codex CLI, install the bundled [custom prompts](codex-prompts/):\n\n```bash\n# 1. Clone the repo (anywhere; ~/pi-plugin-cc is the default the prompts assume)\ngit clone https://github.com/Agents365-ai/pi-plugin-cc ~/pi-plugin-cc\n\n# 2. Install the Codex custom prompts\nmkdir -p ~/.codex/prompts\ncp ~/pi-plugin-cc/codex-prompts/*.md ~/.codex/prompts/\n\n# 3. If you cloned somewhere else, point the prompts at it\necho 'export PI_PLUGIN_ROOT=\"$HOME/path/to/pi-plugin-cc\"' >> ~/.zshrc\n```\n\nThen inside Codex: `/pi-review`, `/pi-adversarial-review`, `/pi-rescue`, `/pi-parallel-rescue`, `/pi-status`, `/pi-result`, `/pi-cancel`, `/pi-setup` (note `-` instead of `:` — Codex prompt names cannot contain colons).\n\nNot available under Codex: the stop-time review gate and session-resume prompts (both rely on Claude Code hooks / subagents). Everything else — including pi-subagents parallel fan-out — works the same.\n\n## 🧑‍⚖️ Multi-model review panel\n\nOne reviewer has blind spots; a panel doesn't share them. Passing `--models` to either review command runs the same diff through several models **in parallel** and merges their findings — issues reported by 2+ models rank first with a `found by:` tag:\n\n```text\n> /pi:review --models deepseek-v4-flash,claude-sonnet-4-6,gpt-5-mini\n> /pi:adversarial-review --models deepseek-v4-pro,o1 focus on concurrency\n```\n\n- Consensus findings (2+ models) are listed first; single-model findings follow.\n- Duplicate findings are matched per file with line-range slack; severity escalates to the highest reported and alternate titles are kept.\n- A member that fails (provider error, invalid JSON) is reported inline and does not sink the panel — it succeeds as long as one model returns a valid review.\n- Panel members do not use the `PI_PLUGIN_FALLBACK_MODELS` chain — the panel itself is the redundancy.\n- This only exists because Pi is provider-agnostic: a single-vendor CLI cannot convene a cross-vendor panel.\n\n## 🛟 Automatic model fallback\n\nSet a fallback chain once, and any failed run — provider outage, auth error, exhausted retries — is automatically retried with the next model:\n\n```bash\nexport PI_PLUGIN_FALLBACK_MODELS=deepseek-v4-flash,MiniMax-M3\n```\n\nApplies to reviews and rescue tasks alike. When a fallback produced the result, the output ends with a `Model fallback:` note (and the JSON payload carries `modelAttempts`). `/pi:setup` shows the configured chain.\n\n## 🏁 Model racing\n\nFor hard problems, run the same rescue task with several models **in parallel** and pick the winner:\n\n```text\n> /pi:rescue --race deepseek-v4-pro,claude-sonnet-4-6 fix the flaky retry logic in src/queue.mjs\n> /pi:rescue --race deepseek-v4-flash,gemini-2.5-pro why does the Windows CI build fail?\n```\n\n- **Write races** (`--write`, the `/pi:rescue` default): each racer works in an isolated git worktree created from `HEAD` — racers can never touch your working tree or each other. Each racer's result is captured as a patch; review them and apply exactly one with `git apply <patch>`.\n- **Read-only races** (investigations): racers analyze the same tree; the output presents each answer side by side — agreement across models is a strong signal.\n- A racer that fails or produces no changes is reported as such; the race succeeds while at least one racer finishes.\n- Not combinable with `--model` or `--resume` (each racer starts a fresh session). Racers start from `HEAD`, so commit or stash first if the task concerns uncommitted work.\n\n## Pick your model\n\nThe plugin keeps three layers of model resolution:\n\n| Priority | Source | Example |\n|---|---|---|\n| 1 | `--model <id>` on the slash command | `/pi:review --model gpt-4o` |\n| 2 | Env var (review / adversarial-review only) | `export PI_PLUGIN_REVIEW_MODEL=deepseek-v4-flash`<br>`export PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=deepseek-v4-pro` |\n| 3 | Pi's own configured default | whatever your `~/.pi/agent/models.json` has, or `/model` last picked in pi TUI |\n\nLayer 1 wins over layer 2 wins over layer 3. **None of the layers are required** — leave them all unset and pi picks for you.\n\n### Suggested settings by provider\n\nThese are opinions, not requirements. Pick what fits your latency / cost / quality budget.\n\n| Provider | Everyday review (`/pi:review`) | Adversarial review (`/pi:adversarial-review`) |\n|---|---|---|\n| DeepSeek | `deepseek-v4-flash` | `deepseek-v4-pro` |\n| OpenAI | `gpt-4o-mini` or `gpt-5-mini` | `o1` or `gpt-5` |\n| Anthropic | `claude-haiku-4-5` | `claude-sonnet-4-6` or `claude-opus-4-7` |\n| Google | `gemini-2.5-flash` | `gemini-2.5-pro` |\n| Local (Ollama) | `qwen2.5-coder:7b` | `qwen2.5-coder:32b` or `deepseek-r1` |\n\nTo make these defaults sticky:\n\n```bash\nexport PI_PLUGIN_REVIEW_MODEL=claude-haiku-4-5\nexport PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=claude-sonnet-4-6\n```\n\n### Value tier — cheaper than Claude/GPT, still competitive\n\nThe whole point of driving Pi is that you are not locked to Claude or GPT. These models cost a fraction of the frontier Claude/GPT tiers and, while not quite as strong, are more than good enough for everyday review and rescue work. Configure them in `~/.pi/agent/models.json` (most are OpenAI-compatible endpoints) and use the exact id your provider exposes — verify with `pi --list-models`.\n\n| Provider | Suggested model(s) |\n|---|---|\n| DeepSeek | `deepseek-v4-flash` (everyday) · `deepseek-v4-pro` (adversarial) |\n| xAI | `grok-4.5` |\n| Zhipu (GLM) | `glm-5.1` · `glm-5.2` (heavier) |\n| Moonshot (Kimi) | `kimi-k3` (or `kimi-k2.6`) |\n| MiniMax | `MiniMax-M3` |\n| ByteDance (Seed) | `doubao-seed-2.1-pro` |\n| Xiaomi (MiMo) | `mimo-v2.5` (everyday) · `mimo-v2.5-pro` (heavier) |\n| Meta | `muse-spark-1.1` |\n\n…and any other OpenAI-compatible endpoint you configure. Availability and the exact id depend on your `~/.pi/agent/models.json`.\n\n> Not every model emits clean JSON for the structured review commands. If `/pi:review` fails with a parse error on a given model, it is still fine for `/pi:rescue` (free-form) — or add it to a `PI_PLUGIN_FALLBACK_MODELS` chain so a flaky member is retried with the next one. (Observed: some MiniMax and local models echo the prompt back instead of returning JSON.)\n\n## Configure pi\n\nThe minimum is a single env var with your API key. For richer setups, write `~/.pi/agent/models.json`:\n\n```json\n{\n \"providers\": {\n \"deepseek\": { \"apiKey\": \"sk-...\" },\n \"openai\": { \"apiKey\": \"sk-...\" },\n \"anthropic\":{ \"apiKey\": \"sk-ant-...\" },\n \"google\": { \"apiKey\": \"...\" },\n \"openrouter\": {\n \"api\": \"openai-completions\",\n \"apiKey\": \"sk-or-v1-...\",\n \"baseUrl\": \"https://openrouter.ai/api/v1\",\n \"models\": [\n {\n \"id\": \"deepseek/deepseek-chat\",\n \"name\": \"DeepSeek via OpenRouter\",\n \"contextWindow\": 128000,\n \"maxTokens\": 8192,\n \"input\": [\"text\"]\n }\n ]\n }\n }\n}\n```\n\nBuilt-in providers (`anthropic`, `openai`, `google`, `deepseek`, `ollama`, `lmstudio`) only need `apiKey` (and optional `baseUrl`); pi ships their model lists. For custom OpenAI-compatible endpoints, set `api: \"openai-completions\"` and declare the `models` you want exposed.\n\nFull reference: [pi providers docs](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md).\n\n## Stop-time review gate\n\nOpt in with `/pi:setup --enable-review-gate`. When a Claude session ends, the plugin runs a Pi adversarial review of the previous turn and can block the stop if it finds material issues. If pi is unavailable while the gate is enabled, the hook blocks (it does **not** silently let the session end). Disable with `/pi:setup --disable-review-gate`.\n\n## 🔗 Related projects\n\n| Project | Niche | When to use |\n|---|---|---|\n| [codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | Same surface, runs Codex | You want OpenAI's Codex agent + ChatGPT auth |\n| [pi (earendil-works)](https://github.com/earendil-works/pi) | The coding agent this plugin drives | You want to use Pi directly without Claude Code |\n| [pi-subagents](https://github.com/nicobailon/pi-subagents) | Pi extension adding `subagent` tool + `/run` / `/chain` / `/parallel` | Powers `/pi:parallel-rescue` and lets `/pi:rescue` delegate to specialized child agents |\n\n## ❤️ Support\n\nIf this plugin helps you, consider supporting the author:\n\n<table>\n <tr>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/wechat-pay.png\" width=\"180\" alt=\"WeChat Pay\">\n <br>\n <b>WeChat Pay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/alipay.png\" width=\"180\" alt=\"Alipay\">\n <br>\n <b>Alipay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/buymeacoffee.png\" width=\"180\" alt=\"Buy Me a Coffee\">\n <br>\n <b>Buy Me a Coffee</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/awarding/award.gif\" width=\"180\" alt=\"Give a Reward\">\n <br>\n <b>Give a Reward</b>\n </td>\n </tr>\n</table>\n\n## 👤 Author\n\n**Agents365-ai**\n\n- GitHub: https://github.com/Agents365-ai\n- Bilibili: https://space.bilibili.com/441831884\n\n## 📄 License\n\n[Apache License 2.0](LICENSE). Forked from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) (Apache-2.0, OpenAI) — see [NOTICE](NOTICE).\n"}, "c85ec1db22cb4eb4ce21cf86d4563f1d30076589": {"t": 1785766134.2490118, "n": 16376, "h": "d67b7230bf2c4583", "c": "# pi-plugin-cc — drive the Pi coding agent from Claude Code and Codex 🥧\n\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/network/members)\n[![Latest Release](https://img.shields.io/github/v/release/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/releases/latest)\n[![Last Commit](https://img.shields.io/github/last-commit/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/commits/main)\n\n[![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-plugin-8a2be2)](https://docs.claude.com/en/docs/claude-code/plugins)\n[![Pi Coding Agent](https://img.shields.io/badge/Pi-coding%20agent-0a7d4a)](https://github.com/earendil-works/pi)\n[![Model agnostic](https://img.shields.io/badge/Model-agnostic-555)](#pick-your-model)\n\n**English** · [中文](README_CN.md)\n\nExternal references: [Pi coding agent](https://github.com/earendil-works/pi) · [Pi RPC mode](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md) · [Pi providers](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md)\n\nA Claude Code plugin that delegates reviews and coding tasks to the [Pi coding agent](https://github.com/earendil-works/pi). Adapted from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc), runtime swapped from Codex to Pi. Also usable from OpenAI's Codex CLI — see [Use from Codex](#-use-from-codex).\n\n**The hard dependency is pi, not any particular LLM.** Pi can be configured for DeepSeek, OpenAI, Anthropic, Google, Ollama, LM Studio, or any OpenAI-compatible endpoint via `~/.pi/agent/models.json`. The plugin defers all model selection to pi unless you override per command.\n\n- **Code review** against the working tree or a branch base, with structured findings\n- **Adversarial review** that challenges the design — not just spell-checks the diff\n- **Task delegation** for diagnoses, refactors, and longer rescues, foreground or background\n- **Parallel fan-out** — `/pi:parallel-rescue` runs multiple independent tasks concurrently via [`pi-subagents`](https://github.com/nicobailon/pi-subagents)\n- **Sharded parallel review** — `/pi:review --shards <N>` splits a large diff's changed files across N review jobs that run in parallel, then merges the findings\n- **Background job control** — `status`, `result`, `cancel`, and stop-time review gate\n- **No OAuth** — pi authenticates by API key (provider-specific), no `codex login` required\n\nIntegrates with [`pi-subagents`](https://github.com/nicobailon/pi-subagents) (`pi install npm:pi-subagents`): `/pi:setup` detects it and lists the agent profiles, `/pi:rescue` prompts advertise the `subagent` tool to Pi, and `/pi:parallel-rescue` fans multiple tasks out to parallel child agents (scout, researcher, planner, worker, reviewer, …).\n\n## 🔄 How it works\n\n<img src=\"docs/pi-plugin-cc-workflow.png\" alt=\"pi-plugin-cc workflow\" width=\"80%\">\n\nCodex's broker layer is gone — Pi is one-conversation-per-process, so the plugin spawns a fresh `pi --mode rpc` for each task. Background jobs are tracked in workspace-scoped state files. Review prompts inline the JSON schema since Pi has no `outputSchema` knob.\n\n## Slash commands\n\n| Command | What it does |\n|---|---|\n| `/pi:setup` | Verifies `pi` is installed + a provider is configured; toggles the stop-time review gate |\n| `/pi:review` | Standard code review of local git state |\n| `/pi:adversarial-review` | Steerable challenge review — questions the approach itself |\n| `/pi:rescue` | Delegate investigation or implementation to a Pi run via the `pi:pi-companion-forwarder` subagent |\n| `/pi:parallel-rescue` | Run multiple independent tasks in parallel via pi-subagents (`subagent({ tasks })` fan-out) |\n| `/pi:status [job-id]` | List active / recent Pi jobs in this repository |\n| `/pi:result <job-id>` | Show the stored final output for a finished job |\n| `/pi:cancel <job-id>` | Terminate a running background job |\n\nEvery command accepts `--model <id>` to pin a specific model just for that run. With no `--model` and no env override (see [Pick your model](#pick-your-model)), pi falls back to whatever it has configured by default.\n\n## Quick Start\n\n```bash\n# 1. Install pi (required)\nnpm install -g --ignore-scripts @earendil-works/pi-coding-agent\n\n# 2. Configure a provider — pick one\nexport OPENAI_API_KEY=sk-... # OpenAI\nexport ANTHROPIC_API_KEY=sk-ant-... # Anthropic\nexport GOOGLE_API_KEY=... # Google\nexport DEEPSEEK_API_KEY=sk-... # DeepSeek\n# or run a local model: see https://github.com/earendil-works/pi (Ollama / LM Studio)\n\n# 3. Verify pi sees a model\npi --list-models | head\n```\n\nInstall the plugin in Claude Code:\n\n```text\n> /plugin marketplace add Agents365-ai/pi-plugin-cc\n> /plugin install pi@agents365-pi\n> /reload-plugins\n> /pi:setup\n```\n\n`/pi:setup` returns a readiness report. If `pi` is missing and `npm` is on PATH, it offers to install it for you.\n\n## Usage\n\n```text\n> /pi:review\n> /pi:review --base main\n> /pi:review --model claude-sonnet-4\n> /pi:review --out-file review.md\n> /pi:adversarial-review focus on the new auth middleware\n> /pi:rescue investigate why the Windows CI build is failing\n> /pi:rescue --background --model gpt-4o refactor src/payments/\n> /pi:parallel-rescue \"audit the auth module\" \"benchmark the db queries\" \"update the API docs\"\n> /pi:status\n> /pi:status task-mpgyiwb9-e3k641 --wait\n> /pi:result task-mpgyiwb9-e3k641\n> /pi:cancel task-mpgyiwb9-e3k641\n```\n\n`--effort <off|minimal|low|medium|high|xhigh|max>` is passed through to Pi via `set_thinking_level`. Models that do not support thinking silently ignore it (the plugin logs a one-line note to stderr when this happens).\n\n`--out-file <path>` (on `/pi:review`, `/pi:adversarial-review`, `/pi:rescue`, `/pi:result`) writes Pi's full output to a file and returns only a short summary — verdict, finding counts, one line per finding. The heavy reasoning already runs on the cheaper model; this also keeps the large result out of the calling agent's context, so a big review doesn't burn Claude Code tokens on the relay. Open the file for the full detail.\n\n`--incremental` (on `/pi:review`, `/pi:adversarial-review`) reviews only the commits since the last review on the current branch, using a per-branch cache of the last-reviewed commit — saving Pi input tokens and time by skipping the code that was already reviewed. Falls back to a full review when there is no valid cache.\n\n## 🧩 Use from Codex\n\nThe core of this plugin is a harness-agnostic CLI (`pi-companion.mjs`) — any coding agent that can run shell commands can drive it. For OpenAI's Codex CLI, install the bundled [custom prompts](codex-prompts/):\n\n```bash\n# 1. Clone the repo (anywhere; ~/pi-plugin-cc is the default the prompts assume)\ngit clone https://github.com/Agents365-ai/pi-plugin-cc ~/pi-plugin-cc\n\n# 2. Install the Codex custom prompts\nmkdir -p ~/.codex/prompts\ncp ~/pi-plugin-cc/codex-prompts/*.md ~/.codex/prompts/\n\n# 3. If you cloned somewhere else, point the prompts at it\necho 'export PI_PLUGIN_ROOT=\"$HOME/path/to/pi-plugin-cc\"' >> ~/.zshrc\n```\n\nThen inside Codex: `/pi-review`, `/pi-adversarial-review`, `/pi-rescue`, `/pi-parallel-rescue`, `/pi-status`, `/pi-result`, `/pi-cancel`, `/pi-setup` (note `-` instead of `:` — Codex prompt names cannot contain colons).\n\nNot available under Codex: the stop-time review gate and session-resume prompts (both rely on Claude Code hooks / subagents). Everything else — including pi-subagents parallel fan-out — works the same.\n\n## 🧑‍⚖️ Multi-model review panel\n\nOne reviewer has blind spots; a panel doesn't share them. Passing `--models` to either review command runs the same diff through several models **in parallel** and merges their findings — issues reported by 2+ models rank first with a `found by:` tag:\n\n```text\n> /pi:review --models deepseek-v4-flash,claude-sonnet-4-6,gpt-5-mini\n> /pi:adversarial-review --models deepseek-v4-pro,o1 focus on concurrency\n```\n\n- Consensus findings (2+ models) are listed first; single-model findings follow.\n- Duplicate findings are matched per file with line-range slack; severity escalates to the highest reported and alternate titles are kept.\n- A member that fails (provider error, invalid JSON) is reported inline and does not sink the panel — it succeeds as long as one model returns a valid review.\n- Panel members do not use the `PI_PLUGIN_FALLBACK_MODELS` chain — the panel itself is the redundancy.\n- This only exists because Pi is provider-agnostic: a single-vendor CLI cannot convene a cross-vendor panel.\n\n## 🛟 Automatic model fallback\n\nSet a fallback chain once, and any failed run — provider outage, auth error, exhausted retries — is automatically retried with the next model:\n\n```bash\nexport PI_PLUGIN_FALLBACK_MODELS=deepseek-v4-flash,MiniMax-M3\n```\n\nApplies to reviews and rescue tasks alike. When a fallback produced the result, the output ends with a `Model fallback:` note (and the JSON payload carries `modelAttempts`). `/pi:setup` shows the configured chain.\n\n## 🏁 Model racing\n\nFor hard problems, run the same rescue task with several models **in parallel** and pick the winner:\n\n```text\n> /pi:rescue --race deepseek-v4-pro,claude-sonnet-4-6 fix the flaky retry logic in src/queue.mjs\n> /pi:rescue --race deepseek-v4-flash,gemini-2.5-pro why does the Windows CI build fail?\n```\n\n- **Write races** (`--write`, the `/pi:rescue` default): each racer works in an isolated git worktree created from `HEAD` — racers can never touch your working tree or each other. Each racer's result is captured as a patch; review them and apply exactly one with `git apply <patch>`.\n- **Read-only races** (investigations): racers analyze the same tree; the output presents each answer side by side — agreement across models is a strong signal.\n- A racer that fails or produces no changes is reported as such; the race succeeds while at least one racer finishes.\n- Not combinable with `--model` or `--resume` (each racer starts a fresh session). Racers start from `HEAD`, so commit or stash first if the task concerns uncommitted work.\n\n## Pick your model\n\nThe plugin keeps three layers of model resolution:\n\n| Priority | Source | Example |\n|---|---|---|\n| 1 | `--model <id>` on the slash command | `/pi:review --model gpt-4o` |\n| 2 | Env var (review / adversarial-review only) | `export PI_PLUGIN_REVIEW_MODEL=deepseek-v4-flash`<br>`export PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=deepseek-v4-pro` |\n| 3 | Pi's own configured default | whatever your `~/.pi/agent/models.json` has, or `/model` last picked in pi TUI |\n\nLayer 1 wins over layer 2 wins over layer 3. **None of the layers are required** — leave them all unset and pi picks for you.\n\n### Suggested settings by provider\n\nThese are opinions, not requirements. Pick what fits your latency / cost / quality budget.\n\n| Provider | Everyday review (`/pi:review`) | Adversarial review (`/pi:adversarial-review`) |\n|---|---|---|\n| DeepSeek | `deepseek-v4-flash` | `deepseek-v4-pro` |\n| OpenAI | `gpt-4o-mini` or `gpt-5-mini` | `o1` or `gpt-5` |\n| Anthropic | `claude-haiku-4-5` | `claude-sonnet-4-6` or `claude-opus-4-7` |\n| Google | `gemini-2.5-flash` | `gemini-2.5-pro` |\n| Local (Ollama) | `qwen2.5-coder:7b` | `qwen2.5-coder:32b` or `deepseek-r1` |\n\nTo make these defaults sticky:\n\n```bash\nexport PI_PLUGIN_REVIEW_MODEL=claude-haiku-4-5\nexport PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=claude-sonnet-4-6\n```\n\n### Value tier — cheaper than Claude/GPT, still competitive\n\nThe whole point of driving Pi is that you are not locked to Claude or GPT. These models cost a fraction of the frontier Claude/GPT tiers and, while not quite as strong, are more than good enough for everyday review and rescue work. Configure them in `~/.pi/agent/models.json` (most are OpenAI-compatible endpoints) and use the exact id your provider exposes — verify with `pi --list-models`.\n\n| Provider | Suggested model(s) |\n|---|---|\n| DeepSeek | `deepseek-v4-flash` (everyday) · `deepseek-v4-pro` (adversarial) |\n| xAI | `grok-4.5` |\n| Zhipu (GLM) | `glm-5.1` · `glm-5.2` (heavier) |\n| Moonshot (Kimi) | `kimi-k3` (or `kimi-k2.6`) |\n| MiniMax | `MiniMax-M3` |\n| ByteDance (Seed) | `doubao-seed-2.1-pro` |\n| Xiaomi (MiMo) | `mimo-v2.5` (everyday) · `mimo-v2.5-pro` (heavier) |\n| Meta | `muse-spark-1.1` |\n\n…and any other OpenAI-compatible endpoint you configure. Availability and the exact id depend on your `~/.pi/agent/models.json`.\n\n> Not every model emits clean JSON for the structured review commands. If `/pi:review` fails with a parse error on a given model, it is still fine for `/pi:rescue` (free-form) — or add it to a `PI_PLUGIN_FALLBACK_MODELS` chain so a flaky member is retried with the next one. (Observed: some MiniMax and local models echo the prompt back instead of returning JSON.)\n\n## Configure pi\n\nThe minimum is a single env var with your API key. For richer setups, write `~/.pi/agent/models.json`:\n\n```json\n{\n \"providers\": {\n \"deepseek\": { \"apiKey\": \"sk-...\" },\n \"openai\": { \"apiKey\": \"sk-...\" },\n \"anthropic\":{ \"apiKey\": \"sk-ant-...\" },\n \"google\": { \"apiKey\": \"...\" },\n \"openrouter\": {\n \"api\": \"openai-completions\",\n \"apiKey\": \"sk-or-v1-...\",\n \"baseUrl\": \"https://openrouter.ai/api/v1\",\n \"models\": [\n {\n \"id\": \"deepseek/deepseek-chat\",\n \"name\": \"DeepSeek via OpenRouter\",\n \"contextWindow\": 128000,\n \"maxTokens\": 8192,\n \"input\": [\"text\"]\n }\n ]\n }\n }\n}\n```\n\nBuilt-in providers (`anthropic`, `openai`, `google`, `deepseek`, `ollama`, `lmstudio`) only need `apiKey` (and optional `baseUrl`); pi ships their model lists. For custom OpenAI-compatible endpoints, set `api: \"openai-completions\"` and declare the `models` you want exposed.\n\nFull reference: [pi providers docs](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md).\n\n## Stop-time review gate\n\nOpt in with `/pi:setup --enable-review-gate`. When a Claude session ends, the plugin runs a Pi adversarial review of the previous turn and can block the stop if it finds material issues. If pi is unavailable while the gate is enabled, the hook blocks (it does **not** silently let the session end). Disable with `/pi:setup --disable-review-gate`.\n\n## 🔗 Related projects\n\n| Project | Niche | When to use |\n|---|---|---|\n| [codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | Same surface, runs Codex | You want OpenAI's Codex agent + ChatGPT auth |\n| [pi (earendil-works)](https://github.com/earendil-works/pi) | The coding agent this plugin drives | You want to use Pi directly without Claude Code |\n| [pi-subagents](https://github.com/nicobailon/pi-subagents) | Pi extension adding `subagent` tool + `/run` / `/chain` / `/parallel` | Powers `/pi:parallel-rescue` and lets `/pi:rescue` delegate to specialized child agents |\n\n## ❤️ Support\n\nIf this plugin helps you, consider supporting the author:\n\n<table>\n <tr>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/wechat-pay.png\" width=\"180\" alt=\"WeChat Pay\">\n <br>\n <b>WeChat Pay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/alipay.png\" width=\"180\" alt=\"Alipay\">\n <br>\n <b>Alipay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/buymeacoffee.png\" width=\"180\" alt=\"Buy Me a Coffee\">\n <br>\n <b>Buy Me a Coffee</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/awarding/award.gif\" width=\"180\" alt=\"Give a Reward\">\n <br>\n <b>Give a Reward</b>\n </td>\n </tr>\n</table>\n\n## 👤 Author\n\n**Agents365-ai**\n\n- GitHub: https://github.com/Agents365-ai\n- Bilibili: https://space.bilibili.com/441831884\n\n## 📄 License\n\n[Apache License 2.0](LICENSE). Forked from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) (Apache-2.0, OpenAI) — see [NOTICE](NOTICE).\n"}, "f6dcdea1a4730cc17c81cd933b4e5f2c6e2e1ebf": {"t": 1785766135.4894242, "n": 16357, "h": "5d8804b3f1770c1f", "c": "# pi-plugin-cc — drive the Pi coding agent from Claude Code and Codex 🥧\n\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/network/members)\n[![Latest Release](https://img.shields.io/github/v/release/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/releases/latest)\n[![Last Commit](https://img.shields.io/github/last-commit/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/commits/main)\n\n[![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-plugin-8a2be2)](https://docs.claude.com/en/docs/claude-code/plugins)\n[![Pi Coding Agent](https://img.shields.io/badge/Pi-coding%20agent-0a7d4a)](https://github.com/earendil-works/pi)\n[![Model agnostic](https://img.shields.io/badge/Model-agnostic-555)](#pick-your-model)\n\n**English** · [中文](README_CN.md)\n\nExternal references: [Pi coding agent](https://github.com/earendil-works/pi) · [Pi RPC mode](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md) · [Pi providers](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md)\n\nA Claude Code plugin that delegates reviews and coding tasks to the [Pi coding agent](https://github.com/earendil-works/pi). Adapted from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc), runtime swapped from Codex to Pi. Also usable from OpenAI's Codex CLI — see [Use from Codex](#-use-from-codex).\n\n**The hard dependency is pi, not any particular LLM.** Pi can be configured for DeepSeek, OpenAI, Anthropic, Google, Ollama, LM Studio, or any OpenAI-compatible endpoint via `~/.pi/agent/models.json`. The plugin defers all model selection to pi unless you override per command.\n\n- **Code review** against the working tree or a branch base, with structured findings\n- **Adversarial review** that challenges the design — not just spell-checks the diff\n- **Task delegation** for diagnoses, refactors, and longer rescues, foreground or background\n- **Parallel fan-out** — `/pi:parallel-rescue` runs multiple independent tasks concurrently via [`pi-subagents`](https://github.com/nicobailon/pi-subagents)\n- **Sharded parallel review** — `/pi:review --shards <N>` splits a large diff's changed files across N review jobs that run in parallel, then merges the findings\n- **Background job control** — `status`, `result`, `cancel`, and stop-time review gate\n- **No OAuth** — pi authenticates by API key (provider-specific), no `codex login` required\n\nIntegrates with [`pi-subagents`](https://github.com/nicobailon/pi-subagents) (`pi install npm:pi-subagents`): `/pi:setup` detects it and lists the agent profiles, `/pi:rescue` prompts advertise the `subagent` tool to Pi, and `/pi:parallel-rescue` fans multiple tasks out to parallel child agents (scout, researcher, planner, worker, reviewer, …).\n\n## 🔄 How it works\n\n<img src=\"docs/pi-plugin-cc-workflow.png\" alt=\"pi-plugin-cc workflow\" width=\"80%\">\n\nCodex's broker layer is gone — Pi is one-conversation-per-process, so the plugin spawns a fresh `pi --mode rpc` for each task. Background jobs are tracked in workspace-scoped state files. Review prompts inline the JSON schema since Pi has no `outputSchema` knob.\n\n## Slash commands\n\n| Command | What it does |\n|---|---|\n| `/pi:setup` | Verifies `pi` is installed + a provider is configured; toggles the stop-time review gate |\n| `/pi:review` | Standard code review of local git state |\n| `/pi:adversarial-review` | Steerable challenge review — questions the approach itself |\n| `/pi:rescue` | Delegate investigation or implementation to a Pi run via the `pi:pi-companion-forwarder` subagent |\n| `/pi:parallel-rescue` | Run multiple independent tasks in parallel via pi-subagents (`subagent({ tasks })` fan-out) |\n| `/pi:status [job-id]` | List active / recent Pi jobs in this repository |\n| `/pi:result <job-id>` | Show the stored final output for a finished job |\n| `/pi:cancel <job-id>` | Terminate a running background job |\n\nEvery command accepts `--model <id>` to pin a specific model just for that run. With no `--model` and no env override (see [Pick your model](#pick-your-model)), pi falls back to whatever it has configured by default.\n\n## Quick Start\n\n```bash\n# 1. Install pi (required)\nnpm install -g --ignore-scripts @earendil-works/pi-coding-agent\n\n# 2. Configure a provider — pick one\nexport OPENAI_API_KEY=sk-... # OpenAI\nexport ANTHROPIC_API_KEY=sk-ant-... # Anthropic\nexport GOOGLE_API_KEY=... # Google\nexport DEEPSEEK_API_KEY=sk-... # DeepSeek\n# or run a local model: see https://github.com/earendil-works/pi (Ollama / LM Studio)\n\n# 3. Verify pi sees a model\npi --list-models | head\n```\n\nInstall the plugin in Claude Code:\n\n```text\n> /plugin marketplace add Agents365-ai/pi-plugin-cc\n> /plugin install pi@agents365-pi\n> /reload-plugins\n> /pi:setup\n```\n\n`/pi:setup` returns a readiness report. If `pi` is missing and `npm` is on PATH, it offers to install it for you.\n\n## Usage\n\n```text\n> /pi:review\n> /pi:review --base main\n> /pi:review --model claude-sonnet-4\n> /pi:review --out-file review.md\n> /pi:adversarial-review focus on the new auth middleware\n> /pi:rescue investigate why the Windows CI build is failing\n> /pi:rescue --background --model gpt-4o refactor src/payments/\n> /pi:parallel-rescue \"audit the auth module\" \"benchmark the db queries\" \"update the API docs\"\n> /pi:status\n> /pi:status task-mpgyiwb9-e3k641 --wait\n> /pi:result task-mpgyiwb9-e3k641\n> /pi:cancel task-mpgyiwb9-e3k641\n```\n\n`--effort <off|minimal|low|medium|high|xhigh>` is passed through to Pi via `set_thinking_level`. Models that do not support thinking silently ignore it (the plugin logs a one-line note to stderr when this happens).\n\n`--out-file <path>` (on `/pi:review`, `/pi:adversarial-review`, `/pi:rescue`, `/pi:result`) writes Pi's full output to a file and returns only a short summary — verdict, finding counts, one line per finding. The heavy reasoning already runs on the cheaper model; this also keeps the large result out of the calling agent's context, so a big review doesn't burn Claude Code tokens on the relay. Open the file for the full detail.\n\n`--incremental` (on `/pi:review`, `/pi:adversarial-review`) reviews only the commits since the last review on the current branch, using a per-branch cache of the last-reviewed commit — saving Pi input tokens and time by skipping the code that was already reviewed. Falls back to a full review when there is no valid cache.\n\n## 🧩 Use from Codex\n\nThe core of this plugin is a harness-agnostic CLI (`pi-companion.mjs`) — any coding agent that can run shell commands can drive it. For OpenAI's Codex CLI, install the bundled [custom prompts](codex-prompts/):\n\n```bash\n# 1. Clone the repo (anywhere; ~/pi-plugin-cc is the default the prompts assume)\ngit clone https://github.com/Agents365-ai/pi-plugin-cc ~/pi-plugin-cc\n\n# 2. Install the Codex custom prompts\nmkdir -p ~/.codex/prompts\ncp ~/pi-plugin-cc/codex-prompts/*.md ~/.codex/prompts/\n\n# 3. If you cloned somewhere else, point the prompts at it\necho 'export PI_PLUGIN_ROOT=\"$HOME/path/to/pi-plugin-cc\"' >> ~/.zshrc\n```\n\nThen inside Codex: `/pi-review`, `/pi-adversarial-review`, `/pi-rescue`, `/pi-parallel-rescue`, `/pi-status`, `/pi-result`, `/pi-cancel`, `/pi-setup` (note `-` instead of `:` — Codex prompt names cannot contain colons).\n\nNot available under Codex: the stop-time review gate and session-resume prompts (both rely on Claude Code hooks / subagents). Everything else — including pi-subagents parallel fan-out — works the same.\n\n## 🧑‍⚖️ Multi-model review panel\n\nOne reviewer has blind spots; a panel doesn't share them. Passing `--models` to either review command runs the same diff through several models **in parallel** and merges their findings — issues reported by 2+ models rank first with a `found by:` tag:\n\n```text\n> /pi:review --models deepseek-v4-flash,claude-sonnet-4-6,gpt-5-mini\n> /pi:adversarial-review --models deepseek-v4-pro,o1 focus on concurrency\n```\n\n- Consensus findings (2+ models) are listed first; single-model findings follow.\n- Duplicate findings are matched per file with line-range slack; severity escalates to the highest reported and alternate titles are kept.\n- A member that fails (provider error, invalid JSON) is reported inline and does not sink the panel — it succeeds as long as one model returns a valid review.\n- Panel members do not use the `PI_PLUGIN_FALLBACK_MODELS` chain — the panel itself is the redundancy.\n- This only exists because Pi is provider-agnostic: a single-vendor CLI cannot convene a cross-vendor panel.\n\n## 🛟 Automatic model fallback\n\nSet a fallback chain once, and any failed run — provider outage, auth error, exhausted retries — is automatically retried with the next model:\n\n```bash\nexport PI_PLUGIN_FALLBACK_MODELS=deepseek-v4-flash,MiniMax-M3\n```\n\nApplies to reviews and rescue tasks alike. When a fallback produced the result, the output ends with a `Model fallback:` note (and the JSON payload carries `modelAttempts`). `/pi:setup` shows the configured chain.\n\n## 🏁 Model racing\n\nFor hard problems, run the same rescue task with several models **in parallel** and pick the winner:\n\n```text\n> /pi:rescue --race deepseek-v4-pro,claude-sonnet-4-6 fix the flaky retry logic in src/queue.mjs\n> /pi:rescue --race deepseek-v4-flash,gemini-2.5-pro why does the Windows CI build fail?\n```\n\n- **Write races** (`--write`, the `/pi:rescue` default): each racer works in an isolated git worktree created from `HEAD` — racers can never touch your working tree or each other. Each racer's result is captured as a patch; review them and apply exactly one with `git apply <patch>`.\n- **Read-only races** (investigations): racers analyze the same tree; the output presents each answer side by side — agreement across models is a strong signal.\n- A racer that fails or produces no changes is reported as such; the race succeeds while at least one racer finishes.\n- Not combinable with `--model` or `--resume` (each racer starts a fresh session). Racers start from `HEAD`, so commit or stash first if the task concerns uncommitted work.\n\n## Pick your model\n\nThe plugin keeps three layers of model resolution:\n\n| Priority | Source | Example |\n|---|---|---|\n| 1 | `--model <id>` on the slash command | `/pi:review --model gpt-4o` |\n| 2 | Env var (review / adversarial-review only) | `export PI_PLUGIN_REVIEW_MODEL=deepseek-v4-flash`<br>`export PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=deepseek-v4-pro` |\n| 3 | Pi's own configured default | whatever your `~/.pi/agent/models.json` has, or `/model` last picked in pi TUI |\n\nLayer 1 wins over layer 2 wins over layer 3. **None of the layers are required** — leave them all unset and pi picks for you.\n\n### Suggested settings by provider\n\nThese are opinions, not requirements. Pick what fits your latency / cost / quality budget.\n\n| Provider | Everyday review (`/pi:review`) | Adversarial review (`/pi:adversarial-review`) |\n|---|---|---|\n| DeepSeek | `deepseek-v4-flash` | `deepseek-v4-pro` |\n| OpenAI | `gpt-4o-mini` or `gpt-5-mini` | `o1` or `gpt-5` |\n| Anthropic | `claude-haiku-4-5` | `claude-sonnet-4-6` or `claude-opus-4-7` |\n| Google | `gemini-2.5-flash` | `gemini-2.5-pro` |\n| Local (Ollama) | `qwen2.5-coder:7b` | `qwen2.5-coder:32b` or `deepseek-r1` |\n\nTo make these defaults sticky:\n\n```bash\nexport PI_PLUGIN_REVIEW_MODEL=claude-haiku-4-5\nexport PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=claude-sonnet-4-6\n```\n\n### Value tier — cheaper than Claude/GPT, still competitive\n\nThe whole point of driving Pi is that you are not locked to Claude or GPT. These models cost a fraction of the frontier Claude/GPT tiers and, while not quite as strong, are more than good enough for everyday review and rescue work. Configure them in `~/.pi/agent/models.json` (most are OpenAI-compatible endpoints) and use the exact id your provider exposes — verify with `pi --list-models`.\n\n| Provider | Suggested model(s) |\n|---|---|\n| DeepSeek | `deepseek-v4-flash` (everyday) · `deepseek-v4-pro` (adversarial) |\n| xAI | `grok-4.5` |\n| Zhipu (GLM) | `glm-5.1` · `glm-5.2` (heavier) |\n| Moonshot (Kimi) | `kimi-k2.6` |\n| MiniMax | `MiniMax-M3` |\n| ByteDance (Seed) | `doubao-seed-2.1-pro` |\n| Xiaomi (MiMo) | `mimo-v2.5` (everyday) · `mimo-v2.5-pro` (heavier) |\n| Meta | `muse-spark-1.1` |\n\n…and any other OpenAI-compatible endpoint you configure. Availability and the exact id depend on your `~/.pi/agent/models.json`.\n\n> Not every model emits clean JSON for the structured review commands. If `/pi:review` fails with a parse error on a given model, it is still fine for `/pi:rescue` (free-form) — or add it to a `PI_PLUGIN_FALLBACK_MODELS` chain so a flaky member is retried with the next one. (Observed: some MiniMax and local models echo the prompt back instead of returning JSON.)\n\n## Configure pi\n\nThe minimum is a single env var with your API key. For richer setups, write `~/.pi/agent/models.json`:\n\n```json\n{\n \"providers\": {\n \"deepseek\": { \"apiKey\": \"sk-...\" },\n \"openai\": { \"apiKey\": \"sk-...\" },\n \"anthropic\":{ \"apiKey\": \"sk-ant-...\" },\n \"google\": { \"apiKey\": \"...\" },\n \"openrouter\": {\n \"api\": \"openai-completions\",\n \"apiKey\": \"sk-or-v1-...\",\n \"baseUrl\": \"https://openrouter.ai/api/v1\",\n \"models\": [\n {\n \"id\": \"deepseek/deepseek-chat\",\n \"name\": \"DeepSeek via OpenRouter\",\n \"contextWindow\": 128000,\n \"maxTokens\": 8192,\n \"input\": [\"text\"]\n }\n ]\n }\n }\n}\n```\n\nBuilt-in providers (`anthropic`, `openai`, `google`, `deepseek`, `ollama`, `lmstudio`) only need `apiKey` (and optional `baseUrl`); pi ships their model lists. For custom OpenAI-compatible endpoints, set `api: \"openai-completions\"` and declare the `models` you want exposed.\n\nFull reference: [pi providers docs](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md).\n\n## Stop-time review gate\n\nOpt in with `/pi:setup --enable-review-gate`. When a Claude session ends, the plugin runs a Pi adversarial review of the previous turn and can block the stop if it finds material issues. If pi is unavailable while the gate is enabled, the hook blocks (it does **not** silently let the session end). Disable with `/pi:setup --disable-review-gate`.\n\n## 🔗 Related projects\n\n| Project | Niche | When to use |\n|---|---|---|\n| [codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | Same surface, runs Codex | You want OpenAI's Codex agent + ChatGPT auth |\n| [pi (earendil-works)](https://github.com/earendil-works/pi) | The coding agent this plugin drives | You want to use Pi directly without Claude Code |\n| [pi-subagents](https://github.com/nicobailon/pi-subagents) | Pi extension adding `subagent` tool + `/run` / `/chain` / `/parallel` | Powers `/pi:parallel-rescue` and lets `/pi:rescue` delegate to specialized child agents |\n\n## ❤️ Support\n\nIf this plugin helps you, consider supporting the author:\n\n<table>\n <tr>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/wechat-pay.png\" width=\"180\" alt=\"WeChat Pay\">\n <br>\n <b>WeChat Pay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/alipay.png\" width=\"180\" alt=\"Alipay\">\n <br>\n <b>Alipay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/buymeacoffee.png\" width=\"180\" alt=\"Buy Me a Coffee\">\n <br>\n <b>Buy Me a Coffee</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/awarding/award.gif\" width=\"180\" alt=\"Give a Reward\">\n <br>\n <b>Give a Reward</b>\n </td>\n </tr>\n</table>\n\n## 👤 Author\n\n**Agents365-ai**\n\n- GitHub: https://github.com/Agents365-ai\n- Bilibili: https://space.bilibili.com/441831884\n\n## 📄 License\n\n[Apache License 2.0](LICENSE). Forked from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) (Apache-2.0, OpenAI) — see [NOTICE](NOTICE).\n"}, "f75dde35051b071dfde3fa30cd44de8159ed148d": {"t": 1785766136.9154866, "n": 16033, "h": "74de8e9d414a7d4a", "c": "# pi-plugin-cc — drive the Pi coding agent from Claude Code and Codex 🥧\n\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/network/members)\n[![Latest Release](https://img.shields.io/github/v/release/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/releases/latest)\n[![Last Commit](https://img.shields.io/github/last-commit/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/commits/main)\n\n[![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-plugin-8a2be2)](https://docs.claude.com/en/docs/claude-code/plugins)\n[![Pi Coding Agent](https://img.shields.io/badge/Pi-coding%20agent-0a7d4a)](https://github.com/earendil-works/pi)\n[![Model agnostic](https://img.shields.io/badge/Model-agnostic-555)](#pick-your-model)\n\n**English** · [中文](README_CN.md)\n\nExternal references: [Pi coding agent](https://github.com/earendil-works/pi) · [Pi RPC mode](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md) · [Pi providers](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md)\n\nA Claude Code plugin that delegates reviews and coding tasks to the [Pi coding agent](https://github.com/earendil-works/pi). Adapted from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc), runtime swapped from Codex to Pi. Also usable from OpenAI's Codex CLI — see [Use from Codex](#-use-from-codex).\n\n**The hard dependency is pi, not any particular LLM.** Pi can be configured for DeepSeek, OpenAI, Anthropic, Google, Ollama, LM Studio, or any OpenAI-compatible endpoint via `~/.pi/agent/models.json`. The plugin defers all model selection to pi unless you override per command.\n\n- **Code review** against the working tree or a branch base, with structured findings\n- **Adversarial review** that challenges the design — not just spell-checks the diff\n- **Task delegation** for diagnoses, refactors, and longer rescues, foreground or background\n- **Parallel fan-out** — `/pi:parallel-rescue` runs multiple independent tasks concurrently via [`pi-subagents`](https://github.com/nicobailon/pi-subagents)\n- **Sharded parallel review** — `/pi:review --shards <N>` splits a large diff's changed files across N review jobs that run in parallel, then merges the findings\n- **Background job control** — `status`, `result`, `cancel`, and stop-time review gate\n- **No OAuth** — pi authenticates by API key (provider-specific), no `codex login` required\n\nIntegrates with [`pi-subagents`](https://github.com/nicobailon/pi-subagents) (`pi install npm:pi-subagents`): `/pi:setup` detects it and lists the agent profiles, `/pi:rescue` prompts advertise the `subagent` tool to Pi, and `/pi:parallel-rescue` fans multiple tasks out to parallel child agents (scout, researcher, planner, worker, reviewer, …).\n\n## 🔄 How it works\n\n<img src=\"docs/pi-plugin-cc-workflow.png\" alt=\"pi-plugin-cc workflow\" width=\"80%\">\n\nCodex's broker layer is gone — Pi is one-conversation-per-process, so the plugin spawns a fresh `pi --mode rpc` for each task. Background jobs are tracked in workspace-scoped state files. Review prompts inline the JSON schema since Pi has no `outputSchema` knob.\n\n## Slash commands\n\n| Command | What it does |\n|---|---|\n| `/pi:setup` | Verifies `pi` is installed + a provider is configured; toggles the stop-time review gate |\n| `/pi:review` | Standard code review of local git state |\n| `/pi:adversarial-review` | Steerable challenge review — questions the approach itself |\n| `/pi:rescue` | Delegate investigation or implementation to a Pi run via the `pi:pi-companion-forwarder` subagent |\n| `/pi:parallel-rescue` | Run multiple independent tasks in parallel via pi-subagents (`subagent({ tasks })` fan-out) |\n| `/pi:status [job-id]` | List active / recent Pi jobs in this repository |\n| `/pi:result <job-id>` | Show the stored final output for a finished job |\n| `/pi:cancel <job-id>` | Terminate a running background job |\n\nEvery command accepts `--model <id>` to pin a specific model just for that run. With no `--model` and no env override (see [Pick your model](#pick-your-model)), pi falls back to whatever it has configured by default.\n\n## Quick Start\n\n```bash\n# 1. Install pi (required)\nnpm install -g --ignore-scripts @earendil-works/pi-coding-agent\n\n# 2. Configure a provider — pick one\nexport OPENAI_API_KEY=sk-... # OpenAI\nexport ANTHROPIC_API_KEY=sk-ant-... # Anthropic\nexport GOOGLE_API_KEY=... # Google\nexport DEEPSEEK_API_KEY=sk-... # DeepSeek\n# or run a local model: see https://github.com/earendil-works/pi (Ollama / LM Studio)\n\n# 3. Verify pi sees a model\npi --list-models | head\n```\n\nInstall the plugin in Claude Code:\n\n```text\n> /plugin marketplace add Agents365-ai/pi-plugin-cc\n> /plugin install pi@agents365-pi\n> /reload-plugins\n> /pi:setup\n```\n\n`/pi:setup` returns a readiness report. If `pi` is missing and `npm` is on PATH, it offers to install it for you.\n\n## Usage\n\n```text\n> /pi:review\n> /pi:review --base main\n> /pi:review --model claude-sonnet-4\n> /pi:review --out-file review.md\n> /pi:adversarial-review focus on the new auth middleware\n> /pi:rescue investigate why the Windows CI build is failing\n> /pi:rescue --background --model gpt-4o refactor src/payments/\n> /pi:parallel-rescue \"audit the auth module\" \"benchmark the db queries\" \"update the API docs\"\n> /pi:status\n> /pi:status task-mpgyiwb9-e3k641 --wait\n> /pi:result task-mpgyiwb9-e3k641\n> /pi:cancel task-mpgyiwb9-e3k641\n```\n\n`--effort <off|minimal|low|medium|high|xhigh>` is passed through to Pi via `set_thinking_level`. Models that do not support thinking silently ignore it (the plugin logs a one-line note to stderr when this happens).\n\n`--out-file <path>` (on `/pi:review`, `/pi:adversarial-review`, `/pi:rescue`, `/pi:result`) writes Pi's full output to a file and returns only a short summary — verdict, finding counts, one line per finding. The heavy reasoning already runs on the cheaper model; this also keeps the large result out of the calling agent's context, so a big review doesn't burn Claude Code tokens on the relay. Open the file for the full detail.\n\n## 🧩 Use from Codex\n\nThe core of this plugin is a harness-agnostic CLI (`pi-companion.mjs`) — any coding agent that can run shell commands can drive it. For OpenAI's Codex CLI, install the bundled [custom prompts](codex-prompts/):\n\n```bash\n# 1. Clone the repo (anywhere; ~/pi-plugin-cc is the default the prompts assume)\ngit clone https://github.com/Agents365-ai/pi-plugin-cc ~/pi-plugin-cc\n\n# 2. Install the Codex custom prompts\nmkdir -p ~/.codex/prompts\ncp ~/pi-plugin-cc/codex-prompts/*.md ~/.codex/prompts/\n\n# 3. If you cloned somewhere else, point the prompts at it\necho 'export PI_PLUGIN_ROOT=\"$HOME/path/to/pi-plugin-cc\"' >> ~/.zshrc\n```\n\nThen inside Codex: `/pi-review`, `/pi-adversarial-review`, `/pi-rescue`, `/pi-parallel-rescue`, `/pi-status`, `/pi-result`, `/pi-cancel`, `/pi-setup` (note `-` instead of `:` — Codex prompt names cannot contain colons).\n\nNot available under Codex: the stop-time review gate and session-resume prompts (both rely on Claude Code hooks / subagents). Everything else — including pi-subagents parallel fan-out — works the same.\n\n## 🧑‍⚖️ Multi-model review panel\n\nOne reviewer has blind spots; a panel doesn't share them. Passing `--models` to either review command runs the same diff through several models **in parallel** and merges their findings — issues reported by 2+ models rank first with a `found by:` tag:\n\n```text\n> /pi:review --models deepseek-v4-flash,claude-sonnet-4-6,gpt-5-mini\n> /pi:adversarial-review --models deepseek-v4-pro,o1 focus on concurrency\n```\n\n- Consensus findings (2+ models) are listed first; single-model findings follow.\n- Duplicate findings are matched per file with line-range slack; severity escalates to the highest reported and alternate titles are kept.\n- A member that fails (provider error, invalid JSON) is reported inline and does not sink the panel — it succeeds as long as one model returns a valid review.\n- Panel members do not use the `PI_PLUGIN_FALLBACK_MODELS` chain — the panel itself is the redundancy.\n- This only exists because Pi is provider-agnostic: a single-vendor CLI cannot convene a cross-vendor panel.\n\n## 🛟 Automatic model fallback\n\nSet a fallback chain once, and any failed run — provider outage, auth error, exhausted retries — is automatically retried with the next model:\n\n```bash\nexport PI_PLUGIN_FALLBACK_MODELS=deepseek-v4-flash,MiniMax-M3\n```\n\nApplies to reviews and rescue tasks alike. When a fallback produced the result, the output ends with a `Model fallback:` note (and the JSON payload carries `modelAttempts`). `/pi:setup` shows the configured chain.\n\n## 🏁 Model racing\n\nFor hard problems, run the same rescue task with several models **in parallel** and pick the winner:\n\n```text\n> /pi:rescue --race deepseek-v4-pro,claude-sonnet-4-6 fix the flaky retry logic in src/queue.mjs\n> /pi:rescue --race deepseek-v4-flash,gemini-2.5-pro why does the Windows CI build fail?\n```\n\n- **Write races** (`--write`, the `/pi:rescue` default): each racer works in an isolated git worktree created from `HEAD` — racers can never touch your working tree or each other. Each racer's result is captured as a patch; review them and apply exactly one with `git apply <patch>`.\n- **Read-only races** (investigations): racers analyze the same tree; the output presents each answer side by side — agreement across models is a strong signal.\n- A racer that fails or produces no changes is reported as such; the race succeeds while at least one racer finishes.\n- Not combinable with `--model` or `--resume` (each racer starts a fresh session). Racers start from `HEAD`, so commit or stash first if the task concerns uncommitted work.\n\n## Pick your model\n\nThe plugin keeps three layers of model resolution:\n\n| Priority | Source | Example |\n|---|---|---|\n| 1 | `--model <id>` on the slash command | `/pi:review --model gpt-4o` |\n| 2 | Env var (review / adversarial-review only) | `export PI_PLUGIN_REVIEW_MODEL=deepseek-v4-flash`<br>`export PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=deepseek-v4-pro` |\n| 3 | Pi's own configured default | whatever your `~/.pi/agent/models.json` has, or `/model` last picked in pi TUI |\n\nLayer 1 wins over layer 2 wins over layer 3. **None of the layers are required** — leave them all unset and pi picks for you.\n\n### Suggested settings by provider\n\nThese are opinions, not requirements. Pick what fits your latency / cost / quality budget.\n\n| Provider | Everyday review (`/pi:review`) | Adversarial review (`/pi:adversarial-review`) |\n|---|---|---|\n| DeepSeek | `deepseek-v4-flash` | `deepseek-v4-pro` |\n| OpenAI | `gpt-4o-mini` or `gpt-5-mini` | `o1` or `gpt-5` |\n| Anthropic | `claude-haiku-4-5` | `claude-sonnet-4-6` or `claude-opus-4-7` |\n| Google | `gemini-2.5-flash` | `gemini-2.5-pro` |\n| Local (Ollama) | `qwen2.5-coder:7b` | `qwen2.5-coder:32b` or `deepseek-r1` |\n\nTo make these defaults sticky:\n\n```bash\nexport PI_PLUGIN_REVIEW_MODEL=claude-haiku-4-5\nexport PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=claude-sonnet-4-6\n```\n\n### Value tier — cheaper than Claude/GPT, still competitive\n\nThe whole point of driving Pi is that you are not locked to Claude or GPT. These models cost a fraction of the frontier Claude/GPT tiers and, while not quite as strong, are more than good enough for everyday review and rescue work. Configure them in `~/.pi/agent/models.json` (most are OpenAI-compatible endpoints) and use the exact id your provider exposes — verify with `pi --list-models`.\n\n| Provider | Suggested model(s) |\n|---|---|\n| DeepSeek | `deepseek-v4-flash` (everyday) · `deepseek-v4-pro` (adversarial) |\n| xAI | `grok-4.5` |\n| Zhipu (GLM) | `glm-5.1` · `glm-5.2` (heavier) |\n| Moonshot (Kimi) | `kimi-k2.6` |\n| MiniMax | `MiniMax-M3` |\n| ByteDance (Seed) | `doubao-seed-2.1-pro` |\n| Xiaomi (MiMo) | `mimo-v2.5` (everyday) · `mimo-v2.5-pro` (heavier) |\n| Meta | `muse-spark-1.1` |\n\n…and any other OpenAI-compatible endpoint you configure. Availability and the exact id depend on your `~/.pi/agent/models.json`.\n\n> Not every model emits clean JSON for the structured review commands. If `/pi:review` fails with a parse error on a given model, it is still fine for `/pi:rescue` (free-form) — or add it to a `PI_PLUGIN_FALLBACK_MODELS` chain so a flaky member is retried with the next one. (Observed: some MiniMax and local models echo the prompt back instead of returning JSON.)\n\n## Configure pi\n\nThe minimum is a single env var with your API key. For richer setups, write `~/.pi/agent/models.json`:\n\n```json\n{\n \"providers\": {\n \"deepseek\": { \"apiKey\": \"sk-...\" },\n \"openai\": { \"apiKey\": \"sk-...\" },\n \"anthropic\":{ \"apiKey\": \"sk-ant-...\" },\n \"google\": { \"apiKey\": \"...\" },\n \"openrouter\": {\n \"api\": \"openai-completions\",\n \"apiKey\": \"sk-or-v1-...\",\n \"baseUrl\": \"https://openrouter.ai/api/v1\",\n \"models\": [\n {\n \"id\": \"deepseek/deepseek-chat\",\n \"name\": \"DeepSeek via OpenRouter\",\n \"contextWindow\": 128000,\n \"maxTokens\": 8192,\n \"input\": [\"text\"]\n }\n ]\n }\n }\n}\n```\n\nBuilt-in providers (`anthropic`, `openai`, `google`, `deepseek`, `ollama`, `lmstudio`) only need `apiKey` (and optional `baseUrl`); pi ships their model lists. For custom OpenAI-compatible endpoints, set `api: \"openai-completions\"` and declare the `models` you want exposed.\n\nFull reference: [pi providers docs](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md).\n\n## Stop-time review gate\n\nOpt in with `/pi:setup --enable-review-gate`. When a Claude session ends, the plugin runs a Pi adversarial review of the previous turn and can block the stop if it finds material issues. If pi is unavailable while the gate is enabled, the hook blocks (it does **not** silently let the session end). Disable with `/pi:setup --disable-review-gate`.\n\n## 🔗 Related projects\n\n| Project | Niche | When to use |\n|---|---|---|\n| [codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | Same surface, runs Codex | You want OpenAI's Codex agent + ChatGPT auth |\n| [pi (earendil-works)](https://github.com/earendil-works/pi) | The coding agent this plugin drives | You want to use Pi directly without Claude Code |\n| [pi-subagents](https://github.com/nicobailon/pi-subagents) | Pi extension adding `subagent` tool + `/run` / `/chain` / `/parallel` | Powers `/pi:parallel-rescue` and lets `/pi:rescue` delegate to specialized child agents |\n\n## ❤️ Support\n\nIf this plugin helps you, consider supporting the author:\n\n<table>\n <tr>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/wechat-pay.png\" width=\"180\" alt=\"WeChat Pay\">\n <br>\n <b>WeChat Pay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/alipay.png\" width=\"180\" alt=\"Alipay\">\n <br>\n <b>Alipay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/buymeacoffee.png\" width=\"180\" alt=\"Buy Me a Coffee\">\n <br>\n <b>Buy Me a Coffee</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/awarding/award.gif\" width=\"180\" alt=\"Give a Reward\">\n <br>\n <b>Give a Reward</b>\n </td>\n </tr>\n</table>\n\n## 👤 Author\n\n**Agents365-ai**\n\n- GitHub: https://github.com/Agents365-ai\n- Bilibili: https://space.bilibili.com/441831884\n\n## 📄 License\n\n[Apache License 2.0](LICENSE). Forked from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) (Apache-2.0, OpenAI) — see [NOTICE](NOTICE).\n"}, "258cd685e7032b8e7ec06ed53129933789a1b981": {"t": 1785766138.1770766, "n": 16019, "h": "3a971f2cc40c0eb3", "c": "# pi-plugin-cc — drive the Pi coding agent from Claude Code and Codex 🥧\n\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/network/members)\n[![Latest Release](https://img.shields.io/github/v/release/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/releases/latest)\n[![Last Commit](https://img.shields.io/github/last-commit/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/commits/main)\n\n[![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-plugin-8a2be2)](https://docs.claude.com/en/docs/claude-code/plugins)\n[![Pi Coding Agent](https://img.shields.io/badge/Pi-coding%20agent-0a7d4a)](https://github.com/earendil-works/pi)\n[![Model agnostic](https://img.shields.io/badge/Model-agnostic-555)](#pick-your-model)\n\n**English** · [中文](README_CN.md)\n\nExternal references: [Pi coding agent](https://github.com/earendil-works/pi) · [Pi RPC mode](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md) · [Pi providers](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md)\n\nA Claude Code plugin that delegates reviews and coding tasks to the [Pi coding agent](https://github.com/earendil-works/pi). Adapted from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc), runtime swapped from Codex to Pi. Also usable from OpenAI's Codex CLI — see [Use from Codex](#-use-from-codex).\n\n**The hard dependency is pi, not any particular LLM.** Pi can be configured for DeepSeek, OpenAI, Anthropic, Google, Ollama, LM Studio, or any OpenAI-compatible endpoint via `~/.pi/agent/models.json`. The plugin defers all model selection to pi unless you override per command.\n\n- **Code review** against the working tree or a branch base, with structured findings\n- **Adversarial review** that challenges the design — not just spell-checks the diff\n- **Task delegation** for diagnoses, refactors, and longer rescues, foreground or background\n- **Parallel fan-out** — `/pi:parallel-rescue` runs multiple independent tasks concurrently via [`pi-subagents`](https://github.com/nicobailon/pi-subagents)\n- **Sharded parallel review** — `/pi:review --shards <N>` splits a large diff's changed files across N review jobs that run in parallel, then merges the findings\n- **Background job control** — `status`, `result`, `cancel`, and stop-time review gate\n- **No OAuth** — pi authenticates by API key (provider-specific), no `codex login` required\n\nIntegrates with [`pi-subagents`](https://github.com/nicobailon/pi-subagents) (`pi install npm:pi-subagents`): `/pi:setup` detects it and lists the agent profiles, `/pi:rescue` prompts advertise the `subagent` tool to Pi, and `/pi:parallel-rescue` fans multiple tasks out to parallel child agents (scout, researcher, planner, worker, reviewer, …).\n\n## 🔄 How it works\n\n<img src=\"docs/pi-plugin-cc-workflow.png\" alt=\"pi-plugin-cc workflow\" width=\"80%\">\n\nCodex's broker layer is gone — Pi is one-conversation-per-process, so the plugin spawns a fresh `pi --mode rpc` for each task. Background jobs are tracked in workspace-scoped state files. Review prompts inline the JSON schema since Pi has no `outputSchema` knob.\n\n## Slash commands\n\n| Command | What it does |\n|---|---|\n| `/pi:setup` | Verifies `pi` is installed + a provider is configured; toggles the stop-time review gate |\n| `/pi:review` | Standard code review of local git state |\n| `/pi:adversarial-review` | Steerable challenge review — questions the approach itself |\n| `/pi:rescue` | Delegate investigation or implementation to a Pi run via the `pi:pi-companion-forwarder` subagent |\n| `/pi:parallel-rescue` | Run multiple independent tasks in parallel via pi-subagents (`subagent({ tasks })` fan-out) |\n| `/pi:status [job-id]` | List active / recent Pi jobs in this repository |\n| `/pi:result <job-id>` | Show the stored final output for a finished job |\n| `/pi:cancel <job-id>` | Terminate a running background job |\n\nEvery command accepts `--model <id>` to pin a specific model just for that run. With no `--model` and no env override (see [Pick your model](#pick-your-model)), pi falls back to whatever it has configured by default.\n\n## Quick Start\n\n```bash\n# 1. Install pi (required)\nnpm install -g --ignore-scripts @earendil-works/pi-coding-agent\n\n# 2. Configure a provider — pick one\nexport OPENAI_API_KEY=sk-... # OpenAI\nexport ANTHROPIC_API_KEY=sk-ant-... # Anthropic\nexport GOOGLE_API_KEY=... # Google\nexport DEEPSEEK_API_KEY=sk-... # DeepSeek\n# or run a local model: see https://github.com/earendil-works/pi (Ollama / LM Studio)\n\n# 3. Verify pi sees a model\npi --list-models | head\n```\n\nInstall the plugin in Claude Code:\n\n```text\n> /plugin marketplace add Agents365-ai/pi-plugin-cc\n> /plugin install pi@agents365-pi\n> /reload-plugins\n> /pi:setup\n```\n\n`/pi:setup` returns a readiness report. If `pi` is missing and `npm` is on PATH, it offers to install it for you.\n\n## Usage\n\n```text\n> /pi:review\n> /pi:review --base main\n> /pi:review --model claude-sonnet-4\n> /pi:review --out-file review.md\n> /pi:adversarial-review focus on the new auth middleware\n> /pi:rescue investigate why the Windows CI build is failing\n> /pi:rescue --background --model gpt-4o refactor src/payments/\n> /pi:parallel-rescue \"audit the auth module\" \"benchmark the db queries\" \"update the API docs\"\n> /pi:status\n> /pi:status task-mpgyiwb9-e3k641 --wait\n> /pi:result task-mpgyiwb9-e3k641\n> /pi:cancel task-mpgyiwb9-e3k641\n```\n\n`--effort <off|minimal|low|medium|high|xhigh>` is passed through to Pi via `set_thinking_level`. Models that do not support thinking silently ignore it (the plugin logs a one-line note to stderr when this happens).\n\n`--out-file <path>` (on `/pi:review`, `/pi:adversarial-review`, `/pi:rescue`) writes Pi's full output to a file and returns only a short summary — verdict, finding counts, one line per finding. The heavy reasoning already runs on the cheaper model; this also keeps the large result out of the calling agent's context, so a big review doesn't burn Claude Code tokens on the relay. Open the file for the full detail.\n\n## 🧩 Use from Codex\n\nThe core of this plugin is a harness-agnostic CLI (`pi-companion.mjs`) — any coding agent that can run shell commands can drive it. For OpenAI's Codex CLI, install the bundled [custom prompts](codex-prompts/):\n\n```bash\n# 1. Clone the repo (anywhere; ~/pi-plugin-cc is the default the prompts assume)\ngit clone https://github.com/Agents365-ai/pi-plugin-cc ~/pi-plugin-cc\n\n# 2. Install the Codex custom prompts\nmkdir -p ~/.codex/prompts\ncp ~/pi-plugin-cc/codex-prompts/*.md ~/.codex/prompts/\n\n# 3. If you cloned somewhere else, point the prompts at it\necho 'export PI_PLUGIN_ROOT=\"$HOME/path/to/pi-plugin-cc\"' >> ~/.zshrc\n```\n\nThen inside Codex: `/pi-review`, `/pi-adversarial-review`, `/pi-rescue`, `/pi-parallel-rescue`, `/pi-status`, `/pi-result`, `/pi-cancel`, `/pi-setup` (note `-` instead of `:` — Codex prompt names cannot contain colons).\n\nNot available under Codex: the stop-time review gate and session-resume prompts (both rely on Claude Code hooks / subagents). Everything else — including pi-subagents parallel fan-out — works the same.\n\n## 🧑‍⚖️ Multi-model review panel\n\nOne reviewer has blind spots; a panel doesn't share them. Passing `--models` to either review command runs the same diff through several models **in parallel** and merges their findings — issues reported by 2+ models rank first with a `found by:` tag:\n\n```text\n> /pi:review --models deepseek-v4-flash,claude-sonnet-4-6,gpt-5-mini\n> /pi:adversarial-review --models deepseek-v4-pro,o1 focus on concurrency\n```\n\n- Consensus findings (2+ models) are listed first; single-model findings follow.\n- Duplicate findings are matched per file with line-range slack; severity escalates to the highest reported and alternate titles are kept.\n- A member that fails (provider error, invalid JSON) is reported inline and does not sink the panel — it succeeds as long as one model returns a valid review.\n- Panel members do not use the `PI_PLUGIN_FALLBACK_MODELS` chain — the panel itself is the redundancy.\n- This only exists because Pi is provider-agnostic: a single-vendor CLI cannot convene a cross-vendor panel.\n\n## 🛟 Automatic model fallback\n\nSet a fallback chain once, and any failed run — provider outage, auth error, exhausted retries — is automatically retried with the next model:\n\n```bash\nexport PI_PLUGIN_FALLBACK_MODELS=deepseek-v4-flash,MiniMax-M3\n```\n\nApplies to reviews and rescue tasks alike. When a fallback produced the result, the output ends with a `Model fallback:` note (and the JSON payload carries `modelAttempts`). `/pi:setup` shows the configured chain.\n\n## 🏁 Model racing\n\nFor hard problems, run the same rescue task with several models **in parallel** and pick the winner:\n\n```text\n> /pi:rescue --race deepseek-v4-pro,claude-sonnet-4-6 fix the flaky retry logic in src/queue.mjs\n> /pi:rescue --race deepseek-v4-flash,gemini-2.5-pro why does the Windows CI build fail?\n```\n\n- **Write races** (`--write`, the `/pi:rescue` default): each racer works in an isolated git worktree created from `HEAD` — racers can never touch your working tree or each other. Each racer's result is captured as a patch; review them and apply exactly one with `git apply <patch>`.\n- **Read-only races** (investigations): racers analyze the same tree; the output presents each answer side by side — agreement across models is a strong signal.\n- A racer that fails or produces no changes is reported as such; the race succeeds while at least one racer finishes.\n- Not combinable with `--model` or `--resume` (each racer starts a fresh session). Racers start from `HEAD`, so commit or stash first if the task concerns uncommitted work.\n\n## Pick your model\n\nThe plugin keeps three layers of model resolution:\n\n| Priority | Source | Example |\n|---|---|---|\n| 1 | `--model <id>` on the slash command | `/pi:review --model gpt-4o` |\n| 2 | Env var (review / adversarial-review only) | `export PI_PLUGIN_REVIEW_MODEL=deepseek-v4-flash`<br>`export PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=deepseek-v4-pro` |\n| 3 | Pi's own configured default | whatever your `~/.pi/agent/models.json` has, or `/model` last picked in pi TUI |\n\nLayer 1 wins over layer 2 wins over layer 3. **None of the layers are required** — leave them all unset and pi picks for you.\n\n### Suggested settings by provider\n\nThese are opinions, not requirements. Pick what fits your latency / cost / quality budget.\n\n| Provider | Everyday review (`/pi:review`) | Adversarial review (`/pi:adversarial-review`) |\n|---|---|---|\n| DeepSeek | `deepseek-v4-flash` | `deepseek-v4-pro` |\n| OpenAI | `gpt-4o-mini` or `gpt-5-mini` | `o1` or `gpt-5` |\n| Anthropic | `claude-haiku-4-5` | `claude-sonnet-4-6` or `claude-opus-4-7` |\n| Google | `gemini-2.5-flash` | `gemini-2.5-pro` |\n| Local (Ollama) | `qwen2.5-coder:7b` | `qwen2.5-coder:32b` or `deepseek-r1` |\n\nTo make these defaults sticky:\n\n```bash\nexport PI_PLUGIN_REVIEW_MODEL=claude-haiku-4-5\nexport PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=claude-sonnet-4-6\n```\n\n### Value tier — cheaper than Claude/GPT, still competitive\n\nThe whole point of driving Pi is that you are not locked to Claude or GPT. These models cost a fraction of the frontier Claude/GPT tiers and, while not quite as strong, are more than good enough for everyday review and rescue work. Configure them in `~/.pi/agent/models.json` (most are OpenAI-compatible endpoints) and use the exact id your provider exposes — verify with `pi --list-models`.\n\n| Provider | Suggested model(s) |\n|---|---|\n| DeepSeek | `deepseek-v4-flash` (everyday) · `deepseek-v4-pro` (adversarial) |\n| xAI | `grok-4.5` |\n| Zhipu (GLM) | `glm-5.1` · `glm-5.2` (heavier) |\n| Moonshot (Kimi) | `kimi-k2.6` |\n| MiniMax | `MiniMax-M3` |\n| ByteDance (Seed) | `doubao-seed-2.1-pro` |\n| Xiaomi (MiMo) | `mimo-v2.5` (everyday) · `mimo-v2.5-pro` (heavier) |\n| Meta | `muse-spark-1.1` |\n\n…and any other OpenAI-compatible endpoint you configure. Availability and the exact id depend on your `~/.pi/agent/models.json`.\n\n> Not every model emits clean JSON for the structured review commands. If `/pi:review` fails with a parse error on a given model, it is still fine for `/pi:rescue` (free-form) — or add it to a `PI_PLUGIN_FALLBACK_MODELS` chain so a flaky member is retried with the next one. (Observed: some MiniMax and local models echo the prompt back instead of returning JSON.)\n\n## Configure pi\n\nThe minimum is a single env var with your API key. For richer setups, write `~/.pi/agent/models.json`:\n\n```json\n{\n \"providers\": {\n \"deepseek\": { \"apiKey\": \"sk-...\" },\n \"openai\": { \"apiKey\": \"sk-...\" },\n \"anthropic\":{ \"apiKey\": \"sk-ant-...\" },\n \"google\": { \"apiKey\": \"...\" },\n \"openrouter\": {\n \"api\": \"openai-completions\",\n \"apiKey\": \"sk-or-v1-...\",\n \"baseUrl\": \"https://openrouter.ai/api/v1\",\n \"models\": [\n {\n \"id\": \"deepseek/deepseek-chat\",\n \"name\": \"DeepSeek via OpenRouter\",\n \"contextWindow\": 128000,\n \"maxTokens\": 8192,\n \"input\": [\"text\"]\n }\n ]\n }\n }\n}\n```\n\nBuilt-in providers (`anthropic`, `openai`, `google`, `deepseek`, `ollama`, `lmstudio`) only need `apiKey` (and optional `baseUrl`); pi ships their model lists. For custom OpenAI-compatible endpoints, set `api: \"openai-completions\"` and declare the `models` you want exposed.\n\nFull reference: [pi providers docs](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md).\n\n## Stop-time review gate\n\nOpt in with `/pi:setup --enable-review-gate`. When a Claude session ends, the plugin runs a Pi adversarial review of the previous turn and can block the stop if it finds material issues. If pi is unavailable while the gate is enabled, the hook blocks (it does **not** silently let the session end). Disable with `/pi:setup --disable-review-gate`.\n\n## 🔗 Related projects\n\n| Project | Niche | When to use |\n|---|---|---|\n| [codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | Same surface, runs Codex | You want OpenAI's Codex agent + ChatGPT auth |\n| [pi (earendil-works)](https://github.com/earendil-works/pi) | The coding agent this plugin drives | You want to use Pi directly without Claude Code |\n| [pi-subagents](https://github.com/nicobailon/pi-subagents) | Pi extension adding `subagent` tool + `/run` / `/chain` / `/parallel` | Powers `/pi:parallel-rescue` and lets `/pi:rescue` delegate to specialized child agents |\n\n## ❤️ Support\n\nIf this plugin helps you, consider supporting the author:\n\n<table>\n <tr>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/wechat-pay.png\" width=\"180\" alt=\"WeChat Pay\">\n <br>\n <b>WeChat Pay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/alipay.png\" width=\"180\" alt=\"Alipay\">\n <br>\n <b>Alipay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/buymeacoffee.png\" width=\"180\" alt=\"Buy Me a Coffee\">\n <br>\n <b>Buy Me a Coffee</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/awarding/award.gif\" width=\"180\" alt=\"Give a Reward\">\n <br>\n <b>Give a Reward</b>\n </td>\n </tr>\n</table>\n\n## 👤 Author\n\n**Agents365-ai**\n\n- GitHub: https://github.com/Agents365-ai\n- Bilibili: https://space.bilibili.com/441831884\n\n## 📄 License\n\n[Apache License 2.0](LICENSE). Forked from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) (Apache-2.0, OpenAI) — see [NOTICE](NOTICE).\n"}, "8ed484fb0c3e031f841338850204f716fd77ccd1": {"t": 1785766139.5717459, "n": 15569, "h": "6bd500e1c8efea93", "c": "# pi-plugin-cc — drive the Pi coding agent from Claude Code and Codex 🥧\n\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/network/members)\n[![Latest Release](https://img.shields.io/github/v/release/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/releases/latest)\n[![Last Commit](https://img.shields.io/github/last-commit/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/commits/main)\n\n[![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-plugin-8a2be2)](https://docs.claude.com/en/docs/claude-code/plugins)\n[![Pi Coding Agent](https://img.shields.io/badge/Pi-coding%20agent-0a7d4a)](https://github.com/earendil-works/pi)\n[![Model agnostic](https://img.shields.io/badge/Model-agnostic-555)](#pick-your-model)\n\n**English** · [中文](README_CN.md)\n\nExternal references: [Pi coding agent](https://github.com/earendil-works/pi) · [Pi RPC mode](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md) · [Pi providers](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md)\n\nA Claude Code plugin that delegates reviews and coding tasks to the [Pi coding agent](https://github.com/earendil-works/pi). Adapted from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc), runtime swapped from Codex to Pi. Also usable from OpenAI's Codex CLI — see [Use from Codex](#-use-from-codex).\n\n**The hard dependency is pi, not any particular LLM.** Pi can be configured for DeepSeek, OpenAI, Anthropic, Google, Ollama, LM Studio, or any OpenAI-compatible endpoint via `~/.pi/agent/models.json`. The plugin defers all model selection to pi unless you override per command.\n\n- **Code review** against the working tree or a branch base, with structured findings\n- **Adversarial review** that challenges the design — not just spell-checks the diff\n- **Task delegation** for diagnoses, refactors, and longer rescues, foreground or background\n- **Parallel fan-out** — `/pi:parallel-rescue` runs multiple independent tasks concurrently via [`pi-subagents`](https://github.com/nicobailon/pi-subagents)\n- **Sharded parallel review** — `/pi:review --shards <N>` splits a large diff's changed files across N review jobs that run in parallel, then merges the findings\n- **Background job control** — `status`, `result`, `cancel`, and stop-time review gate\n- **No OAuth** — pi authenticates by API key (provider-specific), no `codex login` required\n\nIntegrates with [`pi-subagents`](https://github.com/nicobailon/pi-subagents) (`pi install npm:pi-subagents`): `/pi:setup` detects it and lists the agent profiles, `/pi:rescue` prompts advertise the `subagent` tool to Pi, and `/pi:parallel-rescue` fans multiple tasks out to parallel child agents (scout, researcher, planner, worker, reviewer, …).\n\n## 🔄 How it works\n\n<img src=\"docs/pi-plugin-cc-workflow.png\" alt=\"pi-plugin-cc workflow\" width=\"80%\">\n\nCodex's broker layer is gone — Pi is one-conversation-per-process, so the plugin spawns a fresh `pi --mode rpc` for each task. Background jobs are tracked in workspace-scoped state files. Review prompts inline the JSON schema since Pi has no `outputSchema` knob.\n\n## Slash commands\n\n| Command | What it does |\n|---|---|\n| `/pi:setup` | Verifies `pi` is installed + a provider is configured; toggles the stop-time review gate |\n| `/pi:review` | Standard code review of local git state |\n| `/pi:adversarial-review` | Steerable challenge review — questions the approach itself |\n| `/pi:rescue` | Delegate investigation or implementation to a Pi run via the `pi:pi-companion-forwarder` subagent |\n| `/pi:parallel-rescue` | Run multiple independent tasks in parallel via pi-subagents (`subagent({ tasks })` fan-out) |\n| `/pi:status [job-id]` | List active / recent Pi jobs in this repository |\n| `/pi:result <job-id>` | Show the stored final output for a finished job |\n| `/pi:cancel <job-id>` | Terminate a running background job |\n\nEvery command accepts `--model <id>` to pin a specific model just for that run. With no `--model` and no env override (see [Pick your model](#pick-your-model)), pi falls back to whatever it has configured by default.\n\n## Quick Start\n\n```bash\n# 1. Install pi (required)\nnpm install -g --ignore-scripts @earendil-works/pi-coding-agent\n\n# 2. Configure a provider — pick one\nexport OPENAI_API_KEY=sk-... # OpenAI\nexport ANTHROPIC_API_KEY=sk-ant-... # Anthropic\nexport GOOGLE_API_KEY=... # Google\nexport DEEPSEEK_API_KEY=sk-... # DeepSeek\n# or run a local model: see https://github.com/earendil-works/pi (Ollama / LM Studio)\n\n# 3. Verify pi sees a model\npi --list-models | head\n```\n\nInstall the plugin in Claude Code:\n\n```text\n> /plugin marketplace add Agents365-ai/pi-plugin-cc\n> /plugin install pi@agents365-pi\n> /reload-plugins\n> /pi:setup\n```\n\n`/pi:setup` returns a readiness report. If `pi` is missing and `npm` is on PATH, it offers to install it for you.\n\n## Usage\n\n```text\n> /pi:review\n> /pi:review --base main\n> /pi:review --model claude-sonnet-4\n> /pi:adversarial-review focus on the new auth middleware\n> /pi:rescue investigate why the Windows CI build is failing\n> /pi:rescue --background --model gpt-4o refactor src/payments/\n> /pi:parallel-rescue \"audit the auth module\" \"benchmark the db queries\" \"update the API docs\"\n> /pi:status\n> /pi:status task-mpgyiwb9-e3k641 --wait\n> /pi:result task-mpgyiwb9-e3k641\n> /pi:cancel task-mpgyiwb9-e3k641\n```\n\n`--effort <off|minimal|low|medium|high|xhigh>` is passed through to Pi via `set_thinking_level`. Models that do not support thinking silently ignore it (the plugin logs a one-line note to stderr when this happens).\n\n## 🧩 Use from Codex\n\nThe core of this plugin is a harness-agnostic CLI (`pi-companion.mjs`) — any coding agent that can run shell commands can drive it. For OpenAI's Codex CLI, install the bundled [custom prompts](codex-prompts/):\n\n```bash\n# 1. Clone the repo (anywhere; ~/pi-plugin-cc is the default the prompts assume)\ngit clone https://github.com/Agents365-ai/pi-plugin-cc ~/pi-plugin-cc\n\n# 2. Install the Codex custom prompts\nmkdir -p ~/.codex/prompts\ncp ~/pi-plugin-cc/codex-prompts/*.md ~/.codex/prompts/\n\n# 3. If you cloned somewhere else, point the prompts at it\necho 'export PI_PLUGIN_ROOT=\"$HOME/path/to/pi-plugin-cc\"' >> ~/.zshrc\n```\n\nThen inside Codex: `/pi-review`, `/pi-adversarial-review`, `/pi-rescue`, `/pi-parallel-rescue`, `/pi-status`, `/pi-result`, `/pi-cancel`, `/pi-setup` (note `-` instead of `:` — Codex prompt names cannot contain colons).\n\nNot available under Codex: the stop-time review gate and session-resume prompts (both rely on Claude Code hooks / subagents). Everything else — including pi-subagents parallel fan-out — works the same.\n\n## 🧑‍⚖️ Multi-model review panel\n\nOne reviewer has blind spots; a panel doesn't share them. Passing `--models` to either review command runs the same diff through several models **in parallel** and merges their findings — issues reported by 2+ models rank first with a `found by:` tag:\n\n```text\n> /pi:review --models deepseek-v4-flash,claude-sonnet-4-6,gpt-5-mini\n> /pi:adversarial-review --models deepseek-v4-pro,o1 focus on concurrency\n```\n\n- Consensus findings (2+ models) are listed first; single-model findings follow.\n- Duplicate findings are matched per file with line-range slack; severity escalates to the highest reported and alternate titles are kept.\n- A member that fails (provider error, invalid JSON) is reported inline and does not sink the panel — it succeeds as long as one model returns a valid review.\n- Panel members do not use the `PI_PLUGIN_FALLBACK_MODELS` chain — the panel itself is the redundancy.\n- This only exists because Pi is provider-agnostic: a single-vendor CLI cannot convene a cross-vendor panel.\n\n## 🛟 Automatic model fallback\n\nSet a fallback chain once, and any failed run — provider outage, auth error, exhausted retries — is automatically retried with the next model:\n\n```bash\nexport PI_PLUGIN_FALLBACK_MODELS=deepseek-v4-flash,MiniMax-M3\n```\n\nApplies to reviews and rescue tasks alike. When a fallback produced the result, the output ends with a `Model fallback:` note (and the JSON payload carries `modelAttempts`). `/pi:setup` shows the configured chain.\n\n## 🏁 Model racing\n\nFor hard problems, run the same rescue task with several models **in parallel** and pick the winner:\n\n```text\n> /pi:rescue --race deepseek-v4-pro,claude-sonnet-4-6 fix the flaky retry logic in src/queue.mjs\n> /pi:rescue --race deepseek-v4-flash,gemini-2.5-pro why does the Windows CI build fail?\n```\n\n- **Write races** (`--write`, the `/pi:rescue` default): each racer works in an isolated git worktree created from `HEAD` — racers can never touch your working tree or each other. Each racer's result is captured as a patch; review them and apply exactly one with `git apply <patch>`.\n- **Read-only races** (investigations): racers analyze the same tree; the output presents each answer side by side — agreement across models is a strong signal.\n- A racer that fails or produces no changes is reported as such; the race succeeds while at least one racer finishes.\n- Not combinable with `--model` or `--resume` (each racer starts a fresh session). Racers start from `HEAD`, so commit or stash first if the task concerns uncommitted work.\n\n## Pick your model\n\nThe plugin keeps three layers of model resolution:\n\n| Priority | Source | Example |\n|---|---|---|\n| 1 | `--model <id>` on the slash command | `/pi:review --model gpt-4o` |\n| 2 | Env var (review / adversarial-review only) | `export PI_PLUGIN_REVIEW_MODEL=deepseek-v4-flash`<br>`export PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=deepseek-v4-pro` |\n| 3 | Pi's own configured default | whatever your `~/.pi/agent/models.json` has, or `/model` last picked in pi TUI |\n\nLayer 1 wins over layer 2 wins over layer 3. **None of the layers are required** — leave them all unset and pi picks for you.\n\n### Suggested settings by provider\n\nThese are opinions, not requirements. Pick what fits your latency / cost / quality budget.\n\n| Provider | Everyday review (`/pi:review`) | Adversarial review (`/pi:adversarial-review`) |\n|---|---|---|\n| DeepSeek | `deepseek-v4-flash` | `deepseek-v4-pro` |\n| OpenAI | `gpt-4o-mini` or `gpt-5-mini` | `o1` or `gpt-5` |\n| Anthropic | `claude-haiku-4-5` | `claude-sonnet-4-6` or `claude-opus-4-7` |\n| Google | `gemini-2.5-flash` | `gemini-2.5-pro` |\n| Local (Ollama) | `qwen2.5-coder:7b` | `qwen2.5-coder:32b` or `deepseek-r1` |\n\nTo make these defaults sticky:\n\n```bash\nexport PI_PLUGIN_REVIEW_MODEL=claude-haiku-4-5\nexport PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=claude-sonnet-4-6\n```\n\n### Value tier — cheaper than Claude/GPT, still competitive\n\nThe whole point of driving Pi is that you are not locked to Claude or GPT. These models cost a fraction of the frontier Claude/GPT tiers and, while not quite as strong, are more than good enough for everyday review and rescue work. Configure them in `~/.pi/agent/models.json` (most are OpenAI-compatible endpoints) and use the exact id your provider exposes — verify with `pi --list-models`.\n\n| Provider | Suggested model(s) |\n|---|---|\n| DeepSeek | `deepseek-v4-flash` (everyday) · `deepseek-v4-pro` (adversarial) |\n| xAI | `grok-4.5` |\n| Zhipu (GLM) | `glm-5.1` · `glm-5.2` (heavier) |\n| Moonshot (Kimi) | `kimi-k2.6` |\n| MiniMax | `MiniMax-M3` |\n| ByteDance (Seed) | `doubao-seed-2.1-pro` |\n| Xiaomi (MiMo) | `mimo-v2.5` (everyday) · `mimo-v2.5-pro` (heavier) |\n| Meta | `muse-spark-1.1` |\n\n…and any other OpenAI-compatible endpoint you configure. Availability and the exact id depend on your `~/.pi/agent/models.json`.\n\n> Not every model emits clean JSON for the structured review commands. If `/pi:review` fails with a parse error on a given model, it is still fine for `/pi:rescue` (free-form) — or add it to a `PI_PLUGIN_FALLBACK_MODELS` chain so a flaky member is retried with the next one. (Observed: some MiniMax and local models echo the prompt back instead of returning JSON.)\n\n## Configure pi\n\nThe minimum is a single env var with your API key. For richer setups, write `~/.pi/agent/models.json`:\n\n```json\n{\n \"providers\": {\n \"deepseek\": { \"apiKey\": \"sk-...\" },\n \"openai\": { \"apiKey\": \"sk-...\" },\n \"anthropic\":{ \"apiKey\": \"sk-ant-...\" },\n \"google\": { \"apiKey\": \"...\" },\n \"openrouter\": {\n \"api\": \"openai-completions\",\n \"apiKey\": \"sk-or-v1-...\",\n \"baseUrl\": \"https://openrouter.ai/api/v1\",\n \"models\": [\n {\n \"id\": \"deepseek/deepseek-chat\",\n \"name\": \"DeepSeek via OpenRouter\",\n \"contextWindow\": 128000,\n \"maxTokens\": 8192,\n \"input\": [\"text\"]\n }\n ]\n }\n }\n}\n```\n\nBuilt-in providers (`anthropic`, `openai`, `google`, `deepseek`, `ollama`, `lmstudio`) only need `apiKey` (and optional `baseUrl`); pi ships their model lists. For custom OpenAI-compatible endpoints, set `api: \"openai-completions\"` and declare the `models` you want exposed.\n\nFull reference: [pi providers docs](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md).\n\n## Stop-time review gate\n\nOpt in with `/pi:setup --enable-review-gate`. When a Claude session ends, the plugin runs a Pi adversarial review of the previous turn and can block the stop if it finds material issues. If pi is unavailable while the gate is enabled, the hook blocks (it does **not** silently let the session end). Disable with `/pi:setup --disable-review-gate`.\n\n## 🔗 Related projects\n\n| Project | Niche | When to use |\n|---|---|---|\n| [codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | Same surface, runs Codex | You want OpenAI's Codex agent + ChatGPT auth |\n| [pi (earendil-works)](https://github.com/earendil-works/pi) | The coding agent this plugin drives | You want to use Pi directly without Claude Code |\n| [pi-subagents](https://github.com/nicobailon/pi-subagents) | Pi extension adding `subagent` tool + `/run` / `/chain` / `/parallel` | Powers `/pi:parallel-rescue` and lets `/pi:rescue` delegate to specialized child agents |\n\n## ❤️ Support\n\nIf this plugin helps you, consider supporting the author:\n\n<table>\n <tr>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/wechat-pay.png\" width=\"180\" alt=\"WeChat Pay\">\n <br>\n <b>WeChat Pay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/alipay.png\" width=\"180\" alt=\"Alipay\">\n <br>\n <b>Alipay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/buymeacoffee.png\" width=\"180\" alt=\"Buy Me a Coffee\">\n <br>\n <b>Buy Me a Coffee</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/awarding/award.gif\" width=\"180\" alt=\"Give a Reward\">\n <br>\n <b>Give a Reward</b>\n </td>\n </tr>\n</table>\n\n## 👤 Author\n\n**Agents365-ai**\n\n- GitHub: https://github.com/Agents365-ai\n- Bilibili: https://space.bilibili.com/441831884\n\n## 📄 License\n\n[Apache License 2.0](LICENSE). Forked from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) (Apache-2.0, OpenAI) — see [NOTICE](NOTICE).\n"}, "2df961524e4ff395c93cf726dee8f5b1e6571d41": {"t": 1785766141.054888, "n": 15567, "h": "ee0070d556dd4dbb", "c": "# pi-plugin-cc — drive the Pi coding agent from Claude Code and Codex 🥧\n\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/network/members)\n[![Latest Release](https://img.shields.io/github/v/release/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/releases/latest)\n[![Last Commit](https://img.shields.io/github/last-commit/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/commits/main)\n\n[![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-plugin-8a2be2)](https://docs.claude.com/en/docs/claude-code/plugins)\n[![Pi Coding Agent](https://img.shields.io/badge/Pi-coding%20agent-0a7d4a)](https://github.com/earendil-works/pi)\n[![Model agnostic](https://img.shields.io/badge/Model-agnostic-555)](#pick-your-model)\n\n**English** · [中文](README_CN.md)\n\nExternal references: [Pi coding agent](https://github.com/earendil-works/pi) · [Pi RPC mode](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md) · [Pi providers](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md)\n\nA Claude Code plugin that delegates reviews and coding tasks to the [Pi coding agent](https://github.com/earendil-works/pi). Adapted from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc), runtime swapped from Codex to Pi. Also usable from OpenAI's Codex CLI — see [Use from Codex](#-use-from-codex).\n\n**The hard dependency is pi, not any particular LLM.** Pi can be configured for DeepSeek, OpenAI, Anthropic, Google, Ollama, LM Studio, or any OpenAI-compatible endpoint via `~/.pi/agent/models.json`. The plugin defers all model selection to pi unless you override per command.\n\n- **Code review** against the working tree or a branch base, with structured findings\n- **Adversarial review** that challenges the design — not just spell-checks the diff\n- **Task delegation** for diagnoses, refactors, and longer rescues, foreground or background\n- **Parallel fan-out** — `/pi:parallel-rescue` runs multiple independent tasks concurrently via [`pi-subagents`](https://github.com/nicobailon/pi-subagents)\n- **Sharded parallel review** — `/pi:review --shards <N>` splits a large diff's changed files across N review jobs that run in parallel, then merges the findings\n- **Background job control** — `status`, `result`, `cancel`, and stop-time review gate\n- **No OAuth** — pi authenticates by API key (provider-specific), no `codex login` required\n\nIntegrates with [`pi-subagents`](https://github.com/nicobailon/pi-subagents) (`pi install npm:pi-subagents`): `/pi:setup` detects it and lists the agent profiles, `/pi:rescue` prompts advertise the `subagent` tool to Pi, and `/pi:parallel-rescue` fans multiple tasks out to parallel child agents (scout, researcher, planner, worker, reviewer, …).\n\n## 🔄 How it works\n\n<img src=\"docs/pi-plugin-cc-workflow.png\" alt=\"pi-plugin-cc workflow\" width=\"80%\">\n\nCodex's broker layer is gone — Pi is one-conversation-per-process, so the plugin spawns a fresh `pi --mode rpc` for each task. Background jobs are tracked in workspace-scoped state files. Review prompts inline the JSON schema since Pi has no `outputSchema` knob.\n\n## Slash commands\n\n| Command | What it does |\n|---|---|\n| `/pi:setup` | Verifies `pi` is installed + a provider is configured; toggles the stop-time review gate |\n| `/pi:review` | Standard code review of local git state |\n| `/pi:adversarial-review` | Steerable challenge review — questions the approach itself |\n| `/pi:rescue` | Delegate investigation or implementation to a Pi run via the `pi:pi-companion-forwarder` subagent |\n| `/pi:parallel-rescue` | Run multiple independent tasks in parallel via pi-subagents (`subagent({ tasks })` fan-out) |\n| `/pi:status [job-id]` | List active / recent Pi jobs in this repository |\n| `/pi:result <job-id>` | Show the stored final output for a finished job |\n| `/pi:cancel <job-id>` | Terminate a running background job |\n\nEvery command accepts `--model <id>` to pin a specific model just for that run. With no `--model` and no env override (see [Pick your model](#pick-your-model)), pi falls back to whatever it has configured by default.\n\n## Quick Start\n\n```bash\n# 1. Install pi (required)\nnpm install -g --ignore-scripts @earendil-works/pi-coding-agent\n\n# 2. Configure a provider — pick one\nexport OPENAI_API_KEY=sk-... # OpenAI\nexport ANTHROPIC_API_KEY=sk-ant-... # Anthropic\nexport GOOGLE_API_KEY=... # Google\nexport DEEPSEEK_API_KEY=sk-... # DeepSeek\n# or run a local model: see https://github.com/earendil-works/pi (Ollama / LM Studio)\n\n# 3. Verify pi sees a model\npi --list-models | head\n```\n\nInstall the plugin in Claude Code:\n\n```text\n> /plugin marketplace add Agents365-ai/pi-plugin-cc\n> /plugin install pi@agents365-pi\n> /reload-plugins\n> /pi:setup\n```\n\n`/pi:setup` returns a readiness report. If `pi` is missing and `npm` is on PATH, it offers to install it for you.\n\n## Usage\n\n```text\n> /pi:review\n> /pi:review --base main\n> /pi:review --model claude-sonnet-4\n> /pi:adversarial-review focus on the new auth middleware\n> /pi:rescue investigate why the Windows CI build is failing\n> /pi:rescue --background --model gpt-4o refactor src/payments/\n> /pi:parallel-rescue \"audit the auth module\" \"benchmark the db queries\" \"update the API docs\"\n> /pi:status\n> /pi:status task-mpgyiwb9-e3k641 --wait\n> /pi:result task-mpgyiwb9-e3k641\n> /pi:cancel task-mpgyiwb9-e3k641\n```\n\n`--effort <off|minimal|low|medium|high|xhigh>` is passed through to Pi via `set_thinking_level`. Models that do not support thinking silently ignore it (the plugin logs a one-line note to stderr when this happens).\n\n## 🧩 Use from Codex\n\nThe core of this plugin is a harness-agnostic CLI (`pi-companion.mjs`) — any coding agent that can run shell commands can drive it. For OpenAI's Codex CLI, install the bundled [custom prompts](codex-prompts/):\n\n```bash\n# 1. Clone the repo (anywhere; ~/pi-plugin-cc is the default the prompts assume)\ngit clone https://github.com/Agents365-ai/pi-plugin-cc ~/pi-plugin-cc\n\n# 2. Install the Codex custom prompts\nmkdir -p ~/.codex/prompts\ncp ~/pi-plugin-cc/codex-prompts/*.md ~/.codex/prompts/\n\n# 3. If you cloned somewhere else, point the prompts at it\necho 'export PI_PLUGIN_ROOT=\"$HOME/path/to/pi-plugin-cc\"' >> ~/.zshrc\n```\n\nThen inside Codex: `/pi-review`, `/pi-adversarial-review`, `/pi-rescue`, `/pi-parallel-rescue`, `/pi-status`, `/pi-result`, `/pi-cancel`, `/pi-setup` (note `-` instead of `:` — Codex prompt names cannot contain colons).\n\nNot available under Codex: the stop-time review gate and session-resume prompts (both rely on Claude Code hooks / subagents). Everything else — including pi-subagents parallel fan-out — works the same.\n\n## 🧑‍⚖️ Multi-model review panel\n\nOne reviewer has blind spots; a panel doesn't share them. Passing `--models` to either review command runs the same diff through several models **in parallel** and merges their findings — issues reported by 2+ models rank first with a `found by:` tag:\n\n```text\n> /pi:review --models deepseek-v4-flash,claude-sonnet-4-6,gpt-5-mini\n> /pi:adversarial-review --models deepseek-v4-pro,o1 focus on concurrency\n```\n\n- Consensus findings (2+ models) are listed first; single-model findings follow.\n- Duplicate findings are matched per file with line-range slack; severity escalates to the highest reported and alternate titles are kept.\n- A member that fails (provider error, invalid JSON) is reported inline and does not sink the panel — it succeeds as long as one model returns a valid review.\n- Panel members do not use the `PI_PLUGIN_FALLBACK_MODELS` chain — the panel itself is the redundancy.\n- This only exists because Pi is provider-agnostic: a single-vendor CLI cannot convene a cross-vendor panel.\n\n## 🛟 Automatic model fallback\n\nSet a fallback chain once, and any failed run — provider outage, auth error, exhausted retries — is automatically retried with the next model:\n\n```bash\nexport PI_PLUGIN_FALLBACK_MODELS=deepseek-v4-flash,MiniMax-M3\n```\n\nApplies to reviews and rescue tasks alike. When a fallback produced the result, the output ends with a `Model fallback:` note (and the JSON payload carries `modelAttempts`). `/pi:setup` shows the configured chain.\n\n## 🏁 Model racing\n\nFor hard problems, run the same rescue task with several models **in parallel** and pick the winner:\n\n```text\n> /pi:rescue --race deepseek-v4-pro,claude-sonnet-4-6 fix the flaky retry logic in src/queue.mjs\n> /pi:rescue --race deepseek-v4-flash,gemini-2.5-pro why does the Windows CI build fail?\n```\n\n- **Write races** (`--write`, the `/pi:rescue` default): each racer works in an isolated git worktree created from `HEAD` — racers can never touch your working tree or each other. Each racer's result is captured as a patch; review them and apply exactly one with `git apply <patch>`.\n- **Read-only races** (investigations): racers analyze the same tree; the output presents each answer side by side — agreement across models is a strong signal.\n- A racer that fails or produces no changes is reported as such; the race succeeds while at least one racer finishes.\n- Not combinable with `--model` or `--resume` (each racer starts a fresh session). Racers start from `HEAD`, so commit or stash first if the task concerns uncommitted work.\n\n## Pick your model\n\nThe plugin keeps three layers of model resolution:\n\n| Priority | Source | Example |\n|---|---|---|\n| 1 | `--model <id>` on the slash command | `/pi:review --model gpt-4o` |\n| 2 | Env var (review / adversarial-review only) | `export PI_PLUGIN_REVIEW_MODEL=deepseek-v4-flash`<br>`export PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=deepseek-v4-pro` |\n| 3 | Pi's own configured default | whatever your `~/.pi/agent/models.json` has, or `/model` last picked in pi TUI |\n\nLayer 1 wins over layer 2 wins over layer 3. **None of the layers are required** — leave them all unset and pi picks for you.\n\n### Suggested settings by provider\n\nThese are opinions, not requirements. Pick what fits your latency / cost / quality budget.\n\n| Provider | Everyday review (`/pi:review`) | Adversarial review (`/pi:adversarial-review`) |\n|---|---|---|\n| DeepSeek | `deepseek-v4-flash` | `deepseek-v4-pro` |\n| OpenAI | `gpt-4o-mini` or `gpt-5-mini` | `o1` or `gpt-5` |\n| Anthropic | `claude-haiku-4-5` | `claude-sonnet-4-6` or `claude-opus-4-7` |\n| Google | `gemini-2.5-flash` | `gemini-2.5-pro` |\n| Local (Ollama) | `qwen2.5-coder:7b` | `qwen2.5-coder:32b` or `deepseek-r1` |\n\nTo make these defaults sticky:\n\n```bash\nexport PI_PLUGIN_REVIEW_MODEL=claude-haiku-4-5\nexport PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=claude-sonnet-4-6\n```\n\n### Value tier — cheaper than Claude/GPT, still competitive\n\nThe whole point of driving Pi is that you are not locked to Claude or GPT. These models cost a fraction of the frontier Claude/GPT tiers and, while not quite as strong, are more than good enough for everyday review and rescue work. Configure them in `~/.pi/agent/models.json` (most are OpenAI-compatible endpoints) and use the exact id your provider exposes — verify with `pi --list-models`.\n\n| Provider | Suggested model(s) |\n|---|---|\n| DeepSeek | `deepseek-v4-flash` (everyday) · `deepseek-v4-pro` (adversarial) |\n| xAI | `grok-4.5` |\n| Zhipu (GLM) | `glm5.1` · `glm5.2` (heavier) |\n| Moonshot (Kimi) | `kimi 2.6` |\n| MiniMax | `minimax-m3` |\n| ByteDance (Seed) | `seed-2.1-pro-preview` |\n| Xiaomi (MiMo) | `mimo-v2.5` (everyday) · `mimo-v2.5-pro` (heavier) |\n| Meta | `muse-spark-1.1` |\n\n…and any other OpenAI-compatible endpoint you configure. Availability and the exact id depend on your `~/.pi/agent/models.json`.\n\n> Not every model emits clean JSON for the structured review commands. If `/pi:review` fails with a parse error on a given model, it is still fine for `/pi:rescue` (free-form) — or add it to a `PI_PLUGIN_FALLBACK_MODELS` chain so a flaky member is retried with the next one. (Observed: some MiniMax and local models echo the prompt back instead of returning JSON.)\n\n## Configure pi\n\nThe minimum is a single env var with your API key. For richer setups, write `~/.pi/agent/models.json`:\n\n```json\n{\n \"providers\": {\n \"deepseek\": { \"apiKey\": \"sk-...\" },\n \"openai\": { \"apiKey\": \"sk-...\" },\n \"anthropic\":{ \"apiKey\": \"sk-ant-...\" },\n \"google\": { \"apiKey\": \"...\" },\n \"openrouter\": {\n \"api\": \"openai-completions\",\n \"apiKey\": \"sk-or-v1-...\",\n \"baseUrl\": \"https://openrouter.ai/api/v1\",\n \"models\": [\n {\n \"id\": \"deepseek/deepseek-chat\",\n \"name\": \"DeepSeek via OpenRouter\",\n \"contextWindow\": 128000,\n \"maxTokens\": 8192,\n \"input\": [\"text\"]\n }\n ]\n }\n }\n}\n```\n\nBuilt-in providers (`anthropic`, `openai`, `google`, `deepseek`, `ollama`, `lmstudio`) only need `apiKey` (and optional `baseUrl`); pi ships their model lists. For custom OpenAI-compatible endpoints, set `api: \"openai-completions\"` and declare the `models` you want exposed.\n\nFull reference: [pi providers docs](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md).\n\n## Stop-time review gate\n\nOpt in with `/pi:setup --enable-review-gate`. When a Claude session ends, the plugin runs a Pi adversarial review of the previous turn and can block the stop if it finds material issues. If pi is unavailable while the gate is enabled, the hook blocks (it does **not** silently let the session end). Disable with `/pi:setup --disable-review-gate`.\n\n## 🔗 Related projects\n\n| Project | Niche | When to use |\n|---|---|---|\n| [codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | Same surface, runs Codex | You want OpenAI's Codex agent + ChatGPT auth |\n| [pi (earendil-works)](https://github.com/earendil-works/pi) | The coding agent this plugin drives | You want to use Pi directly without Claude Code |\n| [pi-subagents](https://github.com/nicobailon/pi-subagents) | Pi extension adding `subagent` tool + `/run` / `/chain` / `/parallel` | Powers `/pi:parallel-rescue` and lets `/pi:rescue` delegate to specialized child agents |\n\n## ❤️ Support\n\nIf this plugin helps you, consider supporting the author:\n\n<table>\n <tr>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/wechat-pay.png\" width=\"180\" alt=\"WeChat Pay\">\n <br>\n <b>WeChat Pay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/alipay.png\" width=\"180\" alt=\"Alipay\">\n <br>\n <b>Alipay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/buymeacoffee.png\" width=\"180\" alt=\"Buy Me a Coffee\">\n <br>\n <b>Buy Me a Coffee</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/awarding/award.gif\" width=\"180\" alt=\"Give a Reward\">\n <br>\n <b>Give a Reward</b>\n </td>\n </tr>\n</table>\n\n## 👤 Author\n\n**Agents365-ai**\n\n- GitHub: https://github.com/Agents365-ai\n- Bilibili: https://space.bilibili.com/441831884\n\n## 📄 License\n\n[Apache License 2.0](LICENSE). Forked from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) (Apache-2.0, OpenAI) — see [NOTICE](NOTICE).\n"}, "7fec5eb927d428f2659d3d92dc46dd8e8095afb7": {"t": 1785766142.7484827, "n": 15574, "h": "1ddd5e73f5954b02", "c": "# pi-plugin-cc — drive the Pi coding agent from Claude Code and Codex 🥧\n\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/network/members)\n[![Latest Release](https://img.shields.io/github/v/release/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/releases/latest)\n[![Last Commit](https://img.shields.io/github/last-commit/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/commits/main)\n\n[![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-plugin-8a2be2)](https://docs.claude.com/en/docs/claude-code/plugins)\n[![Pi Coding Agent](https://img.shields.io/badge/Pi-coding%20agent-0a7d4a)](https://github.com/earendil-works/pi)\n[![Model agnostic](https://img.shields.io/badge/Model-agnostic-555)](#pick-your-model)\n\n**English** · [中文](README_CN.md)\n\nExternal references: [Pi coding agent](https://github.com/earendil-works/pi) · [Pi RPC mode](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md) · [Pi providers](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md)\n\nA Claude Code plugin that delegates reviews and coding tasks to the [Pi coding agent](https://github.com/earendil-works/pi). Adapted from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc), runtime swapped from Codex to Pi. Also usable from OpenAI's Codex CLI — see [Use from Codex](#-use-from-codex).\n\n**The hard dependency is pi, not any particular LLM.** Pi can be configured for DeepSeek, OpenAI, Anthropic, Google, Ollama, LM Studio, or any OpenAI-compatible endpoint via `~/.pi/agent/models.json`. The plugin defers all model selection to pi unless you override per command.\n\n- **Code review** against the working tree or a branch base, with structured findings\n- **Adversarial review** that challenges the design — not just spell-checks the diff\n- **Task delegation** for diagnoses, refactors, and longer rescues, foreground or background\n- **Parallel fan-out** — `/pi:parallel-rescue` runs multiple independent tasks concurrently via [`pi-subagents`](https://github.com/nicobailon/pi-subagents)\n- **Sharded parallel review** — `/pi:review --shards <N>` splits a large diff's changed files across N review jobs that run in parallel, then merges the findings\n- **Background job control** — `status`, `result`, `cancel`, and stop-time review gate\n- **No OAuth** — pi authenticates by API key (provider-specific), no `codex login` required\n\nIntegrates with [`pi-subagents`](https://github.com/nicobailon/pi-subagents) (`pi install npm:pi-subagents`): `/pi:setup` detects it and lists the agent profiles, `/pi:rescue` prompts advertise the `subagent` tool to Pi, and `/pi:parallel-rescue` fans multiple tasks out to parallel child agents (scout, researcher, planner, worker, reviewer, …).\n\n## 🔄 How it works\n\n<img src=\"docs/pi-plugin-cc-workflow.png\" alt=\"pi-plugin-cc workflow\" width=\"80%\">\n\nCodex's broker layer is gone — Pi is one-conversation-per-process, so the plugin spawns a fresh `pi --mode rpc` for each task. Background jobs are tracked in workspace-scoped state files. Review prompts inline the JSON schema since Pi has no `outputSchema` knob.\n\n## Slash commands\n\n| Command | What it does |\n|---|---|\n| `/pi:setup` | Verifies `pi` is installed + a provider is configured; toggles the stop-time review gate |\n| `/pi:review` | Standard code review of local git state |\n| `/pi:adversarial-review` | Steerable challenge review — questions the approach itself |\n| `/pi:rescue` | Delegate investigation or implementation to a Pi run via the `pi:pi-companion-forwarder` subagent |\n| `/pi:parallel-rescue` | Run multiple independent tasks in parallel via pi-subagents (`subagent({ tasks })` fan-out) |\n| `/pi:status [job-id]` | List active / recent Pi jobs in this repository |\n| `/pi:result <job-id>` | Show the stored final output for a finished job |\n| `/pi:cancel <job-id>` | Terminate a running background job |\n\nEvery command accepts `--model <id>` to pin a specific model just for that run. With no `--model` and no env override (see [Pick your model](#pick-your-model)), pi falls back to whatever it has configured by default.\n\n## Quick Start\n\n```bash\n# 1. Install pi (required)\nnpm install -g --ignore-scripts @earendil-works/pi-coding-agent\n\n# 2. Configure a provider — pick one\nexport OPENAI_API_KEY=sk-... # OpenAI\nexport ANTHROPIC_API_KEY=sk-ant-... # Anthropic\nexport GOOGLE_API_KEY=... # Google\nexport DEEPSEEK_API_KEY=sk-... # DeepSeek\n# or run a local model: see https://github.com/earendil-works/pi (Ollama / LM Studio)\n\n# 3. Verify pi sees a model\npi --list-models | head\n```\n\nInstall the plugin in Claude Code:\n\n```text\n> /plugin marketplace add Agents365-ai/pi-plugin-cc\n> /plugin install pi@agents365-pi\n> /reload-plugins\n> /pi:setup\n```\n\n`/pi:setup` returns a readiness report. If `pi` is missing and `npm` is on PATH, it offers to install it for you.\n\n## Usage\n\n```text\n> /pi:review\n> /pi:review --base main\n> /pi:review --model claude-sonnet-4\n> /pi:adversarial-review focus on the new auth middleware\n> /pi:rescue investigate why the Windows CI build is failing\n> /pi:rescue --background --model gpt-4o refactor src/payments/\n> /pi:parallel-rescue \"audit the auth module\" \"benchmark the db queries\" \"update the API docs\"\n> /pi:status\n> /pi:status task-mpgyiwb9-e3k641 --wait\n> /pi:result task-mpgyiwb9-e3k641\n> /pi:cancel task-mpgyiwb9-e3k641\n```\n\n`--effort <off|minimal|low|medium|high|xhigh>` is passed through to Pi via `set_thinking_level`. Models that do not support thinking silently ignore it (the plugin logs a one-line note to stderr when this happens).\n\n## 🧩 Use from Codex\n\nThe core of this plugin is a harness-agnostic CLI (`pi-companion.mjs`) — any coding agent that can run shell commands can drive it. For OpenAI's Codex CLI, install the bundled [custom prompts](codex-prompts/):\n\n```bash\n# 1. Clone the repo (anywhere; ~/pi-plugin-cc is the default the prompts assume)\ngit clone https://github.com/Agents365-ai/pi-plugin-cc ~/pi-plugin-cc\n\n# 2. Install the Codex custom prompts\nmkdir -p ~/.codex/prompts\ncp ~/pi-plugin-cc/codex-prompts/*.md ~/.codex/prompts/\n\n# 3. If you cloned somewhere else, point the prompts at it\necho 'export PI_PLUGIN_ROOT=\"$HOME/path/to/pi-plugin-cc\"' >> ~/.zshrc\n```\n\nThen inside Codex: `/pi-review`, `/pi-adversarial-review`, `/pi-rescue`, `/pi-parallel-rescue`, `/pi-status`, `/pi-result`, `/pi-cancel`, `/pi-setup` (note `-` instead of `:` — Codex prompt names cannot contain colons).\n\nNot available under Codex: the stop-time review gate and session-resume prompts (both rely on Claude Code hooks / subagents). Everything else — including pi-subagents parallel fan-out — works the same.\n\n## 🧑‍⚖️ Multi-model review panel\n\nOne reviewer has blind spots; a panel doesn't share them. Passing `--models` to either review command runs the same diff through several models **in parallel** and merges their findings — issues reported by 2+ models rank first with a `found by:` tag:\n\n```text\n> /pi:review --models deepseek-v4-flash,claude-sonnet-4-6,gpt-5-mini\n> /pi:adversarial-review --models deepseek-v4-pro,o1 focus on concurrency\n```\n\n- Consensus findings (2+ models) are listed first; single-model findings follow.\n- Duplicate findings are matched per file with line-range slack; severity escalates to the highest reported and alternate titles are kept.\n- A member that fails (provider error, invalid JSON) is reported inline and does not sink the panel — it succeeds as long as one model returns a valid review.\n- Panel members do not use the `PI_PLUGIN_FALLBACK_MODELS` chain — the panel itself is the redundancy.\n- This only exists because Pi is provider-agnostic: a single-vendor CLI cannot convene a cross-vendor panel.\n\n## 🛟 Automatic model fallback\n\nSet a fallback chain once, and any failed run — provider outage, auth error, exhausted retries — is automatically retried with the next model:\n\n```bash\nexport PI_PLUGIN_FALLBACK_MODELS=deepseek-v4-flash,MiniMax-M3\n```\n\nApplies to reviews and rescue tasks alike. When a fallback produced the result, the output ends with a `Model fallback:` note (and the JSON payload carries `modelAttempts`). `/pi:setup` shows the configured chain.\n\n## 🏁 Model racing\n\nFor hard problems, run the same rescue task with several models **in parallel** and pick the winner:\n\n```text\n> /pi:rescue --race deepseek-v4-pro,claude-sonnet-4-6 fix the flaky retry logic in src/queue.mjs\n> /pi:rescue --race deepseek-v4-flash,gemini-2.5-pro why does the Windows CI build fail?\n```\n\n- **Write races** (`--write`, the `/pi:rescue` default): each racer works in an isolated git worktree created from `HEAD` — racers can never touch your working tree or each other. Each racer's result is captured as a patch; review them and apply exactly one with `git apply <patch>`.\n- **Read-only races** (investigations): racers analyze the same tree; the output presents each answer side by side — agreement across models is a strong signal.\n- A racer that fails or produces no changes is reported as such; the race succeeds while at least one racer finishes.\n- Not combinable with `--model` or `--resume` (each racer starts a fresh session). Racers start from `HEAD`, so commit or stash first if the task concerns uncommitted work.\n\n## Pick your model\n\nThe plugin keeps three layers of model resolution:\n\n| Priority | Source | Example |\n|---|---|---|\n| 1 | `--model <id>` on the slash command | `/pi:review --model gpt-4o` |\n| 2 | Env var (review / adversarial-review only) | `export PI_PLUGIN_REVIEW_MODEL=deepseek-v4-flash`<br>`export PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=deepseek-v4-pro` |\n| 3 | Pi's own configured default | whatever your `~/.pi/agent/models.json` has, or `/model` last picked in pi TUI |\n\nLayer 1 wins over layer 2 wins over layer 3. **None of the layers are required** — leave them all unset and pi picks for you.\n\n### Suggested settings by provider\n\nThese are opinions, not requirements. Pick what fits your latency / cost / quality budget.\n\n| Provider | Everyday review (`/pi:review`) | Adversarial review (`/pi:adversarial-review`) |\n|---|---|---|\n| DeepSeek | `deepseek-v4-flash` | `deepseek-v4-pro` |\n| OpenAI | `gpt-4o-mini` or `gpt-5-mini` | `o1` or `gpt-5` |\n| Anthropic | `claude-haiku-4-5` | `claude-sonnet-4-6` or `claude-opus-4-7` |\n| Google | `gemini-2.5-flash` | `gemini-2.5-pro` |\n| Local (Ollama) | `qwen2.5-coder:7b` | `qwen2.5-coder:32b` or `deepseek-r1` |\n\nTo make these defaults sticky:\n\n```bash\nexport PI_PLUGIN_REVIEW_MODEL=claude-haiku-4-5\nexport PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=claude-sonnet-4-6\n```\n\n### Value tier — cheaper than Claude/GPT, still competitive\n\nThe whole point of driving Pi is that you are not locked to Claude or GPT. These models cost a fraction of the frontier Claude/GPT tiers and, while not quite as strong, are more than good enough for everyday review and rescue work. Configure them in `~/.pi/agent/models.json` (most are OpenAI-compatible endpoints) and use the exact id your provider exposes — verify with `pi --list-models`.\n\n| Provider | Suggested model(s) |\n|---|---|\n| DeepSeek | `deepseek-v4-flash` (everyday) · `deepseek-v4-pro` (adversarial) |\n| xAI | `grok-4.5` |\n| Zhipu (GLM) | `glm5.1` · `glm5.2` (heavier) |\n| Moonshot (Kimi) | `kimi 2.6` |\n| MiniMax | `minimax-m3` |\n| ByteDance (Seed) | `seed-2.1-pro-preview` |\n| Xiaomi (MiMo) | `mimo-v2.5-dflash` (everyday) · `mimo-v2.5-pro` (heavier) |\n| Meta | `muse-spark-1.1` |\n\n…and any other OpenAI-compatible endpoint you configure. Availability and the exact id depend on your `~/.pi/agent/models.json`.\n\n> Not every model emits clean JSON for the structured review commands. If `/pi:review` fails with a parse error on a given model, it is still fine for `/pi:rescue` (free-form) — or add it to a `PI_PLUGIN_FALLBACK_MODELS` chain so a flaky member is retried with the next one. (Observed: some MiniMax and local models echo the prompt back instead of returning JSON.)\n\n## Configure pi\n\nThe minimum is a single env var with your API key. For richer setups, write `~/.pi/agent/models.json`:\n\n```json\n{\n \"providers\": {\n \"deepseek\": { \"apiKey\": \"sk-...\" },\n \"openai\": { \"apiKey\": \"sk-...\" },\n \"anthropic\":{ \"apiKey\": \"sk-ant-...\" },\n \"google\": { \"apiKey\": \"...\" },\n \"openrouter\": {\n \"api\": \"openai-completions\",\n \"apiKey\": \"sk-or-v1-...\",\n \"baseUrl\": \"https://openrouter.ai/api/v1\",\n \"models\": [\n {\n \"id\": \"deepseek/deepseek-chat\",\n \"name\": \"DeepSeek via OpenRouter\",\n \"contextWindow\": 128000,\n \"maxTokens\": 8192,\n \"input\": [\"text\"]\n }\n ]\n }\n }\n}\n```\n\nBuilt-in providers (`anthropic`, `openai`, `google`, `deepseek`, `ollama`, `lmstudio`) only need `apiKey` (and optional `baseUrl`); pi ships their model lists. For custom OpenAI-compatible endpoints, set `api: \"openai-completions\"` and declare the `models` you want exposed.\n\nFull reference: [pi providers docs](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md).\n\n## Stop-time review gate\n\nOpt in with `/pi:setup --enable-review-gate`. When a Claude session ends, the plugin runs a Pi adversarial review of the previous turn and can block the stop if it finds material issues. If pi is unavailable while the gate is enabled, the hook blocks (it does **not** silently let the session end). Disable with `/pi:setup --disable-review-gate`.\n\n## 🔗 Related projects\n\n| Project | Niche | When to use |\n|---|---|---|\n| [codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | Same surface, runs Codex | You want OpenAI's Codex agent + ChatGPT auth |\n| [pi (earendil-works)](https://github.com/earendil-works/pi) | The coding agent this plugin drives | You want to use Pi directly without Claude Code |\n| [pi-subagents](https://github.com/nicobailon/pi-subagents) | Pi extension adding `subagent` tool + `/run` / `/chain` / `/parallel` | Powers `/pi:parallel-rescue` and lets `/pi:rescue` delegate to specialized child agents |\n\n## ❤️ Support\n\nIf this plugin helps you, consider supporting the author:\n\n<table>\n <tr>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/wechat-pay.png\" width=\"180\" alt=\"WeChat Pay\">\n <br>\n <b>WeChat Pay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/alipay.png\" width=\"180\" alt=\"Alipay\">\n <br>\n <b>Alipay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/buymeacoffee.png\" width=\"180\" alt=\"Buy Me a Coffee\">\n <br>\n <b>Buy Me a Coffee</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/awarding/award.gif\" width=\"180\" alt=\"Give a Reward\">\n <br>\n <b>Give a Reward</b>\n </td>\n </tr>\n</table>\n\n## 👤 Author\n\n**Agents365-ai**\n\n- GitHub: https://github.com/Agents365-ai\n- Bilibili: https://space.bilibili.com/441831884\n\n## 📄 License\n\n[Apache License 2.0](LICENSE). Forked from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) (Apache-2.0, OpenAI) — see [NOTICE](NOTICE).\n"}, "114dc2068d993704a9de7e84949119c98fcb6d51": {"t": 1785766144.4497705, "n": 15576, "h": "3de9895bf8462e79", "c": "# pi-plugin-cc — drive the Pi coding agent from Claude Code and Codex 🥧\n\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/network/members)\n[![Latest Release](https://img.shields.io/github/v/release/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/releases/latest)\n[![Last Commit](https://img.shields.io/github/last-commit/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/commits/main)\n\n[![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-plugin-8a2be2)](https://docs.claude.com/en/docs/claude-code/plugins)\n[![Pi Coding Agent](https://img.shields.io/badge/Pi-coding%20agent-0a7d4a)](https://github.com/earendil-works/pi)\n[![Model agnostic](https://img.shields.io/badge/Model-agnostic-555)](#pick-your-model)\n\n**English** · [中文](README_CN.md)\n\nExternal references: [Pi coding agent](https://github.com/earendil-works/pi) · [Pi RPC mode](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md) · [Pi providers](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md)\n\nA Claude Code plugin that delegates reviews and coding tasks to the [Pi coding agent](https://github.com/earendil-works/pi). Adapted from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc), runtime swapped from Codex to Pi. Also usable from OpenAI's Codex CLI — see [Use from Codex](#-use-from-codex).\n\n**The hard dependency is pi, not any particular LLM.** Pi can be configured for DeepSeek, OpenAI, Anthropic, Google, Ollama, LM Studio, or any OpenAI-compatible endpoint via `~/.pi/agent/models.json`. The plugin defers all model selection to pi unless you override per command.\n\n- **Code review** against the working tree or a branch base, with structured findings\n- **Adversarial review** that challenges the design — not just spell-checks the diff\n- **Task delegation** for diagnoses, refactors, and longer rescues, foreground or background\n- **Parallel fan-out** — `/pi:parallel-rescue` runs multiple independent tasks concurrently via [`pi-subagents`](https://github.com/nicobailon/pi-subagents)\n- **Sharded parallel review** — `/pi:review --shards <N>` splits a large diff's changed files across N review jobs that run in parallel, then merges the findings\n- **Background job control** — `status`, `result`, `cancel`, and stop-time review gate\n- **No OAuth** — pi authenticates by API key (provider-specific), no `codex login` required\n\nIntegrates with [`pi-subagents`](https://github.com/nicobailon/pi-subagents) (`pi install npm:pi-subagents`): `/pi:setup` detects it and lists the agent profiles, `/pi:rescue` prompts advertise the `subagent` tool to Pi, and `/pi:parallel-rescue` fans multiple tasks out to parallel child agents (scout, researcher, planner, worker, reviewer, …).\n\n## 🔄 How it works\n\n<img src=\"docs/pi-plugin-cc-workflow.png\" alt=\"pi-plugin-cc workflow\" width=\"80%\">\n\nCodex's broker layer is gone — Pi is one-conversation-per-process, so the plugin spawns a fresh `pi --mode rpc` for each task. Background jobs are tracked in workspace-scoped state files. Review prompts inline the JSON schema since Pi has no `outputSchema` knob.\n\n## Slash commands\n\n| Command | What it does |\n|---|---|\n| `/pi:setup` | Verifies `pi` is installed + a provider is configured; toggles the stop-time review gate |\n| `/pi:review` | Standard code review of local git state |\n| `/pi:adversarial-review` | Steerable challenge review — questions the approach itself |\n| `/pi:rescue` | Delegate investigation or implementation to a Pi run via the `pi:pi-companion-forwarder` subagent |\n| `/pi:parallel-rescue` | Run multiple independent tasks in parallel via pi-subagents (`subagent({ tasks })` fan-out) |\n| `/pi:status [job-id]` | List active / recent Pi jobs in this repository |\n| `/pi:result <job-id>` | Show the stored final output for a finished job |\n| `/pi:cancel <job-id>` | Terminate a running background job |\n\nEvery command accepts `--model <id>` to pin a specific model just for that run. With no `--model` and no env override (see [Pick your model](#pick-your-model)), pi falls back to whatever it has configured by default.\n\n## Quick Start\n\n```bash\n# 1. Install pi (required)\nnpm install -g --ignore-scripts @earendil-works/pi-coding-agent\n\n# 2. Configure a provider — pick one\nexport OPENAI_API_KEY=sk-... # OpenAI\nexport ANTHROPIC_API_KEY=sk-ant-... # Anthropic\nexport GOOGLE_API_KEY=... # Google\nexport DEEPSEEK_API_KEY=sk-... # DeepSeek\n# or run a local model: see https://github.com/earendil-works/pi (Ollama / LM Studio)\n\n# 3. Verify pi sees a model\npi --list-models | head\n```\n\nInstall the plugin in Claude Code:\n\n```text\n> /plugin marketplace add Agents365-ai/pi-plugin-cc\n> /plugin install pi@agents365-pi\n> /reload-plugins\n> /pi:setup\n```\n\n`/pi:setup` returns a readiness report. If `pi` is missing and `npm` is on PATH, it offers to install it for you.\n\n## Usage\n\n```text\n> /pi:review\n> /pi:review --base main\n> /pi:review --model claude-sonnet-4\n> /pi:adversarial-review focus on the new auth middleware\n> /pi:rescue investigate why the Windows CI build is failing\n> /pi:rescue --background --model gpt-4o refactor src/payments/\n> /pi:parallel-rescue \"audit the auth module\" \"benchmark the db queries\" \"update the API docs\"\n> /pi:status\n> /pi:status task-mpgyiwb9-e3k641 --wait\n> /pi:result task-mpgyiwb9-e3k641\n> /pi:cancel task-mpgyiwb9-e3k641\n```\n\n`--effort <off|minimal|low|medium|high|xhigh>` is passed through to Pi via `set_thinking_level`. Models that do not support thinking silently ignore it (the plugin logs a one-line note to stderr when this happens).\n\n## 🧩 Use from Codex\n\nThe core of this plugin is a harness-agnostic CLI (`pi-companion.mjs`) — any coding agent that can run shell commands can drive it. For OpenAI's Codex CLI, install the bundled [custom prompts](codex-prompts/):\n\n```bash\n# 1. Clone the repo (anywhere; ~/pi-plugin-cc is the default the prompts assume)\ngit clone https://github.com/Agents365-ai/pi-plugin-cc ~/pi-plugin-cc\n\n# 2. Install the Codex custom prompts\nmkdir -p ~/.codex/prompts\ncp ~/pi-plugin-cc/codex-prompts/*.md ~/.codex/prompts/\n\n# 3. If you cloned somewhere else, point the prompts at it\necho 'export PI_PLUGIN_ROOT=\"$HOME/path/to/pi-plugin-cc\"' >> ~/.zshrc\n```\n\nThen inside Codex: `/pi-review`, `/pi-adversarial-review`, `/pi-rescue`, `/pi-parallel-rescue`, `/pi-status`, `/pi-result`, `/pi-cancel`, `/pi-setup` (note `-` instead of `:` — Codex prompt names cannot contain colons).\n\nNot available under Codex: the stop-time review gate and session-resume prompts (both rely on Claude Code hooks / subagents). Everything else — including pi-subagents parallel fan-out — works the same.\n\n## 🧑‍⚖️ Multi-model review panel\n\nOne reviewer has blind spots; a panel doesn't share them. Passing `--models` to either review command runs the same diff through several models **in parallel** and merges their findings — issues reported by 2+ models rank first with a `found by:` tag:\n\n```text\n> /pi:review --models deepseek-v4-flash,claude-sonnet-4-6,gpt-5-mini\n> /pi:adversarial-review --models deepseek-v4-pro,o1 focus on concurrency\n```\n\n- Consensus findings (2+ models) are listed first; single-model findings follow.\n- Duplicate findings are matched per file with line-range slack; severity escalates to the highest reported and alternate titles are kept.\n- A member that fails (provider error, invalid JSON) is reported inline and does not sink the panel — it succeeds as long as one model returns a valid review.\n- Panel members do not use the `PI_PLUGIN_FALLBACK_MODELS` chain — the panel itself is the redundancy.\n- This only exists because Pi is provider-agnostic: a single-vendor CLI cannot convene a cross-vendor panel.\n\n## 🛟 Automatic model fallback\n\nSet a fallback chain once, and any failed run — provider outage, auth error, exhausted retries — is automatically retried with the next model:\n\n```bash\nexport PI_PLUGIN_FALLBACK_MODELS=deepseek-v4-flash,MiniMax-M3\n```\n\nApplies to reviews and rescue tasks alike. When a fallback produced the result, the output ends with a `Model fallback:` note (and the JSON payload carries `modelAttempts`). `/pi:setup` shows the configured chain.\n\n## 🏁 Model racing\n\nFor hard problems, run the same rescue task with several models **in parallel** and pick the winner:\n\n```text\n> /pi:rescue --race deepseek-v4-pro,claude-sonnet-4-6 fix the flaky retry logic in src/queue.mjs\n> /pi:rescue --race deepseek-v4-flash,gemini-2.5-pro why does the Windows CI build fail?\n```\n\n- **Write races** (`--write`, the `/pi:rescue` default): each racer works in an isolated git worktree created from `HEAD` — racers can never touch your working tree or each other. Each racer's result is captured as a patch; review them and apply exactly one with `git apply <patch>`.\n- **Read-only races** (investigations): racers analyze the same tree; the output presents each answer side by side — agreement across models is a strong signal.\n- A racer that fails or produces no changes is reported as such; the race succeeds while at least one racer finishes.\n- Not combinable with `--model` or `--resume` (each racer starts a fresh session). Racers start from `HEAD`, so commit or stash first if the task concerns uncommitted work.\n\n## Pick your model\n\nThe plugin keeps three layers of model resolution:\n\n| Priority | Source | Example |\n|---|---|---|\n| 1 | `--model <id>` on the slash command | `/pi:review --model gpt-4o` |\n| 2 | Env var (review / adversarial-review only) | `export PI_PLUGIN_REVIEW_MODEL=deepseek-v4-flash`<br>`export PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=deepseek-v4-pro` |\n| 3 | Pi's own configured default | whatever your `~/.pi/agent/models.json` has, or `/model` last picked in pi TUI |\n\nLayer 1 wins over layer 2 wins over layer 3. **None of the layers are required** — leave them all unset and pi picks for you.\n\n### Suggested settings by provider\n\nThese are opinions, not requirements. Pick what fits your latency / cost / quality budget.\n\n| Provider | Everyday review (`/pi:review`) | Adversarial review (`/pi:adversarial-review`) |\n|---|---|---|\n| DeepSeek | `deepseek-v4-flash` | `deepseek-v4-pro` |\n| OpenAI | `gpt-4o-mini` or `gpt-5-mini` | `o1` or `gpt-5` |\n| Anthropic | `claude-haiku-4-5` | `claude-sonnet-4-6` or `claude-opus-4-7` |\n| Google | `gemini-2.5-flash` | `gemini-2.5-pro` |\n| Local (Ollama) | `qwen2.5-coder:7b` | `qwen2.5-coder:32b` or `deepseek-r1` |\n\nTo make these defaults sticky:\n\n```bash\nexport PI_PLUGIN_REVIEW_MODEL=claude-haiku-4-5\nexport PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=claude-sonnet-4-6\n```\n\n### Value tier — cheaper than Claude/GPT, still competitive\n\nThe whole point of driving Pi is that you are not locked to Claude or GPT. These models cost a fraction of the frontier Claude/GPT tiers and, while not quite as strong, are more than good enough for everyday review and rescue work. Configure them in `~/.pi/agent/models.json` (most are OpenAI-compatible endpoints) and use the exact id your provider exposes — verify with `pi --list-models`.\n\n| Provider | Suggested model(s) |\n|---|---|\n| DeepSeek | `deepseek-v4-flash` (everyday) · `deepseek-v4-pro` (adversarial) |\n| xAI | `grok-4.5` |\n| Zhipu (GLM) | `glm5.1` · `glm5.2` (heavier) |\n| Moonshot (Kimi) | `kimi 2.6` |\n| MiniMax | `minimax-m3` |\n| ByteDance (Seed) | `seed-2.1-pro-preview` |\n| Xiaomi (MiMo) | `mimo-v2.5-standard` (everyday) · `mimo-v2.5-pro` (heavier) |\n| Meta | `muse-spark-1.1` |\n\n…and any other OpenAI-compatible endpoint you configure. Availability and the exact id depend on your `~/.pi/agent/models.json`.\n\n> Not every model emits clean JSON for the structured review commands. If `/pi:review` fails with a parse error on a given model, it is still fine for `/pi:rescue` (free-form) — or add it to a `PI_PLUGIN_FALLBACK_MODELS` chain so a flaky member is retried with the next one. (Observed: some MiniMax and local models echo the prompt back instead of returning JSON.)\n\n## Configure pi\n\nThe minimum is a single env var with your API key. For richer setups, write `~/.pi/agent/models.json`:\n\n```json\n{\n \"providers\": {\n \"deepseek\": { \"apiKey\": \"sk-...\" },\n \"openai\": { \"apiKey\": \"sk-...\" },\n \"anthropic\":{ \"apiKey\": \"sk-ant-...\" },\n \"google\": { \"apiKey\": \"...\" },\n \"openrouter\": {\n \"api\": \"openai-completions\",\n \"apiKey\": \"sk-or-v1-...\",\n \"baseUrl\": \"https://openrouter.ai/api/v1\",\n \"models\": [\n {\n \"id\": \"deepseek/deepseek-chat\",\n \"name\": \"DeepSeek via OpenRouter\",\n \"contextWindow\": 128000,\n \"maxTokens\": 8192,\n \"input\": [\"text\"]\n }\n ]\n }\n }\n}\n```\n\nBuilt-in providers (`anthropic`, `openai`, `google`, `deepseek`, `ollama`, `lmstudio`) only need `apiKey` (and optional `baseUrl`); pi ships their model lists. For custom OpenAI-compatible endpoints, set `api: \"openai-completions\"` and declare the `models` you want exposed.\n\nFull reference: [pi providers docs](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md).\n\n## Stop-time review gate\n\nOpt in with `/pi:setup --enable-review-gate`. When a Claude session ends, the plugin runs a Pi adversarial review of the previous turn and can block the stop if it finds material issues. If pi is unavailable while the gate is enabled, the hook blocks (it does **not** silently let the session end). Disable with `/pi:setup --disable-review-gate`.\n\n## 🔗 Related projects\n\n| Project | Niche | When to use |\n|---|---|---|\n| [codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | Same surface, runs Codex | You want OpenAI's Codex agent + ChatGPT auth |\n| [pi (earendil-works)](https://github.com/earendil-works/pi) | The coding agent this plugin drives | You want to use Pi directly without Claude Code |\n| [pi-subagents](https://github.com/nicobailon/pi-subagents) | Pi extension adding `subagent` tool + `/run` / `/chain` / `/parallel` | Powers `/pi:parallel-rescue` and lets `/pi:rescue` delegate to specialized child agents |\n\n## ❤️ Support\n\nIf this plugin helps you, consider supporting the author:\n\n<table>\n <tr>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/wechat-pay.png\" width=\"180\" alt=\"WeChat Pay\">\n <br>\n <b>WeChat Pay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/alipay.png\" width=\"180\" alt=\"Alipay\">\n <br>\n <b>Alipay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/buymeacoffee.png\" width=\"180\" alt=\"Buy Me a Coffee\">\n <br>\n <b>Buy Me a Coffee</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/awarding/award.gif\" width=\"180\" alt=\"Give a Reward\">\n <br>\n <b>Give a Reward</b>\n </td>\n </tr>\n</table>\n\n## 👤 Author\n\n**Agents365-ai**\n\n- GitHub: https://github.com/Agents365-ai\n- Bilibili: https://space.bilibili.com/441831884\n\n## 📄 License\n\n[Apache License 2.0](LICENSE). Forked from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) (Apache-2.0, OpenAI) — see [NOTICE](NOTICE).\n"}, "9c41526998eefddf79f3a5dab6a576cc4a01c828": {"t": 1785766145.655902, "n": 15532, "h": "9f68b670e03cecbb", "c": "# pi-plugin-cc — drive the Pi coding agent from Claude Code and Codex 🥧\n\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/network/members)\n[![Latest Release](https://img.shields.io/github/v/release/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/releases/latest)\n[![Last Commit](https://img.shields.io/github/last-commit/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/commits/main)\n\n[![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-plugin-8a2be2)](https://docs.claude.com/en/docs/claude-code/plugins)\n[![Pi Coding Agent](https://img.shields.io/badge/Pi-coding%20agent-0a7d4a)](https://github.com/earendil-works/pi)\n[![Model agnostic](https://img.shields.io/badge/Model-agnostic-555)](#pick-your-model)\n\n**English** · [中文](README_CN.md)\n\nExternal references: [Pi coding agent](https://github.com/earendil-works/pi) · [Pi RPC mode](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md) · [Pi providers](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md)\n\nA Claude Code plugin that delegates reviews and coding tasks to the [Pi coding agent](https://github.com/earendil-works/pi). Adapted from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc), runtime swapped from Codex to Pi. Also usable from OpenAI's Codex CLI — see [Use from Codex](#-use-from-codex).\n\n**The hard dependency is pi, not any particular LLM.** Pi can be configured for DeepSeek, OpenAI, Anthropic, Google, Ollama, LM Studio, or any OpenAI-compatible endpoint via `~/.pi/agent/models.json`. The plugin defers all model selection to pi unless you override per command.\n\n- **Code review** against the working tree or a branch base, with structured findings\n- **Adversarial review** that challenges the design — not just spell-checks the diff\n- **Task delegation** for diagnoses, refactors, and longer rescues, foreground or background\n- **Parallel fan-out** — `/pi:parallel-rescue` runs multiple independent tasks concurrently via [`pi-subagents`](https://github.com/nicobailon/pi-subagents)\n- **Sharded parallel review** — `/pi:review --shards <N>` splits a large diff's changed files across N review jobs that run in parallel, then merges the findings\n- **Background job control** — `status`, `result`, `cancel`, and stop-time review gate\n- **No OAuth** — pi authenticates by API key (provider-specific), no `codex login` required\n\nIntegrates with [`pi-subagents`](https://github.com/nicobailon/pi-subagents) (`pi install npm:pi-subagents`): `/pi:setup` detects it and lists the agent profiles, `/pi:rescue` prompts advertise the `subagent` tool to Pi, and `/pi:parallel-rescue` fans multiple tasks out to parallel child agents (scout, researcher, planner, worker, reviewer, …).\n\n## 🔄 How it works\n\n<img src=\"docs/pi-plugin-cc-workflow.png\" alt=\"pi-plugin-cc workflow\" width=\"80%\">\n\nCodex's broker layer is gone — Pi is one-conversation-per-process, so the plugin spawns a fresh `pi --mode rpc` for each task. Background jobs are tracked in workspace-scoped state files. Review prompts inline the JSON schema since Pi has no `outputSchema` knob.\n\n## Slash commands\n\n| Command | What it does |\n|---|---|\n| `/pi:setup` | Verifies `pi` is installed + a provider is configured; toggles the stop-time review gate |\n| `/pi:review` | Standard code review of local git state |\n| `/pi:adversarial-review` | Steerable challenge review — questions the approach itself |\n| `/pi:rescue` | Delegate investigation or implementation to a Pi run via the `pi:pi-companion-forwarder` subagent |\n| `/pi:parallel-rescue` | Run multiple independent tasks in parallel via pi-subagents (`subagent({ tasks })` fan-out) |\n| `/pi:status [job-id]` | List active / recent Pi jobs in this repository |\n| `/pi:result <job-id>` | Show the stored final output for a finished job |\n| `/pi:cancel <job-id>` | Terminate a running background job |\n\nEvery command accepts `--model <id>` to pin a specific model just for that run. With no `--model` and no env override (see [Pick your model](#pick-your-model)), pi falls back to whatever it has configured by default.\n\n## Quick Start\n\n```bash\n# 1. Install pi (required)\nnpm install -g --ignore-scripts @earendil-works/pi-coding-agent\n\n# 2. Configure a provider — pick one\nexport OPENAI_API_KEY=sk-... # OpenAI\nexport ANTHROPIC_API_KEY=sk-ant-... # Anthropic\nexport GOOGLE_API_KEY=... # Google\nexport DEEPSEEK_API_KEY=sk-... # DeepSeek\n# or run a local model: see https://github.com/earendil-works/pi (Ollama / LM Studio)\n\n# 3. Verify pi sees a model\npi --list-models | head\n```\n\nInstall the plugin in Claude Code:\n\n```text\n> /plugin marketplace add Agents365-ai/pi-plugin-cc\n> /plugin install pi@agents365-pi\n> /reload-plugins\n> /pi:setup\n```\n\n`/pi:setup` returns a readiness report. If `pi` is missing and `npm` is on PATH, it offers to install it for you.\n\n## Usage\n\n```text\n> /pi:review\n> /pi:review --base main\n> /pi:review --model claude-sonnet-4\n> /pi:adversarial-review focus on the new auth middleware\n> /pi:rescue investigate why the Windows CI build is failing\n> /pi:rescue --background --model gpt-4o refactor src/payments/\n> /pi:parallel-rescue \"audit the auth module\" \"benchmark the db queries\" \"update the API docs\"\n> /pi:status\n> /pi:status task-mpgyiwb9-e3k641 --wait\n> /pi:result task-mpgyiwb9-e3k641\n> /pi:cancel task-mpgyiwb9-e3k641\n```\n\n`--effort <off|minimal|low|medium|high|xhigh>` is passed through to Pi via `set_thinking_level`. Models that do not support thinking silently ignore it (the plugin logs a one-line note to stderr when this happens).\n\n## 🧩 Use from Codex\n\nThe core of this plugin is a harness-agnostic CLI (`pi-companion.mjs`) — any coding agent that can run shell commands can drive it. For OpenAI's Codex CLI, install the bundled [custom prompts](codex-prompts/):\n\n```bash\n# 1. Clone the repo (anywhere; ~/pi-plugin-cc is the default the prompts assume)\ngit clone https://github.com/Agents365-ai/pi-plugin-cc ~/pi-plugin-cc\n\n# 2. Install the Codex custom prompts\nmkdir -p ~/.codex/prompts\ncp ~/pi-plugin-cc/codex-prompts/*.md ~/.codex/prompts/\n\n# 3. If you cloned somewhere else, point the prompts at it\necho 'export PI_PLUGIN_ROOT=\"$HOME/path/to/pi-plugin-cc\"' >> ~/.zshrc\n```\n\nThen inside Codex: `/pi-review`, `/pi-adversarial-review`, `/pi-rescue`, `/pi-parallel-rescue`, `/pi-status`, `/pi-result`, `/pi-cancel`, `/pi-setup` (note `-` instead of `:` — Codex prompt names cannot contain colons).\n\nNot available under Codex: the stop-time review gate and session-resume prompts (both rely on Claude Code hooks / subagents). Everything else — including pi-subagents parallel fan-out — works the same.\n\n## 🧑‍⚖️ Multi-model review panel\n\nOne reviewer has blind spots; a panel doesn't share them. Passing `--models` to either review command runs the same diff through several models **in parallel** and merges their findings — issues reported by 2+ models rank first with a `found by:` tag:\n\n```text\n> /pi:review --models deepseek-v4-flash,claude-sonnet-4-6,gpt-5-mini\n> /pi:adversarial-review --models deepseek-v4-pro,o1 focus on concurrency\n```\n\n- Consensus findings (2+ models) are listed first; single-model findings follow.\n- Duplicate findings are matched per file with line-range slack; severity escalates to the highest reported and alternate titles are kept.\n- A member that fails (provider error, invalid JSON) is reported inline and does not sink the panel — it succeeds as long as one model returns a valid review.\n- Panel members do not use the `PI_PLUGIN_FALLBACK_MODELS` chain — the panel itself is the redundancy.\n- This only exists because Pi is provider-agnostic: a single-vendor CLI cannot convene a cross-vendor panel.\n\n## 🛟 Automatic model fallback\n\nSet a fallback chain once, and any failed run — provider outage, auth error, exhausted retries — is automatically retried with the next model:\n\n```bash\nexport PI_PLUGIN_FALLBACK_MODELS=deepseek-v4-flash,MiniMax-M3\n```\n\nApplies to reviews and rescue tasks alike. When a fallback produced the result, the output ends with a `Model fallback:` note (and the JSON payload carries `modelAttempts`). `/pi:setup` shows the configured chain.\n\n## 🏁 Model racing\n\nFor hard problems, run the same rescue task with several models **in parallel** and pick the winner:\n\n```text\n> /pi:rescue --race deepseek-v4-pro,claude-sonnet-4-6 fix the flaky retry logic in src/queue.mjs\n> /pi:rescue --race deepseek-v4-flash,gemini-2.5-pro why does the Windows CI build fail?\n```\n\n- **Write races** (`--write`, the `/pi:rescue` default): each racer works in an isolated git worktree created from `HEAD` — racers can never touch your working tree or each other. Each racer's result is captured as a patch; review them and apply exactly one with `git apply <patch>`.\n- **Read-only races** (investigations): racers analyze the same tree; the output presents each answer side by side — agreement across models is a strong signal.\n- A racer that fails or produces no changes is reported as such; the race succeeds while at least one racer finishes.\n- Not combinable with `--model` or `--resume` (each racer starts a fresh session). Racers start from `HEAD`, so commit or stash first if the task concerns uncommitted work.\n\n## Pick your model\n\nThe plugin keeps three layers of model resolution:\n\n| Priority | Source | Example |\n|---|---|---|\n| 1 | `--model <id>` on the slash command | `/pi:review --model gpt-4o` |\n| 2 | Env var (review / adversarial-review only) | `export PI_PLUGIN_REVIEW_MODEL=deepseek-v4-flash`<br>`export PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=deepseek-v4-pro` |\n| 3 | Pi's own configured default | whatever your `~/.pi/agent/models.json` has, or `/model` last picked in pi TUI |\n\nLayer 1 wins over layer 2 wins over layer 3. **None of the layers are required** — leave them all unset and pi picks for you.\n\n### Suggested settings by provider\n\nThese are opinions, not requirements. Pick what fits your latency / cost / quality budget.\n\n| Provider | Everyday review (`/pi:review`) | Adversarial review (`/pi:adversarial-review`) |\n|---|---|---|\n| DeepSeek | `deepseek-v4-flash` | `deepseek-v4-pro` |\n| OpenAI | `gpt-4o-mini` or `gpt-5-mini` | `o1` or `gpt-5` |\n| Anthropic | `claude-haiku-4-5` | `claude-sonnet-4-6` or `claude-opus-4-7` |\n| Google | `gemini-2.5-flash` | `gemini-2.5-pro` |\n| Local (Ollama) | `qwen2.5-coder:7b` | `qwen2.5-coder:32b` or `deepseek-r1` |\n\nTo make these defaults sticky:\n\n```bash\nexport PI_PLUGIN_REVIEW_MODEL=claude-haiku-4-5\nexport PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=claude-sonnet-4-6\n```\n\n### Value tier — cheaper than Claude/GPT, still competitive\n\nThe whole point of driving Pi is that you are not locked to Claude or GPT. These models cost a fraction of the frontier Claude/GPT tiers and, while not quite as strong, are more than good enough for everyday review and rescue work. Configure them in `~/.pi/agent/models.json` (most are OpenAI-compatible endpoints) and use the exact id your provider exposes — verify with `pi --list-models`.\n\n| Provider | Suggested model(s) |\n|---|---|\n| DeepSeek | `deepseek-v4-flash` (everyday) · `deepseek-v4-pro` (adversarial) |\n| xAI | `grok-4.5` |\n| Zhipu (GLM) | `glm5.1` · `glm5.2` (heavier) |\n| Moonshot (Kimi) | `kimi 2.6` |\n| MiniMax | `minimax-m3` |\n| ByteDance (Seed) | `seed-2.1-pro-preview` |\n| Xiaomi (MiMo) | `mimo-v2.5 pro` |\n| Muse | `muse-spark-1.1` |\n\n…and any other OpenAI-compatible endpoint you configure. Availability and the exact id depend on your `~/.pi/agent/models.json`.\n\n> Not every model emits clean JSON for the structured review commands. If `/pi:review` fails with a parse error on a given model, it is still fine for `/pi:rescue` (free-form) — or add it to a `PI_PLUGIN_FALLBACK_MODELS` chain so a flaky member is retried with the next one. (Observed: some MiniMax and local models echo the prompt back instead of returning JSON.)\n\n## Configure pi\n\nThe minimum is a single env var with your API key. For richer setups, write `~/.pi/agent/models.json`:\n\n```json\n{\n \"providers\": {\n \"deepseek\": { \"apiKey\": \"sk-...\" },\n \"openai\": { \"apiKey\": \"sk-...\" },\n \"anthropic\":{ \"apiKey\": \"sk-ant-...\" },\n \"google\": { \"apiKey\": \"...\" },\n \"openrouter\": {\n \"api\": \"openai-completions\",\n \"apiKey\": \"sk-or-v1-...\",\n \"baseUrl\": \"https://openrouter.ai/api/v1\",\n \"models\": [\n {\n \"id\": \"deepseek/deepseek-chat\",\n \"name\": \"DeepSeek via OpenRouter\",\n \"contextWindow\": 128000,\n \"maxTokens\": 8192,\n \"input\": [\"text\"]\n }\n ]\n }\n }\n}\n```\n\nBuilt-in providers (`anthropic`, `openai`, `google`, `deepseek`, `ollama`, `lmstudio`) only need `apiKey` (and optional `baseUrl`); pi ships their model lists. For custom OpenAI-compatible endpoints, set `api: \"openai-completions\"` and declare the `models` you want exposed.\n\nFull reference: [pi providers docs](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md).\n\n## Stop-time review gate\n\nOpt in with `/pi:setup --enable-review-gate`. When a Claude session ends, the plugin runs a Pi adversarial review of the previous turn and can block the stop if it finds material issues. If pi is unavailable while the gate is enabled, the hook blocks (it does **not** silently let the session end). Disable with `/pi:setup --disable-review-gate`.\n\n## 🔗 Related projects\n\n| Project | Niche | When to use |\n|---|---|---|\n| [codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | Same surface, runs Codex | You want OpenAI's Codex agent + ChatGPT auth |\n| [pi (earendil-works)](https://github.com/earendil-works/pi) | The coding agent this plugin drives | You want to use Pi directly without Claude Code |\n| [pi-subagents](https://github.com/nicobailon/pi-subagents) | Pi extension adding `subagent` tool + `/run` / `/chain` / `/parallel` | Powers `/pi:parallel-rescue` and lets `/pi:rescue` delegate to specialized child agents |\n\n## ❤️ Support\n\nIf this plugin helps you, consider supporting the author:\n\n<table>\n <tr>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/wechat-pay.png\" width=\"180\" alt=\"WeChat Pay\">\n <br>\n <b>WeChat Pay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/alipay.png\" width=\"180\" alt=\"Alipay\">\n <br>\n <b>Alipay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/buymeacoffee.png\" width=\"180\" alt=\"Buy Me a Coffee\">\n <br>\n <b>Buy Me a Coffee</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/awarding/award.gif\" width=\"180\" alt=\"Give a Reward\">\n <br>\n <b>Give a Reward</b>\n </td>\n </tr>\n</table>\n\n## 👤 Author\n\n**Agents365-ai**\n\n- GitHub: https://github.com/Agents365-ai\n- Bilibili: https://space.bilibili.com/441831884\n\n## 📄 License\n\n[Apache License 2.0](LICENSE). Forked from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) (Apache-2.0, OpenAI) — see [NOTICE](NOTICE).\n"}, "4161825f6a997e8c1f1c8b5a84418f36627fdd2a": {"t": 1785766147.0463903, "n": 14218, "h": "4a69d521d8bdf733", "c": "# pi-plugin-cc — drive the Pi coding agent from Claude Code and Codex 🥧\n\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/network/members)\n[![Latest Release](https://img.shields.io/github/v/release/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/releases/latest)\n[![Last Commit](https://img.shields.io/github/last-commit/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/commits/main)\n\n[![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-plugin-8a2be2)](https://docs.claude.com/en/docs/claude-code/plugins)\n[![Pi Coding Agent](https://img.shields.io/badge/Pi-coding%20agent-0a7d4a)](https://github.com/earendil-works/pi)\n[![Model agnostic](https://img.shields.io/badge/Model-agnostic-555)](#pick-your-model)\n\n**English** · [中文](README_CN.md)\n\nExternal references: [Pi coding agent](https://github.com/earendil-works/pi) · [Pi RPC mode](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md) · [Pi providers](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md)\n\nA Claude Code plugin that delegates reviews and coding tasks to the [Pi coding agent](https://github.com/earendil-works/pi). Adapted from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc), runtime swapped from Codex to Pi. Also usable from OpenAI's Codex CLI — see [Use from Codex](#-use-from-codex).\n\n**The hard dependency is pi, not any particular LLM.** Pi can be configured for DeepSeek, OpenAI, Anthropic, Google, Ollama, LM Studio, or any OpenAI-compatible endpoint via `~/.pi/agent/models.json`. The plugin defers all model selection to pi unless you override per command.\n\n- **Code review** against the working tree or a branch base, with structured findings\n- **Adversarial review** that challenges the design — not just spell-checks the diff\n- **Task delegation** for diagnoses, refactors, and longer rescues, foreground or background\n- **Parallel fan-out** — `/pi:parallel-rescue` runs multiple independent tasks concurrently via [`pi-subagents`](https://github.com/nicobailon/pi-subagents)\n- **Sharded parallel review** — `/pi:review --shards <N>` splits a large diff's changed files across N review jobs that run in parallel, then merges the findings\n- **Background job control** — `status`, `result`, `cancel`, and stop-time review gate\n- **No OAuth** — pi authenticates by API key (provider-specific), no `codex login` required\n\nIntegrates with [`pi-subagents`](https://github.com/nicobailon/pi-subagents) (`pi install npm:pi-subagents`): `/pi:setup` detects it and lists the agent profiles, `/pi:rescue` prompts advertise the `subagent` tool to Pi, and `/pi:parallel-rescue` fans multiple tasks out to parallel child agents (scout, researcher, planner, worker, reviewer, …).\n\n## 🔄 How it works\n\n<img src=\"docs/pi-plugin-cc-workflow.png\" alt=\"pi-plugin-cc workflow\" width=\"80%\">\n\nCodex's broker layer is gone — Pi is one-conversation-per-process, so the plugin spawns a fresh `pi --mode rpc` for each task. Background jobs are tracked in workspace-scoped state files. Review prompts inline the JSON schema since Pi has no `outputSchema` knob.\n\n## Slash commands\n\n| Command | What it does |\n|---|---|\n| `/pi:setup` | Verifies `pi` is installed + a provider is configured; toggles the stop-time review gate |\n| `/pi:review` | Standard code review of local git state |\n| `/pi:adversarial-review` | Steerable challenge review — questions the approach itself |\n| `/pi:rescue` | Delegate investigation or implementation to a Pi run via the `pi:pi-companion-forwarder` subagent |\n| `/pi:parallel-rescue` | Run multiple independent tasks in parallel via pi-subagents (`subagent({ tasks })` fan-out) |\n| `/pi:status [job-id]` | List active / recent Pi jobs in this repository |\n| `/pi:result <job-id>` | Show the stored final output for a finished job |\n| `/pi:cancel <job-id>` | Terminate a running background job |\n\nEvery command accepts `--model <id>` to pin a specific model just for that run. With no `--model` and no env override (see [Pick your model](#pick-your-model)), pi falls back to whatever it has configured by default.\n\n## Quick Start\n\n```bash\n# 1. Install pi (required)\nnpm install -g --ignore-scripts @earendil-works/pi-coding-agent\n\n# 2. Configure a provider — pick one\nexport OPENAI_API_KEY=sk-... # OpenAI\nexport ANTHROPIC_API_KEY=sk-ant-... # Anthropic\nexport GOOGLE_API_KEY=... # Google\nexport DEEPSEEK_API_KEY=sk-... # DeepSeek\n# or run a local model: see https://github.com/earendil-works/pi (Ollama / LM Studio)\n\n# 3. Verify pi sees a model\npi --list-models | head\n```\n\nInstall the plugin in Claude Code:\n\n```text\n> /plugin marketplace add Agents365-ai/pi-plugin-cc\n> /plugin install pi@agents365-pi\n> /reload-plugins\n> /pi:setup\n```\n\n`/pi:setup` returns a readiness report. If `pi` is missing and `npm` is on PATH, it offers to install it for you.\n\n## Usage\n\n```text\n> /pi:review\n> /pi:review --base main\n> /pi:review --model claude-sonnet-4\n> /pi:adversarial-review focus on the new auth middleware\n> /pi:rescue investigate why the Windows CI build is failing\n> /pi:rescue --background --model gpt-4o refactor src/payments/\n> /pi:parallel-rescue \"audit the auth module\" \"benchmark the db queries\" \"update the API docs\"\n> /pi:status\n> /pi:status task-mpgyiwb9-e3k641 --wait\n> /pi:result task-mpgyiwb9-e3k641\n> /pi:cancel task-mpgyiwb9-e3k641\n```\n\n`--effort <off|minimal|low|medium|high|xhigh>` is passed through to Pi via `set_thinking_level`. Models that do not support thinking silently ignore it (the plugin logs a one-line note to stderr when this happens).\n\n## 🧩 Use from Codex\n\nThe core of this plugin is a harness-agnostic CLI (`pi-companion.mjs`) — any coding agent that can run shell commands can drive it. For OpenAI's Codex CLI, install the bundled [custom prompts](codex-prompts/):\n\n```bash\n# 1. Clone the repo (anywhere; ~/pi-plugin-cc is the default the prompts assume)\ngit clone https://github.com/Agents365-ai/pi-plugin-cc ~/pi-plugin-cc\n\n# 2. Install the Codex custom prompts\nmkdir -p ~/.codex/prompts\ncp ~/pi-plugin-cc/codex-prompts/*.md ~/.codex/prompts/\n\n# 3. If you cloned somewhere else, point the prompts at it\necho 'export PI_PLUGIN_ROOT=\"$HOME/path/to/pi-plugin-cc\"' >> ~/.zshrc\n```\n\nThen inside Codex: `/pi-review`, `/pi-adversarial-review`, `/pi-rescue`, `/pi-parallel-rescue`, `/pi-status`, `/pi-result`, `/pi-cancel`, `/pi-setup` (note `-` instead of `:` — Codex prompt names cannot contain colons).\n\nNot available under Codex: the stop-time review gate and session-resume prompts (both rely on Claude Code hooks / subagents). Everything else — including pi-subagents parallel fan-out — works the same.\n\n## 🧑‍⚖️ Multi-model review panel\n\nOne reviewer has blind spots; a panel doesn't share them. Passing `--models` to either review command runs the same diff through several models **in parallel** and merges their findings — issues reported by 2+ models rank first with a `found by:` tag:\n\n```text\n> /pi:review --models deepseek-v4-flash,claude-sonnet-4-6,gpt-5-mini\n> /pi:adversarial-review --models deepseek-v4-pro,o1 focus on concurrency\n```\n\n- Consensus findings (2+ models) are listed first; single-model findings follow.\n- Duplicate findings are matched per file with line-range slack; severity escalates to the highest reported and alternate titles are kept.\n- A member that fails (provider error, invalid JSON) is reported inline and does not sink the panel — it succeeds as long as one model returns a valid review.\n- Panel members do not use the `PI_PLUGIN_FALLBACK_MODELS` chain — the panel itself is the redundancy.\n- This only exists because Pi is provider-agnostic: a single-vendor CLI cannot convene a cross-vendor panel.\n\n## 🛟 Automatic model fallback\n\nSet a fallback chain once, and any failed run — provider outage, auth error, exhausted retries — is automatically retried with the next model:\n\n```bash\nexport PI_PLUGIN_FALLBACK_MODELS=deepseek-v4-flash,MiniMax-M3\n```\n\nApplies to reviews and rescue tasks alike. When a fallback produced the result, the output ends with a `Model fallback:` note (and the JSON payload carries `modelAttempts`). `/pi:setup` shows the configured chain.\n\n## 🏁 Model racing\n\nFor hard problems, run the same rescue task with several models **in parallel** and pick the winner:\n\n```text\n> /pi:rescue --race deepseek-v4-pro,claude-sonnet-4-6 fix the flaky retry logic in src/queue.mjs\n> /pi:rescue --race deepseek-v4-flash,gemini-2.5-pro why does the Windows CI build fail?\n```\n\n- **Write races** (`--write`, the `/pi:rescue` default): each racer works in an isolated git worktree created from `HEAD` — racers can never touch your working tree or each other. Each racer's result is captured as a patch; review them and apply exactly one with `git apply <patch>`.\n- **Read-only races** (investigations): racers analyze the same tree; the output presents each answer side by side — agreement across models is a strong signal.\n- A racer that fails or produces no changes is reported as such; the race succeeds while at least one racer finishes.\n- Not combinable with `--model` or `--resume` (each racer starts a fresh session). Racers start from `HEAD`, so commit or stash first if the task concerns uncommitted work.\n\n## Pick your model\n\nThe plugin keeps three layers of model resolution:\n\n| Priority | Source | Example |\n|---|---|---|\n| 1 | `--model <id>` on the slash command | `/pi:review --model gpt-4o` |\n| 2 | Env var (review / adversarial-review only) | `export PI_PLUGIN_REVIEW_MODEL=deepseek-v4-flash`<br>`export PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=deepseek-v4-pro` |\n| 3 | Pi's own configured default | whatever your `~/.pi/agent/models.json` has, or `/model` last picked in pi TUI |\n\nLayer 1 wins over layer 2 wins over layer 3. **None of the layers are required** — leave them all unset and pi picks for you.\n\n### Suggested settings by provider\n\nThese are opinions, not requirements. Pick what fits your latency / cost / quality budget.\n\n| Provider | Everyday review (`/pi:review`) | Adversarial review (`/pi:adversarial-review`) |\n|---|---|---|\n| DeepSeek | `deepseek-v4-flash` | `deepseek-v4-pro` |\n| OpenAI | `gpt-4o-mini` or `gpt-5-mini` | `o1` or `gpt-5` |\n| Anthropic | `claude-haiku-4-5` | `claude-sonnet-4-6` or `claude-opus-4-7` |\n| Google | `gemini-2.5-flash` | `gemini-2.5-pro` |\n| Local (Ollama) | `qwen2.5-coder:7b` | `qwen2.5-coder:32b` or `deepseek-r1` |\n\nTo make these defaults sticky:\n\n```bash\nexport PI_PLUGIN_REVIEW_MODEL=claude-haiku-4-5\nexport PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=claude-sonnet-4-6\n```\n\n## Configure pi\n\nThe minimum is a single env var with your API key. For richer setups, write `~/.pi/agent/models.json`:\n\n```json\n{\n \"providers\": {\n \"deepseek\": { \"apiKey\": \"sk-...\" },\n \"openai\": { \"apiKey\": \"sk-...\" },\n \"anthropic\":{ \"apiKey\": \"sk-ant-...\" },\n \"google\": { \"apiKey\": \"...\" },\n \"openrouter\": {\n \"api\": \"openai-completions\",\n \"apiKey\": \"sk-or-v1-...\",\n \"baseUrl\": \"https://openrouter.ai/api/v1\",\n \"models\": [\n {\n \"id\": \"deepseek/deepseek-chat\",\n \"name\": \"DeepSeek via OpenRouter\",\n \"contextWindow\": 128000,\n \"maxTokens\": 8192,\n \"input\": [\"text\"]\n }\n ]\n }\n }\n}\n```\n\nBuilt-in providers (`anthropic`, `openai`, `google`, `deepseek`, `ollama`, `lmstudio`) only need `apiKey` (and optional `baseUrl`); pi ships their model lists. For custom OpenAI-compatible endpoints, set `api: \"openai-completions\"` and declare the `models` you want exposed.\n\nFull reference: [pi providers docs](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md).\n\n## Stop-time review gate\n\nOpt in with `/pi:setup --enable-review-gate`. When a Claude session ends, the plugin runs a Pi adversarial review of the previous turn and can block the stop if it finds material issues. If pi is unavailable while the gate is enabled, the hook blocks (it does **not** silently let the session end). Disable with `/pi:setup --disable-review-gate`.\n\n## 🔗 Related projects\n\n| Project | Niche | When to use |\n|---|---|---|\n| [codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | Same surface, runs Codex | You want OpenAI's Codex agent + ChatGPT auth |\n| [pi (earendil-works)](https://github.com/earendil-works/pi) | The coding agent this plugin drives | You want to use Pi directly without Claude Code |\n| [pi-subagents](https://github.com/nicobailon/pi-subagents) | Pi extension adding `subagent` tool + `/run` / `/chain` / `/parallel` | Powers `/pi:parallel-rescue` and lets `/pi:rescue` delegate to specialized child agents |\n\n## ❤️ Support\n\nIf this plugin helps you, consider supporting the author:\n\n<table>\n <tr>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/wechat-pay.png\" width=\"180\" alt=\"WeChat Pay\">\n <br>\n <b>WeChat Pay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/alipay.png\" width=\"180\" alt=\"Alipay\">\n <br>\n <b>Alipay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/buymeacoffee.png\" width=\"180\" alt=\"Buy Me a Coffee\">\n <br>\n <b>Buy Me a Coffee</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/awarding/award.gif\" width=\"180\" alt=\"Give a Reward\">\n <br>\n <b>Give a Reward</b>\n </td>\n </tr>\n</table>\n\n## 👤 Author\n\n**Agents365-ai**\n\n- GitHub: https://github.com/Agents365-ai\n- Bilibili: https://space.bilibili.com/441831884\n\n## 📄 License\n\n[Apache License 2.0](LICENSE). Forked from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) (Apache-2.0, OpenAI) — see [NOTICE](NOTICE).\n"}, "c4048b250d41256e8b957492c032f0b3574ea384": {"t": 1785766148.622456, "n": 14056, "h": "bd9425325f2dd2cc", "c": "# pi-plugin-cc — drive the Pi coding agent from Claude Code and Codex 🥧\n\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/network/members)\n[![Latest Release](https://img.shields.io/github/v/release/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/releases/latest)\n[![Last Commit](https://img.shields.io/github/last-commit/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/commits/main)\n\n[![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-plugin-8a2be2)](https://docs.claude.com/en/docs/claude-code/plugins)\n[![Pi Coding Agent](https://img.shields.io/badge/Pi-coding%20agent-0a7d4a)](https://github.com/earendil-works/pi)\n[![Model agnostic](https://img.shields.io/badge/Model-agnostic-555)](#pick-your-model)\n\n**English** · [中文](README_CN.md)\n\nExternal references: [Pi coding agent](https://github.com/earendil-works/pi) · [Pi RPC mode](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md) · [Pi providers](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md)\n\nA Claude Code plugin that delegates reviews and coding tasks to the [Pi coding agent](https://github.com/earendil-works/pi). Adapted from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc), runtime swapped from Codex to Pi. Also usable from OpenAI's Codex CLI — see [Use from Codex](#-use-from-codex).\n\n**The hard dependency is pi, not any particular LLM.** Pi can be configured for DeepSeek, OpenAI, Anthropic, Google, Ollama, LM Studio, or any OpenAI-compatible endpoint via `~/.pi/agent/models.json`. The plugin defers all model selection to pi unless you override per command.\n\n- **Code review** against the working tree or a branch base, with structured findings\n- **Adversarial review** that challenges the design — not just spell-checks the diff\n- **Task delegation** for diagnoses, refactors, and longer rescues, foreground or background\n- **Parallel fan-out** — `/pi:parallel-rescue` runs multiple independent tasks concurrently via [`pi-subagents`](https://github.com/nicobailon/pi-subagents)\n- **Background job control** — `status`, `result`, `cancel`, and stop-time review gate\n- **No OAuth** — pi authenticates by API key (provider-specific), no `codex login` required\n\nIntegrates with [`pi-subagents`](https://github.com/nicobailon/pi-subagents) (`pi install npm:pi-subagents`): `/pi:setup` detects it and lists the agent profiles, `/pi:rescue` prompts advertise the `subagent` tool to Pi, and `/pi:parallel-rescue` fans multiple tasks out to parallel child agents (scout, researcher, planner, worker, reviewer, …).\n\n## 🔄 How it works\n\n<img src=\"docs/pi-plugin-cc-workflow.png\" alt=\"pi-plugin-cc workflow\" width=\"80%\">\n\nCodex's broker layer is gone — Pi is one-conversation-per-process, so the plugin spawns a fresh `pi --mode rpc` for each task. Background jobs are tracked in workspace-scoped state files. Review prompts inline the JSON schema since Pi has no `outputSchema` knob.\n\n## Slash commands\n\n| Command | What it does |\n|---|---|\n| `/pi:setup` | Verifies `pi` is installed + a provider is configured; toggles the stop-time review gate |\n| `/pi:review` | Standard code review of local git state |\n| `/pi:adversarial-review` | Steerable challenge review — questions the approach itself |\n| `/pi:rescue` | Delegate investigation or implementation to a Pi run via the `pi:pi-companion-forwarder` subagent |\n| `/pi:parallel-rescue` | Run multiple independent tasks in parallel via pi-subagents (`subagent({ tasks })` fan-out) |\n| `/pi:status [job-id]` | List active / recent Pi jobs in this repository |\n| `/pi:result <job-id>` | Show the stored final output for a finished job |\n| `/pi:cancel <job-id>` | Terminate a running background job |\n\nEvery command accepts `--model <id>` to pin a specific model just for that run. With no `--model` and no env override (see [Pick your model](#pick-your-model)), pi falls back to whatever it has configured by default.\n\n## Quick Start\n\n```bash\n# 1. Install pi (required)\nnpm install -g --ignore-scripts @earendil-works/pi-coding-agent\n\n# 2. Configure a provider — pick one\nexport OPENAI_API_KEY=sk-... # OpenAI\nexport ANTHROPIC_API_KEY=sk-ant-... # Anthropic\nexport GOOGLE_API_KEY=... # Google\nexport DEEPSEEK_API_KEY=sk-... # DeepSeek\n# or run a local model: see https://github.com/earendil-works/pi (Ollama / LM Studio)\n\n# 3. Verify pi sees a model\npi --list-models | head\n```\n\nInstall the plugin in Claude Code:\n\n```text\n> /plugin marketplace add Agents365-ai/pi-plugin-cc\n> /plugin install pi@agents365-pi\n> /reload-plugins\n> /pi:setup\n```\n\n`/pi:setup` returns a readiness report. If `pi` is missing and `npm` is on PATH, it offers to install it for you.\n\n## Usage\n\n```text\n> /pi:review\n> /pi:review --base main\n> /pi:review --model claude-sonnet-4\n> /pi:adversarial-review focus on the new auth middleware\n> /pi:rescue investigate why the Windows CI build is failing\n> /pi:rescue --background --model gpt-4o refactor src/payments/\n> /pi:parallel-rescue \"audit the auth module\" \"benchmark the db queries\" \"update the API docs\"\n> /pi:status\n> /pi:status task-mpgyiwb9-e3k641 --wait\n> /pi:result task-mpgyiwb9-e3k641\n> /pi:cancel task-mpgyiwb9-e3k641\n```\n\n`--effort <off|minimal|low|medium|high|xhigh>` is passed through to Pi via `set_thinking_level`. Models that do not support thinking silently ignore it (the plugin logs a one-line note to stderr when this happens).\n\n## 🧩 Use from Codex\n\nThe core of this plugin is a harness-agnostic CLI (`pi-companion.mjs`) — any coding agent that can run shell commands can drive it. For OpenAI's Codex CLI, install the bundled [custom prompts](codex-prompts/):\n\n```bash\n# 1. Clone the repo (anywhere; ~/pi-plugin-cc is the default the prompts assume)\ngit clone https://github.com/Agents365-ai/pi-plugin-cc ~/pi-plugin-cc\n\n# 2. Install the Codex custom prompts\nmkdir -p ~/.codex/prompts\ncp ~/pi-plugin-cc/codex-prompts/*.md ~/.codex/prompts/\n\n# 3. If you cloned somewhere else, point the prompts at it\necho 'export PI_PLUGIN_ROOT=\"$HOME/path/to/pi-plugin-cc\"' >> ~/.zshrc\n```\n\nThen inside Codex: `/pi-review`, `/pi-adversarial-review`, `/pi-rescue`, `/pi-parallel-rescue`, `/pi-status`, `/pi-result`, `/pi-cancel`, `/pi-setup` (note `-` instead of `:` — Codex prompt names cannot contain colons).\n\nNot available under Codex: the stop-time review gate and session-resume prompts (both rely on Claude Code hooks / subagents). Everything else — including pi-subagents parallel fan-out — works the same.\n\n## 🧑‍⚖️ Multi-model review panel\n\nOne reviewer has blind spots; a panel doesn't share them. Passing `--models` to either review command runs the same diff through several models **in parallel** and merges their findings — issues reported by 2+ models rank first with a `found by:` tag:\n\n```text\n> /pi:review --models deepseek-v4-flash,claude-sonnet-4-6,gpt-5-mini\n> /pi:adversarial-review --models deepseek-v4-pro,o1 focus on concurrency\n```\n\n- Consensus findings (2+ models) are listed first; single-model findings follow.\n- Duplicate findings are matched per file with line-range slack; severity escalates to the highest reported and alternate titles are kept.\n- A member that fails (provider error, invalid JSON) is reported inline and does not sink the panel — it succeeds as long as one model returns a valid review.\n- Panel members do not use the `PI_PLUGIN_FALLBACK_MODELS` chain — the panel itself is the redundancy.\n- This only exists because Pi is provider-agnostic: a single-vendor CLI cannot convene a cross-vendor panel.\n\n## 🛟 Automatic model fallback\n\nSet a fallback chain once, and any failed run — provider outage, auth error, exhausted retries — is automatically retried with the next model:\n\n```bash\nexport PI_PLUGIN_FALLBACK_MODELS=deepseek-v4-flash,MiniMax-M3\n```\n\nApplies to reviews and rescue tasks alike. When a fallback produced the result, the output ends with a `Model fallback:` note (and the JSON payload carries `modelAttempts`). `/pi:setup` shows the configured chain.\n\n## 🏁 Model racing\n\nFor hard problems, run the same rescue task with several models **in parallel** and pick the winner:\n\n```text\n> /pi:rescue --race deepseek-v4-pro,claude-sonnet-4-6 fix the flaky retry logic in src/queue.mjs\n> /pi:rescue --race deepseek-v4-flash,gemini-2.5-pro why does the Windows CI build fail?\n```\n\n- **Write races** (`--write`, the `/pi:rescue` default): each racer works in an isolated git worktree created from `HEAD` — racers can never touch your working tree or each other. Each racer's result is captured as a patch; review them and apply exactly one with `git apply <patch>`.\n- **Read-only races** (investigations): racers analyze the same tree; the output presents each answer side by side — agreement across models is a strong signal.\n- A racer that fails or produces no changes is reported as such; the race succeeds while at least one racer finishes.\n- Not combinable with `--model` or `--resume` (each racer starts a fresh session). Racers start from `HEAD`, so commit or stash first if the task concerns uncommitted work.\n\n## Pick your model\n\nThe plugin keeps three layers of model resolution:\n\n| Priority | Source | Example |\n|---|---|---|\n| 1 | `--model <id>` on the slash command | `/pi:review --model gpt-4o` |\n| 2 | Env var (review / adversarial-review only) | `export PI_PLUGIN_REVIEW_MODEL=deepseek-v4-flash`<br>`export PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=deepseek-v4-pro` |\n| 3 | Pi's own configured default | whatever your `~/.pi/agent/models.json` has, or `/model` last picked in pi TUI |\n\nLayer 1 wins over layer 2 wins over layer 3. **None of the layers are required** — leave them all unset and pi picks for you.\n\n### Suggested settings by provider\n\nThese are opinions, not requirements. Pick what fits your latency / cost / quality budget.\n\n| Provider | Everyday review (`/pi:review`) | Adversarial review (`/pi:adversarial-review`) |\n|---|---|---|\n| DeepSeek | `deepseek-v4-flash` | `deepseek-v4-pro` |\n| OpenAI | `gpt-4o-mini` or `gpt-5-mini` | `o1` or `gpt-5` |\n| Anthropic | `claude-haiku-4-5` | `claude-sonnet-4-6` or `claude-opus-4-7` |\n| Google | `gemini-2.5-flash` | `gemini-2.5-pro` |\n| Local (Ollama) | `qwen2.5-coder:7b` | `qwen2.5-coder:32b` or `deepseek-r1` |\n\nTo make these defaults sticky:\n\n```bash\nexport PI_PLUGIN_REVIEW_MODEL=claude-haiku-4-5\nexport PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=claude-sonnet-4-6\n```\n\n## Configure pi\n\nThe minimum is a single env var with your API key. For richer setups, write `~/.pi/agent/models.json`:\n\n```json\n{\n \"providers\": {\n \"deepseek\": { \"apiKey\": \"sk-...\" },\n \"openai\": { \"apiKey\": \"sk-...\" },\n \"anthropic\":{ \"apiKey\": \"sk-ant-...\" },\n \"google\": { \"apiKey\": \"...\" },\n \"openrouter\": {\n \"api\": \"openai-completions\",\n \"apiKey\": \"sk-or-v1-...\",\n \"baseUrl\": \"https://openrouter.ai/api/v1\",\n \"models\": [\n {\n \"id\": \"deepseek/deepseek-chat\",\n \"name\": \"DeepSeek via OpenRouter\",\n \"contextWindow\": 128000,\n \"maxTokens\": 8192,\n \"input\": [\"text\"]\n }\n ]\n }\n }\n}\n```\n\nBuilt-in providers (`anthropic`, `openai`, `google`, `deepseek`, `ollama`, `lmstudio`) only need `apiKey` (and optional `baseUrl`); pi ships their model lists. For custom OpenAI-compatible endpoints, set `api: \"openai-completions\"` and declare the `models` you want exposed.\n\nFull reference: [pi providers docs](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md).\n\n## Stop-time review gate\n\nOpt in with `/pi:setup --enable-review-gate`. When a Claude session ends, the plugin runs a Pi adversarial review of the previous turn and can block the stop if it finds material issues. If pi is unavailable while the gate is enabled, the hook blocks (it does **not** silently let the session end). Disable with `/pi:setup --disable-review-gate`.\n\n## 🔗 Related projects\n\n| Project | Niche | When to use |\n|---|---|---|\n| [codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | Same surface, runs Codex | You want OpenAI's Codex agent + ChatGPT auth |\n| [pi (earendil-works)](https://github.com/earendil-works/pi) | The coding agent this plugin drives | You want to use Pi directly without Claude Code |\n| [pi-subagents](https://github.com/nicobailon/pi-subagents) | Pi extension adding `subagent` tool + `/run` / `/chain` / `/parallel` | Powers `/pi:parallel-rescue` and lets `/pi:rescue` delegate to specialized child agents |\n\n## ❤️ Support\n\nIf this plugin helps you, consider supporting the author:\n\n<table>\n <tr>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/wechat-pay.png\" width=\"180\" alt=\"WeChat Pay\">\n <br>\n <b>WeChat Pay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/alipay.png\" width=\"180\" alt=\"Alipay\">\n <br>\n <b>Alipay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/buymeacoffee.png\" width=\"180\" alt=\"Buy Me a Coffee\">\n <br>\n <b>Buy Me a Coffee</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/awarding/award.gif\" width=\"180\" alt=\"Give a Reward\">\n <br>\n <b>Give a Reward</b>\n </td>\n </tr>\n</table>\n\n## 👤 Author\n\n**Agents365-ai**\n\n- GitHub: https://github.com/Agents365-ai\n- Bilibili: https://space.bilibili.com/441831884\n\n## 📄 License\n\n[Apache License 2.0](LICENSE). Forked from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) (Apache-2.0, OpenAI) — see [NOTICE](NOTICE).\n"}, "42dc0140b1fb1a8b11e6d1660bb5e24552fce33e": {"t": 1785766150.023535, "n": 12999, "h": "7d28b35cd0287197", "c": "# pi-plugin-cc — drive the Pi coding agent from Claude Code and Codex 🥧\n\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/network/members)\n[![Latest Release](https://img.shields.io/github/v/release/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/releases/latest)\n[![Last Commit](https://img.shields.io/github/last-commit/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/commits/main)\n\n[![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-plugin-8a2be2)](https://docs.claude.com/en/docs/claude-code/plugins)\n[![Pi Coding Agent](https://img.shields.io/badge/Pi-coding%20agent-0a7d4a)](https://github.com/earendil-works/pi)\n[![Model agnostic](https://img.shields.io/badge/Model-agnostic-555)](#pick-your-model)\n\n**English** · [中文](README_CN.md)\n\nExternal references: [Pi coding agent](https://github.com/earendil-works/pi) · [Pi RPC mode](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md) · [Pi providers](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md)\n\nA Claude Code plugin that delegates reviews and coding tasks to the [Pi coding agent](https://github.com/earendil-works/pi). Adapted from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc), runtime swapped from Codex to Pi. Also usable from OpenAI's Codex CLI — see [Use from Codex](#-use-from-codex).\n\n**The hard dependency is pi, not any particular LLM.** Pi can be configured for DeepSeek, OpenAI, Anthropic, Google, Ollama, LM Studio, or any OpenAI-compatible endpoint via `~/.pi/agent/models.json`. The plugin defers all model selection to pi unless you override per command.\n\n- **Code review** against the working tree or a branch base, with structured findings\n- **Adversarial review** that challenges the design — not just spell-checks the diff\n- **Task delegation** for diagnoses, refactors, and longer rescues, foreground or background\n- **Parallel fan-out** — `/pi:parallel-rescue` runs multiple independent tasks concurrently via [`pi-subagents`](https://github.com/nicobailon/pi-subagents)\n- **Background job control** — `status`, `result`, `cancel`, and stop-time review gate\n- **No OAuth** — pi authenticates by API key (provider-specific), no `codex login` required\n\nIntegrates with [`pi-subagents`](https://github.com/nicobailon/pi-subagents) (`pi install npm:pi-subagents`): `/pi:setup` detects it and lists the agent profiles, `/pi:rescue` prompts advertise the `subagent` tool to Pi, and `/pi:parallel-rescue` fans multiple tasks out to parallel child agents (scout, researcher, planner, worker, reviewer, …).\n\n## 🔄 How it works\n\n<img src=\"docs/pi-plugin-cc-workflow.png\" alt=\"pi-plugin-cc workflow\" width=\"80%\">\n\nCodex's broker layer is gone — Pi is one-conversation-per-process, so the plugin spawns a fresh `pi --mode rpc` for each task. Background jobs are tracked in workspace-scoped state files. Review prompts inline the JSON schema since Pi has no `outputSchema` knob.\n\n## Slash commands\n\n| Command | What it does |\n|---|---|\n| `/pi:setup` | Verifies `pi` is installed + a provider is configured; toggles the stop-time review gate |\n| `/pi:review` | Standard code review of local git state |\n| `/pi:adversarial-review` | Steerable challenge review — questions the approach itself |\n| `/pi:rescue` | Delegate investigation or implementation to a Pi run via the `pi:pi-companion-forwarder` subagent |\n| `/pi:parallel-rescue` | Run multiple independent tasks in parallel via pi-subagents (`subagent({ tasks })` fan-out) |\n| `/pi:status [job-id]` | List active / recent Pi jobs in this repository |\n| `/pi:result <job-id>` | Show the stored final output for a finished job |\n| `/pi:cancel <job-id>` | Terminate a running background job |\n\nEvery command accepts `--model <id>` to pin a specific model just for that run. With no `--model` and no env override (see [Pick your model](#pick-your-model)), pi falls back to whatever it has configured by default.\n\n## Quick Start\n\n```bash\n# 1. Install pi (required)\nnpm install -g --ignore-scripts @earendil-works/pi-coding-agent\n\n# 2. Configure a provider — pick one\nexport OPENAI_API_KEY=sk-... # OpenAI\nexport ANTHROPIC_API_KEY=sk-ant-... # Anthropic\nexport GOOGLE_API_KEY=... # Google\nexport DEEPSEEK_API_KEY=sk-... # DeepSeek\n# or run a local model: see https://github.com/earendil-works/pi (Ollama / LM Studio)\n\n# 3. Verify pi sees a model\npi --list-models | head\n```\n\nInstall the plugin in Claude Code:\n\n```text\n> /plugin marketplace add Agents365-ai/pi-plugin-cc\n> /plugin install pi@agents365-pi\n> /reload-plugins\n> /pi:setup\n```\n\n`/pi:setup` returns a readiness report. If `pi` is missing and `npm` is on PATH, it offers to install it for you.\n\n## Usage\n\n```text\n> /pi:review\n> /pi:review --base main\n> /pi:review --model claude-sonnet-4\n> /pi:adversarial-review focus on the new auth middleware\n> /pi:rescue investigate why the Windows CI build is failing\n> /pi:rescue --background --model gpt-4o refactor src/payments/\n> /pi:parallel-rescue \"audit the auth module\" \"benchmark the db queries\" \"update the API docs\"\n> /pi:status\n> /pi:status task-mpgyiwb9-e3k641 --wait\n> /pi:result task-mpgyiwb9-e3k641\n> /pi:cancel task-mpgyiwb9-e3k641\n```\n\n`--effort <off|minimal|low|medium|high|xhigh>` is passed through to Pi via `set_thinking_level`. Models that do not support thinking silently ignore it (the plugin logs a one-line note to stderr when this happens).\n\n## 🧩 Use from Codex\n\nThe core of this plugin is a harness-agnostic CLI (`pi-companion.mjs`) — any coding agent that can run shell commands can drive it. For OpenAI's Codex CLI, install the bundled [custom prompts](codex-prompts/):\n\n```bash\n# 1. Clone the repo (anywhere; ~/pi-plugin-cc is the default the prompts assume)\ngit clone https://github.com/Agents365-ai/pi-plugin-cc ~/pi-plugin-cc\n\n# 2. Install the Codex custom prompts\nmkdir -p ~/.codex/prompts\ncp ~/pi-plugin-cc/codex-prompts/*.md ~/.codex/prompts/\n\n# 3. If you cloned somewhere else, point the prompts at it\necho 'export PI_PLUGIN_ROOT=\"$HOME/path/to/pi-plugin-cc\"' >> ~/.zshrc\n```\n\nThen inside Codex: `/pi-review`, `/pi-adversarial-review`, `/pi-rescue`, `/pi-parallel-rescue`, `/pi-status`, `/pi-result`, `/pi-cancel`, `/pi-setup` (note `-` instead of `:` — Codex prompt names cannot contain colons).\n\nNot available under Codex: the stop-time review gate and session-resume prompts (both rely on Claude Code hooks / subagents). Everything else — including pi-subagents parallel fan-out — works the same.\n\n## 🧑‍⚖️ Multi-model review panel\n\nOne reviewer has blind spots; a panel doesn't share them. Passing `--models` to either review command runs the same diff through several models **in parallel** and merges their findings — issues reported by 2+ models rank first with a `found by:` tag:\n\n```text\n> /pi:review --models deepseek-v4-flash,claude-sonnet-4-6,gpt-5-mini\n> /pi:adversarial-review --models deepseek-v4-pro,o1 focus on concurrency\n```\n\n- Consensus findings (2+ models) are listed first; single-model findings follow.\n- Duplicate findings are matched per file with line-range slack; severity escalates to the highest reported and alternate titles are kept.\n- A member that fails (provider error, invalid JSON) is reported inline and does not sink the panel — it succeeds as long as one model returns a valid review.\n- Panel members do not use the `PI_PLUGIN_FALLBACK_MODELS` chain — the panel itself is the redundancy.\n- This only exists because Pi is provider-agnostic: a single-vendor CLI cannot convene a cross-vendor panel.\n\n## 🛟 Automatic model fallback\n\nSet a fallback chain once, and any failed run — provider outage, auth error, exhausted retries — is automatically retried with the next model:\n\n```bash\nexport PI_PLUGIN_FALLBACK_MODELS=deepseek-v4-flash,MiniMax-M3\n```\n\nApplies to reviews and rescue tasks alike. When a fallback produced the result, the output ends with a `Model fallback:` note (and the JSON payload carries `modelAttempts`). `/pi:setup` shows the configured chain.\n\n## Pick your model\n\nThe plugin keeps three layers of model resolution:\n\n| Priority | Source | Example |\n|---|---|---|\n| 1 | `--model <id>` on the slash command | `/pi:review --model gpt-4o` |\n| 2 | Env var (review / adversarial-review only) | `export PI_PLUGIN_REVIEW_MODEL=deepseek-v4-flash`<br>`export PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=deepseek-v4-pro` |\n| 3 | Pi's own configured default | whatever your `~/.pi/agent/models.json` has, or `/model` last picked in pi TUI |\n\nLayer 1 wins over layer 2 wins over layer 3. **None of the layers are required** — leave them all unset and pi picks for you.\n\n### Suggested settings by provider\n\nThese are opinions, not requirements. Pick what fits your latency / cost / quality budget.\n\n| Provider | Everyday review (`/pi:review`) | Adversarial review (`/pi:adversarial-review`) |\n|---|---|---|\n| DeepSeek | `deepseek-v4-flash` | `deepseek-v4-pro` |\n| OpenAI | `gpt-4o-mini` or `gpt-5-mini` | `o1` or `gpt-5` |\n| Anthropic | `claude-haiku-4-5` | `claude-sonnet-4-6` or `claude-opus-4-7` |\n| Google | `gemini-2.5-flash` | `gemini-2.5-pro` |\n| Local (Ollama) | `qwen2.5-coder:7b` | `qwen2.5-coder:32b` or `deepseek-r1` |\n\nTo make these defaults sticky:\n\n```bash\nexport PI_PLUGIN_REVIEW_MODEL=claude-haiku-4-5\nexport PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=claude-sonnet-4-6\n```\n\n## Configure pi\n\nThe minimum is a single env var with your API key. For richer setups, write `~/.pi/agent/models.json`:\n\n```json\n{\n \"providers\": {\n \"deepseek\": { \"apiKey\": \"sk-...\" },\n \"openai\": { \"apiKey\": \"sk-...\" },\n \"anthropic\":{ \"apiKey\": \"sk-ant-...\" },\n \"google\": { \"apiKey\": \"...\" },\n \"openrouter\": {\n \"api\": \"openai-completions\",\n \"apiKey\": \"sk-or-v1-...\",\n \"baseUrl\": \"https://openrouter.ai/api/v1\",\n \"models\": [\n {\n \"id\": \"deepseek/deepseek-chat\",\n \"name\": \"DeepSeek via OpenRouter\",\n \"contextWindow\": 128000,\n \"maxTokens\": 8192,\n \"input\": [\"text\"]\n }\n ]\n }\n }\n}\n```\n\nBuilt-in providers (`anthropic`, `openai`, `google`, `deepseek`, `ollama`, `lmstudio`) only need `apiKey` (and optional `baseUrl`); pi ships their model lists. For custom OpenAI-compatible endpoints, set `api: \"openai-completions\"` and declare the `models` you want exposed.\n\nFull reference: [pi providers docs](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md).\n\n## Stop-time review gate\n\nOpt in with `/pi:setup --enable-review-gate`. When a Claude session ends, the plugin runs a Pi adversarial review of the previous turn and can block the stop if it finds material issues. If pi is unavailable while the gate is enabled, the hook blocks (it does **not** silently let the session end). Disable with `/pi:setup --disable-review-gate`.\n\n## 🔗 Related projects\n\n| Project | Niche | When to use |\n|---|---|---|\n| [codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | Same surface, runs Codex | You want OpenAI's Codex agent + ChatGPT auth |\n| [pi (earendil-works)](https://github.com/earendil-works/pi) | The coding agent this plugin drives | You want to use Pi directly without Claude Code |\n| [pi-subagents](https://github.com/nicobailon/pi-subagents) | Pi extension adding `subagent` tool + `/run` / `/chain` / `/parallel` | Powers `/pi:parallel-rescue` and lets `/pi:rescue` delegate to specialized child agents |\n\n## ❤️ Support\n\nIf this plugin helps you, consider supporting the author:\n\n<table>\n <tr>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/wechat-pay.png\" width=\"180\" alt=\"WeChat Pay\">\n <br>\n <b>WeChat Pay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/alipay.png\" width=\"180\" alt=\"Alipay\">\n <br>\n <b>Alipay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/buymeacoffee.png\" width=\"180\" alt=\"Buy Me a Coffee\">\n <br>\n <b>Buy Me a Coffee</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/awarding/award.gif\" width=\"180\" alt=\"Give a Reward\">\n <br>\n <b>Give a Reward</b>\n </td>\n </tr>\n</table>\n\n## 👤 Author\n\n**Agents365-ai**\n\n- GitHub: https://github.com/Agents365-ai\n- Bilibili: https://space.bilibili.com/441831884\n\n## 📄 License\n\n[Apache License 2.0](LICENSE). Forked from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) (Apache-2.0, OpenAI) — see [NOTICE](NOTICE).\n"}, "af736691555c8b86e0e1789fd238cb3b88685021": {"t": 1785766151.372643, "n": 11499, "h": "eff1eb57e2bb8188", "c": "# pi-plugin-cc — drive the Pi coding agent from Claude Code and Codex 🥧\n\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/network/members)\n[![Latest Release](https://img.shields.io/github/v/release/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/releases/latest)\n[![Last Commit](https://img.shields.io/github/last-commit/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/commits/main)\n\n[![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-plugin-8a2be2)](https://docs.claude.com/en/docs/claude-code/plugins)\n[![Pi Coding Agent](https://img.shields.io/badge/Pi-coding%20agent-0a7d4a)](https://github.com/earendil-works/pi)\n[![Model agnostic](https://img.shields.io/badge/Model-agnostic-555)](#pick-your-model)\n\n**English** · [中文](README_CN.md)\n\nExternal references: [Pi coding agent](https://github.com/earendil-works/pi) · [Pi RPC mode](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md) · [Pi providers](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md)\n\nA Claude Code plugin that delegates reviews and coding tasks to the [Pi coding agent](https://github.com/earendil-works/pi). Adapted from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc), runtime swapped from Codex to Pi. Also usable from OpenAI's Codex CLI — see [Use from Codex](#-use-from-codex).\n\n**The hard dependency is pi, not any particular LLM.** Pi can be configured for DeepSeek, OpenAI, Anthropic, Google, Ollama, LM Studio, or any OpenAI-compatible endpoint via `~/.pi/agent/models.json`. The plugin defers all model selection to pi unless you override per command.\n\n- **Code review** against the working tree or a branch base, with structured findings\n- **Adversarial review** that challenges the design — not just spell-checks the diff\n- **Task delegation** for diagnoses, refactors, and longer rescues, foreground or background\n- **Parallel fan-out** — `/pi:parallel-rescue` runs multiple independent tasks concurrently via [`pi-subagents`](https://github.com/nicobailon/pi-subagents)\n- **Background job control** — `status`, `result`, `cancel`, and stop-time review gate\n- **No OAuth** — pi authenticates by API key (provider-specific), no `codex login` required\n\nIntegrates with [`pi-subagents`](https://github.com/nicobailon/pi-subagents) (`pi install npm:pi-subagents`): `/pi:setup` detects it and lists the agent profiles, `/pi:rescue` prompts advertise the `subagent` tool to Pi, and `/pi:parallel-rescue` fans multiple tasks out to parallel child agents (scout, researcher, planner, worker, reviewer, …).\n\n## 🔄 How it works\n\n<img src=\"docs/pi-plugin-cc-workflow.png\" alt=\"pi-plugin-cc workflow\" width=\"80%\">\n\nCodex's broker layer is gone — Pi is one-conversation-per-process, so the plugin spawns a fresh `pi --mode rpc` for each task. Background jobs are tracked in workspace-scoped state files. Review prompts inline the JSON schema since Pi has no `outputSchema` knob.\n\n## Slash commands\n\n| Command | What it does |\n|---|---|\n| `/pi:setup` | Verifies `pi` is installed + a provider is configured; toggles the stop-time review gate |\n| `/pi:review` | Standard code review of local git state |\n| `/pi:adversarial-review` | Steerable challenge review — questions the approach itself |\n| `/pi:rescue` | Delegate investigation or implementation to a Pi run via the `pi:pi-companion-forwarder` subagent |\n| `/pi:parallel-rescue` | Run multiple independent tasks in parallel via pi-subagents (`subagent({ tasks })` fan-out) |\n| `/pi:status [job-id]` | List active / recent Pi jobs in this repository |\n| `/pi:result <job-id>` | Show the stored final output for a finished job |\n| `/pi:cancel <job-id>` | Terminate a running background job |\n\nEvery command accepts `--model <id>` to pin a specific model just for that run. With no `--model` and no env override (see [Pick your model](#pick-your-model)), pi falls back to whatever it has configured by default.\n\n## Quick Start\n\n```bash\n# 1. Install pi (required)\nnpm install -g --ignore-scripts @earendil-works/pi-coding-agent\n\n# 2. Configure a provider — pick one\nexport OPENAI_API_KEY=sk-... # OpenAI\nexport ANTHROPIC_API_KEY=sk-ant-... # Anthropic\nexport GOOGLE_API_KEY=... # Google\nexport DEEPSEEK_API_KEY=sk-... # DeepSeek\n# or run a local model: see https://github.com/earendil-works/pi (Ollama / LM Studio)\n\n# 3. Verify pi sees a model\npi --list-models | head\n```\n\nInstall the plugin in Claude Code:\n\n```text\n> /plugin marketplace add Agents365-ai/pi-plugin-cc\n> /plugin install pi@agents365-pi\n> /reload-plugins\n> /pi:setup\n```\n\n`/pi:setup` returns a readiness report. If `pi` is missing and `npm` is on PATH, it offers to install it for you.\n\n## Usage\n\n```text\n> /pi:review\n> /pi:review --base main\n> /pi:review --model claude-sonnet-4\n> /pi:adversarial-review focus on the new auth middleware\n> /pi:rescue investigate why the Windows CI build is failing\n> /pi:rescue --background --model gpt-4o refactor src/payments/\n> /pi:parallel-rescue \"audit the auth module\" \"benchmark the db queries\" \"update the API docs\"\n> /pi:status\n> /pi:status task-mpgyiwb9-e3k641 --wait\n> /pi:result task-mpgyiwb9-e3k641\n> /pi:cancel task-mpgyiwb9-e3k641\n```\n\n`--effort <off|minimal|low|medium|high|xhigh>` is passed through to Pi via `set_thinking_level`. Models that do not support thinking silently ignore it (the plugin logs a one-line note to stderr when this happens).\n\n## 🧩 Use from Codex\n\nThe core of this plugin is a harness-agnostic CLI (`pi-companion.mjs`) — any coding agent that can run shell commands can drive it. For OpenAI's Codex CLI, install the bundled [custom prompts](codex-prompts/):\n\n```bash\n# 1. Clone the repo (anywhere; ~/pi-plugin-cc is the default the prompts assume)\ngit clone https://github.com/Agents365-ai/pi-plugin-cc ~/pi-plugin-cc\n\n# 2. Install the Codex custom prompts\nmkdir -p ~/.codex/prompts\ncp ~/pi-plugin-cc/codex-prompts/*.md ~/.codex/prompts/\n\n# 3. If you cloned somewhere else, point the prompts at it\necho 'export PI_PLUGIN_ROOT=\"$HOME/path/to/pi-plugin-cc\"' >> ~/.zshrc\n```\n\nThen inside Codex: `/pi-review`, `/pi-adversarial-review`, `/pi-rescue`, `/pi-parallel-rescue`, `/pi-status`, `/pi-result`, `/pi-cancel`, `/pi-setup` (note `-` instead of `:` — Codex prompt names cannot contain colons).\n\nNot available under Codex: the stop-time review gate and session-resume prompts (both rely on Claude Code hooks / subagents). Everything else — including pi-subagents parallel fan-out — works the same.\n\n## Pick your model\n\nThe plugin keeps three layers of model resolution:\n\n| Priority | Source | Example |\n|---|---|---|\n| 1 | `--model <id>` on the slash command | `/pi:review --model gpt-4o` |\n| 2 | Env var (review / adversarial-review only) | `export PI_PLUGIN_REVIEW_MODEL=deepseek-v4-flash`<br>`export PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=deepseek-v4-pro` |\n| 3 | Pi's own configured default | whatever your `~/.pi/agent/models.json` has, or `/model` last picked in pi TUI |\n\nLayer 1 wins over layer 2 wins over layer 3. **None of the layers are required** — leave them all unset and pi picks for you.\n\n### Suggested settings by provider\n\nThese are opinions, not requirements. Pick what fits your latency / cost / quality budget.\n\n| Provider | Everyday review (`/pi:review`) | Adversarial review (`/pi:adversarial-review`) |\n|---|---|---|\n| DeepSeek | `deepseek-v4-flash` | `deepseek-v4-pro` |\n| OpenAI | `gpt-4o-mini` or `gpt-5-mini` | `o1` or `gpt-5` |\n| Anthropic | `claude-haiku-4-5` | `claude-sonnet-4-6` or `claude-opus-4-7` |\n| Google | `gemini-2.5-flash` | `gemini-2.5-pro` |\n| Local (Ollama) | `qwen2.5-coder:7b` | `qwen2.5-coder:32b` or `deepseek-r1` |\n\nTo make these defaults sticky:\n\n```bash\nexport PI_PLUGIN_REVIEW_MODEL=claude-haiku-4-5\nexport PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=claude-sonnet-4-6\n```\n\n## Configure pi\n\nThe minimum is a single env var with your API key. For richer setups, write `~/.pi/agent/models.json`:\n\n```json\n{\n \"providers\": {\n \"deepseek\": { \"apiKey\": \"sk-...\" },\n \"openai\": { \"apiKey\": \"sk-...\" },\n \"anthropic\":{ \"apiKey\": \"sk-ant-...\" },\n \"google\": { \"apiKey\": \"...\" },\n \"openrouter\": {\n \"api\": \"openai-completions\",\n \"apiKey\": \"sk-or-v1-...\",\n \"baseUrl\": \"https://openrouter.ai/api/v1\",\n \"models\": [\n {\n \"id\": \"deepseek/deepseek-chat\",\n \"name\": \"DeepSeek via OpenRouter\",\n \"contextWindow\": 128000,\n \"maxTokens\": 8192,\n \"input\": [\"text\"]\n }\n ]\n }\n }\n}\n```\n\nBuilt-in providers (`anthropic`, `openai`, `google`, `deepseek`, `ollama`, `lmstudio`) only need `apiKey` (and optional `baseUrl`); pi ships their model lists. For custom OpenAI-compatible endpoints, set `api: \"openai-completions\"` and declare the `models` you want exposed.\n\nFull reference: [pi providers docs](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md).\n\n## Stop-time review gate\n\nOpt in with `/pi:setup --enable-review-gate`. When a Claude session ends, the plugin runs a Pi adversarial review of the previous turn and can block the stop if it finds material issues. If pi is unavailable while the gate is enabled, the hook blocks (it does **not** silently let the session end). Disable with `/pi:setup --disable-review-gate`.\n\n## 🔗 Related projects\n\n| Project | Niche | When to use |\n|---|---|---|\n| [codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | Same surface, runs Codex | You want OpenAI's Codex agent + ChatGPT auth |\n| [pi (earendil-works)](https://github.com/earendil-works/pi) | The coding agent this plugin drives | You want to use Pi directly without Claude Code |\n| [pi-subagents](https://github.com/nicobailon/pi-subagents) | Pi extension adding `subagent` tool + `/run` / `/chain` / `/parallel` | Powers `/pi:parallel-rescue` and lets `/pi:rescue` delegate to specialized child agents |\n\n## ❤️ Support\n\nIf this plugin helps you, consider supporting the author:\n\n<table>\n <tr>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/wechat-pay.png\" width=\"180\" alt=\"WeChat Pay\">\n <br>\n <b>WeChat Pay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/alipay.png\" width=\"180\" alt=\"Alipay\">\n <br>\n <b>Alipay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/buymeacoffee.png\" width=\"180\" alt=\"Buy Me a Coffee\">\n <br>\n <b>Buy Me a Coffee</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/awarding/award.gif\" width=\"180\" alt=\"Give a Reward\">\n <br>\n <b>Give a Reward</b>\n </td>\n </tr>\n</table>\n\n## 👤 Author\n\n**Agents365-ai**\n\n- GitHub: https://github.com/Agents365-ai\n- Bilibili: https://space.bilibili.com/441831884\n\n## 📄 License\n\n[Apache License 2.0](LICENSE). Forked from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) (Apache-2.0, OpenAI) — see [NOTICE](NOTICE).\n"}, "227f73fcd4da1b8b1ff4dd00355e183f812287b6": {"t": 1785766152.7912116, "n": 11611, "h": "349316883bb8e902", "c": "# pi-plugin-cc — drive the Pi coding agent from Claude Code 🥧\n\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/network/members)\n[![Latest Release](https://img.shields.io/github/v/release/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/releases/latest)\n[![Last Commit](https://img.shields.io/github/last-commit/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/commits/main)\n\n[![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-plugin-8a2be2)](https://docs.claude.com/en/docs/claude-code/plugins)\n[![Pi Coding Agent](https://img.shields.io/badge/Pi-coding%20agent-0a7d4a)](https://github.com/earendil-works/pi)\n[![Model agnostic](https://img.shields.io/badge/Model-agnostic-555)](#pick-your-model)\n[![Discord](https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white)](https://discord.gg/79JF5Atuk)\n\n**English** · [中文](README_CN.md)\n\nExternal references: [Pi coding agent](https://github.com/earendil-works/pi) · [Pi RPC mode](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md) · [Pi providers](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md)\n\nA Claude Code plugin that delegates reviews and coding tasks to the [Pi coding agent](https://github.com/earendil-works/pi). Adapted from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc), runtime swapped from Codex to Pi. Also usable from OpenAI's Codex CLI — see [Use from Codex](#-use-from-codex).\n\n**The hard dependency is pi, not any particular LLM.** Pi can be configured for DeepSeek, OpenAI, Anthropic, Google, Ollama, LM Studio, or any OpenAI-compatible endpoint via `~/.pi/agent/models.json`. The plugin defers all model selection to pi unless you override per command.\n\n- **Code review** against the working tree or a branch base, with structured findings\n- **Adversarial review** that challenges the design — not just spell-checks the diff\n- **Task delegation** for diagnoses, refactors, and longer rescues, foreground or background\n- **Parallel fan-out** — `/pi:parallel-rescue` runs multiple independent tasks concurrently via [`pi-subagents`](https://github.com/nicobailon/pi-subagents)\n- **Background job control** — `status`, `result`, `cancel`, and stop-time review gate\n- **No OAuth** — pi authenticates by API key (provider-specific), no `codex login` required\n\nIntegrates with [`pi-subagents`](https://github.com/nicobailon/pi-subagents) (`pi install npm:pi-subagents`): `/pi:setup` detects it and lists the agent profiles, `/pi:rescue` prompts advertise the `subagent` tool to Pi, and `/pi:parallel-rescue` fans multiple tasks out to parallel child agents (scout, researcher, planner, worker, reviewer, …).\n\n## 🔄 How it works\n\n<img src=\"docs/pi-plugin-cc-workflow.png\" alt=\"pi-plugin-cc workflow\" width=\"80%\">\n\nCodex's broker layer is gone — Pi is one-conversation-per-process, so the plugin spawns a fresh `pi --mode rpc` for each task. Background jobs are tracked in workspace-scoped state files. Review prompts inline the JSON schema since Pi has no `outputSchema` knob.\n\n## Slash commands\n\n| Command | What it does |\n|---|---|\n| `/pi:setup` | Verifies `pi` is installed + a provider is configured; toggles the stop-time review gate |\n| `/pi:review` | Standard code review of local git state |\n| `/pi:adversarial-review` | Steerable challenge review — questions the approach itself |\n| `/pi:rescue` | Delegate investigation or implementation to a Pi run via the `pi:pi-companion-forwarder` subagent |\n| `/pi:parallel-rescue` | Run multiple independent tasks in parallel via pi-subagents (`subagent({ tasks })` fan-out) |\n| `/pi:status [job-id]` | List active / recent Pi jobs in this repository |\n| `/pi:result <job-id>` | Show the stored final output for a finished job |\n| `/pi:cancel <job-id>` | Terminate a running background job |\n\nEvery command accepts `--model <id>` to pin a specific model just for that run. With no `--model` and no env override (see [Pick your model](#pick-your-model)), pi falls back to whatever it has configured by default.\n\n## Quick Start\n\n```bash\n# 1. Install pi (required)\nnpm install -g --ignore-scripts @earendil-works/pi-coding-agent\n\n# 2. Configure a provider — pick one\nexport OPENAI_API_KEY=sk-... # OpenAI\nexport ANTHROPIC_API_KEY=sk-ant-... # Anthropic\nexport GOOGLE_API_KEY=... # Google\nexport DEEPSEEK_API_KEY=sk-... # DeepSeek\n# or run a local model: see https://github.com/earendil-works/pi (Ollama / LM Studio)\n\n# 3. Verify pi sees a model\npi --list-models | head\n```\n\nInstall the plugin in Claude Code:\n\n```text\n> /plugin marketplace add Agents365-ai/pi-plugin-cc\n> /plugin install pi@agents365-pi\n> /reload-plugins\n> /pi:setup\n```\n\n`/pi:setup` returns a readiness report. If `pi` is missing and `npm` is on PATH, it offers to install it for you.\n\n## Usage\n\n```text\n> /pi:review\n> /pi:review --base main\n> /pi:review --model claude-sonnet-4\n> /pi:adversarial-review focus on the new auth middleware\n> /pi:rescue investigate why the Windows CI build is failing\n> /pi:rescue --background --model gpt-4o refactor src/payments/\n> /pi:parallel-rescue \"audit the auth module\" \"benchmark the db queries\" \"update the API docs\"\n> /pi:status\n> /pi:status task-mpgyiwb9-e3k641 --wait\n> /pi:result task-mpgyiwb9-e3k641\n> /pi:cancel task-mpgyiwb9-e3k641\n```\n\n`--effort <off|minimal|low|medium|high|xhigh>` is passed through to Pi via `set_thinking_level`. Models that do not support thinking silently ignore it (the plugin logs a one-line note to stderr when this happens).\n\n## 🧩 Use from Codex\n\nThe core of this plugin is a harness-agnostic CLI (`pi-companion.mjs`) — any coding agent that can run shell commands can drive it. For OpenAI's Codex CLI, install the bundled [custom prompts](codex-prompts/):\n\n```bash\n# 1. Clone the repo (anywhere; ~/pi-plugin-cc is the default the prompts assume)\ngit clone https://github.com/Agents365-ai/pi-plugin-cc ~/pi-plugin-cc\n\n# 2. Install the Codex custom prompts\nmkdir -p ~/.codex/prompts\ncp ~/pi-plugin-cc/codex-prompts/*.md ~/.codex/prompts/\n\n# 3. If you cloned somewhere else, point the prompts at it\necho 'export PI_PLUGIN_ROOT=\"$HOME/path/to/pi-plugin-cc\"' >> ~/.zshrc\n```\n\nThen inside Codex: `/pi-review`, `/pi-adversarial-review`, `/pi-rescue`, `/pi-parallel-rescue`, `/pi-status`, `/pi-result`, `/pi-cancel`, `/pi-setup` (note `-` instead of `:` — Codex prompt names cannot contain colons).\n\nNot available under Codex: the stop-time review gate and session-resume prompts (both rely on Claude Code hooks / subagents). Everything else — including pi-subagents parallel fan-out — works the same.\n\n## Pick your model\n\nThe plugin keeps three layers of model resolution:\n\n| Priority | Source | Example |\n|---|---|---|\n| 1 | `--model <id>` on the slash command | `/pi:review --model gpt-4o` |\n| 2 | Env var (review / adversarial-review only) | `export PI_PLUGIN_REVIEW_MODEL=deepseek-v4-flash`<br>`export PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=deepseek-v4-pro` |\n| 3 | Pi's own configured default | whatever your `~/.pi/agent/models.json` has, or `/model` last picked in pi TUI |\n\nLayer 1 wins over layer 2 wins over layer 3. **None of the layers are required** — leave them all unset and pi picks for you.\n\n### Suggested settings by provider\n\nThese are opinions, not requirements. Pick what fits your latency / cost / quality budget.\n\n| Provider | Everyday review (`/pi:review`) | Adversarial review (`/pi:adversarial-review`) |\n|---|---|---|\n| DeepSeek | `deepseek-v4-flash` | `deepseek-v4-pro` |\n| OpenAI | `gpt-4o-mini` or `gpt-5-mini` | `o1` or `gpt-5` |\n| Anthropic | `claude-haiku-4-5` | `claude-sonnet-4-6` or `claude-opus-4-7` |\n| Google | `gemini-2.5-flash` | `gemini-2.5-pro` |\n| Local (Ollama) | `qwen2.5-coder:7b` | `qwen2.5-coder:32b` or `deepseek-r1` |\n\nTo make these defaults sticky:\n\n```bash\nexport PI_PLUGIN_REVIEW_MODEL=claude-haiku-4-5\nexport PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=claude-sonnet-4-6\n```\n\n## Configure pi\n\nThe minimum is a single env var with your API key. For richer setups, write `~/.pi/agent/models.json`:\n\n```json\n{\n \"providers\": {\n \"deepseek\": { \"apiKey\": \"sk-...\" },\n \"openai\": { \"apiKey\": \"sk-...\" },\n \"anthropic\":{ \"apiKey\": \"sk-ant-...\" },\n \"google\": { \"apiKey\": \"...\" },\n \"openrouter\": {\n \"api\": \"openai-completions\",\n \"apiKey\": \"sk-or-v1-...\",\n \"baseUrl\": \"https://openrouter.ai/api/v1\",\n \"models\": [\n {\n \"id\": \"deepseek/deepseek-chat\",\n \"name\": \"DeepSeek via OpenRouter\",\n \"contextWindow\": 128000,\n \"maxTokens\": 8192,\n \"input\": [\"text\"]\n }\n ]\n }\n }\n}\n```\n\nBuilt-in providers (`anthropic`, `openai`, `google`, `deepseek`, `ollama`, `lmstudio`) only need `apiKey` (and optional `baseUrl`); pi ships their model lists. For custom OpenAI-compatible endpoints, set `api: \"openai-completions\"` and declare the `models` you want exposed.\n\nFull reference: [pi providers docs](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md).\n\n## Stop-time review gate\n\nOpt in with `/pi:setup --enable-review-gate`. When a Claude session ends, the plugin runs a Pi adversarial review of the previous turn and can block the stop if it finds material issues. If pi is unavailable while the gate is enabled, the hook blocks (it does **not** silently let the session end). Disable with `/pi:setup --disable-review-gate`.\n\n## 🔗 Related projects\n\n| Project | Niche | When to use |\n|---|---|---|\n| [codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | Same surface, runs Codex | You want OpenAI's Codex agent + ChatGPT auth |\n| [pi (earendil-works)](https://github.com/earendil-works/pi) | The coding agent this plugin drives | You want to use Pi directly without Claude Code |\n| [pi-subagents](https://github.com/nicobailon/pi-subagents) | Pi extension adding `subagent` tool + `/run` / `/chain` / `/parallel` | Powers `/pi:parallel-rescue` and lets `/pi:rescue` delegate to specialized child agents |\n\n## ❤️ Support\n\nIf this plugin helps you, consider supporting the author:\n\n<table>\n <tr>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/wechat-pay.png\" width=\"180\" alt=\"WeChat Pay\">\n <br>\n <b>WeChat Pay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/alipay.png\" width=\"180\" alt=\"Alipay\">\n <br>\n <b>Alipay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/buymeacoffee.png\" width=\"180\" alt=\"Buy Me a Coffee\">\n <br>\n <b>Buy Me a Coffee</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/awarding/award.gif\" width=\"180\" alt=\"Give a Reward\">\n <br>\n <b>Give a Reward</b>\n </td>\n </tr>\n</table>\n\n## 👤 Author\n\n**Agents365-ai**\n\n- GitHub: https://github.com/Agents365-ai\n- Bilibili: https://space.bilibili.com/441831884\n\n## 📄 License\n\n[Apache License 2.0](LICENSE). Forked from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) (Apache-2.0, OpenAI) — see [NOTICE](NOTICE).\n"}, "58386acde4c59763d583b9695007a594f288b3d8": {"t": 1785766154.080476, "n": 10463, "h": "9b58e5fa9eaf2178", "c": "# pi-plugin-cc — drive the Pi coding agent from Claude Code 🥧\n\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/network/members)\n[![Latest Release](https://img.shields.io/github/v/release/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/releases/latest)\n[![Last Commit](https://img.shields.io/github/last-commit/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/commits/main)\n\n[![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-plugin-8a2be2)](https://docs.claude.com/en/docs/claude-code/plugins)\n[![Pi Coding Agent](https://img.shields.io/badge/Pi-coding%20agent-0a7d4a)](https://github.com/earendil-works/pi)\n[![Model agnostic](https://img.shields.io/badge/Model-agnostic-555)](#pick-your-model)\n[![Discord](https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white)](https://discord.gg/79JF5Atuk)\n\n**English** · [中文](README_CN.md)\n\nExternal references: [Pi coding agent](https://github.com/earendil-works/pi) · [Pi RPC mode](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md) · [Pi providers](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md)\n\nA Claude Code plugin that delegates reviews and coding tasks to the [Pi coding agent](https://github.com/earendil-works/pi). Adapted from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc), runtime swapped from Codex to Pi.\n\n**The hard dependency is pi, not any particular LLM.** Pi can be configured for DeepSeek, OpenAI, Anthropic, Google, Ollama, LM Studio, or any OpenAI-compatible endpoint via `~/.pi/agent/models.json`. The plugin defers all model selection to pi unless you override per command.\n\n- **Code review** against the working tree or a branch base, with structured findings\n- **Adversarial review** that challenges the design — not just spell-checks the diff\n- **Task delegation** for diagnoses, refactors, and longer rescues, foreground or background\n- **Parallel fan-out** — `/pi:parallel-rescue` runs multiple independent tasks concurrently via [`pi-subagents`](https://github.com/nicobailon/pi-subagents)\n- **Background job control** — `status`, `result`, `cancel`, and stop-time review gate\n- **No OAuth** — pi authenticates by API key (provider-specific), no `codex login` required\n\nIntegrates with [`pi-subagents`](https://github.com/nicobailon/pi-subagents) (`pi install npm:pi-subagents`): `/pi:setup` detects it and lists the agent profiles, `/pi:rescue` prompts advertise the `subagent` tool to Pi, and `/pi:parallel-rescue` fans multiple tasks out to parallel child agents (scout, researcher, planner, worker, reviewer, …).\n\n## 🔄 How it works\n\n<img src=\"docs/pi-plugin-cc-workflow.png\" alt=\"pi-plugin-cc workflow\" width=\"80%\">\n\nCodex's broker layer is gone — Pi is one-conversation-per-process, so the plugin spawns a fresh `pi --mode rpc` for each task. Background jobs are tracked in workspace-scoped state files. Review prompts inline the JSON schema since Pi has no `outputSchema` knob.\n\n## Slash commands\n\n| Command | What it does |\n|---|---|\n| `/pi:setup` | Verifies `pi` is installed + a provider is configured; toggles the stop-time review gate |\n| `/pi:review` | Standard code review of local git state |\n| `/pi:adversarial-review` | Steerable challenge review — questions the approach itself |\n| `/pi:rescue` | Delegate investigation or implementation to a Pi run via the `pi:pi-companion-forwarder` subagent |\n| `/pi:parallel-rescue` | Run multiple independent tasks in parallel via pi-subagents (`subagent({ tasks })` fan-out) |\n| `/pi:status [job-id]` | List active / recent Pi jobs in this repository |\n| `/pi:result <job-id>` | Show the stored final output for a finished job |\n| `/pi:cancel <job-id>` | Terminate a running background job |\n\nEvery command accepts `--model <id>` to pin a specific model just for that run. With no `--model` and no env override (see [Pick your model](#pick-your-model)), pi falls back to whatever it has configured by default.\n\n## Quick Start\n\n```bash\n# 1. Install pi (required)\nnpm install -g --ignore-scripts @earendil-works/pi-coding-agent\n\n# 2. Configure a provider — pick one\nexport OPENAI_API_KEY=sk-... # OpenAI\nexport ANTHROPIC_API_KEY=sk-ant-... # Anthropic\nexport GOOGLE_API_KEY=... # Google\nexport DEEPSEEK_API_KEY=sk-... # DeepSeek\n# or run a local model: see https://github.com/earendil-works/pi (Ollama / LM Studio)\n\n# 3. Verify pi sees a model\npi --list-models | head\n```\n\nInstall the plugin in Claude Code:\n\n```text\n> /plugin marketplace add Agents365-ai/pi-plugin-cc\n> /plugin install pi@agents365-pi\n> /reload-plugins\n> /pi:setup\n```\n\n`/pi:setup` returns a readiness report. If `pi` is missing and `npm` is on PATH, it offers to install it for you.\n\n## Usage\n\n```text\n> /pi:review\n> /pi:review --base main\n> /pi:review --model claude-sonnet-4\n> /pi:adversarial-review focus on the new auth middleware\n> /pi:rescue investigate why the Windows CI build is failing\n> /pi:rescue --background --model gpt-4o refactor src/payments/\n> /pi:parallel-rescue \"audit the auth module\" \"benchmark the db queries\" \"update the API docs\"\n> /pi:status\n> /pi:status task-mpgyiwb9-e3k641 --wait\n> /pi:result task-mpgyiwb9-e3k641\n> /pi:cancel task-mpgyiwb9-e3k641\n```\n\n`--effort <off|minimal|low|medium|high|xhigh>` is passed through to Pi via `set_thinking_level`. Models that do not support thinking silently ignore it (the plugin logs a one-line note to stderr when this happens).\n\n## Pick your model\n\nThe plugin keeps three layers of model resolution:\n\n| Priority | Source | Example |\n|---|---|---|\n| 1 | `--model <id>` on the slash command | `/pi:review --model gpt-4o` |\n| 2 | Env var (review / adversarial-review only) | `export PI_PLUGIN_REVIEW_MODEL=deepseek-v4-flash`<br>`export PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=deepseek-v4-pro` |\n| 3 | Pi's own configured default | whatever your `~/.pi/agent/models.json` has, or `/model` last picked in pi TUI |\n\nLayer 1 wins over layer 2 wins over layer 3. **None of the layers are required** — leave them all unset and pi picks for you.\n\n### Suggested settings by provider\n\nThese are opinions, not requirements. Pick what fits your latency / cost / quality budget.\n\n| Provider | Everyday review (`/pi:review`) | Adversarial review (`/pi:adversarial-review`) |\n|---|---|---|\n| DeepSeek | `deepseek-v4-flash` | `deepseek-v4-pro` |\n| OpenAI | `gpt-4o-mini` or `gpt-5-mini` | `o1` or `gpt-5` |\n| Anthropic | `claude-haiku-4-5` | `claude-sonnet-4-6` or `claude-opus-4-7` |\n| Google | `gemini-2.5-flash` | `gemini-2.5-pro` |\n| Local (Ollama) | `qwen2.5-coder:7b` | `qwen2.5-coder:32b` or `deepseek-r1` |\n\nTo make these defaults sticky:\n\n```bash\nexport PI_PLUGIN_REVIEW_MODEL=claude-haiku-4-5\nexport PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=claude-sonnet-4-6\n```\n\n## Configure pi\n\nThe minimum is a single env var with your API key. For richer setups, write `~/.pi/agent/models.json`:\n\n```json\n{\n \"providers\": {\n \"deepseek\": { \"apiKey\": \"sk-...\" },\n \"openai\": { \"apiKey\": \"sk-...\" },\n \"anthropic\":{ \"apiKey\": \"sk-ant-...\" },\n \"google\": { \"apiKey\": \"...\" },\n \"openrouter\": {\n \"api\": \"openai-completions\",\n \"apiKey\": \"sk-or-v1-...\",\n \"baseUrl\": \"https://openrouter.ai/api/v1\",\n \"models\": [\n {\n \"id\": \"deepseek/deepseek-chat\",\n \"name\": \"DeepSeek via OpenRouter\",\n \"contextWindow\": 128000,\n \"maxTokens\": 8192,\n \"input\": [\"text\"]\n }\n ]\n }\n }\n}\n```\n\nBuilt-in providers (`anthropic`, `openai`, `google`, `deepseek`, `ollama`, `lmstudio`) only need `apiKey` (and optional `baseUrl`); pi ships their model lists. For custom OpenAI-compatible endpoints, set `api: \"openai-completions\"` and declare the `models` you want exposed.\n\nFull reference: [pi providers docs](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md).\n\n## Stop-time review gate\n\nOpt in with `/pi:setup --enable-review-gate`. When a Claude session ends, the plugin runs a Pi adversarial review of the previous turn and can block the stop if it finds material issues. If pi is unavailable while the gate is enabled, the hook blocks (it does **not** silently let the session end). Disable with `/pi:setup --disable-review-gate`.\n\n## 🔗 Related projects\n\n| Project | Niche | When to use |\n|---|---|---|\n| [codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | Same surface, runs Codex | You want OpenAI's Codex agent + ChatGPT auth |\n| [pi (earendil-works)](https://github.com/earendil-works/pi) | The coding agent this plugin drives | You want to use Pi directly without Claude Code |\n| [pi-subagents](https://github.com/nicobailon/pi-subagents) | Pi extension adding `subagent` tool + `/run` / `/chain` / `/parallel` | Powers `/pi:parallel-rescue` and lets `/pi:rescue` delegate to specialized child agents |\n\n## ❤️ Support\n\nIf this plugin helps you, consider supporting the author:\n\n<table>\n <tr>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/wechat-pay.png\" width=\"180\" alt=\"WeChat Pay\">\n <br>\n <b>WeChat Pay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/alipay.png\" width=\"180\" alt=\"Alipay\">\n <br>\n <b>Alipay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/buymeacoffee.png\" width=\"180\" alt=\"Buy Me a Coffee\">\n <br>\n <b>Buy Me a Coffee</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/awarding/award.gif\" width=\"180\" alt=\"Give a Reward\">\n <br>\n <b>Give a Reward</b>\n </td>\n </tr>\n</table>\n\n## 👤 Author\n\n**Agents365-ai**\n\n- GitHub: https://github.com/Agents365-ai\n- Bilibili: https://space.bilibili.com/441831884\n\n## 📄 License\n\n[Apache License 2.0](LICENSE). Forked from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) (Apache-2.0, OpenAI) — see [NOTICE](NOTICE).\n"}, "da8ae28a3637f572fdcf865d20c21e8178fe8cff": {"t": 1785766155.8937817, "n": 9854, "h": "a9ea100f84b67980", "c": "# pi-plugin-cc — drive the Pi coding agent from Claude Code 🥧\n\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/network/members)\n[![Latest Release](https://img.shields.io/github/v/release/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/releases/latest)\n[![Last Commit](https://img.shields.io/github/last-commit/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/commits/main)\n\n[![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-plugin-8a2be2)](https://docs.claude.com/en/docs/claude-code/plugins)\n[![Pi Coding Agent](https://img.shields.io/badge/Pi-coding%20agent-0a7d4a)](https://github.com/earendil-works/pi)\n[![Model agnostic](https://img.shields.io/badge/Model-agnostic-555)](#pick-your-model)\n[![Discord](https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white)](https://discord.gg/79JF5Atuk)\n\n**English** · [中文](README_CN.md)\n\nExternal references: [Pi coding agent](https://github.com/earendil-works/pi) · [Pi RPC mode](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md) · [Pi providers](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md)\n\nA Claude Code plugin that delegates reviews and coding tasks to the [Pi coding agent](https://github.com/earendil-works/pi). Adapted from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc), runtime swapped from Codex to Pi.\n\n**The hard dependency is pi, not any particular LLM.** Pi can be configured for DeepSeek, OpenAI, Anthropic, Google, Ollama, LM Studio, or any OpenAI-compatible endpoint via `~/.pi/agent/models.json`. The plugin defers all model selection to pi unless you override per command.\n\n- **Code review** against the working tree or a branch base, with structured findings\n- **Adversarial review** that challenges the design — not just spell-checks the diff\n- **Task delegation** for diagnoses, refactors, and longer rescues, foreground or background\n- **Background job control** — `status`, `result`, `cancel`, and stop-time review gate\n- **No OAuth** — pi authenticates by API key (provider-specific), no `codex login` required\n\nPlays well with [`pi-subagents`](https://github.com/nicobailon/pi-subagents): if installed, it works inside `/pi:rescue` runs without configuration.\n\n## 🔄 How it works\n\n<img src=\"docs/pi-plugin-cc-workflow.png\" alt=\"pi-plugin-cc workflow\" width=\"80%\">\n\nCodex's broker layer is gone — Pi is one-conversation-per-process, so the plugin spawns a fresh `pi --mode rpc` for each task. Background jobs are tracked in workspace-scoped state files. Review prompts inline the JSON schema since Pi has no `outputSchema` knob.\n\n## Slash commands\n\n| Command | What it does |\n|---|---|\n| `/pi:setup` | Verifies `pi` is installed + a provider is configured; toggles the stop-time review gate |\n| `/pi:review` | Standard code review of local git state |\n| `/pi:adversarial-review` | Steerable challenge review — questions the approach itself |\n| `/pi:rescue` | Delegate investigation or implementation to a Pi run via the `pi:pi-rescue` subagent |\n| `/pi:status [job-id]` | List active / recent Pi jobs in this repository |\n| `/pi:result <job-id>` | Show the stored final output for a finished job |\n| `/pi:cancel <job-id>` | Terminate a running background job |\n\nEvery command accepts `--model <id>` to pin a specific model just for that run. With no `--model` and no env override (see [Pick your model](#pick-your-model)), pi falls back to whatever it has configured by default.\n\n## Quick Start\n\n```bash\n# 1. Install pi (required)\nnpm install -g --ignore-scripts @earendil-works/pi-coding-agent\n\n# 2. Configure a provider — pick one\nexport OPENAI_API_KEY=sk-... # OpenAI\nexport ANTHROPIC_API_KEY=sk-ant-... # Anthropic\nexport GOOGLE_API_KEY=... # Google\nexport DEEPSEEK_API_KEY=sk-... # DeepSeek\n# or run a local model: see https://github.com/earendil-works/pi (Ollama / LM Studio)\n\n# 3. Verify pi sees a model\npi --list-models | head\n```\n\nInstall the plugin in Claude Code:\n\n```text\n> /plugin marketplace add Agents365-ai/pi-plugin-cc\n> /plugin install pi@agents365-pi\n> /reload-plugins\n> /pi:setup\n```\n\n`/pi:setup` returns a readiness report. If `pi` is missing and `npm` is on PATH, it offers to install it for you.\n\n## Usage\n\n```text\n> /pi:review\n> /pi:review --base main\n> /pi:review --model claude-sonnet-4\n> /pi:adversarial-review focus on the new auth middleware\n> /pi:rescue investigate why the Windows CI build is failing\n> /pi:rescue --background --model gpt-4o refactor src/payments/\n> /pi:status\n> /pi:status task-mpgyiwb9-e3k641 --wait\n> /pi:result task-mpgyiwb9-e3k641\n> /pi:cancel task-mpgyiwb9-e3k641\n```\n\n`--effort <off|minimal|low|medium|high|xhigh>` is passed through to Pi via `set_thinking_level`. Models that do not support thinking silently ignore it (the plugin logs a one-line note to stderr when this happens).\n\n## Pick your model\n\nThe plugin keeps three layers of model resolution:\n\n| Priority | Source | Example |\n|---|---|---|\n| 1 | `--model <id>` on the slash command | `/pi:review --model gpt-4o` |\n| 2 | Env var (review / adversarial-review only) | `export PI_PLUGIN_REVIEW_MODEL=deepseek-v4-flash`<br>`export PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=deepseek-v4-pro` |\n| 3 | Pi's own configured default | whatever your `~/.pi/agent/models.json` has, or `/model` last picked in pi TUI |\n\nLayer 1 wins over layer 2 wins over layer 3. **None of the layers are required** — leave them all unset and pi picks for you.\n\n### Suggested settings by provider\n\nThese are opinions, not requirements. Pick what fits your latency / cost / quality budget.\n\n| Provider | Everyday review (`/pi:review`) | Adversarial review (`/pi:adversarial-review`) |\n|---|---|---|\n| DeepSeek | `deepseek-v4-flash` | `deepseek-v4-pro` |\n| OpenAI | `gpt-4o-mini` or `gpt-5-mini` | `o1` or `gpt-5` |\n| Anthropic | `claude-haiku-4-5` | `claude-sonnet-4-6` or `claude-opus-4-7` |\n| Google | `gemini-2.5-flash` | `gemini-2.5-pro` |\n| Local (Ollama) | `qwen2.5-coder:7b` | `qwen2.5-coder:32b` or `deepseek-r1` |\n\nTo make these defaults sticky:\n\n```bash\nexport PI_PLUGIN_REVIEW_MODEL=claude-haiku-4-5\nexport PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=claude-sonnet-4-6\n```\n\n## Configure pi\n\nThe minimum is a single env var with your API key. For richer setups, write `~/.pi/agent/models.json`:\n\n```json\n{\n \"providers\": {\n \"deepseek\": { \"apiKey\": \"sk-...\" },\n \"openai\": { \"apiKey\": \"sk-...\" },\n \"anthropic\":{ \"apiKey\": \"sk-ant-...\" },\n \"google\": { \"apiKey\": \"...\" },\n \"openrouter\": {\n \"api\": \"openai-completions\",\n \"apiKey\": \"sk-or-v1-...\",\n \"baseUrl\": \"https://openrouter.ai/api/v1\",\n \"models\": [\n {\n \"id\": \"deepseek/deepseek-chat\",\n \"name\": \"DeepSeek via OpenRouter\",\n \"contextWindow\": 128000,\n \"maxTokens\": 8192,\n \"input\": [\"text\"]\n }\n ]\n }\n }\n}\n```\n\nBuilt-in providers (`anthropic`, `openai`, `google`, `deepseek`, `ollama`, `lmstudio`) only need `apiKey` (and optional `baseUrl`); pi ships their model lists. For custom OpenAI-compatible endpoints, set `api: \"openai-completions\"` and declare the `models` you want exposed.\n\nFull reference: [pi providers docs](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md).\n\n## Stop-time review gate\n\nOpt in with `/pi:setup --enable-review-gate`. When a Claude session ends, the plugin runs a Pi adversarial review of the previous turn and can block the stop if it finds material issues. If pi is unavailable while the gate is enabled, the hook blocks (it does **not** silently let the session end). Disable with `/pi:setup --disable-review-gate`.\n\n## 🔗 Related projects\n\n| Project | Niche | When to use |\n|---|---|---|\n| [codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | Same surface, runs Codex | You want OpenAI's Codex agent + ChatGPT auth |\n| [pi (earendil-works)](https://github.com/earendil-works/pi) | The coding agent this plugin drives | You want to use Pi directly without Claude Code |\n| [pi-subagents](https://github.com/nicobailon/pi-subagents) | Pi extension adding `subagent` tool + `/run` / `/chain` / `/parallel` | Let `/pi:rescue` delegate further to specialized child agents |\n\n## ❤️ Support\n\nIf this plugin helps you, consider supporting the author:\n\n<table>\n <tr>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/wechat-pay.png\" width=\"180\" alt=\"WeChat Pay\">\n <br>\n <b>WeChat Pay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/alipay.png\" width=\"180\" alt=\"Alipay\">\n <br>\n <b>Alipay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/buymeacoffee.png\" width=\"180\" alt=\"Buy Me a Coffee\">\n <br>\n <b>Buy Me a Coffee</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/awarding/award.gif\" width=\"180\" alt=\"Give a Reward\">\n <br>\n <b>Give a Reward</b>\n </td>\n </tr>\n</table>\n\n## 👤 Author\n\n**Agents365-ai**\n\n- GitHub: https://github.com/Agents365-ai\n- Bilibili: https://space.bilibili.com/441831884\n\n## 📄 License\n\n[Apache License 2.0](LICENSE). Forked from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) (Apache-2.0, OpenAI) — see [NOTICE](NOTICE).\n"}, "f1c2de6ec7499f0c3f60214a18533a94028f2cdb": {"t": 1785766157.75643, "n": 9853, "h": "900b05056dcb655a", "c": "# pi-plugin-cc — drive the Pi coding agent from Claude Code 🥧\n\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/network/members)\n[![Latest Release](https://img.shields.io/github/v/release/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/releases/latest)\n[![Last Commit](https://img.shields.io/github/last-commit/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/commits/main)\n\n[![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-plugin-8a2be2)](https://docs.claude.com/en/docs/claude-code/plugins)\n[![Pi Coding Agent](https://img.shields.io/badge/Pi-coding%20agent-0a7d4a)](https://github.com/earendil-works/pi)\n[![Model agnostic](https://img.shields.io/badge/Model-agnostic-555)](#pick-your-model)\n[![Discord](https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white)](https://discord.gg/79JF5Atuk)\n\n**English** · [中文](README_CN.md)\n\nExternal references: [Pi coding agent](https://github.com/earendil-works/pi) · [Pi RPC mode](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md) · [Pi providers](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md)\n\nA Claude Code plugin that delegates reviews and coding tasks to the [Pi coding agent](https://github.com/earendil-works/pi). 1:1 fork of [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc), runtime swapped from Codex to Pi.\n\n**The hard dependency is pi, not any particular LLM.** Pi can be configured for DeepSeek, OpenAI, Anthropic, Google, Ollama, LM Studio, or any OpenAI-compatible endpoint via `~/.pi/agent/models.json`. The plugin defers all model selection to pi unless you override per command.\n\n- **Code review** against the working tree or a branch base, with structured findings\n- **Adversarial review** that challenges the design — not just spell-checks the diff\n- **Task delegation** for diagnoses, refactors, and longer rescues, foreground or background\n- **Background job control** — `status`, `result`, `cancel`, and stop-time review gate\n- **No OAuth** — pi authenticates by API key (provider-specific), no `codex login` required\n\nPlays well with [`pi-subagents`](https://github.com/nicobailon/pi-subagents): if installed, it works inside `/pi:rescue` runs without configuration.\n\n## 🔄 How it works\n\n<img src=\"docs/pi-plugin-cc-workflow.png\" alt=\"pi-plugin-cc workflow\" width=\"80%\">\n\nCodex's broker layer is gone — Pi is one-conversation-per-process, so the plugin spawns a fresh `pi --mode rpc` for each task. Background jobs are tracked in workspace-scoped state files. Review prompts inline the JSON schema since Pi has no `outputSchema` knob.\n\n## Slash commands\n\n| Command | What it does |\n|---|---|\n| `/pi:setup` | Verifies `pi` is installed + a provider is configured; toggles the stop-time review gate |\n| `/pi:review` | Standard code review of local git state |\n| `/pi:adversarial-review` | Steerable challenge review — questions the approach itself |\n| `/pi:rescue` | Delegate investigation or implementation to a Pi run via the `pi:pi-rescue` subagent |\n| `/pi:status [job-id]` | List active / recent Pi jobs in this repository |\n| `/pi:result <job-id>` | Show the stored final output for a finished job |\n| `/pi:cancel <job-id>` | Terminate a running background job |\n\nEvery command accepts `--model <id>` to pin a specific model just for that run. With no `--model` and no env override (see [Pick your model](#pick-your-model)), pi falls back to whatever it has configured by default.\n\n## Quick Start\n\n```bash\n# 1. Install pi (required)\nnpm install -g --ignore-scripts @earendil-works/pi-coding-agent\n\n# 2. Configure a provider — pick one\nexport OPENAI_API_KEY=sk-... # OpenAI\nexport ANTHROPIC_API_KEY=sk-ant-... # Anthropic\nexport GOOGLE_API_KEY=... # Google\nexport DEEPSEEK_API_KEY=sk-... # DeepSeek\n# or run a local model: see https://github.com/earendil-works/pi (Ollama / LM Studio)\n\n# 3. Verify pi sees a model\npi --list-models | head\n```\n\nInstall the plugin in Claude Code:\n\n```text\n> /plugin marketplace add Agents365-ai/pi-plugin-cc\n> /plugin install pi@agents365-pi\n> /reload-plugins\n> /pi:setup\n```\n\n`/pi:setup` returns a readiness report. If `pi` is missing and `npm` is on PATH, it offers to install it for you.\n\n## Usage\n\n```text\n> /pi:review\n> /pi:review --base main\n> /pi:review --model claude-sonnet-4\n> /pi:adversarial-review focus on the new auth middleware\n> /pi:rescue investigate why the Windows CI build is failing\n> /pi:rescue --background --model gpt-4o refactor src/payments/\n> /pi:status\n> /pi:status task-mpgyiwb9-e3k641 --wait\n> /pi:result task-mpgyiwb9-e3k641\n> /pi:cancel task-mpgyiwb9-e3k641\n```\n\n`--effort <off|minimal|low|medium|high|xhigh>` is passed through to Pi via `set_thinking_level`. Models that do not support thinking silently ignore it (the plugin logs a one-line note to stderr when this happens).\n\n## Pick your model\n\nThe plugin keeps three layers of model resolution:\n\n| Priority | Source | Example |\n|---|---|---|\n| 1 | `--model <id>` on the slash command | `/pi:review --model gpt-4o` |\n| 2 | Env var (review / adversarial-review only) | `export PI_PLUGIN_REVIEW_MODEL=deepseek-v4-flash`<br>`export PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=deepseek-v4-pro` |\n| 3 | Pi's own configured default | whatever your `~/.pi/agent/models.json` has, or `/model` last picked in pi TUI |\n\nLayer 1 wins over layer 2 wins over layer 3. **None of the layers are required** — leave them all unset and pi picks for you.\n\n### Suggested settings by provider\n\nThese are opinions, not requirements. Pick what fits your latency / cost / quality budget.\n\n| Provider | Everyday review (`/pi:review`) | Adversarial review (`/pi:adversarial-review`) |\n|---|---|---|\n| DeepSeek | `deepseek-v4-flash` | `deepseek-v4-pro` |\n| OpenAI | `gpt-4o-mini` or `gpt-5-mini` | `o1` or `gpt-5` |\n| Anthropic | `claude-haiku-4-5` | `claude-sonnet-4-6` or `claude-opus-4-7` |\n| Google | `gemini-2.5-flash` | `gemini-2.5-pro` |\n| Local (Ollama) | `qwen2.5-coder:7b` | `qwen2.5-coder:32b` or `deepseek-r1` |\n\nTo make these defaults sticky:\n\n```bash\nexport PI_PLUGIN_REVIEW_MODEL=claude-haiku-4-5\nexport PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=claude-sonnet-4-6\n```\n\n## Configure pi\n\nThe minimum is a single env var with your API key. For richer setups, write `~/.pi/agent/models.json`:\n\n```json\n{\n \"providers\": {\n \"deepseek\": { \"apiKey\": \"sk-...\" },\n \"openai\": { \"apiKey\": \"sk-...\" },\n \"anthropic\":{ \"apiKey\": \"sk-ant-...\" },\n \"google\": { \"apiKey\": \"...\" },\n \"openrouter\": {\n \"api\": \"openai-completions\",\n \"apiKey\": \"sk-or-v1-...\",\n \"baseUrl\": \"https://openrouter.ai/api/v1\",\n \"models\": [\n {\n \"id\": \"deepseek/deepseek-chat\",\n \"name\": \"DeepSeek via OpenRouter\",\n \"contextWindow\": 128000,\n \"maxTokens\": 8192,\n \"input\": [\"text\"]\n }\n ]\n }\n }\n}\n```\n\nBuilt-in providers (`anthropic`, `openai`, `google`, `deepseek`, `ollama`, `lmstudio`) only need `apiKey` (and optional `baseUrl`); pi ships their model lists. For custom OpenAI-compatible endpoints, set `api: \"openai-completions\"` and declare the `models` you want exposed.\n\nFull reference: [pi providers docs](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md).\n\n## Stop-time review gate\n\nOpt in with `/pi:setup --enable-review-gate`. When a Claude session ends, the plugin runs a Pi adversarial review of the previous turn and can block the stop if it finds material issues. If pi is unavailable while the gate is enabled, the hook blocks (it does **not** silently let the session end). Disable with `/pi:setup --disable-review-gate`.\n\n## 🔗 Related projects\n\n| Project | Niche | When to use |\n|---|---|---|\n| [codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | Same surface, runs Codex | You want OpenAI's Codex agent + ChatGPT auth |\n| [pi (earendil-works)](https://github.com/earendil-works/pi) | The coding agent this plugin drives | You want to use Pi directly without Claude Code |\n| [pi-subagents](https://github.com/nicobailon/pi-subagents) | Pi extension adding `subagent` tool + `/run` / `/chain` / `/parallel` | Let `/pi:rescue` delegate further to specialized child agents |\n\n## ❤️ Support\n\nIf this plugin helps you, consider supporting the author:\n\n<table>\n <tr>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/wechat-pay.png\" width=\"180\" alt=\"WeChat Pay\">\n <br>\n <b>WeChat Pay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/alipay.png\" width=\"180\" alt=\"Alipay\">\n <br>\n <b>Alipay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/buymeacoffee.png\" width=\"180\" alt=\"Buy Me a Coffee\">\n <br>\n <b>Buy Me a Coffee</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/awarding/award.gif\" width=\"180\" alt=\"Give a Reward\">\n <br>\n <b>Give a Reward</b>\n </td>\n </tr>\n</table>\n\n## 👤 Author\n\n**Agents365-ai**\n\n- GitHub: https://github.com/Agents365-ai\n- Bilibili: https://space.bilibili.com/441831884\n\n## 📄 License\n\n[Apache License 2.0](LICENSE). Forked from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) (Apache-2.0, OpenAI) — see [NOTICE](NOTICE).\n"}, "3690a358289b706f869b9c470fa3cab2fc615614": {"t": 1785766159.1251938, "n": 9827, "h": "64f3bcd256800989", "c": "# pi-plugin-cc — drive the Pi coding agent from Claude Code 🥧\n\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/network/members)\n[![Latest Release](https://img.shields.io/github/v/release/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/releases/latest)\n[![Last Commit](https://img.shields.io/github/last-commit/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/commits/main)\n\n[![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-plugin-8a2be2)](https://docs.claude.com/en/docs/claude-code/plugins)\n[![Pi Coding Agent](https://img.shields.io/badge/Pi-coding%20agent-0a7d4a)](https://github.com/earendil-works/pi)\n[![Model agnostic](https://img.shields.io/badge/Model-agnostic-555)](#pick-your-model)\n[![Discord](https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white)](https://discord.gg/79JF5Atuk)\n\n**English** · [中文](README_CN.md)\n\nExternal references: [Pi coding agent](https://github.com/earendil-works/pi) · [Pi RPC mode](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md) · [Pi providers](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md)\n\nA Claude Code plugin that delegates reviews and coding tasks to the [Pi coding agent](https://github.com/earendil-works/pi). 1:1 fork of [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc), runtime swapped from Codex to Pi.\n\n**The hard dependency is pi, not any particular LLM.** Pi can be configured for DeepSeek, OpenAI, Anthropic, Google, Ollama, LM Studio, or any OpenAI-compatible endpoint via `~/.pi/agent/models.json`. The plugin defers all model selection to pi unless you override per command.\n\n- **Code review** against the working tree or a branch base, with structured findings\n- **Adversarial review** that challenges the design — not just spell-checks the diff\n- **Task delegation** for diagnoses, refactors, and longer rescues, foreground or background\n- **Background job control** — `status`, `result`, `cancel`, and stop-time review gate\n- **No OAuth** — pi authenticates by API key (provider-specific), no `codex login` required\n\nPlays well with [`pi-subagents`](https://github.com/nicobailon/pi-subagents): if installed, it works inside `/pi:rescue` runs without configuration.\n\n## 🔄 How it works\n\n![pi-plugin-cc workflow](docs/pi-plugin-cc-workflow.png)\n\nCodex's broker layer is gone — Pi is one-conversation-per-process, so the plugin spawns a fresh `pi --mode rpc` for each task. Background jobs are tracked in workspace-scoped state files. Review prompts inline the JSON schema since Pi has no `outputSchema` knob.\n\n## Slash commands\n\n| Command | What it does |\n|---|---|\n| `/pi:setup` | Verifies `pi` is installed + a provider is configured; toggles the stop-time review gate |\n| `/pi:review` | Standard code review of local git state |\n| `/pi:adversarial-review` | Steerable challenge review — questions the approach itself |\n| `/pi:rescue` | Delegate investigation or implementation to a Pi run via the `pi:pi-rescue` subagent |\n| `/pi:status [job-id]` | List active / recent Pi jobs in this repository |\n| `/pi:result <job-id>` | Show the stored final output for a finished job |\n| `/pi:cancel <job-id>` | Terminate a running background job |\n\nEvery command accepts `--model <id>` to pin a specific model just for that run. With no `--model` and no env override (see [Pick your model](#pick-your-model)), pi falls back to whatever it has configured by default.\n\n## Quick Start\n\n```bash\n# 1. Install pi (required)\nnpm install -g --ignore-scripts @earendil-works/pi-coding-agent\n\n# 2. Configure a provider — pick one\nexport OPENAI_API_KEY=sk-... # OpenAI\nexport ANTHROPIC_API_KEY=sk-ant-... # Anthropic\nexport GOOGLE_API_KEY=... # Google\nexport DEEPSEEK_API_KEY=sk-... # DeepSeek\n# or run a local model: see https://github.com/earendil-works/pi (Ollama / LM Studio)\n\n# 3. Verify pi sees a model\npi --list-models | head\n```\n\nInstall the plugin in Claude Code:\n\n```text\n> /plugin marketplace add Agents365-ai/pi-plugin-cc\n> /plugin install pi@agents365-pi\n> /reload-plugins\n> /pi:setup\n```\n\n`/pi:setup` returns a readiness report. If `pi` is missing and `npm` is on PATH, it offers to install it for you.\n\n## Usage\n\n```text\n> /pi:review\n> /pi:review --base main\n> /pi:review --model claude-sonnet-4\n> /pi:adversarial-review focus on the new auth middleware\n> /pi:rescue investigate why the Windows CI build is failing\n> /pi:rescue --background --model gpt-4o refactor src/payments/\n> /pi:status\n> /pi:status task-mpgyiwb9-e3k641 --wait\n> /pi:result task-mpgyiwb9-e3k641\n> /pi:cancel task-mpgyiwb9-e3k641\n```\n\n`--effort <off|minimal|low|medium|high|xhigh>` is passed through to Pi via `set_thinking_level`. Models that do not support thinking silently ignore it (the plugin logs a one-line note to stderr when this happens).\n\n## Pick your model\n\nThe plugin keeps three layers of model resolution:\n\n| Priority | Source | Example |\n|---|---|---|\n| 1 | `--model <id>` on the slash command | `/pi:review --model gpt-4o` |\n| 2 | Env var (review / adversarial-review only) | `export PI_PLUGIN_REVIEW_MODEL=deepseek-v4-flash`<br>`export PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=deepseek-v4-pro` |\n| 3 | Pi's own configured default | whatever your `~/.pi/agent/models.json` has, or `/model` last picked in pi TUI |\n\nLayer 1 wins over layer 2 wins over layer 3. **None of the layers are required** — leave them all unset and pi picks for you.\n\n### Suggested settings by provider\n\nThese are opinions, not requirements. Pick what fits your latency / cost / quality budget.\n\n| Provider | Everyday review (`/pi:review`) | Adversarial review (`/pi:adversarial-review`) |\n|---|---|---|\n| DeepSeek | `deepseek-v4-flash` | `deepseek-v4-pro` |\n| OpenAI | `gpt-4o-mini` or `gpt-5-mini` | `o1` or `gpt-5` |\n| Anthropic | `claude-haiku-4-5` | `claude-sonnet-4-6` or `claude-opus-4-7` |\n| Google | `gemini-2.5-flash` | `gemini-2.5-pro` |\n| Local (Ollama) | `qwen2.5-coder:7b` | `qwen2.5-coder:32b` or `deepseek-r1` |\n\nTo make these defaults sticky:\n\n```bash\nexport PI_PLUGIN_REVIEW_MODEL=claude-haiku-4-5\nexport PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=claude-sonnet-4-6\n```\n\n## Configure pi\n\nThe minimum is a single env var with your API key. For richer setups, write `~/.pi/agent/models.json`:\n\n```json\n{\n \"providers\": {\n \"deepseek\": { \"apiKey\": \"sk-...\" },\n \"openai\": { \"apiKey\": \"sk-...\" },\n \"anthropic\":{ \"apiKey\": \"sk-ant-...\" },\n \"google\": { \"apiKey\": \"...\" },\n \"openrouter\": {\n \"api\": \"openai-completions\",\n \"apiKey\": \"sk-or-v1-...\",\n \"baseUrl\": \"https://openrouter.ai/api/v1\",\n \"models\": [\n {\n \"id\": \"deepseek/deepseek-chat\",\n \"name\": \"DeepSeek via OpenRouter\",\n \"contextWindow\": 128000,\n \"maxTokens\": 8192,\n \"input\": [\"text\"]\n }\n ]\n }\n }\n}\n```\n\nBuilt-in providers (`anthropic`, `openai`, `google`, `deepseek`, `ollama`, `lmstudio`) only need `apiKey` (and optional `baseUrl`); pi ships their model lists. For custom OpenAI-compatible endpoints, set `api: \"openai-completions\"` and declare the `models` you want exposed.\n\nFull reference: [pi providers docs](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md).\n\n## Stop-time review gate\n\nOpt in with `/pi:setup --enable-review-gate`. When a Claude session ends, the plugin runs a Pi adversarial review of the previous turn and can block the stop if it finds material issues. If pi is unavailable while the gate is enabled, the hook blocks (it does **not** silently let the session end). Disable with `/pi:setup --disable-review-gate`.\n\n## 🔗 Related projects\n\n| Project | Niche | When to use |\n|---|---|---|\n| [codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | Same surface, runs Codex | You want OpenAI's Codex agent + ChatGPT auth |\n| [pi (earendil-works)](https://github.com/earendil-works/pi) | The coding agent this plugin drives | You want to use Pi directly without Claude Code |\n| [pi-subagents](https://github.com/nicobailon/pi-subagents) | Pi extension adding `subagent` tool + `/run` / `/chain` / `/parallel` | Let `/pi:rescue` delegate further to specialized child agents |\n\n## ❤️ Support\n\nIf this plugin helps you, consider supporting the author:\n\n<table>\n <tr>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/wechat-pay.png\" width=\"180\" alt=\"WeChat Pay\">\n <br>\n <b>WeChat Pay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/alipay.png\" width=\"180\" alt=\"Alipay\">\n <br>\n <b>Alipay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/buymeacoffee.png\" width=\"180\" alt=\"Buy Me a Coffee\">\n <br>\n <b>Buy Me a Coffee</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/awarding/award.gif\" width=\"180\" alt=\"Give a Reward\">\n <br>\n <b>Give a Reward</b>\n </td>\n </tr>\n</table>\n\n## 👤 Author\n\n**Agents365-ai**\n\n- GitHub: https://github.com/Agents365-ai\n- Bilibili: https://space.bilibili.com/441831884\n\n## 📄 License\n\n[Apache License 2.0](LICENSE). Forked from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) (Apache-2.0, OpenAI) — see [NOTICE](NOTICE).\n"}, "d10b89dde66f40b247f516052c0c4bd69add5cdb": {"t": 1785766160.4806986, "n": 10548, "h": "fae12598042cf58f", "c": "# pi-plugin-cc — drive the Pi coding agent from Claude Code 🥧\n\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/network/members)\n[![Latest Release](https://img.shields.io/github/v/release/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/releases/latest)\n[![Last Commit](https://img.shields.io/github/last-commit/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/commits/main)\n\n[![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-plugin-8a2be2)](https://docs.claude.com/en/docs/claude-code/plugins)\n[![Pi Coding Agent](https://img.shields.io/badge/Pi-coding%20agent-0a7d4a)](https://github.com/earendil-works/pi)\n[![Model agnostic](https://img.shields.io/badge/Model-agnostic-555)](#pick-your-model)\n[![Discord](https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white)](https://discord.gg/79JF5Atuk)\n\n**English** · [中文](README_CN.md)\n\nExternal references: [Pi coding agent](https://github.com/earendil-works/pi) · [Pi RPC mode](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md) · [Pi providers](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md)\n\nA Claude Code plugin that delegates reviews and coding tasks to the [Pi coding agent](https://github.com/earendil-works/pi). 1:1 fork of [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc), runtime swapped from Codex to Pi.\n\n**The hard dependency is pi, not any particular LLM.** Pi can be configured for DeepSeek, OpenAI, Anthropic, Google, Ollama, LM Studio, or any OpenAI-compatible endpoint via `~/.pi/agent/models.json`. The plugin defers all model selection to pi unless you override per command.\n\n- **Code review** against the working tree or a branch base, with structured findings\n- **Adversarial review** that challenges the design — not just spell-checks the diff\n- **Task delegation** for diagnoses, refactors, and longer rescues, foreground or background\n- **Background job control** — `status`, `result`, `cancel`, and stop-time review gate\n- **No OAuth** — pi authenticates by API key (provider-specific), no `codex login` required\n\nPlays well with [`pi-subagents`](https://github.com/nicobailon/pi-subagents): if installed, it works inside `/pi:rescue` runs without configuration.\n\n## 🔄 How it works\n\n```\nClaude Code ─► /pi:review · /pi:rescue · /pi:status ...\n │\n ▼\n pi-companion.mjs (Node)\n │ one pi --mode rpc subprocess per task\n ▼\n Pi coding agent ─► whichever provider/model pi is configured for\n │\n ▼\n JSONL events + final assistant message\n │\n ▼\n job state files (status / result / cancel)\n```\n\nCodex's broker layer is gone — Pi is one-conversation-per-process, so the plugin spawns a fresh `pi --mode rpc` for each task. Background jobs are tracked in workspace-scoped state files. Review prompts inline the JSON schema since Pi has no `outputSchema` knob.\n\n## Slash commands\n\n| Command | What it does |\n|---|---|\n| `/pi:setup` | Verifies `pi` is installed + a provider is configured; toggles the stop-time review gate |\n| `/pi:review` | Standard code review of local git state |\n| `/pi:adversarial-review` | Steerable challenge review — questions the approach itself |\n| `/pi:rescue` | Delegate investigation or implementation to a Pi run via the `pi:pi-rescue` subagent |\n| `/pi:status [job-id]` | List active / recent Pi jobs in this repository |\n| `/pi:result <job-id>` | Show the stored final output for a finished job |\n| `/pi:cancel <job-id>` | Terminate a running background job |\n\nEvery command accepts `--model <id>` to pin a specific model just for that run. With no `--model` and no env override (see [Pick your model](#pick-your-model)), pi falls back to whatever it has configured by default.\n\n## Quick Start\n\n```bash\n# 1. Install pi (required)\nnpm install -g --ignore-scripts @earendil-works/pi-coding-agent\n\n# 2. Configure a provider — pick one\nexport OPENAI_API_KEY=sk-... # OpenAI\nexport ANTHROPIC_API_KEY=sk-ant-... # Anthropic\nexport GOOGLE_API_KEY=... # Google\nexport DEEPSEEK_API_KEY=sk-... # DeepSeek\n# or run a local model: see https://github.com/earendil-works/pi (Ollama / LM Studio)\n\n# 3. Verify pi sees a model\npi --list-models | head\n```\n\nInstall the plugin in Claude Code:\n\n```text\n> /plugin marketplace add Agents365-ai/pi-plugin-cc\n> /plugin install pi@agents365-pi\n> /reload-plugins\n> /pi:setup\n```\n\n`/pi:setup` returns a readiness report. If `pi` is missing and `npm` is on PATH, it offers to install it for you.\n\n## Usage\n\n```text\n> /pi:review\n> /pi:review --base main\n> /pi:review --model claude-sonnet-4\n> /pi:adversarial-review focus on the new auth middleware\n> /pi:rescue investigate why the Windows CI build is failing\n> /pi:rescue --background --model gpt-4o refactor src/payments/\n> /pi:status\n> /pi:status task-mpgyiwb9-e3k641 --wait\n> /pi:result task-mpgyiwb9-e3k641\n> /pi:cancel task-mpgyiwb9-e3k641\n```\n\n`--effort <off|minimal|low|medium|high|xhigh>` is passed through to Pi via `set_thinking_level`. Models that do not support thinking silently ignore it (the plugin logs a one-line note to stderr when this happens).\n\n## Pick your model\n\nThe plugin keeps three layers of model resolution:\n\n| Priority | Source | Example |\n|---|---|---|\n| 1 | `--model <id>` on the slash command | `/pi:review --model gpt-4o` |\n| 2 | Env var (review / adversarial-review only) | `export PI_PLUGIN_REVIEW_MODEL=deepseek-v4-flash`<br>`export PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=deepseek-v4-pro` |\n| 3 | Pi's own configured default | whatever your `~/.pi/agent/models.json` has, or `/model` last picked in pi TUI |\n\nLayer 1 wins over layer 2 wins over layer 3. **None of the layers are required** — leave them all unset and pi picks for you.\n\n### Suggested settings by provider\n\nThese are opinions, not requirements. Pick what fits your latency / cost / quality budget.\n\n| Provider | Everyday review (`/pi:review`) | Adversarial review (`/pi:adversarial-review`) |\n|---|---|---|\n| DeepSeek | `deepseek-v4-flash` | `deepseek-v4-pro` |\n| OpenAI | `gpt-4o-mini` or `gpt-5-mini` | `o1` or `gpt-5` |\n| Anthropic | `claude-haiku-4-5` | `claude-sonnet-4-6` or `claude-opus-4-7` |\n| Google | `gemini-2.5-flash` | `gemini-2.5-pro` |\n| Local (Ollama) | `qwen2.5-coder:7b` | `qwen2.5-coder:32b` or `deepseek-r1` |\n\nTo make these defaults sticky:\n\n```bash\nexport PI_PLUGIN_REVIEW_MODEL=claude-haiku-4-5\nexport PI_PLUGIN_ADVERSARIAL_REVIEW_MODEL=claude-sonnet-4-6\n```\n\n## Configure pi\n\nThe minimum is a single env var with your API key. For richer setups, write `~/.pi/agent/models.json`:\n\n```json\n{\n \"providers\": {\n \"deepseek\": { \"apiKey\": \"sk-...\" },\n \"openai\": { \"apiKey\": \"sk-...\" },\n \"anthropic\":{ \"apiKey\": \"sk-ant-...\" },\n \"google\": { \"apiKey\": \"...\" },\n \"openrouter\": {\n \"api\": \"openai-completions\",\n \"apiKey\": \"sk-or-v1-...\",\n \"baseUrl\": \"https://openrouter.ai/api/v1\",\n \"models\": [\n {\n \"id\": \"deepseek/deepseek-chat\",\n \"name\": \"DeepSeek via OpenRouter\",\n \"contextWindow\": 128000,\n \"maxTokens\": 8192,\n \"input\": [\"text\"]\n }\n ]\n }\n }\n}\n```\n\nBuilt-in providers (`anthropic`, `openai`, `google`, `deepseek`, `ollama`, `lmstudio`) only need `apiKey` (and optional `baseUrl`); pi ships their model lists. For custom OpenAI-compatible endpoints, set `api: \"openai-completions\"` and declare the `models` you want exposed.\n\nFull reference: [pi providers docs](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md).\n\n## Stop-time review gate\n\nOpt in with `/pi:setup --enable-review-gate`. When a Claude session ends, the plugin runs a Pi adversarial review of the previous turn and can block the stop if it finds material issues. If pi is unavailable while the gate is enabled, the hook blocks (it does **not** silently let the session end). Disable with `/pi:setup --disable-review-gate`.\n\n## 🔗 Related projects\n\n| Project | Niche | When to use |\n|---|---|---|\n| [codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | Same surface, runs Codex | You want OpenAI's Codex agent + ChatGPT auth |\n| [pi (earendil-works)](https://github.com/earendil-works/pi) | The coding agent this plugin drives | You want to use Pi directly without Claude Code |\n| [pi-subagents](https://github.com/nicobailon/pi-subagents) | Pi extension adding `subagent` tool + `/run` / `/chain` / `/parallel` | Let `/pi:rescue` delegate further to specialized child agents |\n\n## 💬 Community\n\n- **Discord:** https://discord.gg/79JF5Atuk\n- **WeChat:** scan the QR code below\n\n<p align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/agents365ai_wechat_1.png\" width=\"200\" alt=\"WeChat Community Group\">\n</p>\n\n## ❤️ Support\n\nIf this plugin helps you, consider supporting the author:\n\n<table>\n <tr>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/wechat-pay.png\" width=\"180\" alt=\"WeChat Pay\">\n <br>\n <b>WeChat Pay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/alipay.png\" width=\"180\" alt=\"Alipay\">\n <br>\n <b>Alipay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/buymeacoffee.png\" width=\"180\" alt=\"Buy Me a Coffee\">\n <br>\n <b>Buy Me a Coffee</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/awarding/award.gif\" width=\"180\" alt=\"Give a Reward\">\n <br>\n <b>Give a Reward</b>\n </td>\n </tr>\n</table>\n\n## 👤 Author\n\n**Agents365-ai**\n\n- GitHub: https://github.com/Agents365-ai\n- Bilibili: https://space.bilibili.com/441831884\n\n## 📄 License\n\n[Apache License 2.0](LICENSE). Forked from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) (Apache-2.0, OpenAI) — see [NOTICE](NOTICE).\n"}, "d5ce89827ca058c156ed5e395d1c743bd0a9751e": {"t": 1785766161.7805314, "n": 8279, "h": "c08cdb161a604194", "c": "# pi-plugin-cc — drive the Pi coding agent from Claude Code 🥧\n\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Agents365-ai/pi-plugin-cc?style=flat&logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/network/members)\n[![Latest Release](https://img.shields.io/github/v/release/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/releases/latest)\n[![Last Commit](https://img.shields.io/github/last-commit/Agents365-ai/pi-plugin-cc?logo=github)](https://github.com/Agents365-ai/pi-plugin-cc/commits/main)\n\n[![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-plugin-8a2be2)](https://docs.claude.com/en/docs/claude-code/plugins)\n[![Pi Coding Agent](https://img.shields.io/badge/Pi-coding%20agent-0a7d4a)](https://github.com/earendil-works/pi)\n[![DeepSeek](https://img.shields.io/badge/DeepSeek-V4-1f6feb)](https://platform.deepseek.com/)\n[![Discord](https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white)](https://discord.gg/79JF5Atuk)\n\n**English** · [中文](README_CN.md)\n\nExternal references: [Pi coding agent](https://github.com/earendil-works/pi) · [Pi RPC mode](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md) · [DeepSeek API](https://platform.deepseek.com/)\n\nA Claude Code plugin that delegates reviews and coding tasks to the [Pi coding agent](https://github.com/earendil-works/pi), defaulting to DeepSeek V4 (Flash for everyday review, Pro for adversarial review). 1:1 fork of [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) with the runtime swapped from Codex to Pi.\n\n- **Code review** against the working tree or a branch base, with structured findings\n- **Adversarial review** that challenges the design — not just spell-checks the diff\n- **Task delegation** for diagnoses, refactors, and longer rescues, foreground or background\n- **Background job control** — `status`, `result`, `cancel`, and stop-time review gate\n- **No OAuth** — pi authenticates by API key (`DEEPSEEK_API_KEY`, etc.), no `codex login` needed\n\nPlays well with [`pi-subagents`](https://github.com/nicobailon/pi-subagents): if installed, it works inside `/pi:rescue` runs without configuration.\n\n## 🔄 How it works\n\n```\nClaude Code ─► /pi:review · /pi:rescue · /pi:status ...\n │\n ▼\n pi-companion.mjs (Node)\n │ one pi --mode rpc subprocess per task\n ▼\n Pi coding agent ─► DeepSeek (or any pi-configured provider)\n │\n ▼\n JSONL events + final assistant message\n │\n ▼\n job state files (status / result / cancel)\n```\n\nCodex's broker layer is gone — Pi is one-conversation-per-process, so the plugin spawns a fresh `pi --mode rpc` for each task. Background jobs are tracked in workspace-scoped state files. Review prompts inline the JSON schema since Pi has no `outputSchema` knob.\n\n## Slash commands\n\n| Command | Default model | What it does |\n|---|---|---|\n| `/pi:setup` | — | Verifies `pi` is installed + a provider is configured; toggles the stop-time review gate |\n| `/pi:review` | `deepseek-v4-flash` | Standard code review of local git state |\n| `/pi:adversarial-review` | `deepseek-v4-pro` | Steerable challenge review — questions the approach itself |\n| `/pi:rescue` | user's pi default | Delegate investigation or implementation to a Pi run via the `pi:pi-rescue` subagent |\n| `/pi:status [job-id]` | — | List active / recent Pi jobs in this repository |\n| `/pi:result <job-id>` | — | Show the stored final output for a finished job |\n| `/pi:cancel <job-id>` | — | Terminate a running background job |\n\n## Quick Start\n\n```bash\n# 1. Install pi\nnpm install -g --ignore-scripts @earendil-works/pi-coding-agent\n\n# 2. Provide a provider key (DeepSeek by default)\nexport DEEPSEEK_API_KEY=sk-your-key-here\n\n# 3. Verify\npi --list-models deepseek # should show deepseek-v4-flash and -pro\n```\n\nInstall the plugin in Claude Code:\n\n```text\n> /plugin marketplace add Agents365-ai/pi-plugin-cc\n> /plugin install pi@agents365-pi\n> /reload-plugins\n> /pi:setup\n```\n\n`/pi:setup` returns a readiness report and offers to install Pi for you if it's missing and `npm` is on PATH.\n\n## Usage\n\n```text\n> /pi:review\n> /pi:review --base main\n> /pi:adversarial-review focus on the new auth middleware\n> /pi:rescue investigate why the Windows CI build is failing\n> /pi:rescue --background refactor src/payments/ to remove the polling loop\n> /pi:status\n> /pi:status task-mpgyiwb9-e3k641 --wait\n> /pi:result task-mpgyiwb9-e3k641\n> /pi:cancel task-mpgyiwb9-e3k641\n```\n\n`--effort <off|minimal|low|medium|high|xhigh>` is passed through to Pi via `set_thinking_level`. Models that don't support thinking silently ignore it.\n\n## Configure DeepSeek\n\nThe minimum config is just an env var — Pi ships built-in DeepSeek models:\n\n```bash\nexport DEEPSEEK_API_KEY=sk-your-key-here\n```\n\nFor a full custom config, write `~/.pi/agent/models.json`:\n\n```json\n{\n \"providers\": {\n \"deepseek\": {\n \"apiKey\": \"sk-your-deepseek-key\"\n },\n \"openai\": {\n \"apiKey\": \"sk-your-openai-key\"\n },\n \"openrouter-deepseek\": {\n \"api\": \"openai-completions\",\n \"apiKey\": \"sk-or-v1-...\",\n \"baseUrl\": \"https://openrouter.ai/api/v1\",\n \"models\": [\n {\n \"id\": \"deepseek/deepseek-chat\",\n \"name\": \"DeepSeek (via OpenRouter)\",\n \"contextWindow\": 128000,\n \"maxTokens\": 8192,\n \"input\": [\"text\"]\n }\n ]\n }\n }\n}\n```\n\nSee [pi providers docs](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md) for every supported provider and field.\n\n## Stop-time review gate\n\nOpt in with `/pi:setup --enable-review-gate`. When a Claude session ends, the plugin runs a Pi adversarial review of the previous turn and can block the stop if it finds material issues. Disable with `/pi:setup --disable-review-gate`.\n\n## 🔗 Related projects\n\n| Project | Niche | When to use |\n|---|---|---|\n| [codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | Same surface, runs Codex | When you want OpenAI's Codex agent + ChatGPT auth |\n| [pi (earendil-works)](https://github.com/earendil-works/pi) | The coding agent this plugin drives | If you want to use Pi directly without Claude Code |\n| [pi-subagents](https://github.com/nicobailon/pi-subagents) | Pi extension adding `subagent` tool + `/run` / `/chain` / `/parallel` | Lets `/pi:rescue` delegate to specialized child agents |\n\n## 💬 Community\n\n- **Discord:** https://discord.gg/79JF5Atuk\n- **WeChat:** scan the QR code below\n\n<p align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/agents365ai_wechat_1.png\" width=\"200\" alt=\"WeChat Community Group\">\n</p>\n\n## ❤️ Support\n\nIf this plugin helps you, consider supporting the author:\n\n<table>\n <tr>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/wechat-pay.png\" width=\"180\" alt=\"WeChat Pay\">\n <br>\n <b>WeChat Pay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/alipay.png\" width=\"180\" alt=\"Alipay\">\n <br>\n <b>Alipay</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/qrcode/buymeacoffee.png\" width=\"180\" alt=\"Buy Me a Coffee\">\n <br>\n <b>Buy Me a Coffee</b>\n </td>\n <td align=\"center\">\n <img src=\"https://raw.githubusercontent.com/Agents365-ai/images_payment/main/awarding/award.gif\" width=\"180\" alt=\"Give a Reward\">\n <br>\n <b>Give a Reward</b>\n </td>\n </tr>\n</table>\n\n## 👤 Author\n\n**Agents365-ai**\n\n- GitHub: https://github.com/Agents365-ai\n- Bilibili: https://space.bilibili.com/441831884\n\n## 📄 License\n\n[Apache License 2.0](LICENSE). Forked from [`codex-plugin-cc`](https://github.com/openai/codex-plugin-cc) (Apache-2.0, OpenAI) — see [NOTICE](NOTICE).\n"}}}}