Korely

Blog Coding agents · Persistent memory

How to give Claude Code persistent memory

After a compact, Claude Code forgets what we decided, and I'm the one who has to remember. Here is a memory it can ask instead.

On this page
A person walks from the laptop at home to the laptop at the office, holding up one key. Both laptops run Claude Code and reach one Korely memory, a yellow note: deploys to Render, crossed out on Tuesday, and below it deploys to Hetzner.
Render is crossed out, and still readable from both desks. The Claude Code icons are my own cartoon drawings.

To give Claude Code a memory that lasts, make a free Korely key that can read and write, and connect Korely's memory server with one claude mcp add command. The server asks Claude Code to read the current facts before it answers and to save a decision once it's settled. Keys from the same Korely project read the same memory, so your other machines, and other coding assistants like Cursor or Codex, can read it too.

The story

When a decision lives only in the chat

I use Claude Code a lot, and it sometimes gets things wrong (so do I). It does what I ask, and a few hours later a detail is gone. For me it's usually after a compact. The long chat gets squeezed into a short summary, and the small decisions that lived only in the chat don't all make it. Then I'm the one who remembers. I'm the memory of my own code, and I'm not a good one.

Say on Tuesday you decide to move new deployments from Render to Hetzner (two services that host apps), because the background workers keep going over Render's limits. You only say it in the chat. On Wednesday, after a compact, it sets up a deploy to Render again, and you find out from the error.

Why

Why a file isn't enough

Claude Code's docs put it in one line: "Each Claude Code session begins with a fresh context window." The context window is what it can hold in mind at once, and a new session starts without the last conversation in it. When an instruction is gone after a compact, the first reason the same docs give is that it was said only in the chat. Their advice is to write it in CLAUDE.md, a file of instructions Claude Code reads at the start of every session.

That is the right place for what is stable and has one authoritative answer: how to run the tests, where the files live, the deploy settings in the repository. A decision is different: the reason for it, a preference, a change that nobody has written down anywhere else yet. That lives in the conversation, and the conversation is what a compact squeezes.

Korely keeps those decisions in a memory on a server, and the server asks Claude Code to check it before answering. When Korely's judge, an AI model, decides that a new fact replaces an older one, it crosses out the old one with a date instead of deleting it. The judge can be wrong, so for an important decision, ask Claude Code to list the facts, and correct one if it needs it. Every machine and every assistant with a key from your project reads the same memory.

One rule keeps the memory useful. If another system already holds the authoritative answer, let Claude Code read that system. Use the memory for the decision and its reason, not as a duplicate database. In the Render example, the repository's deploy configuration says where it deploys today. The memory is where you find out why you left Render.

Plugin or server

Do you need a memory plugin for Claude Code?

No. Korely's memory plugs into Claude Code from the outside, so there's nothing to install inside it.

Technically, Korely's memory is a remote MCP server. MCP is an open standard for connecting AI apps to outside services, and Claude Code speaks it. You add the server with your key, and Claude Code gets memory tools to read, save, search, list the facts, correct a fact and forget a memory.

Steps

How to connect Korely to Claude Code

You need Claude Code and a free Korely account. Sign in at agent.korely.ai and open the API keys page. Make a key there. The form ticks read and write and leaves admin off. Keep it that way. A key with admin can manage the whole account, and your editor has no business doing that.

The key lasts 90 days unless you pick another length, and the page shows the end date. Before that day, press Rotate and paste the new key where the old one was. The key is shown once, so copy it now and keep it somewhere safe. Make one key for each machine or assistant you connect, all in the same project. You can revoke or rotate one without touching the others. For a quick personal test, reusing one key works too, but it isn't the safest setup.

The examples here use Korely Cloud, which we run for you: your memories are stored in Europe, in Helsinki. The Data and governance page has the details, and the pricing page says what the free plan includes. Korely is also open source, so you can install it on a server of your own and connect Claude Code to its address instead. Install Self-hosted has the steps, and the installer prints the claude mcp add line for your server.

Now connect the memory to Claude Code. Your key goes in a header. Paste it in place of kor_live_...:

claude mcp add --transport http korely https://api.korely.ai/agent/mcp \
--header "Authorization: Bearer kor_live_..."

The key now sits in your shell history and in Claude Code's settings. Keep it out of screenshots and tickets, and revoke it on the API keys page when you stop using it. By default the server loads in this project folder, on this machine. Add --scope user to have it in all your projects on this machine. Then run /mcp inside Claude Code and check that korely is connected.

On your other machine, make a key in the same project and run the same command with it. Keys from the same Korely project read the same memory.

How it works

What the memory does when a decision changes

Korely's server sends Claude Code short instructions: read the current facts before answering, and save a decision once it's settled. Picture a week where Claude Code follows them. The arrows are the calls it makes on its own.

