drayGet started

Coding agents Facts checked 12 October 2026

OpenCode memory

OpenCode’s docs describe rules, not memory: it follows the AGENTS.md files you write and keeps your sessions on disk. Dray saves each turn to your Dray account, where every agent you connect can search it, and removes a session when you delete it in OpenCode.

Get started

Needs macOS or Linux with Node.js 18 or later.

ON THIS PAGE

How OpenCode remembers on its own

  • “Place an AGENTS.md in your project root for project-specific rules.” OpenCode finds it by walking up from the current folder. OpenCode docs: rules
  • Global rules go in ~/.config/opencode/AGENTS.md and apply to all your OpenCode sessions. That file isn’t committed to Git or shared with your team. OpenCode docs: rules
  • Without an AGENTS.md, OpenCode falls back to Claude Code’s files: CLAUDE.md in the project, and ~/.claude/CLAUDE.md for global rules. The first matching file wins in each case, and OPENCODE_DISABLE_CLAUDE_CODE=1 turns the fallback off. OpenCode docs: rules
  • The instructions option in opencode.json adds more instruction files. /init creates an AGENTS.md, or improves the one you have. OpenCode docs: rules
  • OpenCode’s rules and TUI docs describe no memory that carries over between sessions. OpenCode docs: rules OpenCode docs: TUI

Where your history lives

  • OpenCode stores session data on disk under ~/.local/share/opencode/ on macOS and Linux. OpenCode docs: troubleshooting
  • opencode --continue (-c) continues the last session and --session (-s) opens a specific one. opencode session list and opencode session delete <id> manage them. OpenCode docs: CLI
  • opencode export writes a session as JSON and opencode import reads one back. In the TUI, /sessions lists and switches sessions, and /export saves one as Markdown. OpenCode docs: CLI OpenCode docs: TUI

What Dray adds

  • Dray saves through a plugin, ~/.config/opencode/plugins/dray.js, which OpenCode loads at startup. When a session goes idle, it saves what you typed and the answer the turn ended on to your Dray account. OpenCode docs: plugins
  • Delete a session in OpenCode and Dray deletes it too. OpenCode is the only one of these agents that tells a plugin when a session is deleted.
  • Images you paste are saved with their turn, and each session is filed under whichever model provider answered it.
  • Token saver is a free extra, off unless you run dray tokens on. On your computer, it outlines big files and shrinks big browser screenshots before OpenCode reads them. OpenCode can still read the full file. It can’t overwrite one it has only seen in outline until it has read all of it. Dray: connect
  • The import brings in the last 30 days of OpenCode history. It skips subagent sessions, helper sessions a plugin starts, and copies of other agents’ sessions, which those agents’ own capture saves.
  • Anything in the text that looks like a key or password is removed on your computer before it is sent. Dray: connect
  • OpenCode can then search what you saved from your other agents and web chats, and they can search what it saved.
  • Setup adds Dray’s commands to ~/.config/opencode/commands: /link links this chat with your other chats, /link CODE joins a link another chat made, /unlink leaves it, and /dray-status checks what Dray has saved. Dray: connect

Set it up

One command sets up OpenCode and the other agents it finds on your computer. It needs Node.js 18 or later on macOS or Linux, and no Chrome extension.

Terminal
curl -fsSL https://api.withdray.com/cli/install.sh | sh
  1. Your browser opens Dray. Use the same Dray account as your web chats and choose Connect coding agents. This approves the computer.
  2. Setup lists the agents it found, all ticked. Untick any you want to leave out with the arrow keys and space, then press Enter.
  3. For OpenCode, setup installs the plugin and adds Dray’s memory tools to ~/.config/opencode/opencode.json. If your settings are in opencode.jsonc, setup leaves that file alone and prints the lines to add.
  4. Restart OpenCode to use it.

To set up OpenCode on its own, or add it later:

Terminal
dray setup --agents opencode

Memory tools only, by hand

Add this to opencode.json. Connecting this way does not save your sessions.

opencode.json
{
  "mcp": {
    "dray": { "type": "remote", "url": "https://mcp.withdray.com/mcp" }
  }
}

Sign in with opencode mcp auth dray and check with opencode mcp list.

Limits

  • Not saved: tool calls, command output, file contents, the agent’s reasoning, subagent threads, and the narration before a turn’s last tool call. Dray: connect
  • opencode run one-shot runs are not saved unless you run dray config scripted on.
  • Importing OpenCode’s history needs Node.js 22.13 or later.
  • This computer’s sign-in lasts about 90 days. After that, new sessions wait on your computer until you sign in again. Dray: connect
  • Uploading and learning are separate steps, so a new session may take a while to show up in a search. Saved sessions count toward your plan’s monthly allowance like any other messages. Dray: connect

Sources

Facts checked on 12 October 2026 against these pages.