OpenCode memory layer with private retrieval and safe autosave.
Keep OpenCode context-aware without extra prompts.
- Finds relevant memory automatically before normal replies
- Saves durable knowledge quietly in the background
- Keeps writes safe through one controlled tool
- Protects sensitive data before anything is stored
Install MemPalace:
pip install mempalace
mempalace init <dir>
mempalace mine <dir>Add the plugin to opencode.json:
{
"plugin": ["@rvboris/opencode-mempalace"]
}That is enough to enable memory search, autosave, and mempalace_memory.
- hidden memory lookup before answers
- autosave on session lifecycle events
- separate user and project memory
- one safe memory tool for the model
- local Python bridge to MemPalace
The plugin does not require the MemPalace MCP server.
This is the only tool the model needs.
save— store a durable preference, fact, or decisionsearch— find relevant memory by querykg_add— add a structured fact to the knowledge graphdiary_write— save a short work note or daily logmine_messages— internal autosave mode used by the plugin
Save a user preference:
mempalace_memory
mode: save
scope: user
room: preferences
content: Prefers concise responses and numbered steps.
Save a project decision:
mempalace_memory
mode: save
scope: project
room: decisions
content: Use Bun for builds and tests.
Search memory:
mempalace_memory
mode: search
scope: project
room: workflow
query: build command
limit: 3
Add a graph fact:
mempalace_memory
mode: kg_add
subject: my-repo
predicate: uses
object: bun
User memory
preferencesworkflowcommunication
Use it for stable cross-project habits and preferences.
Project memory
architectureworkflowdecisionsbugssetup
Use it for repository-specific knowledge.
Optional config file: ~/.config/opencode/mempalace.jsonc
Useful environment variables:
MEMPALACE_AUTOSAVE_ENABLEDMEMPALACE_RETRIEVAL_ENABLEDMEMPALACE_KEYWORD_SAVE_ENABLEDMEMPALACE_PRIVACY_REDACTION_ENABLEDMEMPALACE_AUTOSAVE_LOG_FILEMEMPALACE_ADAPTER_PYTHON
- respects
<private>...</private>blocks - redacts common secrets before writes
- skips fully private content
- Release history:
CHANGELOG.md - Changelog rules:
CONTRIBUTING.md#changelog
Load from source:
{
"$schema": "https://opencode.ai/config.json",
"plugin": [
"file:///ABSOLUTE/PATH/TO/mempalace-autosave/plugin/index.ts"
]
}Build:
npm run buildDebug logs:
opencode --log-level DEBUGFile log: ~/.mempalace/opencode_autosave.log
- OpenCode: https://opencode.ai
- MemPalace: https://github.com/milla-jovovich/mempalace
{ "autosaveEnabled": true, "retrievalEnabled": true, "keywordSaveEnabled": true, "maxInjectedItems": 6, "retrievalQueryLimit": 5, "privacyRedactionEnabled": true }