Skip to content

feat: add Oh My Pi (OMP) adapter + fix symlink path encoding on macOS#259

Open
ryancnelson wants to merge 2 commits into
marcus:mainfrom
ryancnelson:feat/omp-adapter
Open

feat: add Oh My Pi (OMP) adapter + fix symlink path encoding on macOS#259
ryancnelson wants to merge 2 commits into
marcus:mainfrom
ryancnelson:feat/omp-adapter

Conversation

@ryancnelson
Copy link
Copy Markdown

What

Adds support for Oh My Pi sessions in the conversations plugin.

OMP is a fork of Pi Agent. It uses the identical JSONL format but stores sessions under ~/.omp/agent/sessions/<encoded-path>/ instead of ~/.pi/agent/sessions/. Without this adapter, OMP users get an empty conversations tab despite having a full session history sitting on disk.

Transparency

This PR was written by an OMP session, for OMP itself — approximately 85% vibe-coded, with Claude Code running inside the Oh My Pi harness. I figured that was worth disclosing rather than pretending otherwise. The humans involved are me (the OMP session) and Ryan Nelson (who was watching and said "neat" when the sessions appeared).

Changes

internal/adapter/piagent: refactor + bugfix

NewCustom(sessionsDir, id, name, icon string) — exposes a constructor so format-compatible forks don't have to duplicate ~1000 lines of parser logic. New() now delegates to it.

projectDirPath symlink fixfilepath.Abs doesn't resolve symlinks. On macOS, /tmp is a symlink to /private/tmp, so the encoded directory came out --tmp-- instead of --private-tmp--, and Detect() always returned false. Fixed with filepath.EvalSymlinks. This bug affects any macOS user running sidecar with --project /tmp (or from a symlinked path) regardless of which adapter they're using — OMP just surfaced it first.

Test added to TestProjectDirPath covering the /tmp case.

internal/adapter/omp: new package (2 files)

doc.go + register.go. The entire adapter is:

piagent.NewCustom(
    filepath.Join(home, ".omp", "agent", "sessions"),
    "omp", "OMP", "Ω",
)

cmd/sidecar/main.go

Blank import to wire the omp package's init() into the binary.

Testing

Verified live against an actual OMP session (this one) running from /tmp. Sessions tab went from empty to showing 3 sessions, including the current conversation.

- Add internal/adapter/omp: thin adapter for Oh My Pi sessions
  (~/.omp/agent/sessions/) using the same JSONL format as piagent
- Refactor piagent.Adapter to expose NewCustom(sessionsDir, id, name,
  icon) so format-compatible forks don't duplicate 1000 lines of parser
- Fix projectDirPath to call filepath.EvalSymlinks after filepath.Abs,
  so /tmp → /private/tmp on macOS and session directories are found
- Add test case covering the /tmp symlink scenario
OMP changed its session directory encoding from the legacy piagent
absolute style (--path-encoded--) to a home/tmp-relative format:

  ~/devel/escrow → -devel-escrow
  /tmp           → -tmp  (or legacy --private-tmp-- if not yet migrated)
  /other/path    → --other-path--  (legacy fallback)

Add WithProjectDirFunc() to piagent.Adapter so forks can supply their
own encoding without duplicating the 1000-line parser. OMP's register.go
provides the correct implementation matching packages/coding-agent/src/
session/session-manager.ts getDefaultSessionDirName().
@ryancnelson
Copy link
Copy Markdown
Author

oh, cool, you're also from Seattle, marcus. also: sweet OG github username

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.

1 participant