Files
mem0/integrations/mem0-plugin/.opencode-plugin/CHANGELOG.md
kartik-mem0 013718c817 refactor(opencode): native SDK tools, drop MCP, trim skills, expand telemetry
Reworks @mem0/opencode-plugin to expose memory operations as native OpenCode
tools (via the @opencode-ai/plugin `tool()` helper, backed by the mem0ai SDK)
instead of delegating to the remote MCP server. Skills load via the `config`
hook (`skills.paths`) instead of being copied into the project `.opencode/`.

- Drop MCP: remove the regex-based MCP tool interception, the bundled
  opencode.json MCP registration, and the cli.ts installer (mem0-opencode bin).
- Native tools: add_memory, search_memories, get_memories, get_memory,
  update_memory, delete_memory, delete_all_memories, delete_entities,
  list_entities, get_event_status.
- Trim skills 16 -> 8 (context-loader, dream, forget, health, peek, pin,
  remember, tour); remove import, export, memory-reviewer, mem0, list-projects,
  switch-project, stats, onboard. De-MCP/onboard wording in kept skills.
- Telemetry: emit the full shared plugin.* schema (adds user_prompt, bash_error,
  pre_compact, session_stop alongside session_start, tool_use); tool_use now
  fires from inside each native tool; add project_hash + os_version props.
- Fix duplicate error-search (single topK:6); correct the documented
  experimental.chat.messages.transform hook name.
- Bump to 0.2.0.
2026-06-16 12:35:58 +05:30

8.2 KiB

Changelog

All notable changes to the @mem0/opencode-plugin will be documented in this file.

0.2.0 — Native SDK tools, MCP-free, leaner skill set

Changed (breaking)

  • Memory tools are now native OpenCode tools registered via the @opencode-ai/plugin tool() helper and backed by the mem0ai SDK directly. The plugin no longer registers or depends on the remote MCP server (mcp.mem0.ai); the bundled opencode.json and the regex-based MCP call interception have been removed. Tools: add_memory, search_memories, get_memories, get_memory, update_memory, delete_memory, delete_all_memories, delete_entities, list_entities, plus a get_event_status helper for async-write status.
  • Skills load via the config hook (skills.paths) instead of being copied into the project's .opencode/ directory on startup. The installSkills() filesystem copy and the cli.ts installer (mem0-opencode bin) have been removed — install with opencode plugin @mem0/opencode-plugin.
  • Trimmed to 8 focused skills (context-loader, dream, forget, health, peek, pin, remember, tour). Removed import, export, memory-reviewer, mem0 (SDK reference), list-projects, switch-project, stats, and onboard.

Added

  • Expanded telemetry to the full shared plugin.* schema. In addition to plugin.session_start and plugin.tool_use, the plugin now emits plugin.user_prompt, plugin.bash_error, plugin.pre_compact, and plugin.session_stop. tool_use now fires from inside each native tool. Every event also carries project_hash (anonymized sha256(app_id)) and os_version, matching the editor plugin's telemetry.py.

Fixed

  • Error-pattern lookup in tool.execute.after no longer issues two identical mem0.search() calls; it now performs a single topK: 6 search.
  • Corrected the documented system-prompt hook name from experimental.chat.system.transform to the actual experimental.chat.messages.transform.

0.1.3 — File-context injection, session summaries & activity timeline, anonymous telemetry

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.

Added

  • Auto-configured coding categories: The plugin now automatically sets up 17 coding categories (e.g. architecture_decisions, api_design, security, debugging_notes) on the Mem0 project at startup. Runs in the background on every session start via autoSetupCategories(), is fully idempotent, and never blocks initialization. Uses SHA-256 fingerprints of the category list and API key — stored in ~/.mem0/categories_setup.json — to skip redundant API calls on subsequent sessions.
  • Global search mode (global_search setting): New global_search toggle in ~/.mem0/settings.json (default: false). When enabled, all search_memories and get_memories calls use {"OR": [{"user_id": "*"}]} instead of the per-user per-project AND filter — returning all memories across all users and all app_id scopes. Writes (add_memory) still tag with the current user_id and app_id. Applies to all plugin search paths: initial load, per-message recall, resume detection, error-pattern lookup, and compaction context.
  • /mem0:switch-project --global / --no-global: Enables or disables global search via the switch-project skill. Persists to ~/.mem0/settings.json. No manual config editing needed.
  • MEM0_GLOBAL_SEARCH environment variable: Exported to child shells via the shell.env hook ("true" or "false").

Changed

  • Search filters are now dynamic: All search paths throughout the plugin construct filters based on the global_search setting instead of always using AND [user_id, app_id].
  • Resume-context searches broadened: Resume and error-pattern searches no longer include metadata.type sub-filters (session_state, decision, anti_pattern, bug_fix), broadening recall.
  • System context message updated: Informs the model when global search is active ("Global search is ON — searches return all memories across all users and projects. Writes still use user_id=..., app_id=...").
  • /mem0:onboard Step 5 is no longer interactive: Removed the manual category installation prompt. Categories now configure automatically in the background; the onboarding step only verifies status and stores a fallback project_profile memory if the background run hasn't finished yet.
  • /mem0:switch-project skill expanded: Description and execution updated to document the --global and --no-global flags alongside the existing project-name argument.

0.1.1

  • CI/CD publish flow test (#5288).
  • Fixed tsconfig, added publishConfig and bun lockfile (#5273).
  • Renamed package to @mem0/opencode-plugin (#5272).
  • Added plugin array to bundled opencode.json (#5271).

0.1.0 — Initial release

  • OpenCode plugin (@mem0/opencode-plugin on npm): Pure TypeScript plugin using the mem0ai TS SDK — no Python, no shell scripts. Hooks into all 6 OpenCode events (chat.message, tool.execute.before, tool.execute.after, experimental.chat.system.transform, experimental.session.compacting, shell.env). Features: session start memory loading, per-prompt semantic search, error pattern detection with memory lookup, resume/remember intent detection, auto-capture every 3rd message, periodic save nudges, full metadata defaults injection (confidence, source, type, session_id, files, branch), identity injection for search/get/delete filters, type-filtered error pre-fetch (anti_pattern + bug_fix), pre-compaction memory capture, MEMORY.md write blocking, and secret redaction.
  • 16 OpenCode-native skills bundled in opencode-skills/: context-loader, dream, export, forget, health, import, list-projects, mem0 (SDK reference), memory-reviewer, onboard, peek, pin, remember, stats, switch-project, tour. All skills are pure MCP-tool-based — no Python scripts, no shell scripts, no Claude Code dependencies.
  • Auto-install skills and commands (installSkills()): On plugin load, copies all 16 skills to .opencode/skills/ and creates command wrapper files in .opencode/commands/ so they appear in the OpenCode / palette.
  • CLI installer (cli.ts): bunx @mem0/opencode-plugin install auto-configures plugin and MCP server in ~/.config/opencode/opencode.json.