Skip to content

Adapters: Gemini CLI, then opencode #40

Description

@devcodes9

agsearch indexes Claude Code and Codex CLI today. Other agents that keep transcripts on disk can be added the same way: a parser plus an entry in sources, with no change to search or ranking.

Gemini CLI

Sessions live at:

~/.gemini/tmp/<project>/chats/session-<timestamp>-<id>.json

One JSON object per session:

sessionId, projectHash, startTime, lastUpdated, kind, messages[]
  messages[]: id, timestamp, type, content

That maps onto the existing 8-field row schema almost directly.

Read the format from source, not from samples. Gemini CLI is open source, so the schema is defined rather than inferred:

  • packages/core/src/services/chatRecordingTypes.ts
  • packages/core/src/services/chatRecordingService.ts

There are a couple of small third-party history viewers, but they are reverse-engineered and a weaker reference than the types above.

Worth having a handful of real sessions across a few projects to test against before merging.

opencode

sst/opencode persists sessions through a storage/ module (packages/opencode/src/storage/storage.ts, schema.ts). The on-disk layout is not confirmed yet, but it is open source, so the same approach applies.

Gemini CLI first: its format is already confirmed.

Out of scope here

Pi — no transcripts on disk. ~/.pi holds agent/auth.json and nothing else, so there is nothing to index. Worth revisiting if that changes.

Cursorstate.vscdb is a large SQLite database (blob-encoded JSON, undocumented schema that moves between releases). Readable with stdlib sqlite3, but it is a second storage model rather than another parser, so it deserves its own issue and its own decision.

Contributions welcome. If you use one of these and want it supported, say so here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions