rtk-ai/rtk

feat(discover): support Pi (shop-pi-fy) session format

Open

#1583 opened on Apr 28, 2026

View on GitHub
 (1 comment) (1 reaction) (0 assignees)Rust (48,085 stars) (2,914 forks)batch import
effort-smallenhancementgood first issue

Description

Summary

rtk discover only scans ~/.claude/projects/ (Claude Code sessions). It misses sessions from Pi (shop-pi-fy), Shopify's internal AI coding assistant built on the Claude API.

Impact

Pi users running rtk discover always see:

Scanned: 0 sessions (last 30 days), 0 Bash commands
Already using RTK: 0 commands (0.0%)

...even when rtk gain shows thousands of commands and significant savings. This makes rtk discover useless for Pi users, and the "missed savings" it reports are misleading — those commands are already being handled by Pi's rtk-rewrite extension.

Implementation

The SessionProvider trait is already set up for this. Pi uses the same JSONL format as Claude Code, just at a different path:

  • Claude Code: ~/.claude/projects/<encoded-path>/<session-id>.jsonl
  • Pi: ~/.pi/agent/sessions/<encoded-path>/<session-id>.jsonl

The encoding scheme is slightly different (Pi uses -- as separator vs -), but the JSONL structure — type: assistant with tool_use Bash blocks, type: user with tool_result blocks — is identical.

Adding a PiProvider implementing SessionProvider should be straightforward, reusing the existing ClaudeProvider::extract_commands logic almost verbatim.

Note on Pi's rtk-rewrite extension

Pi's extension rewrites commands transparently (e.g. git statusrtk git status) before they hit the shell, so the JSONL already contains the rewritten rtk commands. A Pi-aware rtk discover would correctly show these as "already using RTK" rather than missed savings.

Contributor guide