Skip to content

feat: ingest Grok Build sessions - #328

Merged
upsetbit merged 8 commits into
masterfrom
feat/grok-build-importer
Aug 14, 2026
Merged

feat: ingest Grok Build sessions#328
upsetbit merged 8 commits into
masterfrom
feat/grok-build-importer

Conversation

@upsetbit

Copy link
Copy Markdown
Contributor

Summary

Adds grok-build as a first-class prosa source: sessions written by the Grok Build CLI
(binary `grok`) under `~/.grok/sessions` now flow through the whole pipeline — local
`prosa sync`, push to prosa-server, and the panel (badges, filters, analytics, cost).

  • New importer `internal/importers/grokbuild`: anchors each session on its `summary.json`,
    projects `chat_history.jsonl` + `turn_completed` usage records into a canonical per-session
    JSONL preserved as raw (Hermes-style projection, now formally authorized for multi-file
    session directories in INTENT.md), one hash shared by dedup, RawHash, and sync state.
  • Usage sums per-prompt `turn_completed` deltas and excludes `subagent-completed-*`
    aggregates; subagent sessions link to their parent via the parent's `subagents//meta.json`,
    resolved pre-hash so late metadata triggers re-import.
  • Registration across sync, server push validation (raw key `.jsonl`), panel filters, `grok`
    short label, and red agent color tokens in all four theme blocks.
  • Pricing for `grok-4.5` / `grok-4.6` (build-variant ids resolve via prefix fallback).
  • Source doc `docs/sources/grok-build.md` + every source enumeration updated.
  • Includes a small pre-existing link fix in `docs/sources/cursor.md` that was failing the
    link-check gate.

Test plan

  • 17 importer tests with corpus-faithful fixtures (walk decoys, synthetic-line skipping, usage
    tri-state, subagent linkage incl. late meta.json, raw provenance hash equality, empty-content
    assistant tool calls, backend_tool_call counting, malformed inputs, ID mismatch).
  • Full local suite green (`go test ./...`, `just vet`, `just lint`, `just quality`).
  • Real-corpus smoke: 105/105 sessions imported, token totals match the ledgers
    (17,843,613 input / 291,385 output), 1 parent link resolved.

🤖 Generated with Claude Code

upsetbit and others added 8 commits August 14, 2026 18:11
Ingests Grok Build CLI sessions from ~/.grok/sessions. Each session dir is
anchored on summary.json; chat_history.jsonl and turn_completed usage records
project into a canonical per-session JSONL preserved as raw, with one hash
shared by dedup, RawHash, and sync state. Subagent parent linkage resolves
pre-hash from the parent's subagents meta.json. Usage sums per-prompt deltas
and excludes subagent-completed aggregates.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Registers the importer, accepts grok-build pushes with .jsonl raw keys, adds
the panel filter entry, the grok short label in badges and the CLI timeline,
and the red agent color tokens across all four theme blocks.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Rates verified against xAI pricing and the costUsdTicks observed in real Grok
Build ledgers: 2.00/6.00 USD per million with cached reads at 0.30 (grok-4.5)
and 0.50 (grok-4.6). Build-variant ids resolve via the prefix fallback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Upstream moved docs/deprecated/guides/ to docs/guides/deprecated/, breaking
the link check on every push.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds the source observation doc and threads grok-build through every source
enumeration: canonical-session mapping tables, importer registry table, store
layout, usage, concepts, panel mock prompts, and the README. INTENT.md and
the importers doc now authorize canonical projection for multi-file session
directories.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A failing Sink.LastHash was treated as a cache miss and let the import fall
through to raw preservation and WriteSession. The error now aborts the import.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
RawPath/RawHash/RawSize and the Import anchor now cover both preserved raw
shapes: the verbatim source file and the canonical per-session projection.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
README, usage roots, and the CLI design brief now list all seven sources,
including Hermes entries that predate this change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@upsetbit
upsetbit merged commit a3b1673 into master Aug 14, 2026
5 checks passed
@upsetbit
upsetbit deleted the feat/grok-build-importer branch August 14, 2026 21:32
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