Repository navigation
feat(memory): index OpenCode sessions (opencode harness) - #115
Merged
Merged
Conversation
|
✅ Docker image built successfully
|
This was referenced Jun 24, 2026
|
✅ Docker image built successfully
|
Adds the missing OpenCode transcript parser so `kit memory index` (and
indexAllHarnesses) covers OpenCode alongside claude-code/codex/gemini/
continue/cursor/amazon-q/cline.
OpenCode persists sessions as flat JSON under $OPENCODE_DATA_DIR
(default ~/.local/share/opencode) in a storage/ tree, with the message
TEXT split into separate `part` files. The parser:
- reads storage/session/** for sessionID → project/cwd,
- reads storage/message/** for role (user|assistant) + timestamp,
- globs storage/part/** and groups text parts by their `messageID` field
(so it doesn't depend on the exact part-dir nesting, which has varied),
- inserts each message with a stable uuid opencode:<session>:<message>
(INSERT OR IGNORE → idempotent re-runs).
Verified against sst/opencode's message-v2 schema (role values; text part
= {type:"text", text}; time.created / time_created tolerated). Defensive +
strict: unrecognized shapes are skipped, so on a layout it doesn't know
(e.g. newer SQLite-backed installs) it indexes nothing rather than garbage
— a safe no-op, not a regression. The SQLite-backed layout is a separate
follow-up. Not yet verified against a live install (no sample on hand);
fixture-tested against the documented flat-JSON format.
Tests: text-part join (excludes tool/ignored/empty parts), idempotent
re-run, absent-dir no-op. Full suite 1538/0.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg
sandstream
force-pushed
the
feat/memory-opencode-parser
branch
from
June 27, 2026 11:05
4f6c704 to
52ceaa8
Compare
|
✅ Docker image built successfully
|
The rebase onto 2.1.1 brought a stricter prettier config; format:check flagged the two new opencode files. Format-only, no logic change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg
|
✅ Docker image built successfully
|
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 the missing OpenCode transcript parser so
kit memory index/indexAllHarnessescovers OpenCode alongside the existing 7 harnesses (claude-code, codex, gemini, continue, cursor, amazon-q, cline). Closes the memory half of the OpenCode-parity gap.How OpenCode stores sessions
Flat JSON under
$OPENCODE_DATA_DIR(default~/.local/share/opencode) in astorage/tree, with the message text split into separatepartfiles:storage/session/<projectHash>/<sessionID>.json— session info (id,directory)storage/message/<sessionID>/msg_<id>.json— per message (role, time)storage/part/.../prt_<id>.json— content parts (type:"text",text)Parser
sessionID → project/cwdrole(user|assistant) + timestamp (toleratestime.createdandtime_created)messageIDfield — so it does not depend on the exact part-dir nesting (which has varied across versions)opencode:<session>:<message>→INSERT OR IGNOREmakes re-runs idempotentVerified against sst/opencode's
message-v2schema (role values; text part= {type:"text", text}).Honest caveats
~/.local/share/opencodebefore relying on it.Tests: text-part join (excludes tool/ignored/empty parts), idempotent re-run, absent-dir no-op. Full suite 1538/0. Independent of #109.
🤖 Generated with Claude Code
https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg
Generated by Claude Code