The most annoying part of using opencode (or any AI coding harness) is watching it start every single session with zero memory of what happened yesterday. A session ends, compaction wipes the slate, and two days later you're watching the agent re-learn the exact same obscure bug fix from scratch. You either burn tokens repeating yourself or manually dig through old transcript files.
I built deja to fix this offline.
It reads your local opencode.db directly and indexes past sessions with zero external API keys, zero LLM calls, and no background daemon eating RAM. It’s just a single Go binary that wakes up on a hook, responds in milliseconds, and dies.
For opencode specifically, a small deja.js plugin injects a digest of relevant past work at session start before you even type your prompt. The agent can also query its history mid-task using MCP tools (deja_recall, blame, remember).
Two features made the biggest difference in my daily workflow:
First, handoff between sessions and tools. The index is shared across 12 harnesses (opencode, Claude Code, Cursor, Codex, Grok etc.). What you fixed in Claude Code yesterday is immediately recalled by opencode today, so you don't lose context when switching tools.
Second, peer-to-peer machine sync. Running deja sync ssh <host> moves new memory between your devices using your existing SSH setup. An agent can grind on a headless mini overnight, and in the morning I pull its memory to my laptop so the local agent instantly knows what was tried, what broke, and what worked. No cloud memory service involved.
Hot searches run in ~12ms. Instead of dumping megabytes of raw transcripts into the context, it distills it down -- deja stats --impact shows it served 199.2 KB of distilled history on my machine instead of shoving 175.7 MB of raw logs back into the prompt. Also, after compaction, the next prompt gets a fresh digest of project memory so the agent doesn't lose the thread.
Search is lexical-first (exact error strings, function names, flags) -- a deliberate tradeoff for zero keys, zero embeddings, and instant local execution. It will miss loose paraphrases that a semantic index catches, but for exact technical artifacts, it hits fast without sending data anywhere. Known secrets (bearer tokens, private keys, high-entropy strings) are stripped during indexing (e.g., replaced with [redacted:bearer-token]).
Setup
You can set it up manually:
curl -fsSL https://raw.githubusercontent.com/vshulcz/deja-vu/main/install.sh | sh
deja install --auto
Or just paste this into your opencode agent:
Install deja memory for my opencode: run curl -fsSL https://raw.githubusercontent.com/vshulcz/deja-vu/main/install.sh | sh, then deja install --auto, then deja doctor. Tell me when it's ready.
Repo: https://github.com/vshulcz/deja-vu (MIT)
How are you handling cross-session memory right now -- MEMORY.md? rules in AGENTS.md? or just re-explaining things?