Docs / Start here
Update to a newer version
After a git pull: reinstall the command, build the portal's pages again, check the engine, and start each world's network again so everything runs the new code.
Mostly read byPlatform, DevOps and IT
An update replaces the mirror command and then lets each part of the mirror pick up the new code. It takes a few minutes. Your worlds, their snapshots and your past runs are kept.
How the command is replaced depends on how you installed it:
- With the install script (
curl ... install.sh | sh): you have a release. Update a release is your first step. - From a clone of the repository: you follow the source. Update a clone is your first step.
mirror update --check says which you have, whether a newer release is out, and what on this computer still runs older code. It changes nothing.
Read CHANGELOG.md for the release you are moving to before you update, and update between runs, not during one. The project follows semantic versioning: a change that breaks something that worked is a new major version, and the changelog says when a world needs rebuilding.
Update a release
mirror update
It finds the newest published release, downloads its package, checks it against the release's checksums as the install script does, and installs it in place of the one you have, with the versions of everything it needs as that release was tested. Then it looks at this computer and lists what still runs the code from before, each with the command that renews it:
- a world's sealed network that is up, with the version that started it;
- a portal or an operator MCP server left running for a world in the folder you ran it from, or beside it;
- the engine's own packages, when they are due an update.
Run it in a world's folder so that it can find a portal left open there. The rest of this page says what each of those is; steps 3 to 6 under The steps are the same for you, and steps 1 and 2 are not needed: a release carries the portal's pages already built.
- On release 1.0.0, which has no
mirror update: run the install script again. It installs the newest release in place of the one you have. - On Windows, a program cannot be replaced while it runs, so
mirror updatetells you to run the install script again in PowerShell. - To install a release you name, or go back to one:
MIRROR_VERSION=1.0.0, then the install script. - Changes not yet released reach you only with the next release. To follow the source between releases, install from a clone.
Update a clone
An update is a git pull followed by the steps below. Between releases the version number does not change, so mirror --version will not tell two updates apart: git log -1 --oneline in the clone shows the change you are on.
What an update has to reach
Replacing the command, or pulling into a clone, changes the files the command runs from. Some parts of the mirror read those files each time they are used. Others hold a copy made earlier, and keep running the old code until you renew them.
| Part | What it holds | How it gets the new code |
|---|---|---|
The mirror command |
A release: its own installed copy. A clone: nothing of its own, it runs from the clone | A release: mirror update. A clone: git pull, and reinstall to pick up new dependencies |
| The portal's web pages | A release: built, inside the package. A clone: files built from the source, which are not in git, so a pull does not change them | A release: nothing to do. A clone: build them again with npm |
| A portal that is open, an operator MCP server, a desktop app's connection | A program started from the old code | Stop it and start it again |
| A world's sealed network | The gateway, the resolver and the recorders were given their code when the network started | mirror up again in the world's folder |
| The engine's configuration (its firewall and runtime settings) | Applied the last time the engine started | Nothing to do: it is applied again when the engine starts or a world comes up |
| The engine's own packages (Docker, gVisor, the kernel) | Not part of this repository | mirror engine update, separately, when you choose |
| A world's data, snapshots and runs | Kept in the engine and in the world's folder | Left as they are |
Before you update
- Let running scenarios finish, or end them with
mirror run stop <run-id>. Starting a world's network again replaces its containers. - For a clone: in it, run
git status. If you changed files there, commit or stash them first, or the pull stops. - To be able to go back, note what you are on:
mirror --versionfor a release,git rev-parse --short HEADin a clone.
The steps
1. Pull the source and reinstall the command (a clone only).
cd <path to the clone>
git pull --ff-only
uv tool install --editable . --reinstall
If git refuses the pull, see If the pull is refused below.
The reinstall is what picks up a new or changed dependency; the mirror's own code is read from the clone and needs nothing more. On a network that replaces certificates, add --system-certs, as for the first install.
2. Build the portal's web pages again (a clone only), if you use the portal. This needs Node.js 22, as the first build did.
npm --prefix src/mirrordimensions/portal/web ci
npm --prefix src/mirrordimensions/portal/web run build
If you skip this, the portal still opens, with the older screens on top of the newer program. A screen can then show an error or miss a feature.
3. Check the engine.
mirror engine start # does nothing if it is already running
mirror engine check
mirror engine status # says when the engine's packages are due an update
The engine's configuration is applied again by itself. Its packages are a separate matter: the engine installs updates only when you run mirror engine update, with every world's network stopped. You can do that now or leave it for later.
4. Start each world's network again, in the world's folder, and check it.
cd ~/mirror-worlds/northfield
mirror up
mirror doctor # ends with: Isolation: full, Coverage: complete, Undetectability: full
mirror up replaces the network's containers with new ones that carry the new code. The world's data is kept. If the new version uses a newer image for a system, it is downloaded at this step. Repeat this for every world you use; a world you leave stopped picks up the new code the next time you start it.
mirror changes lists anything saved in the world's files that is not in effect yet, and mirror world status says whether the world still matches its definition.
5. Start again whatever was left running. Close the portal (Ctrl-C) and run mirror portal again. If an AI tool or a desktop app is connected through mirror mcp serve or mirror world connect, restart that connection in the tool, so it starts the new program.
6. Run something you know. A run that passed before the update is the quickest check that everything is in place:
mirror run rotate-leaked-token --agent scripted-good
mirror report latest --open
If the pull is refused
"Not possible to fast-forward", or "Need to specify how to reconcile divergent branches". The clone's main and the repository's main have each gone their own way. There are two usual causes.
The first is a clone made before 1 December 2026. The history of main was replaced on that day, so an older clone shares no commits with it. The pull prints (forced update) beside main, and git merge then says refusing to merge unrelated histories. git status says that your branch and origin/main have diverged, with well over a hundred commits on each side, though you made none of them. Do not merge the two, and do not pass --allow-unrelated-histories: that joins the old history to the new one and leaves a clone that cannot be pulled cleanly again. Move the clone's main to the repository's instead:
git status # stash or copy aside any file you changed
git branch old-main # keeps what the clone had, in case you need it
git fetch origin
git reset --hard origin/main
Files git does not track are left alone, so a world's folder and its .mirror directory stay as they are. Changes to tracked files that you did not stash are lost, which is why git status comes first. When you are sure nothing is missing, remove the copy with git branch -D old-main. Then carry on from the reinstall in step 1. Every part in the table above needs renewing after a jump this large, and a world built by the older code may need mirror build --force.
The second cause is a commit of your own on main. git log origin/main..main --oneline lists such commits. Move them to a branch and put main back:
git branch my-changes
git reset --hard origin/main
Your commits are then on my-changes, where you can rebase them onto the new main or open a pull request from them.
"Your local changes would be overwritten". A tracked file was edited in the clone. git stash puts the edit aside, the pull then goes through, and git stash pop brings it back.
If a world does not come back
Most updates need nothing more than the steps above. When one changes how a world is built, the changelog says so. If mirror doctor reports a failure after an update, or a run that used to pass now ends in an error from the mirror itself (exit code 4), rebuild the world from its definition:
mirror build --force
mirror up
mirror doctor
The world is generated again from mirror.yaml and its seed, so the same company comes back. Anything that was changed inside the world after it was built is replaced.
If that does not help, please open an issue with the output of mirror doctor and mirror engine check. Do not describe a way out of the sandbox, or a gap in what is recorded, in a public issue: SECURITY.md says how to report those.
Going back
To return to a release you had, run the install script with MIRROR_VERSION set to it, then start each world's network again. In a clone, check out the commit you noted and repeat the steps:
git checkout <commit>
uv tool install --editable . --reinstall
Then build the portal's pages and start each world's network again. A world that was built or rebuilt by the newer version may not work with an older one; rebuild it with mirror build --force. git checkout main returns the clone to the branch.
On a company network
An update downloads from the same places as the first install: the release or the repository, Python packages (and Node packages for a clone), and sometimes a newer container image. If your network blocks or inspects those, restricted-networks.md applies as it did the first time. mirror engine network says what is blocked, and mirror engine fetch, run on an open network, downloads the images in one go.
This page is docs/updating.md in the repository; improve it there.