Skip to content

Add Pi code agent integration #161

@jcleira

Description

@jcleira

Summary

Add support for capturing sessions from Pi code, an AI coding agent, so Partio can checkpoint Pi-driven commits alongside Claude Code ones.

Inspired by entireio/cli#811.

What to implement

Add a Pi code agent detector in internal/agent/ following the existing Claude Code pattern:

  • Detect a running Pi process via process list scan (look for pi or pi-mono binary)
  • Locate Pi session/transcript files (research ~/.pi/ or similar per Pi's docs)
  • Parse Pi transcript format into SessionData fields: Prompt, Context, TokensUsed
  • Register the detector so partio enable --agent pi installs the appropriate hooks

The implementation should follow the same Detector interface defined in internal/agent/detector.go and mirror the structure of internal/agent/claude/.

Why

Pi is an actively developed AI coding agent. Users running Pi to write code should be able to capture those sessions in Partio just like Claude Code sessions. Without this, Pi users get no checkpoint trailers and lose the AI reasoning history for their commits.

User Relevance

Pi users who adopt Partio expect it to work with their toolchain. Missing agent support means silent failures — hooks run, commits complete, but no checkpoint is linked and no session is preserved. Supporting Pi makes Partio usable for a broader set of AI-assisted development workflows.

Target Repos

  • cli

Context Hints

  • internal/agent/ — Detector interface and agent package structure
  • internal/agent/claude/ — Reference implementation to mirror
  • cmd/partio/enable.go — Where agent flag is parsed and hooks installed

Acceptance Criteria

  • partio enable --agent pi succeeds and installs hooks
  • partio status shows the Pi agent as configured
  • Pre-commit hook detects a running Pi process and saves state
  • Post-commit hook reads Pi session data and creates a checkpoint
  • Table-driven tests cover process detection and transcript parsing
  • If Pi is not running, Partio falls back gracefully (no checkpoint, no error)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions