Park your model’s conversation state. Pick up where you left off.
kvpark saves a local model's conversation inference state to disk and restores it when you return, using the managed patched llama.cpp runtime. Built for people running open-weight models on their own hardware. MIT licensed. No cloud service or account. The portable runtime uses psutil.
kvpark bridge translates a conversation's cache from one local model to another through a
shared latent, so the new model continues without re-reading the conversation. In live tests
on a 128 GB Ryzen AI Max+ 395, with the translation engine resident on the integrated GPU
(0.5–3.7 s per translation), conversations of 11–14K tokens moved between Qwen3.8-27B (the
production DFlash2 build), Muse-Glimmer-30B and Qwen3-4B in 8–18 s instead of 15–86 s of
native prefill, every target reusing exactly the translated tokens. Draft models (DFlash2,
MTP) keep drafting after a switch, an image in the conversation is read natively by a vision
target, and Hermes' reasoning settings are rendered as the server renders them. A hybrid
target such as Qwen3.8 can start its recurrent state from a per-model mean, which removes most
of the reset's cost on chats. Quality is close to native for chat and noticeably lower for long
documents and tool-heavy agent work. More cache families are supported: twelve more local models
(DeepSeek-style MLA, Kimi's and Ling's linear-attention hybrids, Mamba-style hybrids, Gemma 4) have been
onboarded into the shared latent and measured against Qwen3.8, with quality that varies by model and
direction (a few models are targets only); DSA models and DeepSeek V4 as a target are verified on small
test models only. See docs/bridge.md.
Disk save/resume currently requires the managed patched llama.cpp runtime with one slot. Connecting another server enables chat routing; it does not enable kvpark disk snapshots.
| Inference server | Chat routing | kvpark disk save/resume |
|---|---|---|
| Patched llama.cpp, managed by kvpark | Yes | Supported — validate your model/build |
| Stock llama.cpp | Yes | Unavailable |
| Ollama | Yes | Unavailable |
| vLLM / vLLM-MLX | Yes, through the compatible chat API | Unavailable |
| MLX-LM | Yes | Unavailable |
| Other OpenAI-compatible servers | Compatible chat API required | Unavailable |
For example, Gemma served by vLLM-MLX cannot be parked or resumed by kvpark. The server's own caching is separate. See backend capabilities and requirements.
Alpha release 0.3.0a3. The proxy supports Linux, macOS, and Windows,
with automatic free-port selection.
Download the current alpha.
Previously installed sloth-memory? Follow the
one-time rename migration before enabling kvpark.
The package, CLI, Hermes command, and repository are now named kvpark.
The service is independent of Hermes. A native Hermes adapter provides startup,
slash-command onboarding, and cleanup controls; OpenCode connects with one command.
Other agents integrate through an HTTP proxy and explicit session metadata; a plain
Python example is included.
- Park a conversation: explicitly save the currently resident conversation.
- Resume after process restarts: send the conversation again; compatible state loads automatically before inference.
- Prove reuse: inspect cached and newly processed token counts, plus time to first token for streamed requests, including queueing and restoration.
- Protect ownership: background calls cannot claim a foreground archive.
- Bound storage: seven-day retention and a 32 GiB archive budget by default.
This is an inference-state cache. Your agent must keep and replay the transcript. It does not add semantic memory, expand the context window, or reconstruct a chat from a cache file. Parking does not release the model's preallocated KV buffer.
Your agent → kvpark (local proxy) → inference server
↕
local archive files
Using Hermes? Install kvpark as a Hermes plugin, from Hermes itself:
hermes plugins install uncrayon/kvpark
hermes plugins enable kvparkHermes' plugin scanner asks you to confirm because this repository also contains
installer scripts and tests; answer yes. Restart Hermes, then type /kvpark setup
and pick a model by number. Update later with hermes plugins update kvpark.
kvpark is tested with Hermes 0.21.x; 0.20.1 or newer loads it, and argument
suggestions in the composer need 0.21.0.
Everyone else, or to install the package into Hermes' Python instead: on macOS, Linux, or WSL, paste this into a terminal:
curl -fsSL https://raw.githubusercontent.com/uncrayon/kvpark/main/install.sh | bashThe installer detects Hermes, installs into its own Python environment, enables
the plugin, and then loads it exactly as Hermes does to confirm it works. Without
Hermes, it creates a private standalone installation. It supplies Python when
needed and adds the kvpark command to your shell. No Git checkout, pip setup,
virtual-environment activation, or sudo.
After installation, the setup wizard opens automatically:
- Pick a model from the numbered list of running servers.
- Confirm with yes, or choose 0 to set up later.
- For Hermes, restart it and start a new conversation.
No model IDs to look up, ports to type, or setup flags to assemble. The scan checks this computer's listening ports and asks model servers which models they offer. Your current connection changes only after you confirm and the new connection works.
To reopen the chooser, type /kvpark setup in Hermes, or kvpark setup in a
terminal. Existing servers support chat routing; disk park/resume still requires
the patched llama.cpp runtime. The wizard tells you which capability you are selecting.
Something off? kvpark doctor --hermes, run with Hermes' Python (the installed
kvpark command does that), reports Hermes' version, where kvpark loads from,
whether /kvpark registered, which route Hermes uses, and whether the proxy answers.
Force a standalone install:
curl -fsSL https://raw.githubusercontent.com/uncrayon/kvpark/main/install.sh | bash -s -- --standaloneNeed the patched llama.cpp runtime for disk park/resume? Add --runtime cpu
(or metal, cuda, hip, or vulkan for your installed GPU toolchain). This
also requires Git, CMake, and a C++ compiler. The installer builds the runtime and
prints the exact setup command; you supply your own GGUF model.
See installer options, custom Hermes locations, and troubleshooting. Native Windows and manual installation instructions are below; WSL uses the one-command installer.
Manual installation and runtime launch (advanced)
Requirements: Python 3.10+ and Git. Building the managed llama.cpp runtime also requires CMake and a C/C++ toolchain (Xcode Command Line Tools on macOS). For Hermes, use its own Python environment.
The .venv below belongs only to kvpark. If you plan to run
hermes plugins enable kvpark, use the Hermes installation commands
instead; Hermes cannot discover packages installed only in this separate environment.
On macOS/Linux:
git clone --branch v0.3.0a3 https://github.com/uncrayon/kvpark.git
cd kvpark
python3 -m venv .venv
source .venv/bin/activate
python -m pip install .On Windows, use py -3 -m venv .venv and activate it in PowerShell with
.\.venv\Scripts\Activate.ps1, then run the same pip command.
To connect an existing server, continue with backend setup; no runtime build is needed for routing. To test disk park/resume, build the managed runtime (CPU first):
python scripts/build_runtime.py --cmake-arg=-DGGML_METAL=OFFThe build script fetches an exact llama.cpp commit and applies the included
checkpoint persistence patch. It builds in runtime/; it does not modify an
existing inference installation. See runtime compatibility
for GPU builds and the current scope.
Start the backend in one terminal (on Windows, use the llama-server.exe path
printed by the build, usually runtime/build/bin/Release/llama-server.exe).
The multiline shell examples below use macOS/Linux syntax; in PowerShell, put
the command on one line and omit the continuation backslashes:
kvpark backend \
--server runtime/build/bin/llama-server \
--model /absolute/path/to/your-model.gguf \
-- --ctx-size 8192 --cache-ram 0 --ctx-checkpoints 8 --checkpoint-min-step 128 --jinjaIn another terminal with the same virtual environment active:
kvpark serveKeep both terminals running. Run kvpark doctor from a third terminal with
the same environment active. Ports 8080 and 8090 are preferences; occupied ports
automatically fall back to free ones. CLI controls discover the selected proxy.
Storage defaults to ~/Library/Application Support/kvpark on macOS,
~/.local/share/kvpark on Linux, or %LOCALAPPDATA%\kvpark on Windows;
XDG_DATA_HOME overrides these. To change it, pass the same --archive-dir to
the backend, proxy, and control commands.
For an installed kvpark package, use /kvpark update check in Hermes to compare
installed, loaded, and running versions, then /kvpark update to install a
published release. The former sloth-memory package needs the one-time migration first. The updater saves
resident state, replaces its proxy, verifies health, and attempts rollback on
failure. Hermes gateways restart through their native restart lifecycle.
A plugin-directory installation is updated with hermes plugins update kvpark
followed by a Hermes restart; /kvpark update says so.
For terminal use on any OS: python -m kvpark update check and
python -m kvpark update. See updates and recovery.
The installer enables the plugin in Hermes' own Python environment and opens the model chooser. To choose or change a model later, run:
/kvpark setup
Choose a model number and confirm with yes. Choose 0 to leave the current
connection alone. The Hermes setup guide shows the full flow.
Migrating from sloth-memory? Use the rename migration, which preserves its archive and backend.
Already using a custom proxy or qwen-slot? Follow the migration steps
to retire the old services and preserve your model settings.
Complete setup starts the proxy and points new Hermes sessions at the chosen
model server, not at the proxy: the plugin inserts the proxy into each request
while it is running. If kvpark is stopped, or Hermes cannot load the plugin,
Hermes keeps talking to the server directly, just without parking.
The managed llama.cpp backend also starts with Hermes; existing servers remain
under your control. Services keep running after Hermes closes for cleanup. No sudo
is needed. To relaunch them at boot without Hermes, run kvpark start --hermes --supervise
from a systemd or launchd service.
Disk controls below require native snapshot mode.
/kvpark doctor
/kvpark save
/kvpark forget
/kvpark retention 7
/kvpark cleanup off
/kvpark cleanup on
/kvpark base-url http://127.0.0.1:8080
By default, cleanup runs hourly and expires snapshots seven days after saving. It deletes disk snapshots, not transcripts or live RAM. Preferences persist across restarts; the guide lists every command and the external-service option.
With the patched runtime built and a GGUF model of your own:
kvpark setup --opencode --server /absolute/path/to/llama-server --model /absolute/path/to/model.gguf
opencode -m kvpark/localSetup starts the model server and the proxy, and adds a kvpark provider and a small
plugin to OpenCode's config, keeping a backup. The plugin tells kvpark which OpenCode
session each request belongs to. Conversations are then saved when other work, such as
title generation or a subagent, needs the model's slot, and restored when you return.
A new session reuses OpenCode's system prompt and tools from a saved one. kvpark stop
saves the conversation in the slot and stops both services; kvpark start starts them
again, also after a reboot. Check with kvpark doctor --opencode, and remove with
kvpark uninstall --opencode --confirm. To share Hermes' proxy, use --url instead of
--server. See the OpenCode guide.
The example client defaults to port 8080. If the proxy selected another port, pass
--url http://127.0.0.1:<selected-port> to both example invocations; find the URL in
proxy.json inside the archive directory.
python examples/chat.py --session cli:orchid:1 --history orchid-chat.json \
'Our project code is ORCHID-731. Help me plan a workshop.'
kvpark save --session cli:orchid:1
kvpark statusStop both services with Ctrl-C, then start them again with exactly the same commands. Continue using the same transcript and session:
python examples/chat.py --session cli:orchid:1 --history orchid-chat.json \
'What was the project code?'
kvpark statusShort chats demonstrate the workflow but may gain little speed. Long stable prefixes are the intended use case. Park again before leaving to save the latest state. Use a unique transcript file and session ID for each conversation.
Point chat completions at the selected proxy URL plus /v1 (normally
http://127.0.0.1:8080/v1; consult proxy.json after startup). Add these fields to each
foreground request's JSON body:
{
"slot_archive_role": "foreground",
"slot_archive_key": "my-agent:my-project:conversation-uuid"
}With clients that support it, supply these fields through extra_body. They are
removed before forwarding to the backend. Send slot_archive_role: "background"
for detached work. A user/account ID is not a conversation ID.
See the integration contract for branching, compaction, streaming and authentication. The optional Hermes adapter does not patch Hermes.
| Command | Purpose |
|---|---|
kvpark backend --server … --model … -- … |
Launch the backend and record runtime identity |
kvpark serve |
Run the inference proxy |
kvpark start |
Start the connection chosen with kvpark setup (--hermes: the Hermes profile's) |
kvpark stop |
Save the conversation in the slot, then stop that connection's proxy and managed backend; keep the setup |
kvpark doctor |
Check backend reachability, runtime identity, and the single-slot topology |
kvpark save --session … |
Save exactly that resident conversation |
kvpark status |
Inspect archives and actual completed-request reuse |
kvpark forget --session … |
Delete that saved archive; keep the transcript |
kvpark settings --ttl-days 7 --cleanup |
Persist cleanup preferences without a restart |
kvpark cleanup |
Run cleanup now |
doctor does not prove checkpoint support or cache reuse. Verify the complete
flow with your own model:
python scripts/acceptance.py \
--server runtime/build/bin/llama-server \
--model /absolute/path/to/your-model.ggufThis CPU test launches private services on temporary ports, disables the RAM
prompt cache, restarts both processes, and compares restored output and token
counts against resident output. Evidence is written to evidence/acceptance.json.
It does not stop any existing services. Read validation before
interpreting timing results.
- Compatible model, runtime, configuration, and prompt prefix are required. Changing weights, builds, tools, system prompts, or reasoning settings may require a fresh prefill. The transcript remains the source of truth.
- Only
chat/completionsinference is supported. Responses API, multiple slots, and model routers are outside the current scope. Remote upstreams are supported in routing mode only; disk snapshots require the local managed runtime. - CI tests startup/integration and CPU runtime builds on Linux, macOS, and Windows. This does not establish real-model cache reuse or GPU performance on every OS.
- All generation traffic must go through the proxy. Direct backend requests bypass ownership tracking and can invalidate archives.
- A conversation displaced before its first park cannot be recovered from KV alone. Send another foreground message, then park it.
- Archives may be several GiB each. Retention is best effort under the storage budget, and atomic replacement temporarily needs space for both generations.
- Treat archive files as sensitive and trusted local data. They contain model state and prompt tokens. See security.
The offline Qwen → Muse prototype
collects attention values, fits affine maps, and evaluates them on held-out
documents. experiments/universal_kv
generalizes it to one shared latent for many models; it is the engine behind
kvpark bridge and runs as a separate Python, outside the installed package.
Native archives retain their model identity checks.
python -m pip install -e .
python -m unittest discover -s tests -vUseful early contributions: reproducible model compatibility reports, agent adapters, installation feedback, and upstream checkpoint persistence work. See CONTRIBUTING.md.