The Problem
Every OpenCode session starts from scratch. Your AI doesn't remember past conversations, decisions, or solved problems. You repeat context over and over.
The Solution
opencode-mempalace-persistence is a pure TypeScript plugin that auto-saves every conversation to MemPalace β a local vector database with 96.6% recall on LongMemEval. No cron, no cloud, no API keys.
Architecture
The plugin uses two OpenCode hooks:
chat.message β when you send a new question, the previous turn (question + answer) is saved
session.idle β catches the last turn before you close OpenCode
Each turn is categorized by wing type (developer, creative, emotions, family, consciousness) and fed to MemPalace's vector store. Knowledge Graph facts (decisions, milestones, problems, preferences) are extracted automatically.
The mining runs asynchronously β state is saved immediately, and MemPalace indexing happens in the background.β¦