RAMen Back to RAMen

How to make llama.cpp remember chats after a restart

When llama.cpp reads a conversation it builds a working memory for it, the KV cache. That memory lives in RAM or on the GPU, so restarting llama-server, or switching between many chats, throws it away. The next message then makes the model read the whole conversation again from the first word. On long chats that wait is long: a 70,082-token chat took 12 minutes 47 seconds to read again on a Mac mini M2 Pro with Qwen3 4B.

There are three ways to keep that memory, from most manual to least.

1. By hand, with llama-server's slot save and restore

Start the server with a folder for saved slots (recent llama.cpp versions listen on port 9931 unless you pass --port, so the command sets 8080 to match the examples below):

llama-server -m model.gguf --port 8080 --slot-save-path ./slots

After a long conversation in slot 0, save its memory to a file:

curl -X POST "http://127.0.0.1:8080/slots/0?action=save" \
     -H "Content-Type: application/json" -d '{"filename": "my-chat.bin"}'

After a restart, load it back before you send the next message:

curl -X POST "http://127.0.0.1:8080/slots/0?action=restore" \
     -H "Content-Type: application/json" -d '{"filename": "my-chat.bin"}'

This works, and it is built in. The catches: you have to remember to save and restore, each file belongs to one slot, the file must come from the same model and settings, and chat apps such as Cline, Continue or Open WebUI never call these endpoints for you.

2. With a small proxy that does it for you

Small open tools sit in front of llama-server and save and restore slots around each request, for example StillWarm and hearth. They are a good fit if you run one model and want the saving part only.

3. With RAMen

RAMen does the saving for every chat and agent session automatically, checks that each saved memory matches the model and settings before using it, and lets many chats share a few live slots while the rest wait on disk. In the same test as above, the 70,082-token chat came back with its first word after 3.7 seconds. It also does one thing the tools above do not: it keeps long chats fast by reading only the parts of the conversation that matter for each new word. How it works, with all measurements.

Install with one command, then start it:

curl -fsSL https://getramenai.com/install.sh | bash      # Mac and Linux
irm https://getramenai.com/install.ps1 | iex             # Windows (PowerShell)
ramen start

RAMen has a free plan that keeps your last 3 chats; every install starts with 14 days of everything. See plans.