You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Will consider mempalace as session db? It able to search related message across all session with 170 token only. I can use claude opus help to contribute before june
Thanks @geco for sharing your persistence plugin! It's great to see the MemPalace integration evolving.
I wanted to share another approach that complements the persistence work - automatic Memory Injection with Wake-up Context using the experimental.chat.messages.transform hook.
While your plugin handles the write side (saving conversations), I've been experimenting with the read side - automatically injecting relevant memories and wake-up context before the AI processes each message, without relying on model discipline to search MemPalace.
Key Implementation
The core mechanism uses experimental.chat.messages.transform to intercept and augment user messages:
"experimental.chat.messages.transform": async(_input,output)=>{if(!output?.messages?.length)returnoutputconstlastUser=[...output.messages].reverse().find(m=>m.info?.role==="user")if(!lastUser)returnoutput// 1. Wake-up: Inject L0+L1 context on first messageif(!wakeupDone){wakeupDone=trueconstctx=wakeup()// Calls `mempalace wake-up`if(ctx){lastUser.parts.push({id: `mp-wakeup-${Date.now()}`,type: "text",synthetic: true,text: `[MemPalace Context]\n${ctx}\n[/MemPalace Context]`})}}// 2. Recall: Search and inject relevant memoriesconstquery=textFromParts(lastUser.parts,true)constmemories=search(query)// Similarity search with budget controlif(memories){lastUser.parts.push({id: `mp-recall-${Date.now()}`,type: "text",synthetic: true,text: `[MemPalace Recall]\n${memories}\n[/MemPalace Recall]`})}returnoutput}
Benefits
Guaranteed Recall - Doesn't depend on model following AGENTS.md instructions (which smaller models skip ~60% of the time)
Wake-up Context - Provides L0+L1 identity/project context automatically, similar to AAAK pattern
Token Efficient - Uses similarity thresholds (MIN_SIMILARITY=0.20) and character budgets (MAX_INJECT_CHARS=900)
Zero Configuration - No need for separate AGENTS.md or identity.txt files
Storage Side
For the persistence side, maybe consider following:
@d0uub I ended up implementing this as a plugin — opencode-mempalace-persistence. It uses experimental.chat.messages.transform to inject relevant MemPalace memories into every prompt automatically (the approach you pioneered). The plugin also saves conversations back to MemPalace in real-time.
Activity
github-actions commentedon May 15, 2026
This issue might be a duplicate of existing issues. Please check:
geco commentedon Jun 3, 2026
Hey @d0uub, I built an OpenCode plugin that persists conversations to MemPalace in real-time — might be what you are looking for:
https://github.com/geco/opencode-mempalace-persistence
Happy to collaborate or discuss how this could be extended as a native session backend. Also just opened a PR to list it on the ecosystem page: #30540
d0uub commentedon Jun 4, 2026
Thanks @geco for sharing your persistence plugin! It's great to see the MemPalace integration evolving.
I wanted to share another approach that complements the persistence work - automatic Memory Injection with Wake-up Context using the
experimental.chat.messages.transformhook.While your plugin handles the write side (saving conversations), I've been experimenting with the read side - automatically injecting relevant memories and wake-up context before the AI processes each message, without relying on model discipline to search MemPalace.
Key Implementation
The core mechanism uses
experimental.chat.messages.transformto intercept and augment user messages:Benefits
Storage Side
For the persistence side, maybe consider following:
geco commentedon Jun 4, 2026
@d0uub I ended up implementing this as a plugin — opencode-mempalace-persistence. It uses experimental.chat.messages.transform to inject relevant MemPalace memories into every prompt automatically (the approach you pioneered). The plugin also saves conversations back to MemPalace in real-time.
Repo: https://github.com/geco/opencode-mempalace-persistence
npm: opencode-mempalace-persistence@1.3.1
Thanks for the inspiration — your comment sparked the auto-inject approach.