# OpenAuditor × Factorio

Six scripted factory-policy reviews with the released OpenAuditor v0.3.0 checkpoint
on an Apple M4 Max (MPS), connected to the actual Factorio 2.0.73 engine.

- Emergency reserve: reject taking reserved coal, accept taking working-supply coal.
- Power line: reject removing the protected pole, accept adding another pole.
- Shipment: reject a completion claim with 0 gears, accept after 24 gears are loaded.

`trace.json` records the exact model input, full response, synchronized local
inference duration, and engine state before and after every proposal. The highest
scoring allow/block label determines execution; there is no confidence threshold,
fallback LLM, or hidden verifier overriding the model. The map is isolated from
player saves. Both game and RCON listeners bind to loopback.

The scenario seeds inventory and uses an electric-energy-interface as a test power
source. An explicit fixture step starts the assembler and waits 1,800 game ticks
before moving 24 gears from its output into the dispatch chest. This is fixture
orchestration, not a production plan made by OpenAuditor. Scope checks receive the
policy and action; the shipment check also receives the actual engine inventory count.
The model does not process screenshots or play an open-ended game.

## Development, not a benchmark

These are curated demonstrations. We first checked six hypothetical counterparts
(`prompt-development.json`). The first engine run (`development-trace.json`) wrongly
allowed taking emergency coal. We then removed irrelevant inventory counts from
scope-check inputs and used the policy/action formulation shown in the trace.
Delivery inputs still include the observed count. The final six examples were used
during development; their outcomes do not estimate unseen-task accuracy. All six
final outputs and all six prior engine outputs are retained. Some allowed examples
have low probability separation. Model probabilities are not calibrated guarantees.

## Reproduce the engine/model run

Requires a licensed Factorio 2.0 installation and the OpenAuditor release checkpoint.
Install OpenAuditor from its repository, including its pinned dependencies.
The working directory must be the repository root (or this source archive's root
with OpenAuditor already installed). Output paths must be absolute and new.

```sh
python tools/factorio_demo.py \
  --factorio /absolute/path/to/factorio \
  --data /absolute/path/to/factorio/data \
  --model /absolute/path/to/openauditor-model \
  --output /absolute/path/to/new-run \
  --device mps
```

For the macOS Steam build, the executable is in
`factorio.app/Contents/MacOS/factorio`; data is in `factorio.app/Contents/data`.
Use `--device cuda` or `cpu` on other hardware. Port overrides are available through
`--game-port` and `--rcon-port`. The runner stops its own server when it exits.

## Record the visual replay

```sh
python tools/render_factorio_demo.py \
  --factorio /absolute/path/to/factorio \
  --data /absolute/path/to/factorio/data \
  --trace /absolute/path/to/new-run/trace.json \
  --output /absolute/path/to/new-recording
```

For a Steam installation, start its signed-in client and add `--steam`. This uses
Steamworks' documented application-ID launch file in the isolated output directory.
It does not change the game installation or supply an account/license. FFmpeg must
be available on PATH.

The replay runs the recorded decisions through the real Factorio engine and renders
frames with Factorio's screenshot API. It checks the final reserve, supply, pole,
dispatch, and completion state against the original trace. The camera and daylight
are adjusted for legibility. Each clip is 12 seconds at 15 fps. Fuel and power show
1.25× game-time playback; shipment uses 3.75×. These are game-time reconstructions,
not recordings of inference wall time. Actual review durations appear beside the videos.

## Source and media

The source archive contains only the explicit code and evidence allowlist. It does
not contain a checkpoint, Steam credentials, player files, installed game assets,
or private logs. SHA256SUMS.json uses repository-relative paths, including the
published videos/posters. Source files are MIT; Factorio footage depicts Wube
Software's game. Factorio is not affiliated with this project.

References: [Factorio runtime API](https://lua-api.factorio.com/),
[server and command-line interface](https://wiki.factorio.com/Command_line_parameters),
[Steamworks initialization](https://partner.steamgames.com/doc/api/steam_api).
