@mem-weave/opencode-plugin
v0.5.6
Published
MemWeave OpenCode plugin: ships a .mcp.json so oh-my-openagent auto-registers the MemWeave remote MCP, and auto-injects summary-only memory XML into the agent's system prompt at session_start, prompt_delta, and file_pack phases. Also writes every chat mes
Readme
@mem-weave/opencode-plugin
MemWeave OpenCode plugin — registers the @mem-weave/mcp server as an MCP provider inside OpenCode, and auto-injects summary-only memory XML into the agent's system prompt at session_start, prompt_delta, and file_pack phases. Closes the progressive disclosure loop: the LLM sees summaries in the system prompt, then calls memory_expand to fetch full content.
This is the OpenCode integration half of the MemWeave stack. The complementary packages are:
- @mem-weave/server — the memory backend
- @mem-weave/mcp — the MCP server this plugin auto-registers
Install
# 1. Install the server + mcp
npm install -g @mem-weave/server @mem-weave/mcp
# 2. Install this plugin as an OpenCode plugin
npm install -g @opencode-ai/plugin # peer dep
npm install -g @mem-weave/opencode-pluginThen add to ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@mem-weave/opencode-plugin"]
}Restart OpenCode. The plugin loads on startup and:
- Registers
mcp["memweave"]— OpenCode auto-spawns@mem-weave/mcpand the 10memory_*tools become available to the LLM. - Hooks
experimental.chat.system.transform— appends<memory-context>XML (summary-only) to the system prompt at every turn. - Hooks
tool.execute.before— when the LLM callsRead/Edit/Write/Glob/Grep, queues afile_packXML for the next system turn.
Progressive disclosure, end to end
plugin loads → config hook registers mcp["memweave"]
↓
OpenCode → 10 memory_* tools in LLM's tool list
↓
LLM starts → system.transform injects summary-only XML
↓
LLM sees m_abc → calls memory_expand({memoryId: "m_abc"})
↓
MCP server → proxies to GET /api/v1/memories/m_abc
↓
LLM gets full contentThe plugin itself is a thin coordinator — no business logic. All memory work happens in @mem-weave/server, surfaced via @mem-weave/mcp's 10 tools.
Environment variables
| Var | Default | Meaning |
|---|---|---|
| MEMWEAVE_URL | http://127.0.0.1:3131 | MemWeave server base URL |
| MEMWEAVE_PLUGIN_TIMEOUT | 10000 (ms) | Per-inject-request timeout. Overridable. |
License
MIT
