Run the server

Upgrade Kraft

Back up, upgrade and check an installed Kraft, and pin it to a version, with a pointer to how to roll back to an earlier release.

By the end you have a newer Kraft release, with a backup of your database taken first, and kraft admin health names the new version. The page also says how to go back to the version you had.

Coming from 1.4? Don't follow the steps on this page: 1.4's own kraft admin update mishandles the install. Follow Coming from 1.4 instead. What's new says what you get.

Before you start

  • You know how Kraft was installed: with uv or install.sh, with Homebrew, with pipx or pip, or from a source checkout. The update step differs for each.
  • You can pick a moment when no agent is running, or you pause the running items first. Step 4 restarts the server, which ends the agents of items that run in place. Across a major version kraft admin restart refuses and kraft admin update --restart waits while anything runs, so only kraft admin update --now, or kraft admin stop --now then a start, ends the rest.
  • sqlite3 or python3 is on your PATH, for the backup.

Upgrade

  1. Back up the database. A newer Kraft can migrate run/orchestrator.db forward when it starts, and there is no way back: the version you had then refuses to start on it (database schema vN is newer than code vM). The backup is what lets you roll back.
    This copy is safe while the server runs. The file is named for the second you run the command, so a backup taken at another time never replaces this one, and a rollback to 1.4 needs the backup from before the first upgrade. The command prints the name: write it down, and keep the file.
    -readonly opens the database you copy from read-only, so a wrong path fails instead of making an empty backup. run follows KRAFT_RUN_DIR, then KRAFT_HOME, as Kraft does:
    run="${KRAFT_RUN_DIR:-${KRAFT_HOME:-$HOME/.kraft}/run}"
    backup="$HOME/kraft-backup-$(date +%Y%m%d-%H%M%S).db"
    sqlite3 -readonly "$run/orchestrator.db" ".backup '$backup'" && chmod 600 "$backup" && echo "$backup"
    
    /home/you/kraft-backup-20261002-093015.db
    

    The chmod keeps the copy readable by you alone, as the database is.
    Back up and restore the database has the form for a machine without sqlite3, and how to check the copy and put it back. Kraft also copies the database itself before it migrates it, as The copy Kraft makes before an upgrade says. Take your own anyway: you know when you made it, and it doesn't depend on the version you upgrade to.
  2. Pause the running items, or wait until none run. The restart in step 4 ends the agents of in-place items; across a major version it waits or refuses while anything runs. The commands are in A restart leaves local steps running.
  3. Install the newest release. On 1.4, don't run this command: follow Update from 1.4.
    kraft admin update
    

    It prints the release it installs:
    kraft 2.0.0 -> v2.0.1
    kraft v2.0.1 installed.
    Restart a running server: kraft admin restart
    

    What it runs depends on how Kraft was installed:
    • uv or script install: uv tool install --force --python 3.X "kraft-sdlc[vector]==X.Y.Z". The vector extra (when you have it) and a Python you chose with --python stay. With no --python recorded, it asks for the minor version Kraft runs on now, such as 3.13, so a later uv python upgrade still carries Kraft along.
    • Homebrew: brew upgrade kraft.
    • pipx, pip or a source checkout: nothing, because a uv copy would sit beside the kraft you run and change nothing. It prints the command that updates the install you have instead, such as pipx install --force --python /path/to/python "kraft-sdlc==X.Y.Z".

    On a uv install, uv records the exact version, so uv tool upgrade leaves Kraft where it is: update with kraft admin update. In the few minutes after a release, before PyPI has it, kraft admin update installs the release's wheel from GitHub instead.
    A Kraft add-on runs on one major version of Kraft. Before kraft admin update installs a release of another major, it lists the loaded add-ons that release would leave out, and asks:
    kraft 3.0.0 would stop loading these add-ons until each publishes a version for it:
      release@acme 1.0.0 needs Kraft 2.x
    Install it anyway? [y/N]
    

    A no installs nothing. After a yes, or -y, each listed add-on stays installed and stops loading, and a chain that extends it stops resolving. kraft admin addon update brings it back once its author publishes a version for the new major.
  4. Restart the server so it runs the new release. Either run kraft admin restart, or give step 3 --restart (kraft admin update --restart) to do both.
    Within a major version the restart leaves the local steps of worktree items running: the new server starts a local worker of its own and takes the steps over. The old worker exits once it has finished its processes.
    kraft admin update --restart to a new major version doesn't restart at once. It marks the release for when Kraft is free and says so, since the new major can't take over the old one's steps. With no server running it only installs.
    kraft admin update --now installs and restarts at once, ending every step. kraft admin restart onto a new major with an item active exits 1 and names --when-free and kraft admin stop --now.
    Without a restart, a running server keeps running the old release, the board shows a page saying to restart instead of the interface, and kraft admin doctor warns on its restart row. The page doesn't appear when you update from 1.4 or from a 1.5.0 release candidate before rc14: see If you used 1.4's update anyway.
  5. Check the result:
    kraft --version
    kraft admin health
    

    --version prints kraft and the release, such as kraft 2.0.1. health prints the same release on its version row, and no installed row that says restart pending:
    status         ok
    version        2.0.1
    

    The restart row of kraft admin doctor reads the server (pid N) runs the installed version (2.0.1).

