Repository navigation
Conversation
Two additions that were developed together because the first one made the second one worth having. OpenCode source adapter ----------------------- OpenCode keeps sessions in a single SQLite database rather than one file per session, so it cannot be scanned like the Claude Code and Codex sources. An opt-in adapter exports each session into a staging directory of JSONL files during `ingest`, which the normal scanner then picks up — leaving dedup, --force, grouping, summarization and the web UI untouched. Three things the implementation has to work around: - `opencode session list` only reports sessions belonging to the current working directory's project, so no single cwd can enumerate them all. Sessions are enumerated from OpenCode's database; transcripts still come from `opencode export`, which works from anywhere. - `opencode export` yields empty stdout over a pipe but is complete when redirected to a file, and a single export can run to megabytes. Both call sites go through one runToFile helper. - is_subagent was derived purely from Claude Code's /subagents/ path convention, so flat-staged files always read as 0. Formats that state it outright now win; Claude Code keeps path detection, because its parentSessionId also covers continuations and would otherwise misflag them. Projects are keyed off each session's working directory, so OpenCode and Claude Code work in the same repo on the same day lands in one journal entry. Configurable summary provider ----------------------------- Summaries and session titles were hardcoded to Claude Haiku via the Agent SDK. A summary_provider config block now selects any OpenAI-compatible endpoint, including a local llama.cpp server. Absent config keeps the previous behaviour. Both call sites route through the new provider, since leaving titles on Anthropic would silently contradict a configured provider, and the Claude auth preflight is skipped for non-Anthropic providers that authenticate with their own key. Entries record the model that actually produced them. API keys are referenced by environment variable name and never stored in config. Reasoning models spend completion tokens before emitting content, so an exhausted budget fails loudly rather than writing an empty summary. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…re/opencode-import-and-model-provider
Owner
Author
|
Superseded by prime-radiant-inc#20, which contains the same work branched from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds OpenCode as a session source, and makes the model that writes journal entries configurable. Developed together because the first made the second worth having — a local model is a reasonable choice once the corpus includes local-agent sessions.
Based on
feature/react-frontendrather thanmainso the diff shows only this work;prime-radiant-inchas no branch other thanmain, so an upstream PR would have carried all 61 React commits. Retarget once prime-radiant-inc#19 lands.OpenCode source adapter (opt-in)
OpenCode keeps sessions in a single SQLite database rather than one file per session, so it can't be scanned like the Claude Code and Codex sources. The adapter exports each session into a staging directory of JSONL files during
ingest, which the normal scanner picks up — dedup,--force, grouping, summarization and the web UI are untouched.Three things worth a reviewer's attention, each found empirically against OpenCode 1.18.0:
opencode session listis scoped to the current directory's project. 5356 bytes from/tmp, 0 bytes from inside another repo. No single cwd can enumerate every project, so sessions are enumerated from OpenCode's database. Transcripts still come fromopencode export, which works from anywhere — the fragile part (transcript shape) stays on the supported CLI, and only a five-column query touches the schema.opencode exportreturns empty stdout over a pipe but is complete when redirected to a file, and one export can run to megabytes. Both call sites go through a singlerunToFilehelper, covered by a 2MB regression test.is_subagentwas derived purely from Claude Code's/subagents/path convention, so flat-staged files always read as 0. Formats that state it outright now win. Claude Code deliberately keeps path detection: itsparentSessionIdalso covers continuations, so switching it to "has a parent" would misflag them.Projects are keyed off each session's working directory, so OpenCode and Claude Code work in the same repo on the same day lands in one journal entry rather than two disconnected ones.
Configurable summary provider
Summaries and titles were hardcoded to Claude Haiku through the Agent SDK. A
summary_providerblock now selects any OpenAI-compatible endpoint. Absent config keeps existing behaviour exactly.Testing
221 tests pass, typecheck clean. Every change was written test-first; the OpenAI provider is tested against a real local server rather than a mocked
fetch.Exercised end-to-end against a live corpus: 96 OpenCode sessions across 16 projects (61 subagents correctly flagged), summarized by a local Gemma via llama.cpp. The token-budget error path fired on a real transcript and was fixed by raising the budget — that failure mode is not theoretical.
The
web/React tests are covered separately by vitest, not bybun run check. They were failing under a barebun test, which is fixed on the base branch (bunfig.tomlscopes Bun's runner tosrc/; CI now runs the web suite with vitest). That fix is merged in here, so a barebun teston this branch is green.🤖 Generated with Claude Code