If you also use Google Antigravity, you can read the exact same PR-approved memories there — both your global store and each repository’s project store — without duplicating files or changing how OpenCode manages them.
Antigravity integration is read-only. Antigravity can see active memory titles at session start and load full memory bodies on demand, but it cannot propose, update, retire, or publish memories. Continue using OpenCode (or a normal Git pull request) whenever you want to add or change a memory.
Set up Antigravity (one-time)
- Install the package globally so
opencode-memory-hookandopencode-memory-mcpare on yourPATH:
npm install -g @chncaesar/opencode-plugin-memory@latest
- Add the session-start hook to
~/.gemini/config/hooks.jsonso every new Antigravity session receives your active memory index automatically:
{
"opencode-memory": {
"SessionStart": [
{
"type": "command",
"command": "opencode-memory-hook"
}
]
}
}
- Add the read-only MCP server to
~/.gemini/config/mcp_config.jsonso Antigravity can load full memory bodies when a title looks relevant:
{
"mcpServers": {
"opencode-memory": {
"command": "opencode-memory-mcp"
}
}
}
If you already have other hooks or MCP servers configured, merge these entries into your existing files instead of replacing them.
What happens automatically
- Instant index at session start: When a new Antigravity session opens, the hook reads your local global store and the current repository’s managed project store and injects only active memory IDs and titles. Startup never waits for remote Git fetches.
- Background refresh: After emitting the index, the hook triggers a background refresh (throttled across concurrent windows) so newly merged pull requests appear in later reads and future sessions.
- On-demand full reading: When a title in the index is relevant to your task, Antigravity calls
memory_readthrough MCP to load the full memory body. It passes the current workspace path automatically so project memories stay isolated per repository. - Graceful degradation: If a repository is opened for the first time (before its managed project store is ready) or one store is busy refreshing, startup still proceeds immediately and the other store remains readable.
Optional settings
Both commands use the same defaults as OpenCode (see Configure). If you changed defaults in OpenCode — for example, a custom global store location — pass the matching environment variables in your hook or MCP server configuration:
| Environment variable | Default | Purpose |
|---|---|---|
OPENCODE_MEMORY_GLOBAL_PATH | ~/.local/share/opencode/memory | Path to your global memory repository clone. |
OPENCODE_MEMORY_GLOBAL_ENABLED | true | Set to false to disable the global store and read project memories only. |
OPENCODE_MEMORY_MAX_SUMMARY_CHARS | 10000 | Maximum characters shared by the global and project title indexes at session start. |
OPENCODE_MEMORY_GLOBAL_INDEX_SHARE | 0.7 | Share of the index budget the global store may use (the project store keeps at least the remainder). |
OPENCODE_MEMORY_ENABLE_LOG | true | Set to false to disable operation logging. |
What Antigravity does not see or do
- No unmerged drafts: Staged proposals and open pull requests are never shown in Antigravity. Only merged active memories (and retired memories when explicitly requested) are returned.
- No working-tree edits: Project memories always come from the plugin-managed checkout of the remote default branch, never from uncommitted files in your working directory.
- No write tools: Antigravity does not expose
memory_propose,memory_update,memory_delete, ormemory_publish, and does not run background semantic audits.
Upgrading
Because opencode-memory-hook and opencode-memory-mcp come from the global npm install, upgrade them with the same command you use for the bot:
npm install -g @chncaesar/opencode-plugin-memory@latest