013718c817
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.
8.2 KiB
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/plugintool()helper and backed by themem0aiSDK directly. The plugin no longer registers or depends on the remote MCP server (mcp.mem0.ai); the bundledopencode.jsonand 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 aget_event_statushelper for async-write status. - Skills load via the
confighook (skills.paths) instead of being copied into the project's.opencode/directory on startup. TheinstallSkills()filesystem copy and thecli.tsinstaller (mem0-opencodebin) have been removed — install withopencode plugin @mem0/opencode-plugin. - Trimmed to 8 focused skills (
context-loader,dream,forget,health,peek,pin,remember,tour). Removedimport,export,memory-reviewer,mem0(SDK reference),list-projects,switch-project,stats, andonboard.
Added
- Expanded telemetry to the full shared
plugin.*schema. In addition toplugin.session_startandplugin.tool_use, the plugin now emitsplugin.user_prompt,plugin.bash_error,plugin.pre_compact, andplugin.session_stop.tool_usenow fires from inside each native tool. Every event also carriesproject_hash(anonymizedsha256(app_id)) andos_version, matching the editor plugin'stelemetry.py.
Fixed
- Error-pattern lookup in
tool.execute.afterno longer issues two identicalmem0.search()calls; it now performs a singletopK: 6search. - Corrected the documented system-prompt hook name from
experimental.chat.system.transformto the actualexperimental.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 structuredsession_summarymemory withinfer=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 withMEM0_TELEMETRY=false. Only fires when an API key is present; never sends memory content, prompts, or the API key — only an anonymizedsha256(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 aplatformin the shared plugin dashboard. Events:plugin.session_start(with memory count) andplugin.tool_use(add/search/update/delete).
Changed
experimental.session.compactinghandler: Now storesmetadata.type=session_summarywithmetadata.source=opencode-stopinstead ofmetadata.type=session_statewithmetadata.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.
0.1.2 — Automatic coding categories & global search
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 viaautoSetupCategories(), 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_searchsetting): Newglobal_searchtoggle in~/.mem0/settings.json(default:false). When enabled, allsearch_memoriesandget_memoriescalls use{"OR": [{"user_id": "*"}]}instead of the per-user per-projectANDfilter — returning all memories across all users and allapp_idscopes. Writes (add_memory) still tag with the currentuser_idandapp_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_SEARCHenvironment variable: Exported to child shells via theshell.envhook ("true"or"false").
Changed
- Search filters are now dynamic: All search paths throughout the plugin construct filters based on the
global_searchsetting instead of always usingAND [user_id, app_id]. - Resume-context searches broadened: Resume and error-pattern searches no longer include
metadata.typesub-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:onboardStep 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 fallbackproject_profilememory if the background run hasn't finished yet./mem0:switch-projectskill expanded: Description and execution updated to document the--globaland--no-globalflags alongside the existing project-name argument.
0.1.1
- CI/CD publish flow test (
#5288). - Fixed tsconfig, added
publishConfigand 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-pluginon npm): Pure TypeScript plugin using themem0aiTS 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 installauto-configures plugin and MCP server in~/.config/opencode/opencode.json.