Skip to content

Save Claude Code chats

The Relay plugin for Claude Code saves each chat to your Relay server as you talk. You find a chat on the Relay page by a word, and your AI can search it through the AI connector. Ask save this to Relay, and the AI also writes a title and a summary of what you decided, kept beside the chat.

The owner of the Relay server makes one connect code for each computer, on the computer that holds the server’s project:

Terminal window
node scripts/relay-device-key.mjs create --name "Laptop" --for claude-code

The code shows once: in that terminal, and on a private page on that computer. It is a key that can only add chats. It can’t read, change or delete anything on your server, and it lasts one year.

To keep chats in your own account, run your own Relay server and make the code there. The plugin sends only to the server in the code: it has no address built in.

  1. In Claude Code, add the plugin from the public Relay repository:

    /plugin marketplace add matthewwong525/RelayEverything
    /plugin install relay@relay
  2. When Claude Code asks for the Relay connect code, paste the code. Claude Code keeps it in your system’s secure store.

  3. Delete the code’s private page.

Chats from then on are saved. Chats from before the install are not sent.

After each answer, the plugin sends the chat’s new messages:

  • each message you typed, and each answer the AI wrote, word for word;
  • one line for each step the AI took, such as Ran: npm test or Read src/app.ts, and for each ! command you run, never the step’s output;
  • the project’s folder name, the chat’s title and the times.

It never sends the AI’s thinking, a file’s contents, a command’s output or a helper’s own chat. Before a message leaves your computer, the plugin replaces keys and tokens, and each value of 8 characters or more in the project’s .env and .dev.vars, with [hidden].

A send that fails waits on your computer, and the next start of Claude Code sends it.

The Chats card on the Relay page lists your chats, newest first. Type words in its search to find the chats that hold all of them. Open a chat to read it: the AI’s saved summary shows at the top, marked Written by the AI, and each step shows as a grey line.

Your AI can search the chats too: the AI connector has the tools search_chats and read_chat.

  • In one project: type /relay:saving off in Claude Code. Type /relay:saving on to save again, or /relay:saving to see which it is and when the project last sent a chat.
  • For one run: start Claude Code with RELAY_SAVE=0 claude.
  • On one computer: turn the key off with node scripts/relay-device-key.mjs revoke --name "Laptop", or remove the plugin with /plugin uninstall relay@relay.

Open the chat on the Relay page, click Delete, then confirm. Relay removes the chat, its messages and the AI’s summary. You can’t undo it. If the chat is still open in Claude Code, turn saving off first, or the plugin sends it again with your next message.

The plugin calls two routes with the chat key, CF-Access-Client-Id and CF-Access-Client-Secret, as headers.

POST https://<your-relay-server>/apps/relay/api/chats adds a chat’s new messages:

{
"sessionId": "5d1c2b7a-0e4f-4a6b-9c3d-8e7f6a5b4c3d",
"project": "relay-ring",
"startedAt": 1793800800000,
"title": "How thick should the stiffener be?",
"messages": [
{ "seq": 0, "role": "you", "text": "How thick should the stiffener be?", "at": 1793800800000 },
{ "seq": 1, "role": "step", "text": "Read pcb/relay.kicad_pcb", "at": 1793800830000 },
{ "seq": 2, "role": "ai", "text": "0.2 mm steel is enough for a ring this size.", "at": 1793800860000 }
]
}
  • role is you, ai or step. seq counts from 0 in each chat, and at is milliseconds since 1970.
  • The answer is only { "stored": 3 }: how many messages the server holds for this chat.
  • A message the server holds already is kept as it was. A repeat changes nothing, and the chat’s title, project and start stay as the first send gave them.
  • When the first seq is past stored, the answer is 400 with stored. Send again from there.
  • Send at most 500 messages and 4 MB at a time, and at most 200,000 characters in one message. A larger send answers 413 and stores nothing.

POST https://<your-relay-server>/apps/relay/api/chat-saves adds the AI’s summary to a chat this key sent: { "sessionId": "...", "title": "Stiffener plan", "text": "Use a 0.2 mm steel stiffener." }. The answer is { "ok": true }, or 404 when this key sent no chat with that sessionId.

A chat key gets 403 on every other route. Only a signed-in person can list, read or delete chats: Routes shows each one.