OpenCode

Tuneloop captures OpenCode sessions via a plugin that hooks into OpenCode's session lifecycle and uploads transcripts automatically.

How It Works

The Tuneloop plugin hooks into OpenCode's session.updated event. When a session completes, the plugin reads the session data from OpenCode's SQLite database, normalizes it, and uploads it to your Tuneloop server. The server URL and ingest token are baked into the plugin at setup time — no per-machine configuration is needed.

Generating the Plugin

Use the open-source setup utility to generate the plugin files with your deployment's credentials:

npx tuneloop-plugin-setup \
  --server https://tuneloop.yourcompany.com \
  --token <your-ingest-token> \
  --harness opencode \
  -o tuneloop-opencode/

This produces a plugin directory ready to deploy, with the server URL and token embedded.

Individual Setup

For testing or single-machine setup, generate and install the plugin directly:

npx tuneloop-plugin-setup \
  --server https://tuneloop.yourcompany.com \
  --token <your-ingest-token> \
  --harness opencode \
  --install

The --install flag generates the plugin and copies it to ~/.config/opencode/plugins/. After setup, every OpenCode session is automatically uploaded.

Backfill

To upload existing OpenCode sessions that predate the plugin installation:

npx tuneloop-plugin-setup \
  --server https://tuneloop.yourcompany.com \
  --token <your-ingest-token> \
  --harness opencode \
  --backfill

Options:

  • --since 2025-01-01 — only sessions after this date
  • --limit 100 — cap the number of sessions
  • --dry-run — preview what would be uploaded

Re-running backfill is safe — the server deduplicates on content hash.

Enterprise Rollout

Deploy the generated plugin to the global OpenCode plugin directory on every developer machine via your configuration management tool (Ansible, Puppet, Chef, or MDM):

  • Copy the plugin to ~/.config/opencode/plugins/tuneloop-opencode/

OpenCode loads plugins from ~/.config/opencode/plugins/ automatically at startup — no changes to opencode.json are needed. Since credentials are baked into the plugin, there are no additional per-machine configuration steps.

Project-level plugin

You can also commit the plugin to .opencode/plugins/ in each repository. Since the plugin contains your ingest token, the repo must be private. Every developer who clones the repo gets automatic session capture.

Transcript Location

OpenCode stores sessions in a SQLite database (opencode.db) rather than individual files.