feat(pi): auto-detect oh-my-pi (omp) sessions by sgfeniex · Pull Request #1338 · ccusage/ccusage · GitHub
Skip to content

feat(pi): auto-detect oh-my-pi (omp) sessions#1338

Open
sgfeniex wants to merge 1 commit into
ccusage:mainfrom
sgfeniex:feat/pi-omp-support
Open

feat(pi): auto-detect oh-my-pi (omp) sessions#1338
sgfeniex wants to merge 1 commit into
ccusage:mainfrom
sgfeniex:feat/pi-omp-support

Conversation

@sgfeniex

@sgfeniex sgfeniex commented Jun 18, 2026

Copy link
Copy Markdown

oh-my-pi (omp) is a widely used pi fork that writes identical JSONL session files with the same message.usage schema.

Auto-detect ~/.omp/agent/sessions alongside ~/.pi/agent/sessions when neither --pi-path nor PI_AGENT_DIR is set, so omp users get usage reports without having to pass --pi-path manually.

Both directories are scanned and entries are deduplicated by the loader; setting PI_AGENT_DIR or --pi-path overrides detection and scans only the given paths.

Closes #1193


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.


Summary by cubic

Auto-detect ~/.omp/agent/sessions alongside ~/.pi/agent/sessions so oh-my-pi users get usage reports without setting --pi-path or PI_AGENT_DIR.

  • New Features
    • When neither --pi-path nor PI_AGENT_DIR is set, scan both default dirs; overrides scan only the provided paths.
    • Loader deduplicates entries across sources.
    • Docs updated in the getting started guide and pi guide; added tests for detection logic.

Written for commit c0241a9. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added automatic discovery of oh-my-pi (omp) session directories alongside pi-agent sessions.
    • The tool now auto-scans both ~/.pi/agent/sessions and ~/.omp/agent/sessions when custom paths are not specified.
  • Documentation

    • Updated guides to document auto-detection of both pi-agent and oh-my-pi session directories.
    • Enhanced troubleshooting documentation with default session directory scan locations.

oh-my-pi (omp) is a widely used pi fork that writes identical JSONL
session files with the same message.usage schema. Auto-detect
~/.omp/agent/sessions alongside ~/.pi/agent/sessions when neither
--pi-path nor PI_AGENT_DIR is set, so omp users get usage reports
without having to pass --pi-path manually. Both directories are scanned
and entries are deduplicated by the loader; setting PI_AGENT_DIR or
--pi-path overrides detection and scans only the given paths.

Closes ccusage#1193

Signed-off-by: Stefan Giroux <stefan.g@feniex.com>
@pullfrog

pullfrog Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: eca49007-e55a-4bb8-873b-3693e9834046

📥 Commits

Reviewing files that changed from the base of the PR and between 02843ad and c0241a9.

📒 Files selected for processing (4)
  • docs/guide/getting-started.md
  • docs/guide/pi/index.md
  • rust/crates/ccusage/src/adapter/pi/README.md
  • rust/crates/ccusage/src/adapter/pi/paths.rs

📝 Walkthrough

Walkthrough

Adds ~/.omp/agent/sessions as a second auto-detected default session directory in the pi adapter alongside ~/.pi/agent/sessions. A new default_session_dirs() helper and DEFAULT_SESSION_DIRS constant replace the previous single hardcoded path probe. Documentation in the adapter README, pi guide, and getting-started troubleshooting guide is updated accordingly.

Changes

OMP Auto-Detection for Pi Adapter

Layer / File(s) Summary
DEFAULT_SESSION_DIRS constant, helper, and call site
rust/crates/ccusage/src/adapter/pi/paths.rs
Adds DEFAULT_SESSION_DIRS constant listing .pi/agent/sessions and .omp/agent/sessions, introduces default_session_dirs(home: &Path) that maps those relative paths to absolute paths and filters to directories that exist, replaces the single hardcoded probe in paths with a call to this helper, and adds unit tests for all four presence combinations (both, only OMP, only PI, neither).
Documentation updates
rust/crates/ccusage/src/adapter/pi/README.md, docs/guide/pi/index.md, docs/guide/getting-started.md
Updates the adapter README, pi guide data source table, and getting-started troubleshooting entry to document that both ~/.pi/agent/sessions and ~/.omp/agent/sessions are auto-detected when no override is provided.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Two paths through the warren I sniff and I find,
.pi and .omp — no session left behind!
A constant declared, a helper so neat,
Filters the ones that exist on the beat.
Oh-my-pi users, rejoice and be glad —
No more "no data found" making you sad! 🎉

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot closed this Jun 18, 2026
@ryoppippi ryoppippi reopened this Jun 21, 2026
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.

Feat: Add OMP Directory Support

2 participants