drayGet started

Coding agents Facts checked 27 October 2026

Kimi Code memory

Kimi Code’s docs describe sessions saved on your computer and compression of long ones, but no memory it builds for itself. Dray saves each turn from Kimi Code to your Dray account, where every agent you connect can search it.

Get started

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

ON THIS PAGE

How Kimi Code remembers on its own

Where your history lives

  • All sessions are saved under ~/.kimi-code/sessions/, grouped by working directory. Each has a state.json for its details and an event log at agents/<agent>/wire.jsonl. Moonshot asks you not to edit these files. Kimi Code docs: sessions
  • kimi --continue resumes the latest session in the current directory, kimi --session <id> resumes a specific one, and kimi --session alone opens a list. /sessions (also /resume) switches sessions from inside one, and /fork makes an independent copy. Kimi Code docs: sessions
  • The pages we read give no retention period for saved sessions. Kimi Code docs: sessions

What Dray adds

  • Setup installs a Dray plugin in ~/.kimi-code/plugins/managed/dray/ and registers it in ~/.kimi-code/plugins/installed.json. Its hooks run when you send a prompt, when a turn stops and when the session ends. They save what you typed and the answer the turn ended on, filed under the company whose model answered. Dray: connect
  • Setup also adds a server named dray to ~/.kimi-code/mcp.json. It runs the local bridge that the Dray CLI provides (dray mcp serve), so Kimi Code needs no sign-in of its own. Kimi Code lists the tools as mcp__dray__search_memory and so on. Dray: connect
  • Images you paste into a prompt are saved with their turn while dray images is on. Dray: connect
  • The import brings in the last 30 days of Kimi Code history from ~/.kimi-code/sessions/. It reads the main agent only. Dray: connect
  • Anything in the text that looks like a key or password is removed on your computer before it is sent. Dray: connect
  • Kimi Code 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 ~/.kimi-code/skills. In Kimi Code they start with /skill:, not /: /skill:link links this chat with your other chats, /skill:link CODE joins a link another chat made, /skill:unlink leaves it, and /skill:dray-status checks what Dray has saved. Dray: connect

Set it up

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

Terminal
curl -fsSL https://api.withdray.com/cli/install.sh | sh
Windows PowerShell
irm https://api.withdray.com/cli/install.ps1 | iex
  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. Restart Kimi Code. A new session loads the plugin and the server, and one that is already open doesn’t.
  4. Ask Kimi Code to search your memory. Kimi Code 2.3.3 asks before every tool call, so pick Approve for this session.

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

Terminal
dray setup --agents kimi

If you don’t have Kimi Code yet, install it with curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash or npm i -g @moonshot-ai/kimi-code, then sign in with kimi login. Setup finds it when ~/.kimi-code/bin/kimi or ~/.kimi-code/sessions exists, or the kimi on your PATH is Kimi Code’s (not the old Python kimi-cli). Dray: connect Kimi Code docs

There are no steps by hand: the CLI connects Kimi Code through its local bridge. Dray: connect

Limits

  • Kimi Code 2.3.3 asks before every tool call, because its allow rules don’t take effect yet. Dray can’t turn the prompts off. Dray: connect
  • Not saved: sub-agent conversations, and sessions Kimi Code imported from Claude Code or Codex, since Dray already has those from the original agent. Dray: connect
  • Runs with kimi -p aren’t saved unless you run dray config scripted on, the same rule as claude -p. Dray: connect
  • The old Python kimi-cli (the ~/.kimi folder) isn’t supported. kimi migrate moves its sessions into Kimi Code, and Dray then imports them. Dray: connect
  • 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
  • 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 27 October 2026 against these pages.