OpenCode × Nowledge Mem
Bring your cross-tool knowledge into OpenCode, and share what you learn in OpenCode with every other tool.
For your agent
Give this line to your agent. It should use the universal install skill first; this page remains the behavior and troubleshooting reference:
Read https://mem.nowledge.co/SKILL.md and follow the instructions to install or update Nowledge Mem for OpenCode. Verify with nmem status and the Context Bundle or Working Memory check, then summarize what changed.opencode plugin opencode-nowledge-mem -gOpenCode is a terminal coding agent. Nowledge Mem adds the layer above: knowledge from all your other AI tools, decisions made in Claude Code, preferences set in Cursor, insights from ChatGPT, searchable inside OpenCode. New OpenCode sessions are also captured after OpenCode goes idle, so what you learn there can feed later recall and crystallization without switching tools.
Before You Start
- Nowledge Mem running locally (installation) or a reachable remote Mem server
- OpenCode installed
nmemCLI in your PATH. In Nowledge Mem go to Settings → Preferences → Developer Tools → Install CLI, orpip install nmem-cli
nmem status # Nowledge Mem is running
opencode --version # OpenCode is availableSetup
Install the plugin
Install the npm plugin and let OpenCode update your config:
opencode plugin opencode-nowledge-mem -gUse -g for global use across all projects. Omit it when you only want the plugin in the current project.
If you prefer editing config manually, add the plugin name yourself:
{
"plugin": ["opencode-nowledge-mem"]
}Restart OpenCode
Close and reopen OpenCode so it loads the plugin.
Verify the integration
Ask OpenCode to check your Nowledge Mem connection:
What was I working on recently?You should see OpenCode call nowledge_mem_context_bundle when full startup context matters, or nowledge_mem_working_memory as the lightweight fallback, then return your current context. That's success: OpenCode can now see knowledge from your other tools.
To verify thread capture, finish a short turn and wait a moment after OpenCode becomes idle. In another terminal, search for a phrase from the turn:
nmem t search "the phrase you just used" --source opencodeYou should see an opencode-... thread. If you do not, update the plugin and restart OpenCode so the event hook is loaded.
Update
Refresh the global plugin package and replace the installed copy:
opencode plugin opencode-nowledge-mem -g --forceCustomize Safely
Use OpenCode's own instruction surfaces, not the installed plugin files:
AGENTS.mdin the repo when this project needs shared behavior~/.config/opencode/AGENTS.mdfor your personal defaultsinstructionsinopencode.jsonwhen you want host-level config instead of file-based guidance
Do not edit the installed Nowledge Mem plugin package directly. For the full host-by-host map, see Customize Integration Behavior.
What You Can Do
Find knowledge from other tools
Ask "what did we decide about the database?" and OpenCode searches across decisions you made in Claude Code, insights from ChatGPT, notes from Cursor, not just this session.
Save knowledge for everywhere
When you reach a conclusion in OpenCode, the agent saves it so your next Claude Code session, Cursor project, or ChatGPT conversation can find it too.
Start with today's context
Your Context Bundle, Working Memory briefing, and relevant past knowledge are available before you repeat yourself across tools.
Keep the full session searchable
When OpenCode finishes a turn and reports idle, the plugin saves the session as a Mem thread. Long sessions also flush before compaction, so the transcript stays available for search, review, and later knowledge crystallization.
Create resumable handoffs
Wrap up in OpenCode, then pick up right where you left off in Claude Code or any other tool. Decisions, plans, and context carry over automatically.
Tools
| Tool | What it does |
|---|---|
nowledge_mem_context_bundle | Read startup context: owner identity, agent identity, active space, Rules, Working Memory, and KFS paths. |
nowledge_mem_working_memory | Read today's lightweight Working Memory: focus areas, priorities, recent activity. |
nowledge_mem_search | Search knowledge from all your tools. Supports label, date, and deep mode filters. |
nowledge_mem_save | Save a decision, insight, or preference so any tool can find it. |
nowledge_mem_update | Update an existing memory with refined information. |
nowledge_mem_thread_search | Search past conversations from any tool. |
nowledge_mem_save_thread | Save the current session as a full conversation thread on demand. Automatic idle capture normally handles this for new work. |
nowledge_mem_save_handoff | Save a curated handoff summary (lighter, agent-composed). |
nowledge_mem_status | Check Nowledge Mem server connectivity and diagnostics. |
How Session Capture Works
Nowledge Mem captures OpenCode sessions in four complementary ways:
Plugin automatic live capture. When OpenCode reports session.status=idle (or the older session.idle event), the plugin waits briefly for messages to flush, reads the current session through OpenCode's SDK, and writes the matching opencode-... thread to Mem. This is the path you should rely on for new work.
Pre-compaction flush. Before OpenCode compacts a long session, the plugin saves the current transcript through the same thread path, then reminds the agent to reload Mem context after compaction.
Manual full session capture. nowledge_mem_save_thread reads the current session's messages via OpenCode's SDK client and posts them to Nowledge Mem over HTTP. It is safe to run multiple times and remains useful as an explicit fallback.
Plugin proactive knowledge save. nowledge_mem_save captures individual decisions and insights during the conversation, stamped with source=opencode. nowledge_mem_save_handoff creates a curated summary at wrap-up. Both complement the full transcript with focused, high-value takeaways.
Desktop import reads OpenCode's local database directly, so it only sees sessions on the machine where Mem is running. In remote mode, use the native plugin's live capture or run nmem t sync on the client machine where OpenCode stores its sessions.
Import older sessions
To backfill older OpenCode sessions, preview first:
nmem t sync --from opencode --all-projects --limit 20Then import:
nmem t sync --from opencode --all-projects --applyUse -p /path/to/project instead of --all-projects when you only want one project. The command reads OpenCode's local session database or legacy JSON storage on this machine and writes to the Mem server configured in nmem. Imported history becomes searchable immediately; deeper distillation remains an explicit review step.
Configuration
No config needed for local use.
| Env Variable | Default | What it does |
|---|---|---|
NMEM_API_URL | (local) | Remote Nowledge Mem server URL |
NMEM_API_KEY | (none) | API key for remote access |
For a persistent shared setup, configure this machine once with nmem config client .... Environment variables still take priority when you need a temporary override.
Remote access
nmem config client set url https://your-server
nmem config client set api-key your-keyOpenCode uses that same shared config for nmem command tools, automatic idle capture, manual session capture, and historical sync.
See Access Mem Anywhere.
Troubleshooting
nmem not found. Install with pip install nmem-cli, then run nmem status to verify.
Server not responding. Start the Nowledge Mem desktop app, or check nmem status for diagnostics.
Plugin not loading. Re-run opencode plugin opencode-nowledge-mem -g --force, confirm "opencode-nowledge-mem" appears in your opencode.json plugin array, then restart OpenCode.
Related
- Connectors overview
- Claude Code · Pi · Hermes Agent · OpenClaw · Alma
- Plugin source: nowledge-mem-opencode-plugin