Update when Kraft is free

Added in 2.3

Kraft can take a release for you, at a moment when it costs no running work. You mark a release, or turn on auto-update, and Kraft installs it and restarts once nothing is going on. Nothing is held while it waits: items still start, and Kraft tries again a minute later.

Kraft is free when no agent session is running and no work item is active, waiting, queued or rate_limited. An item waiting for a person (needs_human), paused, blocked, completed or abandoned doesn't hold it back. If you set allowed hours, Kraft also waits for them. Once it is free and has decided to go ahead, it starts no new walk or agent session until it has installed and restarted, about a minute, so nothing is cut off while starting.

If the restart never happens, that hold lapses after 15 minutes and Kraft looks again.

  1. Open Settings › About. On a release install made with uv, an available version has an Install when free button, and a marked one has Don't. The CLI does the same:
    kraft admin update --when-free
    kraft admin update --when-free v2.3.0
    kraft admin update --cancel-when-free
    

    The mark works whatever the switches say, and stays across a restart. A new major version is offered beside the newest release of your major, and installs only when you mark it.
  2. To have Kraft mark releases itself, turn on Update automatically. It marks each new minor or patch release on your channel. Both switches are off until you turn them on. Restart when free also restarts a dev install or a settings change when it is free. A release Kraft installed itself always finishes with its restart.
  3. Optionally, add Allowed hours, such as 01:00-06:00, in the server's local time. Kraft updates and restarts only inside them, and only when free. A person's mark waits for them too.

About says what is waiting and why it isn't done yet: waiting for 1 running item, outside 01:00-06:00, attached to a terminal. It also keeps how the last attempt ended.

What Kraft does when it is free

  1. It claims the moment, and checks that it is still free.
  2. It installs the marked release, after the checks kraft admin update makes. Kraft installs nothing that would ask a question by hand: a configuration migration, add-ons the release would drop, a leftover kraft uv tool. It refuses, says why on About, and leaves the old version running. Run kraft admin update yourself. It also holds a release that would break one of your overrides of kraft-default, or whose kraft-default it can't compare (below).
  3. It checks that the new install can start: it imports the server, reads every configuration file, and checks the bind address and port, without starting anything.
  4. It copies the configuration directory and the databases, then restarts. The new server comes up on probation: it answers, and starts no walk, poller or loop until a helper has seen it come up as a new process, of the new version for a release.
  5. If it doesn't come up in time, the helper puts back what changed: it reinstalls the previous version, restores the configuration and the databases, and starts that version. About shows the failure. The same version isn't tried again until you mark it again.

