oG-Memory opencode Plugin
oG-Memory context engine plugin for opencode.
Installation
Add the plugin to your project's opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"plugin": [
"git+https://gitcode.com/opengauss/oG-Memory.git#dev"
]
}
Run opencode — the plugin is automatically cloned and loaded. No manual git clone or dependency install needed.
How It Works
The plugin hooks into opencode's lifecycle automatically:
- Chat message — calls
/api/v1/composebefore model inference to inject retrieved memory context into the conversation - Tool execution — records side-effect tool calls (Write, Edit, Bash, etc.) into oG-Memory for indexing
- Session idle — on conversation end, submits the full session to oG-Memory for archival
- Session compacting — before context compression, submits conversation to preserve memory
If the oG-Memory service is unreachable, the plugin silently skips all operations — opencode works normally regardless.
Development
cd opencode_plugin
npm install
npm run build # compile TypeScript
npm run test # run unit tests
For local development, use a relative path in opencode.json:
{
"plugin": ["./opencode_plugin/src/index.ts"]
}