QUICK ANSWER

A Godot save file agent testing addon should have a separate read-only inspect step and a dry run that predicts the file's SHA-256 before writing. It should make byte-exact edits, refuse with exit codes an agent can branch on when the file is locked, deleted or changed, and restore the original bytes. Save Value Editor's maker reports these behaviours on Godot 4.4 to 4.7 on Windows 11, but the numbers are their own, and macOS, Linux and network drives are untested.

If you are choosing a Godot save file agent testing addon, or writing your own, check that it does five things. It should read without being able to write. It should predict the result of a write before making it. It should change only the bytes it was asked to change, refuse with a distinct exit code when the file changed underneath it, and restore the original exactly.

One addon maker, onpont, has published measurements of their own tool against those properties in a dev.to post. This guide turns those numbers into a checklist for any save tool an agent calls. It also separates what the maker reports from what nobody else has checked.

Why does an agent need a save editor that can say no?

The maker frames the risk this way: an agent editing a save is "one bad write away from destroying the thing it was asked to test." The post asks three questions about any write: can it be predicted, can it be refused when the file has changed, and can it be undone exactly?

Writing the file is the easy part. Godot's saving games documentation covers saves stored under user://. The source of that page on GitHub opens user://savegame.save with FileAccess in WRITE mode and serialises data with JSON's static stringify method. Any script can do that. The docs pattern shows how your game produces a save. It does not protect that save from an automated caller that writes at the wrong moment. That protection is the job of the tool that sits between the agent and the file.

Keep this in mind when reading the numbers below. The post's author builds the addon being measured, Save Value Editor, which views and edits ConfigFile and JSON saves. The maker ran the measurements on Godot 4.4.1, 4.5.2, 4.6.3 and 4.7.2, using standard builds on Windows 11. They are the maker's own results, not an independent review.

What loop should an agent run against a save file?

The post describes a five-step loop. The maker says each step returns one machine-readable line. Each exit code is meant to be branched on, not parsed as English.

  1. Inspect the file with --json.
  2. Decide what to change.
  3. Dry run the edit with --set.
  4. Write the edit with --write.
  5. Inspect again to verify.

The post gives these headless commands. Its script path is a generic addons/my_addon, so replace it with your addon's real path:

# Read only: returns one JSON line
godot --headless --script addons/my_addon/inspect.gd -- --path=user://save.cfg --json

# Dry run: nothing is written, returns the predicted SHA-256
godot --headless --script addons/my_addon/edit.gd -- --path=user://save.cfg --set=/hp=13

The --headless and --script options belong to Godot's own command line, not to the addon. Check the exact flags for your engine version in the Godot command line tutorial before you wire them into CI. For the wider pattern of driving a game headlessly from an agent, see AI playtesting for Godot: headless runs and input replay.

The read step

According to the post, the inspect step returns:

  • the absolute path and format
  • the byte length and SHA-256
  • whether a backup exists
  • every value as it appears in the source text

Its exit codes are 0 for OK, 1 for a usage error and 2 for a missing or unsupported file.

The read path is its own script, separate from the writer. It is not a --readonly flag on the writing script. The maker reports that it works with the plugin disabled and with the .godot/ folder deleted, and that the file's bytes were identical before and after.

A separate read-only script is easy to hand to an agent that has no write rights at all. For a broader view of which tools to let an agent write, see our guide to the godot-ai MCP server and which tools to let an agent write.

How does a dry run predict the file hash?

Without --write, the post says nothing is touched: no file change, no .sve.bak backup and no .tmp file. The output is the SHA-256 the file would have after the write. The maker reports that this predicted hash matched the file actually written, on all four Godot versions.

The post also says every --set is staged before anything is written. If one fails, nothing is written at all. A typo in the third key of a three-value edit cannot leave the first two applied.

This gives an agent a simple check:

  1. Run the dry run and store the predicted hash.
  2. Run the same command with --write.
  3. Run inspect and compare its SHA-256 with the stored hash.
  4. Stop and report on any mismatch. Do not retry.

The check only works if the dry run and the write really follow the same code path, as the tool claims. The maker reports a match. No one else has published a reproduction.

Why shouldn't an agent re-serialise a ConfigFile or JSON save?

Re-saving through a parser can rewrite parts of the file nobody asked to change. Formatting, comments and number precision can all shift. The maker says this is where save editors "quietly damage data", and reports these results:

  • A 78-byte ConfigFile with two values edited had exactly two spans replaced.
  • In JSON, 9007199254740993 and 0.7500 survived as written. The post says this comes from avoiding a float round-trip.
  • Byte order marks, CRLF line endings and comments were preserved.
  • In a project.godot file with an input map, the Object(InputEventKey, ...) line stayed byte-for-byte unchanged, and the project still opened in the editor.
  • --restore --write returned the file to its original SHA-256.

The large number is a deliberate test. 9007199254740993 is 2^53+1, the first integer a 64-bit float cannot store exactly. Any tool that reads JSON numbers into floats and writes them back can change it. If your own game round-trips saves through a JSON parser, test that value in your Godot version.

Byte-exact patching has a cost. The parser has to track where each value sits in the source text, and the maker reports that their parser was slow at first.

What should the tool refuse to write?

The post lists four states where the editor refuses to write. The maker says behaviour was identical on all four Godot versions.