A dev install, installed from a checkout, has no release to look for. Install it yourself with just install; its restart then waits for a free moment, if you turned on Restart when free. If the old server can't start on what is installed, Kraft is left down, and About says so.

Which servers can restart themselves:

  • A service (launchd or systemd) and a server started with --detach can. They restart through their own manager, or by stopping and starting in the background.
  • A server started in a terminal can't. About shows the update and says it is attached to a terminal. Restart it there.

A failed or refused attempt, and each one that works, is written to run/logs/server.log and shown on About. Kraft's notifications carry events of work items, which an update doesn't belong to, so they don't carry it.

What an upgrade leaves in config

An upgrade never changes $KRAFT_HOME/config/, with three exceptions:

  • An install still on Kraft 0.x's template format (a registry.yaml, no library.yaml) is migrated, after a prompt. See A 0.x home.
  • The first start of 2.0 or later rewrites theme.yaml once if it still has palette. See The interface.
  • The first start of 2.0 or later renames a 1.4 templates/ to config/ and moves two keys between policy.yaml and intake.yaml, rewriting the files it moves a key between. See Config directory and files.

Kraft's own chains and library aren't config: they are the built-in add-on kraft-default, which an upgrade updates with Kraft. A home seeded before that keeps its full copies; see Move onto kraft-default.

What an update shows about kraft-default

Added in 2.6

Your chains extends: kraft-default:<id>, so a release can change what they run. kraft admin update compares the new release's kraft-default with the running one before it installs anything, so declining needs no rollback. It downloads the release's wheel, which also carries the web UI, so the step can take a while on a slow connection.

kraft admin update
  • The review. It prints what changes how far a run goes (a gate removed, a merge step added), the chain changes, and any extends: or override of yours that the new version breaks, naming what breaks, as breaks: lines. The first line names both versions, as in kraft-default@kraft 2.5.0 -> 2.6.0.
  • The question. If anything changed, broke or couldn't be compared, it asks Install it? [y/N]. Anything but y or yes installs nothing, and so does an answer with no terminal. -y answers yes, as it does for the other questions in an update, so a script can accept. When kraft-default is the same it prints kraft-default: unchanged and asks nothing.
  • Can't compare. With no network for the wheel, or a broken policy.yaml, it says kraft-default: cannot compare: ... and still asks.
  • Across a major with --restart. kraft admin update --restart to a new major hands off to the when-free path. It prints the same review first, and doesn't ask. If something breaks, or it can't compare, it adds that the update is held until you run kraft admin update without --restart and accept.

An unattended update (--when-free, Install when free, Update automatically) can't ask, so it decides alone and -y isn't a way around it:

  • It holds when the new kraft-default would break one of your overrides, or Kraft can't compare. It installs nothing, and drops the mark. kraft admin doctor's kraft-default row says why and names the file and node.
    • Run an interactive kraft admin update, accept with the break shown, then fix the override.
    • You can't fix it first: renaming it to the new node ID breaks default on the release you are running.
    • Until you fix it, filing on default answers 422 with the resolver's message. quick-task and other chains keep working.
  • Otherwise it installs, and the kraft-default row lists what changed, including changes to how far a run goes, until the next update. This is the one change to a run's reach that an update installs without showing it first.

The first upgrade onto the release that added this shows no preview, because the kraft admin update that runs is the previous release's. From then on, every update does. A rollback or downgrade needs nothing: the older Kraft serves its own kraft-default, and work items already running keep the one they were filed with.

What doctor lists about kraft-default

Kraft's own chains and library are the built-in add-on kraft-default, read from the installed Kraft, so they can't fall behind it. The kraft-default row of kraft admin doctor is always ok, and a warning when it has any of these lines:

