Skip to content

feat(crush): session adapter for Crush [3/3] - #27

Open
LarsArtmann wants to merge 3 commits into
cosmtrek:masterfrom
LarsArtmann:crush-adapter-core
Open

LarsArtmann wants to merge 3 commits into
cosmtrek:masterfrom
LarsArtmann:crush-adapter-core

Conversation

@LarsArtmann

@LarsArtmann LarsArtmann commented Sep 9, 2026 •

Copy link
Copy Markdown

Why

Crush users currently have no way to visualize their sessions. This adds Crush as a fourth first-class harness alongside Claude Code, Codex, and pi — same rail, same trace model, same judge input.

What changed

  • New internal/adapter/crush: reads the SQLite-backed crush.db (per-project .crush/ or global data dir) via the published, read-only go-crush-data SDK (v0.3.0) — sealed part types, schema-drift detection, no ORM.
  • Sessions surface through a synthetic crush://session/<id> handle, so the server's filesystem-based code works unchanged.
  • Multi-database discovery: reads Crush's projects.json registry, merges sessions across every project database, and routes each session id back to its source db.
  • Sub-agent sessions (the agent tool's child rows) normalize into the standard agent metadata, so the Agent Lens works without new code paths.
  • Tool results pair by ToolCallID (from refactor(adapter): shared helpers + tool-call pairing contract [2/3] #26), including results split across messages.
  • Committed fixture (testdata/crush/crush.db) + full test battery: parts parser branches, agent graph tiers, synthetic-path routing, timestamps, diagnostics, stress and fuzz coverage.

Wiring (server registration, flags, endpoints) follows in separate PRs to keep this one reviewable; this PR is package-atomic — the adapter is one Go package and cannot compile in halves.

Validation

  • go build ./...
  • go test -count=1 ./... — green at the branch tip in a clean checkout (no local Crush data; the fixture carries everything)

Series

Part 3/3, stacks on #25 and #26. The library-extraction discussion in #15 is the reason the Crush reading layer lives in a published module rather than inline SQL here.

💘 Generated with Crush


Reviewing this stacked series

GitHub shows the cumulative diff against master, so "Files changed" also includes parts #25 and #26. This PR's own delta is only the last commit, feat(crush): session adapter for Crush — reviewing that single commit gives the actual scope of this change.

Test fixture

testdata/crush/crush.db is a committed 24 KB SQLite database with a root session, one sub-agent child session (parent_session_id set), and assorted message-part shapes. It is not a black box — regenerate or inspect it with:

go run testdata/crush/build.go

The builder writes the same schema and seed data the adapter tests assert against, so it doubles as documentation of the expected database shape.

LarsArtmann added a commit to LarsArtmann/mindwalk that referenced this pull request Sep 9, 2026
…ck loop

Capture what every future session needs to keep the upstream stream
healthy: the three open PRs (cosmtrek#25-cosmtrek#27) and their branches, the jj
colocation (reversible via rm -rf .jj), the exact restack loop after an
upstream merge (fetch, rebase --skip-emptied, delete snapped bookmark,
push), the force-push rules, and the fork CI posture (lint reports
without blocking until the debt sweep).
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