SituationReported behaviourExit code given in postShould an agent retry?
Another process holds the fileBody unchanged, no .tmp left, reading still works. Save succeeds after release with the staged edit kept4Yes, with a cap
File deleted between read and writeRefused. The file is not recreatedNot statedNo
Path replaced by a directoryRefused. The directory is left in placeNot statedNo
Two editors, the older one saves laterRefused. The later session's value is keptNot statedNo. Re-inspect first

The maker also reports that unusual paths worked through the same atomic replace. These included spaces, Japanese characters, a single quote, square brackets and a 286-character path.

The post's own lesson is that an agent that retries blindly is the worst possible caller. Give the agent a list of exit codes, each marked retryable or not. A lock is probably temporary, so allow a few retries with a delay. A deleted file or a newer edit means the agent's picture of the file is out of date. It should stop, re-inspect and report.

How fast is it, and what rough edges did the maker report?

The post reports that opening an 8,388,419-byte JSON file took 1,654 to 1,860 ms, almost all of it spent parsing. After a switch to unicode_at integer comparisons, the same file opened in 320 to 367 ms. The post says this fix is in the working tree and not yet in a released build.

The maker openly reports two defects that the same tests found:

  • Leftover backup. A failed first save can leave an .sve.bak file identical to the untouched save. The post says this only affects a fresh save folder.
  • Three codes for "nothing happened". --restore on a file that already matches its backup returns exit 4, while the post says the README documents exit 3 for that case. A --set that changes nothing returns 0.

The second defect is the more useful lesson. Inconsistent exit codes can make a CI check pass or fail for the wrong reason. Run this test on any tool you give an agent: make it do nothing in each mode it supports, and confirm the exit codes match its documentation. The maker says both issues will be fixed by merging them into one contract. Those fixes are planned, not shipped.

What is not established yet?

The post lists its own limits:

  • Windows 11 and headless runs only. The failure messages were not re-checked in the real editor window.
  • The lock was reproduced with a Python file handle. It was not reproduced with Godot's FileAccess, OneDrive mid-sync or an antivirus scan.
  • Network drives, FAT32, encrypted folders (EFS), macOS and Linux are untested.

The post also states that an autonomous agent pipeline drafted it and ran the measurements, and that no human editor reviewed it before publication. Treat every number above as the maker's claim until someone reproduces it.

The post refers to a README that documents the flags, exit codes and a CI example. However, the public CLI contract repository it pointed to was not reachable when this article was updated. Check the addon's itch.io page for current documentation before you build CI logic around any exit code above.

A checklist for any save-editing tool an agent will call

Apply this to Save Value Editor, another tool, or your own script:

  1. Separate read-only path. Inspect should be its own script or tool, with no write code in it.
  2. Dry run with a predicted hash. The default mode writes nothing and returns the hash the file would have.
  3. All-or-nothing staging. A multi-value edit either applies in full or leaves the file untouched.
  4. Atomic replace. No half-written file and no leftover temp files after a failure.
  5. Refusal on four states. The tool refuses when the file is locked, deleted, replaced by a directory, or changed by a newer edit.
  6. Backup and exact restore. A restore brings back the original hash, not just similar content.
  7. One documented exit code per outcome, including "nothing to do", with a test that confirms it.
  8. Least privilege. Give the agent write rights only for the saves it needs to touch.

For the wider agent setup, see how to make a game legible to Claude Code. For using saves inside automated play sessions, see the Open Godot MCP playtest plan.

Who is this for?

Based on the sources, this approach suits developers who run agent or CI checks against ConfigFile or JSON saves and want the tool to fail loudly instead of guessing. It does not cover binary or encrypted saves. There is no evidence yet for macOS, Linux or synced folders, so if you work on those, run the checklist above before you rely on the tool. Its CLI documentation also needs confirming until the contract repository is available again. More Godot agent tooling is collected under Godot and coding agents.

FAQ

How do I let an AI agent edit a Godot save file safely?

Give the agent a read-only inspect step that is separate from the writer. Make edits dry-run by default and require an explicit write flag. After writing, have the agent re-inspect and compare the file hash with the dry run's prediction. The tool should refuse with exit codes the agent can branch on when the file is locked, deleted or changed by someone else. It should also keep a backup that restores the original bytes.

What is a dry run for a save editor, and how does it predict the file hash?

A dry run stages the edit in memory and writes nothing: no file change, no backup and no temp file. In the Save Value Editor post, the dry run returns the SHA-256 the file would have after the write. The maker reports that this matched the real written file on Godot 4.4.1, 4.5.2, 4.6.3 and 4.7.2. Nobody has independently confirmed that.

What should an agent do when a save file is locked by the running game?

Treat a lock as the only retryable refusal. In the post, a locked file returns exit 4 with the file unchanged, and the staged edit saves once the lock is released. Retry a few times with a delay, then stop and report. Do not retry after a deleted file or a conflicting newer edit. Re-inspect instead.

Does this addon work on macOS or Linux?

That is not established. The maker's measurements cover Windows 11 headless runs only. The post lists macOS, Linux, network drives, FAT32 and EFS-encrypted folders as untested.

How do I undo an agent's change to a save file?

Use a tool that makes a backup before the first write and can restore it byte for byte. The maker reports that --restore --write returned the file to its original SHA-256. Don't rely on the exit code alone. Compare the restored hash with the one from your first inspect.

SOURCES