LineMeaningFix
the <version> update was held: ...An unattended update would break one of your overrides, or Kraft couldn't compare.Run kraft admin update, accept with the break shown, then fix the override it names, as above says. Until you do, filing on default answers 422.
<from> -> <to> changed kraft-default:An unattended update installed a release that changed it; the lines say how, including changes to how far a run goes.None. It clears at the next update.
chains/<file>.yaml is a full copy and hides kraft-default:<id>A home seeded before the built-in keeps its own copy, which Kraft never rewrites.See Move onto kraft-default.
kraft-default@<collection>: Kraft now ships kraft-default itself; ...An add-on copy installed from GitHub on 2.5 is left out in favour of the built-in.Run kraft admin addon update kraft-superpowers@kraft-sdlc, then kraft admin addon uninstall kraft-default@kraft-sdlc. See If you installed kraft-default from GitHub.
harnesses.yaml lacks <names>; using the packaged onesYour file lacks a harness or profile kraft-default needs, and Kraft supplies it from the package.None needed; define the name in harnesses.yaml to change it. See Names from the package.
repository id kraft-default is kraft-default's namespace; rename itA repos.yaml entry uses the reserved ID.Rename the repository.
maxima: clamps kraft-default task(s): ...policy.yaml's maxima: is below some built-in tasks' caps. They run clamped; the add-on stays.Raise maxima:, or accept the clamp.

The board shows the same lines in a banner, "Kraft's own chains need attention", and the webhook and a hidden browser tab are told once for each new state, so you need not run doctor to see it. Hide until it changes hides the banner in that browser. The banner never makes /api/health degraded.

Pin or roll back a version

kraft admin update only installs the newest release on a channel; it can't target a version. Install a specific version with the package manager instead.

To go back to an earlier 2.x release, pin it, as below, then follow Roll back to an earlier 2.x release. To go back to 1.4, see Roll back to 1.4.

Pin a version

  • uv or script install. Name the version, and the Python you run Kraft on ("$(uv tool dir)/kraft-sdlc/bin/python" -V prints it):
    uv tool install --force --python 3.X "kraft-sdlc==X.Y.Z"
    

    Without --python, uv moves Kraft to its default Python. Add the extra if you use vector search: "kraft-sdlc[vector]==X.Y.Z". To stay on that version, don't run kraft admin update; it moves you to the newest release again.
  • Homebrew. The tap has one formula, which each release rewrites to the newest version, so Homebrew can't install an older one. brew pin kraft stops brew upgrade, and with it kraft admin update, from moving the version you have. To go back to an older release, brew uninstall kraft and install that version with uv.

Search works out of the box as full-text search. To add vector (semantic) search to a uv or script install, reinstall the version you run, on the Python it runs on, with the vector extra. It downloads a model of about 130 MB on the first search.

uv tool install --force --python 3.X "kraft-sdlc[vector]==X.Y.Z"

Name both the Python and the version. Without the version, uv installs the newest final release, which on a release candidate is an older Kraft that refuses to start on its database. Without --python, uv rebuilds Kraft on its own default Python. kraft --version prints kraft X.Y.Z.

kraft admin doctor's embeddings row prints this command filled in for your install. On a pipx or pip install it prints that installer's command instead; the Homebrew formula doesn't ship the vector extra.

If the model can't be downloaded (offline, or a proxy refuses Hugging Face), search keeps working as full-text search and says so in a note. A search that asks for mode=vector answers 422 with the reason. kraft admin doctor fails its embeddings row, and /api/health reports the model's state as failing.

A failed download is remembered for five minutes, so neither a search nor an approval retries it on every call. Approving a gate doesn't wait for the model: the gate's document is indexed just after the approval answers.

On Python 3.15 the vector extra doesn't install yet, on any machine: onnxruntime has no build for 3.15. A plain uv tool install picks the newest Python installed: if that's 3.15, install Kraft with --python 3.14.

On an Intel Mac, or on Apple Silicon before macOS 14, the vector extra installs only on Python 3.12 or 3.13: on 3.14 the package that runs the model, onnxruntime, has no build for those Macs, and the install fails to resolve. Install Kraft with --python 3.13 there. A plain uv tool install or install.sh can pick 3.14 when the machine has no Python 3.12 or newer.

Next steps

Copyright © 2026