pi-migrate converts Claude Code plugin repositories into native Pi packages.
It is designed for agent-native migration work: it copies compatible resources, converts MCP servers into deterministic CLI bridges, writes package-level instructions, flags partial/failed migrations, and generates a verification prompt for a follow-up agent.
Local development:
npm link
pi install /path/to/pi-migrateOr run directly:
node ./bin/pi-migrate.mjs --helpDefault command migrates the source:
pi-migrate {gh-repo|url|local} [--name <pkg>] [--out <dir>] [--install] [--force]Examples:
pi-migrate tirth8205/code-review-graph --name code-review-graph-pi --force
pi-migrate https://github.com/tirth8205/code-review-graph --install
pi-migrate ./local-claude-plugin --name local-plugin-pi
pi-migrate verify ~/.pi/agent/packages/code-review-graph-piskills/,.claude/skills/→pi.skillscommands/,.claude/commands/,prompts/→pi.promptsagents/,.claude/agents/→pi.agents(via@fractary/pi-claude-codeandpi-subagents), with Claude Code model aliases translated to Pi-available models (opus→gpt-5.5,sonnet→deepseek-v4-pro,haiku→deepseek-v4-flash)extensions/→pi.extensionsCLAUDE.md,.claude/CLAUDE.md,AGENTS.md→ packageAGENTS.md.mcp.json→mcportergenerated CLI bridges in packagebin/, plusdocs/MCP_CLI_FALLBACK.mdfor directmcpCLI discovery/debugging- safe Claude Code command hooks from settings → Pi extension hooks, including lifecycle mappings for
SessionEnd,UserPromptSubmit, andPostToolUseFailure - non-Claude hook manifests (
.github/hooks/*.json,.codex/hooks.json,.cursor/hooks.json,.gemini/settings.json, etc.) → preserved underdocs/source-hooks/and flagged for explicit native-Pi behavior verification - migration status →
MIGRATION_REPORT.md - follow-up verification/repair prompt →
VERIFY_WITH_AGENT.md
Pi does not expose MCP tools natively. pi-migrate therefore converts MCP servers with:
mcporter generate-cli --server <server> --compile <package>/bin/<server>-mcpMigrated skills are patched with deterministic CLI bridge instructions. When bridge generation fails, or when you need to explore a server before hardening a bridge, the generated package includes docs/MCP_CLI_FALLBACK.md with mcp tools, mcp tools --format json, and mcp call <tool> --params '<json>' examples derived from .mcp.json.
Claude Code hooks that map cleanly to Pi are translated into TypeScript extensions:
| Claude event | Pi event |
|---|---|
SessionStart |
session_start |
PreToolUse |
tool_call |
PostToolUse |
tool_result |
PostToolUseFailure |
tool_result with failure detection |
UserPromptSubmit |
before_agent_start |
SessionEnd / Stop |
session_shutdown |
Hooks that call project-local agent scripts such as .claude/hooks/* or .cursor/* are skipped and reported as partial because packaged Pi extensions should not depend on source-repo-local hook paths.
A successful migration means the plugin's normal behavior works for Pi, not merely that Pi can load copied resources. pi-migrate therefore flags source-level gaps when it detects provider/model layers, CLI binaries, or per-agent config generators. It must not assume Claude Code model aliases, tool names, hook events, slash-command semantics, or other bespoke Claude Code functions are available in Pi. These require runtime adaptation, for example:
- provider adapters should inherit Pi's default provider/model/auth instead of requiring separate API keys;
- agent frontmatter should use Pi-available model identifiers, not raw Claude aliases;
- setup/init flows should accept
piwhere they accept other agent targets; - generated outputs should land in Pi-compatible locations such as global
~/.pi/agentpackage resources or projectAGENTS.md/.agents/skills/.
Known adapter: Caliber (caliber-ai-org/ai-setup) receives bin/caliber-pi, bin/pi, and bin/opencode shims so caliber status reports provider pi and caliber init --agent pi maps to Pi-compatible output.
The generated VERIFY_WITH_AGENT.md instructs a follow-up agent to inspect the report first, test only generated bridges and partial failures, repair in-place, and abduct reusable improvements back into the CLI.
Every verification pass is also instructed to:
- Extract compact learnings from migration surprises.
- Append them to
MIGRATOR_LEARNINGS.mdin the pi-migrate package. - Update
pi-migrate.mjs,README.md, orskills/pi-migrate/SKILL.mdwhen the learning is generalizable. - Rerun
pi-migrate verify. - Commit and push if the migrator root is in a git repository with a configured remote; otherwise report the exact git commands needed.
This keeps the migrator self-improving instead of only fixing the one generated package.
The command is named generically because future versions should migrate additional agent ecosystems:
- Codex
AGENTS.mdpackages - Gemini CLI extensions
- OpenCode plugins
- Cursor/Windsurf rules
- other agent apps and extension bundles
- Node.js 20+
gitpimcporterfor MCP bridge generation- recommended:
@fractary/pi-claude-code,pi-subagents