Skip to content
Mimir

OpenCode Capture

opencodeOpenCode

Mimir captures completed OpenCode turns through its global plugin. OpenRouter traffic stays canonical at the proxy; direct-provider turns are reconstructed from OpenCode’s session store.

Terminal window
mimir install --harness opencode

Restart OpenCode after installing or updating the plugin. Run mimir doctor --json and confirm that the integration is active.

  • OpenRouter: the Worker proxy captures the canonical exchange.
  • Direct providers: the plugin uploads a bounded exchange after OpenCode completes the turn, including exposed tool results.
  • Lifecycle: turn, heartbeat, and end events keep session state current without interrupting OpenCode when delivery fails.

Complete a turn, then check its durable receipt:

Terminal window
mimir session status <session-id>

The receipt, not proxy activity alone, proves that Mimir saved the session.

If the session is missing, follow OpenCode capture is missing.

Managed files and credentials

The installer owns ~/.config/opencode/plugins/mimir.ts and records that ownership in ~/.mimir/install-receipt.json. $MIMIR_HOME replaces ~/.mimir when set.

The plugin reads MIMIR_URL and MIMIR_TOKEN first, then the connection written by mimir setup or mimir login. It contains no credentials.

Manual copying from plugins/opencode/mimir.ts is recovery-only.

Reporting and payload limits

Turn events include the model, provider, token usage, and latency. Heartbeats arrive every 60 seconds while active. OpenCode deletion emits an end event; otherwise the silence timer finalizes the session in about 10 minutes.

Direct-provider exchanges can include user, assistant, and tool parts plus timing and finish metadata. Payloads are limited to 512 KiB and individual strings to 64 KiB, so oversized parts may be trimmed. See Session Lifecycle for the event model.

Install and uninstall safety

Mimir never rewrites general OpenCode configuration. Install and update only manage receipt-owned plugin and skill files. Conflicting, modified, and symlinked targets are preserved or rejected rather than overwritten.

mimir uninstall removes only unchanged receipt-owned files. Installations created through Mimir v0.3.0 may require manual review because prior user values were not recorded.