# Monday
You › Remember that this repo deploys to Render.
→ korely_add("This repo deploys to Render")
# Tuesday
You › We decided to move new deployments from Render to Hetzner, because
the background workers keep going over Render's limits. Remember that.
→ korely_add("We decided to move new deployments from Render to Hetzner,
because the background workers keep going over Render's limits")
# next session, days later
You › Where do new deployments go, and why did we leave Render?
→ korely_get_context("deployments Render Hetzner")
Claude › To Hetzner. You decided it on Tuesday, because the background
workers kept going over Render's limits. ...

The memory lives outside the chat, so a compact doesn't touch it. Claude Code still decides when to call it.

Korely reads each thing you save and writes short facts from it. Each fact has a subject, a relation and an object: "new deployments / go to / Hetzner".

A fridge door with a note held by a magnet: dentist Tuesday crossed out on Monday, and dentist Thursday written below.
The note on the fridge is how Korely keeps a decision that changed.

When the judge decides that a new fact replaces an older one, Korely closes the old fact with an end date and keeps it. So when you ask where new deployments go, you get the answer that holds now, and the old one is still there if you want to look. Since a model makes that call, for a decision that matters ask Claude Code to list the facts on that topic, the old ones too. You'll see the current one and the crossed-out ones, each with its date. If one is wrong, ask Claude Code to correct it.

The technical name for this is a temporal knowledge graph. The facts are linked through the things they name (this repo, Render, Hetzner), and each fact carries two dates: when it was true, and when Korely learned it. "Deploys to Render" was true from Monday to Tuesday, so if you ask what was true on Monday evening, you still get Render. If what you save has a date with its year ("new deployments go to Hetzner since 2 March 2026"), the fact counts from that day, even if it's saved a week later.

Sharing

One memory for every assistant

The memory belongs to a Korely project, not to Claude Code. Give Cursor or Codex a key of the same project, one key for each, and they read and write the same memory. Apps that sign you in instead of taking a key, like the Claude app, ChatGPT and Grok, reach the same server. When they ask for a Korely project, choose the one your keys were made in (Default, unless you picked another), and they share the memory too.

I built Korely for this. I had agents in three different places, Claude Code, Hermes and Grok, and I wanted one memory for all of them. Today the AI agents that help me build Korely each have their own job, and before each piece of work they read their past decisions from one Korely memory. For now I still have them write every decision in plain text files too, so we can put the two side by side and see what works.

It isn't only for editors, either. An agent or a bot you build yourself reads and writes the same kind of memory through the API. The Quickstart gets you a key and a first write.

Optional

Optional: let the hooks save for you

If you'd rather not wait for Claude Code to decide when to save, there's a second way, with Korely's hooks. It has its own behaviour and its own risks, so here is the short version, and the docs have the rest.

Hooks are small scripts Claude Code runs at set moments. Korely's hooks hand Claude Code the repository's memory when a session starts, and save the session as it goes. You need Python. In your repository, run this with a key from the dashboard. It saves the key on your machine and adds the hooks:

pip install -U korely-memory
korely init --tool claude-code --api-key kor_live_...

Before you run it:

  • The hooks send your prompts and Claude Code's answers to your memory: to Korely Cloud, or, if you install Korely yourself and add --base-url with your address, to your own server. Before anything leaves your machine, they blank out what looks like a key. That is best effort, not a guarantee: they judge by shape, so a short password typed into a sentence stays as plain text. Never count on it to make a secret safe to type.
  • The sessions go to one memory per repository, named after its folder: repo:<name>.
  • The command also adds a local memory server named korely for this repository. It takes the place of the remote one and has fewer tools: it can't correct or forget a single fact or memory. To keep the remote server, add --no-mcp, and the command leaves your MCP settings alone.

Then restart Claude Code, so it loads the hooks.

Conclusions

What to take home

Keep the stable rules and the authoritative facts in CLAUDE.md and in the repository, where Claude Code reads them every session. Put the decisions and their reasons somewhere a compact can't reach, where the old one is crossed out with its day and stays readable. Keys from the same project share one memory, and Korely runs on our Cloud or, as open source, on your own server.

Make a free key at agent.korely.ai and connect the memory. Tell Claude Code one thing that changed this week, and ask about it tomorrow. Then wait for the next compact and see who remembers.

Read next

More on memory for Claude Code

FAQ

Questions about Korely and Claude Code

How do I give Claude Code persistent memory with Korely?

Make a key on the API keys page of agent.korely.ai, with read and write and without admin. Then add Korely's remote MCP server with claude mcp add and put the key in a header. The server asks Claude Code to read the current facts before it answers and to save a decision once it is settled. This is Korely Cloud. If you run Korely on your own server, the same command points at your own address.

Do I need to install a plugin in Claude Code?

No. Korely is a remote MCP server. One command with your key connects it, and there is nothing to install inside Claude Code. Claude Code gets memory tools to read, save, search, list facts, correct a fact and forget a memory.

Does the memory follow me to another machine?

Yes. Make a key for the other machine in the same Korely project and run the same command with it. Keys from the same project read the same memory. For a quick test you can reuse one key, but a key for each machine is safer, because you can revoke or rotate one without touching the others.

What does Korely do when a decision changes?

When Korely's judge, an AI model, decides that a new fact replaces an older one, it closes the old fact with an end date and keeps it. A read returns what holds now, and the old fact stays readable, so you can see what changed and when. The judge can be wrong, so for an important decision, list the facts and correct one if it needs it.

Where are my memories stored?

On Korely Cloud, in Europe, on our server in Helsinki. The Data and governance page of the docs has the details. If you install Korely on your own infrastructure, from its open-source code, the memories stay on the server you choose.

Back to top