Index Cursor, opencode and Gemini CLI sessions - #57
Open
devcodes9 wants to merge 2 commits into
Open
Conversation
Adding a harness was supposed to be one line in the source list. It was not: the file extension, the parser preview uses, the row label, the preview label and the resume command each decided separately what a source was, so an unknown one was discovered as jsonl, parsed as Claude, labelled cc and resumed with claude --resume. Two of those tables had already drifted against each other. They now read one record per harness. A new agent is a parser plus one entry. Cursor keeps each chat as a SQLite store under ~/.cursor/chats. Message blobs are plain json beside binary merkle nodes and images, so the scan filters on the leading byte in SQL and opens the store read-only. Blob order is insertion order; per-message times were never recorded, so every row carries the session's updatedAtMs rather than inventing them. Gemini keeps one json object per session, which is why the global .jsonl filter had to go. Its --resume takes a project-scoped index number, not a stable id, so resume goes through --session-file instead. Claude Code and Codex behaviour is unchanged. Cache format bumps to 7. On a 852-session corpus, the 101 new Cursor sessions moved held-out ranking +0.004.
opencode keeps every session in one SQLite database instead of a file per session. The indexer could not represent that: it read the first row's id and registered it as the id for the whole file, so every session but one was invisible, and previewing that id would have shown all of them concatenated. It now registers each session a fragment contains, and reading one filters to it. Both are no-ops for a file that holds a single session, which is every harness indexed before this. Text lives in `part` rows, one per span, with the role on the parent `message`. Only `text` parts are indexed; `reasoning` joins them under --thinking, and tool calls and step markers are not conversation. Resume is `opencode run --session`. Verified against real sessions: three generated locally, each found by content from the middle of the conversation and read back in isolation. Held-out ranking over 268 queries is unchanged, 0.504 to 0.507.
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.
Closes #40.
agsearch indexed Claude Code and Codex. It now indexes Cursor, opencode and Gemini CLI too,
in the same list, with each session resumed by the tool that created it.
~/.claude/projects/**/*.jsonlclaude --resume <id>~/.codex/sessions/**/*.jsonlcodex resume <id>~/.cursor/chats/**/store.dbcursor-agent --resume <id>~/.local/share/opencode/opencode.dbopencode run --session <id>~/.gemini/tmp/**/chats/*.jsongemini --session-file <path>Why it needed more than a new list entry
Adding a harness was meant to be one line. Five places decided independently what a source
was, so an unknown one was discovered as
.jsonl, parsed as Claude, labelledcc, andresumed with
claude --resume. Two of those tables had already drifted (codexagainstcx). They now read one record per harness, so a new agent is a parser plus one entry.Two assumptions also had to go:
The indexer took the first row's id as the id for the whole file, making every other
session unreachable. It now registers each session a file contains, and reading one
filters to it. No change for the four harnesses that write a file per session.
invisible regardless of what the source table said. The filename test now comes from the
source record.
Notes per harness
images, so the scan filters on the leading byte in SQL and opens the store read-only.
Blob order is insertion order and per-message times were never recorded, so each row
carries the session's
updatedAtMsrather than inventing timestamps. Injected<user_info>context is stripped from user turns.partrows with the role on the parentmessage. Onlytextparts are indexed;
reasoningjoins them under--thinking.--resumetakes a project-scoped index number, which is not a stable handlefor a session found by search, so resume goes through
--session-file. Gemini records aprojectHashand no path, socwdcomes from the sibling.project_root.Verification
Cursor and opencode were tested against real sessions on disk: found by content from the
middle of a conversation, previewed in isolation, and resumed with the right command.
Gemini is covered by fixtures only. The CLI returns
IneligibleTierErroron a free-tieraccount, so no session could be generated to test against, and the parser is written to the
confirmed on-disk schema.
Held-out ranking over 268 queries is unchanged by the larger corpus: 0.504 to 0.507 (@1).
169 tests pass. Cache format bumps to 7 and reindexes once on first run.