feat(discovery): discover OMP session transcripts in the pi adapter - #150
MrGTV-love wants to merge 7 commits into
Conversation
omp (Oh My Pi) writes the same version:3 JSONL session format as pi under
~/.omp/agent/sessions/, but prepends a fixed-width {type:"title"} record so
the {type:"session", cwd} entry is line 2, and nests subagent transcripts
one level deeper at <escaped-cwd>/<session-id>/<Name>.jsonl.
- Add ~/.omp/agent/sessions as a default nested store root (omp honors
PI_CODING_AGENT_DIR, so an env redirect still dedupes against it).
- classify() scans the first head lines for the session entry instead of
requiring it on line 1.
- enumerate() descends one extra level inside nested roots.
- read() accepts model_change.model as a fallback for modelId.
…nest OMP subagents
…gnore graft cache
|
| ), | ||
| ]), | ||
| ].filter(Boolean), | ||
| domain: priors.some((observation) => observation.domain !== "orchestration") ? "project" : "orchestration", |
There was a problem hiding this comment.
Later domain vote is lost When a parent’s project-domain sighting and a subagent’s later orchestration-domain sighting are migrated into one ledger key, this line chooses project because any prior sighting was project-domain. The later run should replace the earlier vote; instead, an orchestration gap can become eligible for a repository proposal.
Knowledge Base Used: Memory resolution and folding
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| graft/.cache/ | ||
|
|
||
| # graft's local graph cache — regenerable, not committed (run `graft build`). | ||
| /graft/ |
There was a problem hiding this comment.
Entire graft tree ignored
/graft/ ignores the whole tree, overriding the narrower cache-only rule above it. This violates the accepted requirement to retain only the tracked graft/.cache/ ignore rule while excluding generated cards and graph output from commits. The repository requirement must be satisfied before merging.
| /graft/ |
Context Used: If there is a VISION.md file at the root of the repo, the PR must not conflict / diverge / drift from it. If the PR description has an "Intent" section, respect that as the accepted user intent. - Do make comments if anything in the implementation ... (source)
|
Speaking as Kun's firstmate. Reviewed head contract-class: new-default (same class as #151) — always-on CI: required checks green on this HEAD — CI 36055330313, Guard 36055330053, no-mistakes 36055329721. Greptile fail — not a gate (repo does not use Greptile). Status: superseded by sibling #151 (live help / captain-decision candidate). Leaving this PR open and untouched per your request — not closing as stale. No further firstmate action here unless captain lands a different overlap (#129 / #151) or you ask to revive this branch. |
Intent
Discover OMP session transcripts in the Pi adapter and preserve parent/subagent identity through analysis, folding, and remote discovery. Parent and subagent files remain separately discoverable/analyzable but share the root parent's corroboration identity; selected legacy gap-ledger observations migrate to that identity, and cached child relationships refresh when an ancestor session appears or changes. Discover second-level nested OMP subagents and resolve their full ancestry to the root. Preserve fold admission by overlaying only parentSessionId, corroborationIdentity, corroborationNativeId, and corroborationStartedAt; legacy evidence without its stored interaction stamp remains excluded. Migrate legacy ledger IDs only when their identity is unambiguous. Remove synthetic chain re-queue behavior only with a real nested-discovery regression test proving root identity and old per-file ledger observations converge. Keep shared parent/subagent domain voting order-independent, with project evidence taking precedence as normalization already requires. Document ~/.omp/agent/sessions/ and root-parent sharing in README and AGENTS.md. User-authorized decisions: project evidence wins for observations sharing a root identity in one run, regardless of input order, with later-run replacement preserved and both orders tested; add ~/.omp/agent/sessions/ to AGENTS.md; retain cacheVersion as adapter-semantic invalidation independent of file/dependency fingerprints; keep OMP subagents non-interactive when parentSessionId exists. For publication, retain the tracked graft/.cache/ ignore rule, exclude generated graft cards and .graph output from every commit, and verify exact target-main..HEAD contains no graft/ paths or prohibited cache blob IDs.
What Changed
~/.omp/agent/sessions/. It handles OMP's leadingtitlerecord and themodelfield onmodel_changeentries. It also finds subagent JSONL files up to two levels deep and resolves each one to its root parent session. The adapter bumpscacheVersionand exportscacheDependency, a fingerprint of the ancestor session files. A cached child entry is classified again when an ancestor session appears or changes. Local discovery, the remote SSH probe, and pi usage recovery all share one per-scan parent-header cache.corroborationIdentity(a newcorroborationIdentityOfinsrc/transcript.js). This shared identity drives harm and non-compliance session counts, gap sightings, and evidence source labels (gapSource), so a session and its subagents never count as separate sessions.foldForRuncopies only the current discovery'sparentSessionIdandcorroborationIdentity/NativeId/StartedAtonto admitted evidence. Records without a stored interaction stamp stay excluded. The newnormalizeGapLedgerSessionsmoves old per-file ledger keys to the root identity, but only for legacy ids that map to exactly one identity. When observations share a root identity in one run, project evidence wins over orchestration evidence, whatever the input order. OMP subagents (any transcript with aparentSessionId) are always non-interactive.README.mdandAGENTS.mddocument the OMP store path, nested subagents, and root-parent sharing..gitignoreand the new.ignorekeep the localgraft/graph cache out of commits. New tests and anomp-session.jsonlfixture cover: adapter discovery, nested ancestry, cache invalidation, ledger migration, domain order, fold overlay, interaction classification, and remote discovery.Risk Assessment
Testing
I ran the real backpass CLI end to end in isolated temp HOMEs and repos. A fake acpx took the place of the model only. Scenarios driven live: nested OMP discovery with a child in a different cwd; root-identity corroboration with and without an independent session; cache refresh when an ancestor appears or changes; upgrade from the older per-file build, where the ledger converges; order-independent domain voting and later-run replacement; git object checks for the graft publication guard. All live scenarios passed. Three scenarios are untested live: the SSH-host scenario used a fake ssh transport because no real SSH host was available; legacy-evidence exclusion was checked only by unit tests; docs were checked only by reading the diff. The 6 test files this change touched pass (131 tests). Temp dirs were removed and the worktree is clean. This change has no UI, so there are no screenshots.
backpass scanwith an OMP root, a child whose cwd is a repo subdirectory, and a second-level grandchild under ~/.omp/agent/sessions/: all 3 are listed separately, and child and grandchild…Evidence: S1 scan of nested OMP tree
Evidence: S2 propose: tree + independent session = sessions=2
Evidence: S3 OMP tree alone is not corroborated
Evidence: S4 cache refresh on ancestor appear/change
Evidence: S5 old build ledger converges on upgrade
Evidence: S6 shared domain vote order-independent
Evidence: S6b later run replaces vote
Evidence: S7 remote host OMP tree
Evidence: S8 graft publication guard
Evidence: Docs additions (README/AGENTS.md)
~/.no-mistakes/evidence/01M3AF6JSKAXX5M7RJEN7C9CTY/targeted-tests.txt)Evidence: Live driver script
Evidence: Upgrade-path summary
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 2 issues found → auto-fixed ✅
src/discovery/adapters/pi.js:198- The parent link needs the ancestor headercwdto equal the subagent headercwd. The file path alone already proves the ancestry (<cwd>/<sid>/<Name>.jsonl). Example: an OMP subagent that runs in another cwd, such as a subdirectory or an isolated worktree that still maps to this repo. Its file sits under the root session dir, but the loop skips every ancestor. Result: the subagent gets no parentSessionId. It becomes its own corroboration root, is labelled interactive, and can count as a second independent session toward minGapEvidence and the harm floor. That breaks the README promise at README.md:240 that "a session and its subagents cannot count as independent sessions". I could not confirm from the source how OMP records a subagent's cwd. Decision needed: link on path layout alone, or keep the cwd gate and soften the README/AGENTS wording.src/gap-ledger.js:291- Simplification.normalizeGapLedgerSessionscopies the prior-merge logic fromrecordGapObservations(lines 219-229): it collects priors from the identity key and its aliases, takes the earliest validfirstObservedAt, carries forwardcoveredBySkill, and deletes the aliases. Move the shared part into one helper, for examplemergePriors(entry, sessionIdentity, aliases), that returns priors and earliestFirstObservedAt. Then the two re-key paths cannot drift apart. Behavior does not change.🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
backpass scanwith an OMP root, a child whose cwd is a repo subdirectory, and a second-level grandchild under ~/.omp/agent/sessions/: all 3 are listed separately, and child and grandchild…node drive.mjs <wt> <work> setup root child grand indep && node drive.mjs <wt> <work> scan(realbackpass scan --harness pi --since all --json)backpass analyze --harness pi --since all --analysis-agent pi --jobs 1 --json+backpass propose --harness pi --since all --analysis-agent pi --synthesis-agent pi --min-gap-evidence 2with a root + child + grandchild + an independent Pi session; I then read .backpass/gap-ledger.json and the synthesis prompt sent to the fake modelBreak test: the same propose run with only the 3 OMP files (no independent session)Cache refresh: 4backpass scanruns (root absent → root added → root header id rewritten → no change)Upgrade path: ran the680ecc6build (per-file identity, extracted withgit archiveto /tmp), then the HEAD build, on the same repo and ledger (s5.sh)Domain vote:s6.shwith root:orch+child, root+child:orch, and root:orch+child:orch;s6b.shchecks that a later run replaces the voteRemote:node s7-remote.mjs <wt>runs realbackpass scan/analyze/proposewith host mac-home from the personal config and the repo's fake ssh transportgit rev-list --objects origin/main..HEADchecked against every graft/.graph blob in all refs;git log --name-only origin/main..HEAD -- graft .graph;git check-ignore -v --no-index graft/.cache/x.jsonnode --test test/adapters.test.js test/analyze-reuse.test.js test/fold.test.js test/gap-ledger.test.js test/interaction.test.js test/remote-discovery.test.js(only the test files this change touched: 131 pass)Read-only check of the real ~/.omp/agent/sessions layout on this machine (headers only): title line first, subagents at <sid>/<Name>.jsonl, grandchildren at <sid>/<Name>/<Name>.<Child>.jsonl, and nothing deeper.gitignore:9- Two uncommitted changes were already in the worktree before this phase:.gitignoreadds/graft/, and.ignoreis a new untracked file. This phase did not create or touch them. The user decided the tracked .gitignore keeps onlygraft/.cache/, so leave both files out of every commit.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.