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

オープン
#166 コメント 3 件 リアクション 3 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

  • #175 @talbananaz による — マージされずにクローズ

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
5.6k
フォーク
344
平均マージ
14時間 41分
マージ済み PR(30日)
54

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/TokenEconomizer のほかの issue

microsoft/TokenEconomizer の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。