opencode-v0.1.3

mem0ai/mem0opencode-v0.1.3Jun 13, 2026by whysosaket

AI Summary

OpenCode plugin update adding file context injection and session summary features.

Key Highlights

  • Added file-context injection (`tool.execute.before`) to search for memories referencing a file path.
  • Enhanced session compaction to store a structured `session_summary` memory.
  • Added PostHog telemetry with `plugin.*` event schema.
  • Improved initial context formatting with type icons and relative age indicators.

New Features

  • File-context injection for agent awareness of prior work on specific files.
  • Structured session summary extraction of key facts (request, decisions, learnings).
  • PostHog telemetry integration for anonymous usage events.
  • Visual timeline formatting for recent activity.

Full Release Notes

## Mem0 OpenCode Plugin (v0.1.3)

### Added

- **File-context injection (`tool.execute.before` / Read):** Before the agent reads a file, the plugin searches mem0 for memories referencing that file path and injects prior work as system context. Gates on file size (>= 1,500 bytes). Gives the agent "I've worked on this file before" awareness automatically.
- **Stop hook session summary (`experimental.session.compacting`):** Enhanced session compaction to store a structured `session_summary` memory with `infer=True`, letting the mem0 backend AI extract key facts (request, decisions, learnings, next steps). Previously only stored a raw stats string.
- **SessionStart activity timeline:** The initial memory loading now formats recent memories with type icons (⚖️ decision, 🔴 bug_fix, 🔵 task_learning, etc.) and relative age indicators (2h ago, 1d ago) instead of bare text. Provides a visual "Recent Activity" timeline on first message.
- **PostHog telemetry (`telemetry.ts`):** Anonymous, fire-and-forget usage events. Opt out with `MEM0_TELEMETRY=false`. Only fires when an API key is present; never sends memory content, prompts, or the API key — only an anonymized `sha256(apiKey)[:32]` identity plus event type, platform, and plugin version. Emits the same schema as the Mem0 editor plugin (`plugin.*` events, `source: "plugin"`, `platform: "opencode"`) so OpenCode appears as a `platform` in the shared plugin dashboard. Events: `plugin.session_start` (with memory count) and `plugin.tool_use` (`add` / `search` / `update` / `delete`).

### Changed

- **`experimental.session.compacting` handler:** Now stores `metadata.type=session_summary` with `metadata.source=opencode-stop` instead of `metadata.type=session_state` with `metadata.source=pre-compaction`. Includes a structured prompt that instructs mem0's AI to extract request, decisions, learnings, and next steps.
- **Initial context formatting:** Memories shown on first message now include type icons and age labels for quick scanning.