zot continuous: Agents That Survive
A persistent, recoverable execution layer for zot. The whole conversation lives in a durable store instead of in the running process. That one decision makes a crash a pause, and lets you pick up the same agent from any machine.
Agents are fragile in a very boring way.
Close the laptop lid, lose the SSH connection, hit Ctrl+C at the wrong
moment, or let the process get killed, and the run is gone. At best you have
a session file with half a conversation in it. At worst the agent was in the
middle of a bash call and you have no idea whether that migration ran or
not.
Event sourcing taught me that this is a solved problem, as long as you take history seriously. So I built zot continuous: the persistent, recoverable execution layer for zot.
The one idea
The whole post comes down to a single decision: the conversation lives in a durable store, not in the running process. That store can be a local journal directory, a single SQLite file, or a named store in an external PostgreSQL server.
A normal agent keeps everything that matters in memory. The history, the tool call it is executing right now, the answer it is streaming. Kill the process and all of that is gone. zot continuous turns it around. Every model request and every tool call is written to the store before it starts and again when it finishes. The process is just a worker that reads the store, does the next step, and writes the result back.
Two things follow from that, and they only look unrelated:
- A crash is a pause. If the process dies, the next one picks up from the last committed boundary. Nothing to reconstruct, nothing to guess.
- Any process can be that worker. If the state is not tied to the process, it is not tied to a terminal or a machine either. Start a run on your desktop, close the window, open the same conversation from your laptop. That is the "host" mode further down, and it is not a second feature, it is the same one seen from another angle.
The rest of this post is those two consequences, plus the one hard question in between: what to do with a tool call that was in flight when the process died.
What it is
zot continuous sits between you and the regular zot engine. The engine still does the actual work: talking to the model, running tools. zot continuous decides what runs and records what happened. When something was interrupted, it only repeats a step if it can show that step never ran. When it cannot show that, it stops and says so.
It is pure Go, ships inside the same single binary, and needs no CGO or native client library. It is also explicitly experimental: the journal format, Go APIs, and host protocol may still change. Ordinary zot workflows are untouched.
The quickest way in
Tools that remember things across calls usually need a background process
that is always running (Docker, tmux, a database server). zot continuous does
not. The store is a directory, the command reads it, does its work, writes
back, and exits. Think git, not dockerd:
zot continuous run "summarize the README" --store ./store --tools read,glob
zot continuous run "now list every TODO" --store ./store --tools read,globThe second call continues the same conversation with its full history. If something was interrupted, you resume it without adding new input:
zot continuous run --resume --store ./store --tools read,globThere is no --continue or --session here. The store is the authority, not
a session file.
Recovery that does not lie
The interesting part is what happens to a tool call that was running when the
process died. Did the bash call finish? Did the migration run? The store
knows the call was started, but not how it ended.
You cannot prove that something did not happen. So zot continuous does not try. It flips the burden of proof: a step is only re-run if there is positive evidence that it never ran, or if re-running is harmless by construction. No evidence, no retry. Each tool declares which of those it can offer, its replay contract:
- never (the default, including
bash,write,edit): no evidence is possible, so nothing is re-run. The model gets aninterruptederror result and decides what to do next. - safe (
read,glob): running it twice changes nothing, so it is re-executed after a fresh authorization check. - idempotent: re-executed with the same stable operation key. The receiver guarantees that the same key is applied at most once, so a second delivery is harmless.
- reconcile: the tool is asked "did this complete?" and can look it up (is the record there, does the file exist). It only runs again if the answer is "not started".
The default is the honest one: unknown outcomes are reported, never retried. A policy is never widened between the stored intent and the live tool. You can even ask beforehand what recovery would do:
zot continuous recover --dry-run --store ./storeThat is the whole point: an agent that might have charged a credit card twice is worse than an agent that stops and tells you it does not know.
The same store, from anywhere
This is the second consequence from the top. The one-shot run command is a
worker that reads the store, does one step, and exits. A host is the same
worker, kept running, that lets other programs hand it prompts and watch the
result. Because the state is in the store and not in whoever is looking at
it, clients can come and go freely:
zot continuous serve --store ./store --tools read,glob
zot continuous attach "summarize the README" --socket ./store/host.sock --workspace main
zot continuous attach --follow --socket ./store/host.sock --workspace mainserve owns the store, recovers interrupted runs, works through queued
prompts for every conversation, and listens on a 0600 Unix socket (or an
authenticated WebSocket). Clients submit, watch, and leave. Closing a client
never cancels host work.
The regular TUI can attach too:
zot --continuous ./store/host.sock --continuous-workspace mainOpen it in two terminals and both views stay in sync: prompts, streamed text, tool progress, and answers show up everywhere. Start a long refactor on your desktop, close the window, check on it from your laptop later. It just kept going.
What else is in the box
Everything below falls out of the same model: if every step is a committed entry, you can pause on it, branch from it, bill it, or hand it to another machine. Skip this list on first read if you only wanted the idea. The highlights:
- Persisted approvals. A tool call can require a human decision. The
pending approval is committed, survives restarts, binds to the exact
arguments, and is never implicitly approved. Decide it whenever:
zot continuous decide <id> --allow --scope call --reason "reviewed". - Steering. Send new input while a run is active, and it joins at the next request boundary instead of fighting the current tool round.
- Budgets. Set a USD limit per conversation or for the whole runtime. Unknown costs count as reservations, never as zero, and an exceeded budget fails the run before the request is sent.
- Usage ledger. One immutable row per attempt and compaction.
- Forks and resets. Branch a conversation at any committed entry, or restart the model context with a handoff note while keeping the full history searchable.
- Compaction. Automatic, optionally in the background, and it never splits a tool round. Old entries stay in history, they just leave the model context.
- Subagents and Swarm. Subagents are owned conversations on the host,
scheduled and recovered like everything else.
/swarmon an attached TUI runs every agent there. - Tasks and documents. Versioned tasks with timers, dependencies, retries with backoff, and cleanup as compensation. Typed, versioned documents for structured state like todo lists.
- Remote workers. Run tools on another machine with
zot continuous worker --root name=directory. A lost connection is an unknown outcome, reconciled later, never blindly retried. - Provider routing. Each conversation keeps its own provider and model, switchable without restarting the host.
- Operations.
verify,backup,restore,migrate, full-historysearch, and a SQLite backend if you prefer that over the local journal. - PostgreSQL backend. Optionally keep a named store in an external
PostgreSQL 15 to 18 server, using the pure Go pgx driver:
zot continuous serve --backend postgres --store-name main --postgres-dsn-file ./pg.dsn --state-dir ./host. It is never selected by default. Connections require verified TLS, a numeric loopback address, or a Unix socket, and a lost connection stops the store instead of silently retrying writes. Database backups use your PostgreSQL or managed-service tooling.
What you can build with it
This is where it stops being a feature and starts being a platform.
Long-running coding sessions. Kick off a big task on a dev box, detach, reattach from anywhere. Nothing dies with your terminal.
Agents with a human in the loop. Let the agent run freely, but require an
approval for bash or deploys. The request waits, durably, until someone
says yes. Hours later is fine.
Bots and integrations. Talk to the host over its JSON protocol with stable request IDs. A Slack or ticket bot can retry a submission as often as it likes and still get exactly one answer. Pending approvals and blocked runs land in a notification outbox with at-least-once delivery.
Scheduled and background work. Timers survive downtime and fire once afterwards. Reminders, nightly reviews, periodic checks, all as tasks with retries and cleanup.
Multi-agent setups. A read-only reviewer subagent with its own tool set, parallel threads, forks that explore alternatives from the same history.
Embedding it in your own Go program. The runtime is a Go package. The repository has runnable examples using a synthetic provider, so you can try crash recovery, approvals, forks, tasks, idempotent tools, and remote workers without credentials:
go run ./examples/continuous/07-approval
go run ./examples/continuous/15-remote-workerWhy I care about this
I come from the world of event sourcing and built GenesisDB, an event-sourcing database engine. zot continuous is basically an event store for agent execution: an append-only history of intents and results, with recovery that follows the facts instead of hoping for the best.
Agents are going to run longer, touch more systems, and do things that matter. That only works if the runtime knows exactly what happened, and is honest when it does not.
Give it a try, break it, and tell me what you build: zot.sh and the continuous docs.