Add Pi (pi.dev) agent harness support + shared derive layer#17
Merged
Add Pi (pi.dev) agent harness support + shared derive layer#17
Conversation
Two new crates: - toolpath-derive (0.1.0): shared derivation layer that converts a provider-agnostic toolpath-convo::ConversationView into a toolpath::v1::Path. Centralizes the turn→step mapping so future providers produce consistent output; toolpath-claude will migrate onto it in a follow-up. - toolpath-pi (0.1.0): read Pi (pi.dev) coding-agent session JSONL logs from ~/.pi/agent/sessions/, implement ConversationProvider, and derive Toolpath Path documents. Preserves Pi's in-file conversation tree (id/parentId) as a DAG in the output Path and follows parentSession links across session files. CLI: `path derive pi` and `path list pi` subcommands, matching the shape of the existing claude/git/github commands. Tests: 30 + 132 + 3 new tests in the new crates + CLI, all passing. Workspace-wide totals unchanged-everything-else; clippy clean on new and modified code.
|
🔍 Preview deployed: https://50054a6c.toolpath.pages.dev |
Collaborator
Author
Collapses the separate toolpath-derive crate into toolpath-convo so the provider-agnostic ConversationView → toolpath::v1::Path mapping lives alongside the types it consumes. Callers now use toolpath_convo::derive_path and toolpath_convo::DeriveConfig directly. - toolpath-convo 0.5.0 → 0.6.0; gains a toolpath workspace dep and a new derive module with all 30 existing derive tests. - toolpath-pi drops its toolpath-derive dependency; re-exports DeriveConfig from toolpath-convo. - toolpath-derive crate removed from the workspace. - release.sh: toolpath-convo moves from tier 1 to tier 2 (now has a workspace dep on toolpath). toolpath is the sole tier-1 crate. - CLAUDE.md, README.md, CHANGELOG.md, site data, and release script updated accordingly. 791 tests passing, no clippy warnings on new/modified code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds support for deriving Toolpath provenance documents from Pi coding-agent session logs, and introduces a new shared derivation layer that future conversation providers will build on.
toolpath-derive(new, 0.1.0) — shared derivation:toolpath_convo::ConversationView→toolpath::v1::Path. Centralizes the turn→step mapping so every provider produces consistent output.toolpath-claudeis not migrated in this PR; that's a follow-up so we can validate the shared layer on Pi first.toolpath-pi(new, 0.1.0) — read Pi JSONL session files from~/.pi/agent/sessions/, implementConversationProvider, and derive ToolpathPathdocuments. Preserves Pi's in-file conversation tree (id/parentId) as a DAG in the output Path, and followsparentSessionlinks across session files.path derive piandpath list pi, matching the shape of the existingclaude/git/githubsubcommands.What the new crates do
toolpath-pilayout:types.rs— Pi v3 session schema as typed serde enums with forward-compatextramaps on every structpaths.rs—PathResolverfor~/.pi/agent/sessions/--<encoded-cwd>--/reader.rs— JSONL parser, tree reconstruction via id/parentId, boundedparentSessionchain-followingio.rs— filesystem enumeration (list_projects,list_sessions)provider.rs—ConversationProviderimpl, tool classification, bash-execution synthesis, tool-result correlation viatoolCallIdderive.rs— thinPiSession → ConversationView → toolpath_derive::derive_pathwrapperlib.rs—PiConvomanager (default~/.pi/agent/sessions/, configurable viawith_resolver)toolpath-derive:derive_path(view, config)withDeriveConfig { base_uri, path_id, title, include_thinking, include_tool_uses }FileWritetools uses a fixed field-name preference list:file_path,path,filename,filePathMeta/step extrasUsage
--base DIRoverrides the default~/.pi/agent/sessions/on both commands.Design decisions worth flagging
watcherfeature parallel totoolpath-claude's can be added later.toolpath-pi's provider; the shared derive consumes pre-classifiedToolCategoryonly. Keeps the shared layer agnostic of provider tool names/casing.<session-id>:<entry-id>when merged so they can't collide with child-session IDs.toolpath-claudeunchanged. Migration ontotoolpath-deriveis a separate PR.Test plan
All green:
cargo test --workspace— 220 existing + 185 new tests, 0 failurestoolpath-derive: 30 unit + 1 doctoolpath-pi: 123 unit + 9 integration + 3 doctoolpath-cli: +11 Pi tests (137 total, up from 126)cargo clippy -p toolpath-derive -p toolpath-pi --all-targets -- -D warnings— cleancargo clippy -p toolpath-cli --bin path -- -D warnings— cleanpath derive pi --help/path list pi --helprender correctlypath derive piagainst a real~/.pi/agent/sessions/directory (reviewer can try)Release-checklist updates
Per
CLAUDE.md's rules for adding new crates, this PR updates:Cargo.toml(workspace members +[workspace.dependencies])CLAUDE.md(repository layout, dependency graph, CLI examples, testing section, "Things to know")README.md(workspace listing)site/_data/crates.json+site/pages/crates.mdscripts/release.sh(tier-2 publish order:toolpath-derivebeforetoolpath-pi)CHANGELOG.mdFollow-ups (not in this PR)
toolpath-claudeontotoolpath-derive(separate PR; must preserve or justify snapshot deltas).watchermodule mirroringtoolpath-claude).