pi-claude2pi

pi extension: import Claude Code sessions (~/.claude/projects) into pi as native, resumable pi sessions

Packages

Package details

extension

Install pi-claude2pi from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-claude2pi
Package
pi-claude2pi
Version
0.1.0
Published
Aug 28, 2026
Downloads
149/mo · 149/wk
Author
x2s2
License
MIT
Types
extension
Size
25.8 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-claude2pi

pi extension that imports Claude Code session transcripts (~/.claude/projects/**/*.jsonl) into pi as native, resumable pi sessions — pick up a Claude Code conversation and keep chatting in pi.

一个 pi 插件:把 Claude Code 的会话记录转换导入为 pi 原生会话,在 pi 里直接继续对话。

Install

pi install npm:pi-claude2pi

Or try it without installing:

pi -e npm:pi-claude2pi

Requires pi (the AI coding agent).

Usage

Command Description
/claude2pi List Claude Code sessions for the current project, pick one to import
/claude2pi all List sessions across all projects
/claude2pi <path.jsonl> Import a specific transcript file

Flow: pick a session → converted → written as a genuine pi session via pi's own SessionManager (ids, parent chain and session directory always valid) → pi switches to it → the whole history is visible and you can continue chatting.

What gets converted

  • Tree → active path: Claude transcripts are parentUuid trees (abandoned branches, retries). Only the active path from the last message back to the root is imported.
  • Split assistant lines merged: Claude splits one API response into several JSONL lines sharing the same message.id (thinking line, tool_use line…). They are merged into a single pi assistant message.
  • Tool calls paired: tool_usetoolCall, tool_resulttoolResult (tool name lookup, is_error mapping, base64 images). Interrupted calls get a synthetic (interrupted) result so the imported history stays API-valid.
  • Noise skipped: subagent sidechains, retry notices, attachments, file-history snapshots, <local-command-stdout>, <system-reminder>.
  • Summaries: top-of-file summary entries (previous-session summaries) become a context message; inline compact summaries are kept as user messages.
  • Metadata: stop_reason, token usage and timestamps are mapped; the provider is recorded as claude-code (display only — new replies use whatever model you select in pi). Thinking blocks are kept, Anthropic signatures are dropped so switching models never breaks signature validation.

中文说明

安装pi install npm:pi-claude2pi

使用:在 pi 中执行 /claude2pi(当前项目会话)、/claude2pi all(所有项目)、 或 /claude2pi <文件路径>。导入完成后 pi 会自动切换到新会话,历史完整可见,直接继续对话。

历史较长时 pi 会按正常逻辑自动压缩上下文,也可以导入后立即 /compact

License

MIT