title: "OpenCode / OpenClaw adapter" type: navigation docs_shell: true


OpenCode / OpenClaw adapter

Reads .jsonl session transcripts written by the OpenCode / OpenClaw agents — both use an identical schema.

AI-session adapter (is_ai_session = True) — fires by default when its session store is present on disk.

Session store

The adapter auto-detects the store across platforms:

  • Linux: ~/.config/opencode/sessions/ and ~/.config/openclaw/sessions/
  • macOS: ~/Library/Application Support/opencode/sessions/ and ~/Library/Application Support/openclaw/sessions/
  • Windows: %APPDATA%\opencode\sessions\ and %APPDATA%\openclaw\sessions\

Both nested (<project>/<session>.jsonl) and flat (<project>-<session>.jsonl) layouts are handled.

What it reads

Each session is a JSONL stream of {role, content} records:

{"role": "user",      "content": "start a new feature"}
{"role": "assistant", "content": "…"}
{"role": "tool",      "content": "…"}

normalize_records() translates that schema into the Claude-style {type, message: {role, content}} that the shared renderer expects:

OpenCode role Claude-style type Claude-style role
user user user
assistant assistant assistant
tool user tool (preserved so the renderer can show tool turns distinctly)

Enable it

Works out-of-the-box if OpenCode / OpenClaw is installed on this machine. To explicitly disable:

// sessions_config.json
{ "opencode": { "enabled": false } }

Output layout

Standard raw/sessions/<YYYY-MM-DDTHH-MM>-<project>-<slug>.md.

Code

  • llmwiki/adapters/contrib/opencode.py
  • Tests: tests/test_opencode_adapter.py (23 cases)
  • Issue history: #43 (initial)

See also

  • All adapters — comparison table of every agent adapter llmwiki supports out of the box.

Keyboard shortcuts

⌘K / Ctrl+KOpen command palette
/Focus search
g hGo to home
g pGo to projects
g sGo to sessions
j / kNext / prev row (tables)
?Show this help
EscClose dialogs

Structured queries

Mix key:value filters with free text in the palette:

type:sessionOnly session pages
project:llm-wikiFilter by project name (substring)
model:claudeFilter by model name (substring)
date:>2026-03-01Sessions after a date
date:<2026-04-01Sessions before a date
tags:rustPages mentioning a tag/topic
sort:dateSort results by date (newest first)

Example: type:session project:llm-wiki date:>2026-04 sort:date