Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,15 @@ surface.
### More adapters

Beyond the hosts above, Better Harness also supports Qwen Code, Pi, Kimi Code,
WorkBuddy, and Grok. Their exact install, invocation, and evidence boundaries
live in the docs so this README stays focused:
WorkBuddy, and Grok. Their exact install, invocation, and
evidence boundaries live in the docs so this README stays focused:

- **Qwen Code** — [installation guide](docs/docs/installation.mdx#qwen-code)
(`qwen extensions install QoderAI/better-harness`).
- **Pi** — [Host Adapter Matrix](docs/docs/hosts/adapter-matrix.md#pi)
(`pi install <source>` or `pi -e <source>`).
(`pi install <source>` or `pi -e <source>`). The same adapter reads
[Oh My Pi (OMP)](docs/docs/hosts/adapter-matrix.md#oh-my-pi-omp) sessions when
`PI_CODING_AGENT_DIR` points at an OMP agent directory.
- **Kimi Code** — [Host Adapter Matrix](docs/adapters/README.md)
(`.kimi-plugin/plugin.json` plugin install).
- **WorkBuddy** — [Host Adapter Matrix](docs/docs/hosts/adapter-matrix.md#workbuddy).
Expand Down
4 changes: 3 additions & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,9 @@ Grok。它们确切的安装、调用与证据边界都放在文档里,以保
- **Qwen Code** —— [安装指南](docs/docs/installation.mdx#qwen-code)
(`qwen extensions install QoderAI/better-harness`)。
- **Pi** —— [宿主适配器矩阵](docs/docs/hosts/adapter-matrix.md#pi)
(`pi install <source>` 或 `pi -e <source>`)。
(`pi install <source>` 或 `pi -e <source>`)。当 `PI_CODING_AGENT_DIR` 指向 OMP
的 agent 目录时,同一适配器也能读取
[Oh My Pi (OMP)](docs/docs/hosts/adapter-matrix.md#oh-my-pi-omp) 会话。
- **Kimi Code** —— [宿主适配器矩阵](docs/adapters/README.md)
(`.kimi-plugin/plugin.json` 插件安装)。
- **WorkBuddy** —— [宿主适配器矩阵](docs/docs/hosts/adapter-matrix.md#workbuddy)。
Expand Down
13 changes: 13 additions & 0 deletions docs/adapters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,19 @@ edit host settings, or register an `apply` path.
discovers the canonical root `skills/` directory and the `prompts/`
templates through the `pi` manifest in `package.json`; that manifest is
install/discovery metadata and does not own Pi evidence collection.
- Oh My Pi (OMP) is a session layout of the `pi` platform, not a host of its own:
it has no host id, capability profile, install shell, or lifecycle target here.
Pointing `PI_CODING_AGENT_DIR` at `~/.omp/agent` makes both the Pi
configured-asset provider and `scripts/session-analysis/platforms/pi.mjs` read
that tree. OMP names session directories relative to the home directory
(`-src-dotai` for `~/src/dotai`) alongside pi's absolute `--<slug>--` form, and
prefixes its JSONL transcripts with a `title` record before the session header;
the adapter skips that preamble while still rejecting any other pre-header
record fail-closed. An OMP `/fork` transcript carries a copy of its parent's
entries and a `parentSession` id: those entries are attributed to the parent
only when the parent session is discovered in the same result, so they are
counted exactly once and never dropped silently. Boundaries and acceptance
scenarios live in `docs/specs/2026-09-04-omp-session-format-compat.md`.
- Kimi Code configured assets are inventoried through
`scripts/agent-customize/providers/kimi.mjs`: user-level
`~/.kimi-code/skills/**/SKILL.md` and `~/.kimi-code/mcp.json`, plus
Expand Down
20 changes: 19 additions & 1 deletion docs/docs/hosts/adapter-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ remains the complete capability-level source of truth.
| Cursor | Verified Quickstart | Canvas-capable source-local host | `.cursor-plugin/` | Workspace-matched transcripts, metadata, audit logs, and optional native Context Usage snapshots; partial coverage stays explicit | Cursor Canvas report |
| Qwen Code | Verified Quickstart | Analysis-capable source-local host | `qwen-extension.json` | Workspace-matching local Qwen transcripts when present | Self-contained HTML + Markdown |
| GitHub Copilot | Verified Quickstart | Analysis-capable source-local host | `.github/plugin/` | Workspace-matched Copilot CLI transcripts; partial coverage stays explicit | Self-contained HTML + Markdown |
| Pi | Adapter support | Analysis-capable source-local host | `pi` manifest in `package.json` | Workspace-matching local Pi sessions | Self-contained HTML + Markdown |
| Pi | Adapter support | Analysis-capable source-local host | `pi` manifest in `package.json` | Workspace-matching local Pi sessions, including the Oh My Pi (OMP) session layout | Self-contained HTML + Markdown |
| Kimi Code | Adapter support | Analysis-capable source-local host | `.kimi-plugin/plugin.json` | Workspace-matching Kimi wire transcripts | Self-contained HTML + Markdown |
| WorkBuddy | Adapter support | Analysis-capable source-local host | None; skills use WorkBuddy-owned paths | Workspace-matching WorkBuddy JSONL transcripts | Self-contained HTML + Markdown |
| Grok | Adapter support | Analysis-capable source-local host | None; skills use Grok-owned paths | Workspace-matching Grok session dirs (`updates.jsonl`) | Self-contained HTML + Markdown |
Expand Down Expand Up @@ -122,6 +122,24 @@ workspace-matched session evidence, and portable HTML routing are implemented.
Pi remains outside the verified Quickstart set until a complete interactive
report-loop smoke is observed.

### Oh My Pi (OMP) {#oh-my-pi-omp}

Oh My Pi (OMP) is not a separate host adapter: it is a session layout the `pi`
platform recognizes when `PI_CODING_AGENT_DIR=~/.omp/agent` points at an OMP
agent directory. OMP has no host id, capability profile, install shell, or
lifecycle target of its own.

OMP keys session directories on the home-relative workspace path (`~/src/dotai` →
`-src-dotai`) instead of pi's absolute `--<slug>--` form, and its JSONL
transcripts start with a `title` record before the session header. The Pi adapter
reads both naming conventions and skips that preamble while keeping pi's
fail-closed header rule and workspace isolation. An OMP `/fork` transcript copies
its parent's entries; those entries count as the parent's only when the parent
session is discovered in the same result, so nothing is double-counted and nothing
silently disappears. Session evidence and portable HTML routing come from the
shared Pi provider, and configured assets are inventoried by the Pi provider
because it honors the same `PI_CODING_AGENT_DIR` override.

### Kimi Code {#kimi-code}

Kimi Code installs the repository through `/plugins install <source>` and the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Better Harness 当前声明了十个能力层宿主适配器,其中六个已
| Cursor | 已验证快速开始 | 支持 Canvas 的源码本地宿主 | `.cursor-plugin/` | 工作区匹配的转录、元数据、审计日志和可选原生 Context Usage 快照;部分覆盖保持显式标注 | Cursor Canvas 报告 |
| Qwen Code | 已验证快速开始 | 具备分析能力的源码本地宿主 | `qwen-extension.json` | 匹配当前工作区的本地 Qwen 转录(存在时) | 自包含 HTML + Markdown |
| GitHub Copilot | 已验证快速开始 | 具备分析能力的源码本地宿主 | `.github/plugin/` | 工作区匹配的 Copilot CLI 转录;部分覆盖保持显式标注 | 自包含 HTML + Markdown |
| Pi | 适配器支持 | 具备分析能力的源码本地宿主 | `package.json` 中的 `pi` manifest | 匹配当前工作区的本地 Pi 会话 | 自包含 HTML + Markdown |
| Pi | 适配器支持 | 具备分析能力的源码本地宿主 | `package.json` 中的 `pi` manifest | 匹配当前工作区的本地 Pi 会话,包含 Oh My Pi (OMP) 会话布局 | 自包含 HTML + Markdown |
| Kimi Code | 适配器支持 | 具备分析能力的源码本地宿主 | `.kimi-plugin/plugin.json` | 匹配工作区的 Kimi wire 转录 | 自包含 HTML + Markdown |
| WorkBuddy | 适配器支持 | 具备分析能力的源码本地宿主 | 无;Skill 使用 WorkBuddy 自有路径 | 匹配工作区的 WorkBuddy JSONL 转录 | 自包含 HTML + Markdown |
| Grok | 适配器支持 | 具备分析能力的源码本地宿主 | 无;Skill 使用 Grok 自有路径 | 匹配工作区的 Grok 会话目录(`updates.jsonl`) | 自包含 HTML + Markdown |
Expand Down Expand Up @@ -76,6 +76,20 @@ Pi 可以通过 `pi install <source>` 安装本仓库,或使用 `pi -e <source
HTML 路由均已实现。在观察到完整交互式报告闭环冒烟验证前,Pi 仍不进入已验证
快速开始集合。

### Oh My Pi (OMP) {#oh-my-pi-omp}

Oh My Pi (OMP) 不是独立的宿主适配器,而是 `pi` 平台能识别的一种会话布局:将
`PI_CODING_AGENT_DIR=~/.omp/agent` 指向 OMP 的 agent 目录即可。OMP 在本仓库里
没有自己的 host id、能力画像、安装 Shell 或生命周期目标。

OMP 以相对 home 目录的工作区路径命名会话目录(`~/src/dotai` → `-src-dotai`),
而不是 pi 的绝对路径 `--<slug>--` 形式,并且在会话头之前先写一条 `title` 记录。
Pi 适配器同时识别两种命名约定并跳过该前置记录,同时保留 pi 的 fail-closed
会话头规则与工作区隔离。OMP 的 `/fork` 转录会复制父会话的全部条目:只有当父
会话也在同一次发现结果中时,这些条目才计入父会话,因此既不会重复计数,也不会
静默丢失。会话证据与可移植 HTML 路由均来自共享的 Pi provider;已配置资产也由 Pi
provider 清点,因为它遵循同一个 `PI_CODING_AGENT_DIR` 覆盖项。

### Kimi Code {#kimi-code}

Kimi Code 通过 `/plugins install <source>` 和 `.kimi-plugin/plugin.json`
Expand Down
110 changes: 110 additions & 0 deletions docs/specs/2026-09-04-omp-session-format-compat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Spec: Oh My Pi session format compatibility in the Pi adapter

## Traceability

- **Spec ID:** OMP-01
- **Story:** none; maintainer-approved review follow-up on PR #143
- **Status:** implemented

## Intent

Oh My Pi (OMP) is a fork of Pi that shares the session transcript schema but
diverges in three observable ways. The Pi session adapter should read OMP session
trees when it is pointed at an OMP agent directory, without loosening any of the
workspace-isolation guarantees the Pi adapter already makes.

OMP is not a new host adapter: it has no host id, no capability profile, no
install shell, and no lifecycle target of its own. It is a recognized session
layout for the existing `pi` platform, reached with
`PI_CODING_AGENT_DIR=~/.omp/agent`.

## Observed OMP divergences

| Divergence | Pi | OMP |
| --- | --- | --- |
| Session directory name | absolute slug `--Users-ooxx-src-dotai--` | home-relative slug `-src-dotai` |
| JSONL preamble | first record is the `session` header | a `title` record precedes the header |
| Session forking | not observed | `/fork` copies every parent entry into a new file carrying `parentSession` |

## Acceptance scenarios

- **AC-1 — Home-relative discovery.** A workspace under the home directory
resolves an additional `homeExact` variant (`~/src/dotai` → `-src-dotai`), and
a session directory with that name is discovered.
- **AC-2 — Bounded home-relative prefix.** Subdirectory session directories match
through `homePrefix` only across a separator boundary (`-src-dotai-packages-app`
matches, `-src-dotaix` does not). A workspace whose only prefix-similar sibling
has sessions reports its source root as absent.
- **AC-3 — Non-home workspaces unchanged.** A workspace outside the home
directory exposes no home-relative variant, and the absolute `exact`/`prefix`
contract is byte-identical to before.
- **AC-4 — Foreign-platform slug integrity.** A Windows-shaped workspace string
keeps its drive letter on every host (`C:\workspace\project` →
`--C--workspace-project--`) and never resolves against the host cwd. Only a
host-native absolute path is eligible for a home-relative variant.
- **AC-5 — Title preamble.** Leading `title` records are skipped when locating
the session header. Any other non-`session` record before the header still
rejects the transcript fail-closed, and a second `session` header still rejects
the whole file.
- **AC-6 — Fork deduplication.** When a fork's `parentSession` is also discovered
in the same result, entries stamped before the fork point are read as the
parent's and excluded from the fork, so each entry is counted once.
- **AC-7 — Orphan fork retention.** When the parent is not in the discovery
result, the fork keeps its inherited entries: nothing else owns them, so
dropping them would silently lose evidence.
- **AC-8 — Time range agreement.** A session's reported `firstSeen`/`lastSeen`
always covers exactly the entries it yields, whether or not the fork cutoff
applies.

## Design

`workspaceToPiSessionDirVariants` keeps the absolute slug derivation untouched
and adds `homeExact`/`homePrefix` when the workspace is a host-native absolute
path under the home directory. Slug normalization and home-relative derivation
read different inputs on purpose: the slug body keeps `path.win32` handling so a
Windows-shaped workspace string survives on a POSIX host, while the
home-relative body needs the host-native path because a foreign-platform path can
never be home-relative.

`probeTranscript` records `parentSessionId`, `forkTimestamp`, and a second
"owned" time range that excludes inherited entries. `discoverSessions` collects
every probe first, then decides per file whether the fork cutoff applies, because
the parent may be probed after its fork. The cutoff is stored on the source ref
rather than the session, so a session with several transcripts cannot leak one
file's cutoff onto another. `isInheritedForkEntry` is shared by discovery and
`readSession` so the reported time range and the yielded events cannot disagree.

## Non-goals

- Adding OMP to `scripts/host-support` as a distinct host id or capability
profile.
- An OMP install shell, plugin manifest, or npm-packaged host artifact.
- Promoting OMP into the verified Quickstart set.
- Detecting an OMP agent directory automatically; the operator points at it with
`PI_CODING_AGENT_DIR`.

## Risks

- The `parentSession` field name and the header-timestamp-as-fork-point rule come
from observed OMP transcripts, not a published schema. If OMP renames the field,
fork deduplication silently stops applying and forks report inherited entries
again — the fail-open direction, which over-counts rather than loses evidence.
- Fork deduplication compares timestamps. An inherited entry without a timestamp,
or one sharing the fork millisecond, stays with the fork.

## Test evidence

`test/sessions/session-analysis-providers.test.mjs`:

- `Pi derives OMP home-relative session directory names with a bounded prefix` (AC-1, AC-2, AC-3)
- `Pi discovers OMP home-relative session directories and skips the title preamble` (AC-1, AC-5)
- `Pi keeps a sibling OMP workspace out of the home-relative prefix match` (AC-2)
- `Pi discovers OMP subdirectory session dirs under the home-relative prefix` (AC-2)
- `Pi counts OMP inherited fork entries once when the parent session is discovered` (AC-6, AC-8)
- `Pi retains OMP inherited fork entries when the parent session is absent` (AC-7, AC-8)
- `Claude, Cursor, and Qwen workspace slugs cover Unix and Windows layouts` (AC-4)
- `Pi provider requires one authoritative first session header` (AC-5)

Each new assertion was mutation-checked: reverting the prefix boundary, the
`path.win32` slug handling, or the parent-existence condition fails exactly the
test that covers it.
Loading