Skip to content

Repository files navigation

OpenCode Codex Memory

Latest npm version npm downloads

Persistent memory for OpenCode. Your agent learns from past sessions — your conventions, your projects, the decisions you made — and brings useful context into new conversations automatically.

No Codex subscription or OpenAI account required. This plugin ports the memory system from OpenAI's Codex and uses the models you already have in OpenCode. Memory is stored locally as Markdown files and a small SQLite database. Background learning makes additional calls through your configured model providers; there is no separate memory service or MCP server.

Install

The plugin works with its default settings; no extra memory configuration is needed.

1. Add the plugin for your OpenCode version

Run opencode --version if you are unsure which version you use. Add the entry to your existing global ~/.config/opencode/opencode.jsonc or opencode.json (under $XDG_CONFIG_HOME/opencode if set). Keep your other settings and plugins.

OpenCode 2.x

{
  "$schema": "https://opencode.ai/config.json",
  "plugins": [
    { "package": "opencode-codex-memory@0.9.0" }
  ]
}

OpenCode 1.x (1.18 or newer)

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-codex-memory@0.9.0"]
}

Keep a published package version pinned as shown. See Updating the plugin when a new release is available.

2. Restart OpenCode and check status

On OpenCode 2, run:

opencode service restart

On OpenCode 1.x, restart OpenCode. If an IDE or another app manages your OpenCode server, restart that server too.

Start a conversation and ask “Check my memory status.” The agent can run memory_inspect to show progress and any warnings. In OpenCode 2's terminal UI, you can also open the /memory-inspect panel.

Try it

Use OpenCode normally. By default, a session becomes eligible for learning after 6 hours of inactivity, and consolidation combines learned material into memory. The work runs in the background while OpenCode is running; an empty memory immediately after installation is normal.

In a later conversation, try:

  • “What do you know about how I work?”
  • “What was I working on in this repo last week?”
  • “Remember that I deploy this project with make release.”

Explicit “remember this” requests save a note immediately; a later consolidation integrates it into the summary. You can check progress or pause learning at any time.

Memory is global across projects. Project-specific details carry context about where they came from, while general preferences can follow you into a new repo. Files live under ~/.local/share/opencode/ by default. See Storage and privacy for the layout, model-call privacy, backups, and relocation.

Start here

I want to… Read
Recall past work, save a note, or pause learning Using memory
Choose or switch memory behavior Memory V1 and Memory V2
Set models, learning frequency, or other options Configuration
Find, back up, move, or reset my data Storage and privacy
Share with Codex CLI or import Claude Code memories Integrations
Fix missing memory or check an update Troubleshooting

Learn more and contribute

License

Apache 2.0 — the same license as OpenAI Codex, whose memory system this project ports. See LICENSE and NOTICE. Not affiliated with the Codex project.

About

Port of the codex memory patterns to opencode, Purely opencode, no dependency on codex.

Resources

Contributing

Stars

8 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages