docs: align agent plugin guides with shared runtime behavior (#7269)
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
Persistent memory for [OpenCode](https://opencode.ai). Your agent remembers decisions, preferences, and learnings across sessions automatically.
|
||||
|
||||
Current package version: `0.3.0`. This native TypeScript integration keeps its own tools and scopes while sharing redaction and lifecycle utilities with [agent-plugin-core](../agent-plugin-core/README.md).
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
@@ -28,7 +30,7 @@ Restart OpenCode.
|
||||
|
||||
| Component | Description |
|
||||
|-----------|-------------|
|
||||
| **9 Native Memory Tools** | `add_memory`, `search_memories`, `get_memories`, `update_memory`, `delete_memory`, and more — registered as OpenCode tools, backed by the `mem0ai` SDK (no MCP server required) |
|
||||
| **10 Native Memory Tools** | `add_memory`, `search_memories`, `get_memories`, `update_memory`, `delete_memory`, and more — registered as OpenCode tools, backed by the `mem0ai` SDK (no MCP server required) |
|
||||
| **Lifecycle Hooks** | Auto-search on session start and every prompt, error memory lookup, compaction context, secret redaction |
|
||||
| **7 Skills** | `/mem0-remember`, `/mem0-tour`, `/mem0-search`, `/mem0-status`, `/mem0-scope`, `/mem0-forget`, `/mem0-context-loader` — discovered in place from the plugin via OpenCode's `skills.paths` |
|
||||
|
||||
@@ -43,7 +45,7 @@ Pure TypeScript — no Python, no shell scripts. Memory operations are native Op
|
||||
| **Pre-tool** | `tool.execute.before` | Blocks MEMORY.md writes, steering them to the `add_memory` tool |
|
||||
| **Post-tool** | `tool.execute.after` | Scans bash errors and pre-fetches related memories |
|
||||
| **Messages transform** | `experimental.chat.messages.transform` | Injects memory context (session memories, search results, error lookups) into the prompt |
|
||||
| **Compaction** | `experimental.session.compacting` | Stores session state memory, then injects prior memories into compaction context so nothing is lost |
|
||||
| **Compaction** | `experimental.session.compacting` | Stores session state memory, then injects prior memories into compaction context |
|
||||
| **Shell env** | `shell.env` | Exports `MEM0_USER_ID`, `MEM0_APP_ID`, `MEM0_SESSION_ID`, and `MEM0_BRANCH` to shell |
|
||||
|
||||
## Memory Tools
|
||||
@@ -63,7 +65,7 @@ Pure TypeScript — no Python, no shell scripts. Memory operations are native Op
|
||||
|
||||
## Memory scope
|
||||
|
||||
Every memory tool accepts an optional `scope`, and you can set the **default**
|
||||
`add_memory`, `search_memories`, `get_memories`, and `delete_all_memories` accept an optional `scope`. You can set the **default**
|
||||
scope (used when none is passed) with the `/mem0-scope` skill:
|
||||
|
||||
| Scope | Reads | Writes |
|
||||
@@ -83,6 +85,14 @@ fresh on each memory operation, so a change applies immediately — no restart.
|
||||
`delete_all_memories` always requires an explicit `scope="global"` to delete
|
||||
user-wide, so changing the default can't trigger a cross-project wipe.
|
||||
|
||||
## Capture and session context
|
||||
|
||||
Automatic capture saves every third qualifying user prompt. Other exchanges and assistant conclusions can be saved through `add_memory` or the remember skill; this is not a complete transcript recorder. Captured and explicitly saved text is redacted without the former 6,000-character cutoff.
|
||||
|
||||
Automatic capture uses the user and repository IDs, with the session ID in metadata. Explicit `session`-scope writes and searches use the top-level `run_id` filter. A session-scoped search therefore does not automatically include project memories that only carry `metadata.session_id`.
|
||||
|
||||
These `project`/`session`/`global` scopes are specific to this integration, not the Python plugins' `repo`/`dir`/`mine` scopes. Global tool access requires the user to enable it through `/mem0-scope global` or plugin settings first.
|
||||
|
||||
## Verify
|
||||
|
||||
Start OpenCode and ask: *"Search my memories for recent decisions"*
|
||||
@@ -94,11 +104,9 @@ If the `mem0` tools respond, you're all set.
|
||||
| Problem | Fix |
|
||||
|---------|-----|
|
||||
| No tools appearing | Restart OpenCode after installing |
|
||||
| 401 Unauthorized | `echo $MEM0_API_KEY` must print your `m0-` key |
|
||||
| 401 Unauthorized | Check that `MEM0_API_KEY` is set to a valid key without printing it |
|
||||
| Plugin not loading | Run `opencode plugin @mem0/opencode-plugin` again |
|
||||
|
||||
## License
|
||||
|
||||
Apache-2.0
|
||||
|
||||
A memory tool cannot select global scope unless `/mem0-scope global` or the plugin settings already enable it.
|
||||
|
||||
Reference in New Issue
Block a user