Skip to content

feat(trace): support Pi coding agent sessions #3520

Description

@waveywaves

Design

Problem / use case

Chainloop Trace can capture coding sessions from Claude Code, Cursor, and OpenCode, but not from Pi. Work produced with Pi therefore cannot provide native Chainloop AI coding-session evidence and currently needs the skip-ai-session bypass.

Pi exposes project-local TypeScript extensions, session lifecycle events, tool-call events, and persisted JSONL v3 session files. Those capabilities are sufficient for a native Trace provider without changing Pi itself.

Expected outcome

  • chainloop trace init --pi and chainloop trace run --pi install Pi support alongside the existing providers.
  • Chainloop installs one marked, project-local Pi extension, refuses unrelated content at the same path, and removes only its own file during uninstall.
  • Pi session start, shutdown, write, edit, and bash events feed the existing Trace hook pipeline without blocking agent work.
  • The provider copies Pi's persisted session JSONL before parsing it and emits the existing AI coding-session evidence type.
  • Pi session trees, model/provider metadata, token usage, tool counts, and conversation counts are represented without changing the control-plane API or attestation schema.
  • Pi receives the full session instruction once, the Spec 003 reminder on every user turn, and post-push links through UI or headless stderr.
  • Pi reuses the existing tool_use_id; file snapshots adopt the same per-call correlation already used by command snapshots. Existing provider defaults and external behavior remain unchanged.

Constraints

  • Follow the repository's spec-first process before implementation.
  • Do not require a Pi fork or a separately published Pi package.
  • Keep the generated extension functional in interactive, RPC, JSON, and print modes without writing arbitrary output to Pi's stdout.
  • Treat missing transcripts, abrupt process termination, and legacy or unknown JSONL fields as best-effort conditions that must not block Pi or a Git push. Hook children use a 60-second timeout, then SIGTERM with five seconds of grace before SIGKILL.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions