Skip to content

feat(ingest): roll OMP session transcripts into the brain - #69

Merged
mustafa-bharmal-shipveho merged 2 commits into
mainfrom
feat/omp-session-ingestion
Sep 14, 2026
Merged

mustafa-bharmal-shipveho merged 2 commits into
mainfrom
feat/omp-session-ingestion

Conversation

@mustafa-bharmal-shipveho

Copy link
Copy Markdown
Owner

Summary

Ingests oh-my-pi (OMP) coding-agent session transcripts into the brain through the same NormalizedSession pipeline as Claude Code and Codex. Without this, switching daily-driver agents means memory accumulation stops on switch day.

  • agent/tools/_session_normalize.py — normalize_omp_session(): maps OMP JSONL entry types (session, model_change, message user/assistant/toolResult, custom, ttsr_injection) onto the shared contract. toolCall → {id, name, input}; toolResult → user-role text (same convention as Claude tool_result); harness bookkeeping (title, custom_message, ttsr_injection) skipped as metadata.
  • agent/tools/claude_session_digest_adapter.py — iter_omp_sessions() walker; OMP filenames are <timestamp>_<uuid>.jsonl so the source path is stashed for sidecar SHA dedup, same as the Codex walker.
  • agent/tools/digest_cli.py — backfill --source gains omp, defaults to all (both removed; verified nothing in launchd/cron/harness referenced it). --omp-root override for testability. Incremental (hourly LaunchAgent) passes the OMP root unconditionally.
  • agent/tools/discover_all_sources.py — tier-2 manifest row for OMP transcripts.

Review-driven hardening

A staff-engineer review pass (second model) caught two things, both fixed in this branch:

  • Silent skip loop: iter_omp_sessions now counts and logs unparseable files (threaded through backfill's log) — silent schema drift would otherwise starve the brain with no signal, the same failure shape the v0.7.0 audit found for Claude memories.
  • Lexicographic timestamp min/max: assumption (uniform ISO-8601 …Z) documented inline.

Test plan

  • 65 focused tests pass: test_session_normalize.py (9 new OMP tests: fields, role order, thinking+text concat, toolCall/toolResult mapping, malformed-line tolerance, metadata-only → None), test_session_digest.py (discovery, dual-surface backfill, sidecar dedup), test_digest_budget.py (root-patching isolation fix).
  • Dry-run against the author's real ~/.omp/agent/sessions: dry-run: would process claude=0 codex=0 omp=5, no errors.
  • Real-world parse of a 1.1 MB / 470-line OMP session: 346 messages, 177 tool calls, correct cwd/model/session id.
  • OMP session files are read-only consumers; no transcript is ever modified.

OMP (oh-my-pi) sessions live at ~/.omp/agent/sessions/<slug>/<ts>_<uuid>.jsonl
and were invisible to the brain — a user who moves their daily driver off
Claude Code stops accumulating memory the day they switch. OMP entries map
onto the same NormalizedSession contract (toolCall -> {id,name,input},
toolResult -> user text, metadata events skipped), so the hourly scanner,
sidecar SHA dedup, redaction, and dual episodic+markdown writes all apply
unchanged; origin is namespaced session.digest.omp.

Parse failures in OMP files are counted and logged rather than swallowed:
silent schema drift would otherwise starve the brain with no signal, the
same failure shape the v0.7.0 audit found for Claude memories.
@mustafa-bharmal-shipveho
mustafa-bharmal-shipveho merged commit a5933a2 into main Sep 14, 2026
3 checks passed
@mustafa-bharmal-shipveho
mustafa-bharmal-shipveho deleted the feat/omp-session-ingestion branch September 14, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant