feat: add Oh My Pi support

TH
3mo ago
+1057-9

Problem

Oh My Pi sessions were invisible to continues. OMP stores session transcripts as JSONL under $PI_CODING_AGENT_DIR/sessions/ (default ~/.omp/agent/sessions/), but there was no parser, registry entry, fixture, or cross-tool handoff path for it.

That meant starting work in OMP and handing it off to Codex, Claude, Gemini, OpenCode, etc. lost the entire session.

Before

$ continues list --source omp
# omp was not a supported source

After

$ continues list --source omp --json -n 1
[
  {
    "source": "omp",
    "cwd": "/Users/kd-m2air/Local",
    "summary": "Add OMP support",
    "model": "openai-codex/gpt-5.5",
    "originalPath": "/Users/kd-m2air/.omp/agent/sessions/...jsonl"
  }
]

And OMP sessions can now generate normal handoff markdown:

# Session Handoff Context

## Session Overview
| Source | Oh My Pi |
| Session ID | `019f6a82-...` |
| Working Directory | `~/Local` |
| Session File | `~/.omp/agent/sessions/...jsonl` |

## Recent Conversation
...

## Tool Activity
...

## Session Origin
This session was extracted from **Oh My Pi** session data.

What changed

Added OMP as the 17th supported tool.

New parser support:

  • Discovers OMP .jsonl sessions from $PI_CODING_AGENT_DIR/sessions/*/*.jsonl
  • Defaults to ~/.omp/agent/sessions/
  • Extracts session id, cwd, repo, title/summary, model, created/updated timestamps
  • Keeps lightweight session ordering based on the latest OMP metadata updatedAt
  • De-dupes duplicate session ids by newest updatedAt

New handoff data extracted:

  • User/assistant/system conversation messages
  • Tool execution start/result pairs by toolCallId
  • Shell/read/write/edit/grep/glob/search/MCP tool summaries via SummaryCollector
  • Modified files from write/edit activity
  • Model/provider metadata
  • Token usage, cache tokens, thinking tokens
  • Thinking level configuration
  • Session lifecycle events
  • Timeline events for messages, tool calls, tool results, and exits

CLI integration:

  • Adds omp to TOOL_NAMES
  • Registers OMP in src/parsers/registry.ts
  • Exports parseOmpSessions / extractOmpContext
  • Adds native resume display/args: omp --resume <id>
  • Adds cross-tool handoff support with positional prompt argument

Docs and metadata:

  • README supported-tool table now includes Oh My Pi
  • README storage table documents $PI_CODING_AGENT_DIR/sessions/
  • Package description mentions Oh My Pi
  • CHANGELOG has an Unreleased OMP entry

Technical approach

  • Follows the existing parser contract: parseOmpSessions() and extractOmpContext().
  • Uses shared JSONL helpers instead of loading session files wholesale.
  • Uses scanJsonlHead for cheap metadata discovery and readJsonlFile only during full context extraction.
  • Uses SummaryCollector and existing summarizer helpers instead of OMP-specific markdown formatting.
  • Treats unknown/malformed records conservatively: skip what cannot be parsed, keep the session usable.
  • Adds a regression test for lightweight recency because continues list/pick/quick-resume can use source indexes built without full transcript scans.

Files changed

File / areaPurpose
src/parsers/omp.tsNew OMP parser and handoff extractor.
src/parsers/registry.tsRegister OMP source, storage path, native resume, and cross-tool args.
src/types/tool-names.tsAdd omp to supported tool names and source union.
src/parsers/index.tsExport OMP parser functions.
src/__tests__/omp-parser.test.tsOMP discovery, extraction, and lightweight recency regression tests.
src/__tests__/fixtures/index.tsSanitized OMP fixture factory.
src/__tests__/unit-conversions.test.tsAdd OMP to source/target conversion matrix.
src/__tests__/schemas.test.tsUpdate supported-tool schema expectations.
README.md, CHANGELOG.md, package.jsonUser-facing OMP support docs/metadata.

Testing

Automated checks:

  • corepack pnpm@10 run build
  • corepack pnpm@10 test
    • 29 test files passed
    • 984 tests passed
    • 2 skipped
  • npx -y node@22 node_modules/vitest/vitest.mjs run
    • verifies the suite under the CI Node 22 runtime
    • 29 test files passed
    • 984 tests passed
    • 2 skipped

E2E smoke against real local OMP data:

  • npm run dev -- scan --rebuild
    • found OMP sessions
  • npm run dev -- list --source omp --json -n 1
    • returned a real OMP session from ~/.omp/agent/sessions/...jsonl
  • npm run dev -- resume 019f6a82 -i codex --debug-prompt --no-tui
    • generated a Codex handoff from an OMP session

Review pass:

  • Ran an internal reviewer pass before opening the PR.
  • Reviewer found one correctness issue: lightweight OMP indexing could order sessions by stale timestamps.
  • Added a failing regression test first, then fixed timestamp handling to keep updatedAt monotonic.

Risks / reviewer focus

  1. OMP schema drift — parser is tolerant, but new record shapes may need follow-up coverage.
  2. Tool result pairing — tool summaries depend on tool_execution_start and later toolResult messages sharing toolCallId; missing results still produce conservative summaries.
  3. Native resume contract — assumes omp --resume <id> is the right CLI shape.
  4. Cross-tool prompt contract — assumes OMP accepts the handoff prompt as a positional message argument.

Follow-ups

  • Add parser-documentation pages for OMP storage/message/tool-call formats if this repo wants docs parity with older tools.
  • Add live sanitized OMP fixture samples if the project prefers fixtures copied from real sessions over synthetic records.

Summary by cubic

Adds Oh My Pi (OMP) as a first-class source: we discover, parse, and extract handoffs from OMP JSONL sessions and support native resume. This brings supported tools to 17 and updates docs accordingly.

  • New Features

    • OMP session discovery and parsing from $PI_CODING_AGENT_DIR/sessions/ (default ~/.omp/agent/sessions/), with lightweight recency ordering.
    • Context extraction: recent messages, tool calls/results, model notes, token/cache usage, thinking level, and lifecycle; handoff markdown and timeline included.
    • Registry/CLI integration: new omp source with list/inspect/dump; native resume via omp --resume <id> and cross-tool handoff.
    • Tests and fixtures: new omp fixtures and parser tests; e2e/unit paths updated across sources.
    • Docs and metadata updated (README.md, CHANGELOG.md, package.json); minor lint and import path cleanups.
  • Migration

    • No changes required. Optionally set PI_CODING_AGENT_DIR; otherwise the default ~/.omp/agent/sessions/ is used.
    • Try it: continues list --source omp -n 1 and continues resume <id> -i codex