You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Proposing native Pi coding agent integration, similar to the existing Claude Code and Gemini CLI agents, and the in-progress OpenCode integration (#220).
Why Pi?
Pi is one of the fastest-growing coding agent CLIs right now:
npm downloads exploding: ~4k/week in Dec 2025 → 1.3M/week by late Jan 2026 (300x growth in ~6 weeks)
207 published versions across 4 months — extremely active development cadence (multiple releases per week)
Rapidly expanding user base that would benefit from Entire session tracking
How Extensible Pi Is (Implementation Feasibility)
Pi makes this integration straightforward due to its architecture:
JSONL Session Format (Same as Claude Code)
Pi stores sessions as JSONL at ~/.pi/agent/sessions/--<path>--/<timestamp>_<uuid>.jsonl. Each line is a typed JSON entry with id/parentId fields forming a tree. The format is well-documented (session.md) and closely parallels Claude Code's JSONL transcript format — meaning the existing ChunkJSONL/ReassembleJSONL utilities, transcript position tracking, and modified file extraction patterns all transfer directly.
TypeScript Extension System for Hooks
Pi has a rich extension API with lifecycle events that map cleanly to Entire's hook model:
Entire Hook
Pi Extension Event
Notes
session_start
session_start
Direct 1:1
session_end / stop
session_shutdown / agent_end
agent_end fires per-prompt; session_shutdown on exit
user_prompt_submit
before_agent_start
Provides event.prompt
pre_tool_use
tool_call
Can inspect tool name + input
post_tool_use
tool_result
Has result content + details
InstallHooks() would generate a .pi/extensions/entire.ts file that subscribes to these events and calls entire hooks pi <verb> via pi.exec() — the same bridge pattern used in the OpenCode integration (#220) with its .opencode/plugins/entire.js.
Extensions Are Auto-Discovered
Pi auto-discovers extensions from .pi/extensions/*.ts (project-local) or ~/.pi/agent/extensions/*.ts (global). TypeScript runs without compilation via jiti. No config file modification needed — just drop the file and it works on next session start. This makes InstallHooks()/UninstallHooks() trivially clean (create/delete a single .ts file).
Rich Session Metadata
Pi's session entries include:
Token usage with cost breakdowns per assistant message
Model/provider info on every response
Tool call arguments and results with structured details
Compaction summaries, branch summaries, labels
bashExecution messages with command, output, exit code
This means ReadSession() can extract rich checkpoint metadata (modified files from write/edit tool results, token usage aggregation, etc.).
Key difference from Claude/Gemini: Pi's JSONL is a tree, not a flat log. ParseTranscript() would need to resolve the leaf, walk parentId chain to root, and produce a linear conversation. This is a well-defined operation — Pi's own buildSessionContext() does exactly this.
Notes
Happy to implement this. Wanted to open an issue first to gauge interest and get architectural feedback before writing Go code.
The OpenCode PR (Add OpenCode agent integration #220) establishes the extension-bridge pattern — would be good to see how that lands before/alongside this, since they share the same approach.
Pi's .pi/extensions/ auto-discovery means zero friction for users: entire enable --agent pi generates one file, done.
Summary
Proposing native Pi coding agent integration, similar to the existing Claude Code and Gemini CLI agents, and the in-progress OpenCode integration (#220).
Why Pi?
Pi is one of the fastest-growing coding agent CLIs right now:
How Extensible Pi Is (Implementation Feasibility)
Pi makes this integration straightforward due to its architecture:
JSONL Session Format (Same as Claude Code)
Pi stores sessions as JSONL at
~/.pi/agent/sessions/--<path>--/<timestamp>_<uuid>.jsonl. Each line is a typed JSON entry withid/parentIdfields forming a tree. The format is well-documented (session.md) and closely parallels Claude Code's JSONL transcript format — meaning the existingChunkJSONL/ReassembleJSONLutilities, transcript position tracking, and modified file extraction patterns all transfer directly.TypeScript Extension System for Hooks
Pi has a rich extension API with lifecycle events that map cleanly to Entire's hook model:
session_startsession_startsession_end/stopsession_shutdown/agent_endagent_endfires per-prompt;session_shutdownon exituser_prompt_submitbefore_agent_startevent.promptpre_tool_usetool_callpost_tool_usetool_resultInstallHooks()would generate a.pi/extensions/entire.tsfile that subscribes to these events and callsentire hooks pi <verb>viapi.exec()— the same bridge pattern used in the OpenCode integration (#220) with its.opencode/plugins/entire.js.Extensions Are Auto-Discovered
Pi auto-discovers extensions from
.pi/extensions/*.ts(project-local) or~/.pi/agent/extensions/*.ts(global). TypeScript runs without compilation via jiti. No config file modification needed — just drop the file and it works on next session start. This makesInstallHooks()/UninstallHooks()trivially clean (create/delete a single.tsfile).Rich Session Metadata
Pi's session entries include:
detailsbashExecutionmessages with command, output, exit codeThis means
ReadSession()can extract rich checkpoint metadata (modified files fromwrite/edittool results, token usage aggregation, etc.).Proposed Implementation
New package:
cmd/entire/cli/agent/pi/pi.goPiAgentstruct —Agentinterface, session read/write, presence detection (.pi/dir)hooks.goHookSupport+HookHandler— generate/remove.pi/extensions/entire.tsbridgetranscript.gotypes.goKey difference from Claude/Gemini: Pi's JSONL is a tree, not a flat log.
ParseTranscript()would need to resolve the leaf, walkparentIdchain to root, and produce a linear conversation. This is a well-defined operation — Pi's ownbuildSessionContext()does exactly this.Notes
.pi/extensions/auto-discovery means zero friction for users:entire enable --agent pigenerates one file, done.