Support omp (oh-my-pi) sessions: history import and host detection

Open
#166 3 comments 3 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@tal32123 is already working on this.

Since Nov 10, 2026.

  • #175 by @talbananaz — closed without merging
  • #196 by @tal32123 — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python

Research direction

Read trace/pi.py and plugin/hosts.py, then inspect the existing Pi host history and detection paths. The issue names omp's session directory and log differences, but host detection still needs a discriminator from omp's hook environment. A linked pull request is already open; completion would include importing converted sessions with source mtimes and tests for title-prefixed logs and ignored non-message entries.

Written by the indexing model from the issue text.

Description

Problem. Running under omp (it loads Claude Code plugins and sets CLAUDE_PLUGIN_ROOT), the plugin reports host claude and te history import finds nothing: ClaudeCode.history() only reads ~/.claude/projects, while omp keeps sessions in ~/.omp/agent/sessions/<cwd-folder>/<timestamp>_<id>.jsonl.

The omp log is Pi-style (tree of id/parentId entries, toolCall/toolResult, same usage fields), with two differences:

  • the first line is {"type":"title",...}, so pi_session_header (which only checks entry 0) returns {};
  • extra entry types (custom, custom_message, developer, credential_pin, model_change, ...) that must be ignored.

Proposal.

  1. trace/pi.py: make pi_session_header scan the first few entries for type == "session"; have pi_session_to_claude write timestamp and cwd on user lines (needed by claude_log_head / history import).
  2. plugin/hosts.py: add Omp(Pi) with keeps_history = True and a history() that lists omp's session dir, converting each log with pi_session_to_claude into a cache under state_root() (keep the source mtime so the "recent"/"too_old" filters work). Register in HOSTS; add omp to --host.
  3. Host detection: pick omp rather than claude when running under omp (needs a discriminator from omp's hook env; I haven't confirmed which var).
  4. Tests: fixture omp log starting with a title line; assert history lists it and pi_prompt_count ignores non-message entries.

Verified locally with a minimal patch of 1 + a history() hook on ClaudeCode: te history import --dry-run went from nothing to "2 earlier session(s) would be read", and te status showed +2 from earlier history, 44 prompts. Happy to send a PR for 1, 2, 4 if the approach is acceptable; 3 needs maintainer input.

Dominant language
Python
Stars
5.6k
Forks
344
Avg merge
17h 41m
Merged PRs (30d)
73

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/TokenEconomizer

All issues in microsoft/TokenEconomizer

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.