Skip to content

Feature/pi agent#155

Merged
marcus merged 4 commits intomarcus:mainfrom
gregzuro:feature/pi-agent
Feb 16, 2026
Merged

Feature/pi agent#155
marcus merged 4 commits intomarcus:mainfrom
gregzuro:feature/pi-agent

Conversation

@gregzuro
Copy link
Contributor

This adds the plain-old pi-agent as an adapter (conversations) and as an agent (workspaces).

Since pi-agent works differently in its stand-alone release as compared to the openclaw one, it seemed like a separate implementation was in order.

For conversations, this is basically the pi (openclaw) version melded with session handling a la Claude Code.

All the adapter patterns were followed, tests and doc updated.

I've live-exercised it a bit, but would appreciate some input from someone with more sidecar experience.

-G

Add support for standalone pi-agent sessions stored in ~/.pi/agent/sessions/.
This complements the existing 'pi' adapter which handles openclaw-embedded pi.

Key differences from openclaw pi:
- Per-project directory structure (like Claude Code)
- Path encoding: /path/to/project → --path-to-project--
- Project-specific watch scope (not global)

Implementation:
- Reuses pi package types (same JSONL format)
- Full message parsing with tool result linking
- Incremental parsing for append-only growth
- Session categorization (interactive, cron, system)

Identity: pi-agent / Pi Agent / π
- Add AgentPi constant and entries in all agent maps (types.go)
- Add detectPiSessionStatus for session file detection (agent_session.go)
- Pi stores sessions in ~/.pi/agent/sessions/--{path}--/*.jsonl
- Update README.md and website docs with Pi Agent support
- Add AgentPi to TestGetAgentCommand, TestShouldShowSkipPermissions,
  and TestBuildAgentCommand tables
- Add TestDetectPiSessionStatus_* tests for session file detection
boozedog added a commit to boozedog/sidecar that referenced this pull request Feb 14, 2026
@boozedog
Copy link
Contributor

boozedog commented Feb 14, 2026

Your changes are working great in my testing.

One small addition that would enable the resume feature from the conversations plugin:

internal/plugins/conversations/view_content.go - add to resumeCommand():

case "pi-agent", "pi":
    return fmt.Sprintf("pi --session %s", session.ID)

internal/plugins/conversations/resume_modal.go - add to defaultAgentIdxForAdapter():

case "pi-agent", "pi":
    agentType = workspace.AgentPi

Without these, pressing resume on a pi session shows "Resume not supported for Pi Agent".

Example of this in my fork: boozedog@4d41eb4

@marcus
Copy link
Owner

marcus commented Feb 16, 2026

Hey @gregzuro — this looks great, thanks for putting it together! We already have the pi adapter for the OpenClaw-integrated version, so it's nice that you built this as a separate piagent adapter for the standalone Pi Agent — makes sense given the different session paths.

One thing before we merge: @boozedog flagged that resume support is missing for Pi sessions (see their comment on PR #155). Would you mind folding in those two small additions?

// internal/plugins/conversations/view_content.go — resumeCommand()
case "pi-agent", "pi":
    return fmt.Sprintf("pi --session %s", session.ID)

// internal/plugins/conversations/resume_modal.go — defaultAgentIdxForAdapter()
case "pi-agent", "pi":
    agentType = workspace.AgentPi

That way both adapters get resume support in one shot. Once that's in, we're good to merge. 🪶

@gregzuro
Copy link
Contributor Author

Would you mind folding in those two small additions?

Sure will. JAS.

- Map pi-agent and pi adapter IDs to AgentPi in resume modal
- Add resume command format for pi sessions (pi --session <id>)
- Fix minor whitespace alignment in renderSourceLabel
@gregzuro
Copy link
Contributor Author

Added. Ready to go. Thanks @boozedog

@marcus marcus merged commit dddcb88 into marcus:main Feb 16, 2026
@marcus
Copy link
Owner

marcus commented Feb 16, 2026

Thanks @gregzuro! 🎉 This is shipped in v0.74.0. Great work on the Pi Agent adapter — clean implementation that follows all the existing patterns perfectly.

@gregzuro gregzuro deleted the feature/pi-agent branch February 17, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants