feat(discovery): discover OMP session transcripts in the pi adapter - #151
MrGTV-love wants to merge 10 commits into
Conversation
|
|
Speaking as Kun's firstmate. Reviewed head Diff (high level): Pi adapter default scan adds VISION per-rule
contract-class: new-default — unconfigured Security: clean. Local read-only discovery; CI: fork workflows approved. Required checks green on this HEAD — CI ubuntu+macos 36060341084, Guard 36060341386, no-mistakes 36060341142 (attestation matches Hold: waiting on captain, not on the author. Auto-merge is blocked solely by the new-default decision. Flagging for Firstmate/captain merge-or-not. Overlap: #129 (mdc2122, narrower adapter-only) stays open until captain lands one; #150 stamped superseded by this PR. |
| if (config?.discovery?.includeOmp === true) { | ||
| specs.push({ path: home(".omp", "agent", "sessions"), direct: false, nested: true }); | ||
| } |
There was a problem hiding this comment.
OMP sessions skipped by default
An ordinary Pi scan does not visit ~/.omp/agent/sessions/ because discovery.includeOmp defaults to false. Users with OMP transcripts must discover and enable that setting before their sessions appear. This conflicts with the stated intent to discover the OMP store through the Pi adapter.
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)
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!
| - **backpass must never analyze itself**: keep `SELF_SESSION_SENTINEL` (`src/prompts.js`) at the start of every | ||
| model-facing prompt (`src/discovery/self.js` drops those sessions). | ||
| - **Gap evidence**: one ledger sighting per (gap, transcript) (`src/gap-ledger.js`); record before pruning; | ||
| never surface uncorroborated singletons; gap identity is judged by the consolidation call, with bigram |
There was a problem hiding this comment.
The replacement guidance omits both ~/.omp/agent/sessions/ and the fact that parent and nested subagent files share the root corroboration identity. The stated intent requires both to be documented in AGENTS.md as well as README.md. Maintainers relying on this file lose that discovery and evidence-counting guidance, so this repository requirement must be met before merging.
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)
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
5287c0d to
8afb786
Compare
|
Speaking as Kun's firstmate. Re-triaged head Diff (high level, vs main VISION per-rule
contract-class: opt-in — Security: clean. Local read-only discovery; no secrets/egress/workflow edits in the three-dot delta. CI help done this pass
Author blocker (blocking): no-mistakes attestation still binds to Notes: Sibling #150 remains the dirty-history twin — leave it; #151 stays the live path. #129 closed-stale earlier. Intent mentioned AGENTS.md OMP docs; tip documents the opt-in in README only (AGENTS.md unchanged vs main after the always-loaded trim) — not a merge blocker once attestation is current. @MrGTV-love please re-attest on |
Intent
Discover OMP session transcripts in the Pi adapter and preserve parent and subagent identity through analysis, folding, and remote discovery. Parent and subagent files remain separately discoverable and analyzable but share the root parent 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. Keep OMP subagents non-interactive when parentSessionId exists. Link nested OMP parent identity by nested file path regardless of child header cwd. Publish only a clean-history branch that preserves the reviewed code and documentation fixes but contains no graft/ artifacts, no .ignore change, and only the tracked .gitignore rule graft/.cache/, never /graft/. Preserve the original 070dced branch and PR 150 unchanged.
What Changed
src/discovery/adapters/pi.js) now also scans~/.omp/agent/sessions/. It reads the session header whether it is on line 1 (Pi) or line 2 after OMP's{type:"title"}record. It also reads OMP'smodelfield. It finds subagent transcripts up to two levels deep. It links each subagent to its root session by the nested file path, whatever cwd the child header shows. Discovery and the remote probe now pass one shared scan context. The scan cache now stores a per-adaptercacheVersionand acacheDependencyfingerprint of each ancestor session. So a cached subagent is classified again when an ancestor session appears or changes.parentSessionIdand a corroboration identity, native id, and start date taken from its root session. A new helper,corroborationIdentityOf, gives this shared identity. Analysis stores these fields on evidence. Fold lays only these four fields from current discovery over admitted evidence, so the admission checks do not change. Harm and non-compliance session counts, gap-ledger sightings, and evidence source labels now use the root identity. Parent and subagent files are still sampled and analyzed as separate files. An OMP subagent is always non-interactive.normalizeGapLedgerSessions, moves old per-file gap-ledger keys for selected sessions to the root identity. It moves a legacytranscript.idkey only when the fold proves that id belongs to exactly one evidence identity. When sightings merge, the domain vote does not depend on order: anyprojectsighting wins overorchestration. The README and AGENTS.md now document the OMP path and how subagents share the root identity..gitignorenow ignoresgraft/.cache/. New tests and an OMP fixture cover the adapter, nested discovery, ledger migration, fold, interaction, analysis reuse, and remote discovery.Risk Assessment
Testing
I made a sandbox git repo with an OMP store (root, subagent, nested subagent). I ran the real backpass CLI against it:
scan(text and --json), a 4-step cache refresh test, a realanalyzewith the claude agent, and the fold/gap-ledger part of a realpropose. All results matched the intent. I stopped theproposerun during its synthesis model step, after it had written the fold summary and gap ledger. Synthesis is not part of this change. Five scenarios are marked untested because they were not driven live: legacy-ledger migration, legacy fold admission, domain vote order, remote SSH discovery, and the README/AGENTS.md docs check. For the first four, I ran the 23 focused unit tests added by this change, and all passed. I checked branch hygiene with git log, git diff against 070dced, git check-ignore, and gh pr view. There is no UI surface, so there are no screenshots. The evidence is CLI transcripts and saved state files.backpass scanwith sessions under ~/.omp/agent/sessions/ and sees the OMP root, subagent, and nested subagent associated with the repobackpass analyzepersists parentSessionId and the corroboration fields on each OMP evidence file--hostdiscovery keeps the subagent's link to the parent's corroboration identityssh localhostgave 'Connection refused' because macOS Remote Login is off and no host is set up. Only a fake-ssh unit te…graft/.cache/ignore rule, code same as reviewed 070dced, PR 150 unchangedEvidence: OMP store layout used for live scan
Evidence: backpass scan human output (3 OMP files, 1 interactive, 2 non-interactive)
Evidence: backpass scan --json: per-file identity vs shared root corroborationIdentity
Evidence: Scan-cache refresh when root appears / changes
Evidence: Live analyze run (claude)
Evidence: Persisted evidence stamps (parentSessionId / corroboration fields)
Evidence: Live gap ledger: one sighting keyed by root identity
Evidence: Live fold summary: 3 analyzed files, 1 source, gap dropped as singleton
Evidence: Focused OMP unit tests (23 pass)
Evidence: Branch hygiene: diff vs 070dced, graft/.ignore absence, check-ignore, PR 150 head
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
src/discovery/index.js:341- Simplification: the change adds a generic adaptercacheVersionmechanism (export const cacheVersion = 4in src/discovery/adapters/pi.js:35, checked at src/discovery/index.js:341 and stamped at :352, plus new doc text in the discovery header). No intent requirement needs it: the required cache refresh is already delivered bycacheDependency. Every pre-change pi scan-cache entry lacks acacheDependencyfield, whilepi.cacheDependency()always returns a JSON string (e.g. "[null,null]"), socached.cacheDependency === cacheDependencyalready fails and forces reclassification for all old entries (including OMP files previously cached as null under PI_CODING_AGENT_DIR). The version field only adds a second invalidation path and a new adapter contract. Recommended remedy: removecacheVersionfrom pi.js and the two checks/stamp in discoverFiles, relying oncacheDependency; or confirm it is a deliberate future-proofing contract.✅ **Test** - passed
✅ No issues found.
backpass scanwith sessions under ~/.omp/agent/sessions/ and sees the OMP root, subagent, and nested subagent associated with the repobackpass analyzepersists parentSessionId and the corroboration fields on each OMP evidence file--hostdiscovery keeps the subagent's link to the parent's corroboration identityssh localhostgave 'Connection refused' because macOS Remote Login is off and no host is set up. Only a fake-ssh unit te…graft/.cache/ignore rule, code same as reviewed 070dced, PR 150 unchangedHOME=<sandbox>/home node bin/backpass.js scan --harness pi --since 30d(text +--json) over ~/.omp/agent/sessions with root, Worker subagent, and Worker/Worker.Grandchild nested subagentScan-cache refresh: 4 realbackpass scan --jsonruns (root missing, cache hit, root appears, root header id changes)PI_CODING_AGENT_DIR=<sandbox>/omp-agent node bin/backpass.js analyze --harness pi --analysis-agent claude(real claude model) then inspected .backpass/evidence/*.json stampsnode bin/backpass.js propose --harness pi --analysis-agent claude --synthesis-agent claude --no-openup to fold; inspected .backpass/gap-ledger.json and .backpass/evidence-summary.json; stopped during synthesisnode --test --test-name-pattern='omp|OMP|Pi child|legacy session id|ambiguous legacy|legacy evidence excluded' 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.jsnode --test --test-name-pattern='accepts only line one|missing parent path once' test/adapters.test.js test/interaction.test.jsgit log --name-only de6a9aa..HEAD | grep graft/|.ignore,git diff 070dced6 HEAD,git check-ignore -v --no-index graft/.cache/x graft/other.txt graft/.graph/g,gh pr view 150 --json headRefOidssh -o BatchMode=yes localhost true(to see if a live remote host was available: refused)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.