Skip to content

[cloud-push] Pi adapter: research first, then conversation continuity #18

@Zeus-Deus

Description

@Zeus-Deus

Context

Pi is one of the agents Codemux already integrates (visible in the agent picker tab bar alongside Claude, Codex, OpenCode, Gemini). Like the others, it currently launches on a remote pushed workspace with a fresh conversation — no history continuity.

Pi CLI is installed locally — use it for research

The user (@Zeus-Deus) has the Pi CLI installed on their machine. The agent picking up this issue can:

  1. Run `pi --help` (and any subcommands) directly to learn the CLI surface
  2. Start a Pi session, send a message, then poke around for where it stored conversation state (`/.pi`, `/.config/pi`, etc.)
  3. Find the resume command and the session id format empirically
  4. Supplement with online research (Pi project repo, docs site) as needed

Post research findings as a comment on this issue before writing the adapter code.

Required research questions

  1. What command launches Pi? Confirm by checking `src-tauri/src/agent_provider/` and `src-tauri/src/commands/presets.rs` — what's the actual binary name and preset command Codemux uses today?
  2. Where does Pi store conversation history? Run a session, then find new/modified files under `~/`. Document the path pattern (per-project? cwd-encoded? single DB?)
  3. What's the resume invocation? `pi --resume `, `pi chat resume`, interactive-only, or something else?
  4. How to capture the session id locally? Hooks, output scanning, file watching, or polling whatever store Pi uses?

Acceptance criteria

  • Push workspace with a Pi pane → conversation continues on remote
  • Pull back → conversation continues on laptop
  • 3+ push/pull cycles preserve full history

(OR if Pi doesn't expose session resume: document the limitation in `docs/features/remote-hosts.md` and close without implementation.)

Implementation pattern

Mirror what PR #15 did for Claude (commit `495f62f`):

  1. Sync helper in `src-tauri/src/commands/hosts.rs` — file rsync if Pi is per-project file-based (like Claude), DB extract+merge if Pi is single-DB (like OpenCode in issue [cloud-push] OpenCode conversation sync via SQLite extract+merge #16)
  2. Register a Pi adapter in `src-tauri/src/session_adapters.rs` (only `claude-code` exists today, around line 115)
  3. Session-id capture via whatever mechanism Pi exposes — emit to `adapter_captures["pi_session_id"]` on the active `TerminalSessionSnapshot`
  4. Remote-relaunch branch in `src-tauri/src/terminal/daemon_backed.rs` (around line 488–573) that builds the correct `pi --resume` invocation

References

Out of scope

Estimate

Research: 30 min (Pi CLI is already installed; just probe + read).
Implementation: 2 hours if file-based, half-day if DB-based.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions