Update the X4 AI Assistant Toolkit itself (not a mod) to its newest GitHub release, or answer "is there a new version". Use when the user says "update the toolkit", "is there a new version of the toolkit", or when the session start said a newer toolkit release is out, or said an update failed or is unfinished. Shows what changes before anything is installed, and asks the user at each step.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of X4 Toolkit Update?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/wingedguardian-x4-toolkit-update)
---
name: x4-toolkit-update
description: Update the X4 AI Assistant Toolkit itself (not a mod) to its newest GitHub release, or answer "is there a new version". Use when the user says "update the toolkit", "is there a new version of the toolkit", or when the session start said a newer toolkit release is out, or said an update failed or is unfinished. Shows what changes before anything is installed, and asks the user at each step.
allowed-tools: Bash, Read
---
<!-- GENERATED by tools/x4validate/scripts/gen-agent-trees.py from agent/. Do not edit: regenerate. -->
Update the toolkit that is installed in this folder. **This is the toolkit, not a mod**: for porting a mod to a newer
game version use `x4-update-mod`. **Nothing here installs anything by itself.** Every step that changes the installed
toolkit waits for the user's own word in this conversation, and an update never starts because a session-start line
suggested one.
The commands are subcommands of the toolkit's harness entry; run them from the install folder:
`python {{TOOLKIT}}/tools/agent-harness.py <command> [--installed-root <folder>]`. Each prints one JSON object and
sets the exit code. `update-check` exits `0` always (offline, off and "no newer release" are results, not errors). `update-fetch` exits `0` when the release was downloaded, verified and unpacked aside, and `2` when it failed for any reason (no newer release, a digest or commit mismatch, a download that died half way): it only reads, downloads and unpacks away from the install, so a `2` always means nothing installed has changed. For the staged commands below: `0` ok, `1` the update failed after it began replacing files (rolled back, or the failed marker was written), `2` refused before anything changed.
## Which commands exist in this install
`update-check`, `update-fetch`, `update-stage`, `update-apply` and `update-clear-failed` are in every install that has
this skill (4.3.1 and later). A 4.3.0 install has none of them: its first update is done by hand from the release page.
If `python {{TOOLKIT}}/tools/agent-harness.py --help` does not list `update-stage`, say so, stop after step 1, and
tell the user the update has to be done by hand from the release page -- never improvise an install with
`update-fetch` plus a copy.
## The flow
1. **Is there a newer release?** `update-check` (add `--now` to ignore the once-a-day limit). It reports `installed`,
`latest`, `update_available`, `status` and `error`:
- `status: off` -- checking is switched off (`X4_UPDATE_CHECK=off`, `X4_HOUSEKEEP_SWEEP=off`,
`MODDING_HARNESS_UPDATE_CHECK=off`, or `{"v": 1, "check": false}` in `.modding-agent-harness/updates.json`).
Say so; do not turn it on for the user and do not work around it.
- `status: unreachable` -- GitHub could not be reached. Offline is normal; say so and stop.
- `installed: null` -- this install has no release to compare with: a git checkout (always, even if a stray
`BUILD-INFO` sits in it), or an install with neither a `BUILD-INFO` file nor a release heading in `CHANGELOG.md`. Say so; a checkout is updated with git.
- `update_available: false` -- tell the user they are current.
2. **Stage it**: `update-stage`. It first runs this install's own health check (`x4doctor.py --update-canary`), then
downloads the release, verifies it against the digest GitHub publishes and the commit its tag points at, unpacks it
away from the install, and builds a review of every file that would change. It installs nothing and authorizes
nothing (`application_authorized: false`). It refuses (exit `2`), changing nothing, when an earlier update left a
failed or in-flight marker (step 8), when this is a git checkout, or when this install already fails its health
check: the error then starts `fix x4doctor first` and names the FAIL rows. The review starts with a line naming
what is NOT written (the release's files for agents this install does not have, and `agent/`, `docs/`,
`.github/`): an update keeps the install's agent set; adding an agent is the installer's job. Tell the user, have them run
`python {{TOOLKIT}}/scripts/x4doctor.py`, fix what it FAILs, and stage again. Never work around that refusal: an
install that is already unhealthy cannot prove a rollback.
3. **Show the review to the user, verbatim.** Print the whole `review` text from the result; do not summarise it, do
not skip the files that look harmless, and do not decide for them what matters. Say which files the user edited
themselves (`preserve_collision`) and which collide with the new release. If a guard diff preview is truncated,
show the complete diff using the staged candidate (or merged settings) and rollback files before seeking approval.
4. **Ask the user** whether to go ahead. Wait for the answer. "Continue", an earlier "update the toolkit" and a yes to
some other question are not the answer to this one.
5. **Guard changes need a separate, explicit go.** When the result says `requires_guard_accept: true` (the review's
`GUARD CHANGES` section), the release changes hooks, guards, settings or policy files: the code that protects
saves, `reference/` and the game folder. Name those files and ask a second time, in its own message. Pass
`--accept-guard-changes` only after that yes. The same holds for choosing `candidate` on a file listed under
"Only if you choose `candidate`".
6. **Conflicts need the user's choices.** For every file the user changed that the release also changes, the user
picks `keep` (theirs), `candidate` (the release's) or, for a hook settings file, `merged_settings`. Each agent's
hook settings file always needs a choice, even when unchanged (an apply without one is refused and names it):
explain that `merged_settings` keeps the user's own hooks and takes the release's. Write their
answers as one JSON object (`{"README.md": "keep"}`) to the choices file the review's `next:` block names (beside
the bundle, outside the install) and pass it as `--choices`. Never pick for them. `x4-paths.env` and `X4-NOTES.md`
are always kept; an update never replaces them.
7. **Ask them to close their other agent sessions** (and any editor writing into the install) before applying.
Wait for them to confirm that the install is quiescent.
Check `python "{{TOOLKIT}}/scripts/x4lock.py" status --toolkit "<install>"` in the install being updated.
Match the `locked` entries to the absolute paths of files the approved review and choices will write.
Include a locked `.opencode/opencode.jsonc` on an OpenCode install because setup may regenerate it.
If any match, show the exact list and get the user's permission to unlock it after the install is quiescent.
Record those paths before changing their permissions. Run
`python "{{TOOLKIT}}/scripts/x4lock.py" unlock "<path>" --toolkit "<install>"` for each approved path.
If an unlock fails, skip apply and restore and verify the locks for every recorded path before reporting the failure.
Run `update-apply` with the reviewed
bundle, the review SHA-256, the choices file, the same `--installed-root` if used for staging, and `--accept-guard-changes` only
if step 5 was answered yes, and `--quiescent` (it states that you asked; it does not stop anything). It runs this
installed health check first and refuses (exit `2`, `fix x4doctor first`) if it fails. Once the review and choices
pass verification, it replaces the files, runs the new setup and health check, and **rolls back by itself
if either fails** (exit `1`). Once apply has stopped, including after a refusal or rollback, run
`python "{{TOOLKIT}}/scripts/x4lock.py" lock "<path>" --toolkit "<install>"` for each recorded path.
Use `x4lock status` on the same install to verify every recorded path is locked again. Report any missing path
or failed re-lock. If apply refused on another read-only target, report it after restoring the recorded locks so
the other file can be reviewed separately. If execution was interrupted, keep the list and restore the locks after confirming that
apply has stopped. Report the update's `report` text as returned. After a successful apply, tell Codex users to
review changed hook definitions in `/hooks`.
8. **A failed update is loud, and stays loud.** If the result says `FAIL CLOSED` (it could not be rolled back and
verified), if the command was interrupted, or if a later session start says `TOOLKIT UPDATE NEEDS THE USER`, the
guards may be broken or missing. Stop. Tell the user, show them the marker file it names
(`.modding-agent-harness/update-failed.json` or `update-in-flight.json`) and do not update, edit guards or trust
the hooks until they have read it and fixed the cause. Clear the markers with `update-clear-failed` only when the
user asks you to, after that; it sets them aside as evidence, never deletes them. For an in-flight marker whose
process may still be running it refuses; `--force` only when the user is sure that update has ended. Staging and
applying refuse until the markers are cleared.
## Rules
- Never download a release by hand, never unpack one into the install, never copy files over the install: the
commands verify the download, unpack it away from the install and keep a rollback journal. A hand copy has none of it.
- The note at session start is only a suggestion drawn from a cache. Run `update-check` yourself before telling the
user what is current.
- Applying is the user's decision, always: the only thing you may do without asking is step 1.