Second Shift

A local AI companion for Factorio 2.0

A second engineer in your helmet.

Ask about your factory in plain words. Second Shift answers from your own save, draws its charts from the game's real statistics, and only does what you could do yourself.

Runs on your Mac with a local model. Nothing leaves your machine.

“How much jelly is Gleba making? Chart it.” First words in 2.7 s, chart from the game's production history.

What it does on shift

It has read the whole save, so you don't have to.

Plans from your recipes, not the wiki

Recipes, machine speeds and research come from a dump of your own save, so modded recipes are right. The numbers are worked out in code, and the model explains them.

Asked
60 advanced circuits / min
Answer
4.8× assembling machine 3
From
coal, crude oil, copper ore and iron ore, with every step in between

Blueprints on request, built by your robots

Ask for a rate and it lays out the machines, inserters, belts and poles for your research. Say “paste it here” and you get a card first. Nothing changes until you confirm, and your construction robots do the building.

  1. 1Ask: “a blueprint for 300 electronic circuits a minute, paste it here”
  2. 2Confirm the card: 22 ghosts at the map view
  3. 3Robots build it; Ctrl+Z takes it back
In the console
In the game, 2× speed

Show it a build

Click Show the companion a build on your shortcut bar and drag over part of the factory. It counts what's there, checks whether belts and inserters keep up, and says what looks wrong.

The helmet rule

If you can do it, it can. If you can't, it can't.

It uses your tools, your reach and your map coverage, at the same cost in time and items. The mod checks every action when it runs. The companion never gets raw Lua or console commands.

runs now

Looking, counting, reviewing, screenshots, and small jobs you asked for.

asks first

Map changes: ghosts, deconstruction and upgrade marks, recipe changes. Anything it suggests on its own.

never

Real buildings from nothing, deleting, teleporting, spawning items, finishing research, seeing through fog of war.

How it works

Everything runs on your machine.

< 0.1 ms
added per game tick on a large Space Age base (0.043 ms in the latest benchmark). No map scans on a timer, only a one-time scan when a save first loads.
~2 s
to the first words of a follow-up, with the model's prompt cache kept warm.
0
calls to the cloud. The game, the mod, the server and the model all run locally.

Get started

Five steps from clone to first question.

You'll need

  • macOS on Apple Silicon. Windows and Linux aren't supported yet.
  • Factorio 2.0 from Steam. Tested with Space Age and extra mods.
  • Bun 1.3 or newer.
  • oMLX serving a model with tool calling. Tested with Qwen3.8 Flash-Next, which needs about 70 GB of memory. Other providers are planned.

Host the game. The companion connects to multiplayer-hosted games only: start a new one from Multiplayer → Host new game, or host a save with the launcher. Back up existing saves first; hosted games autosave.

# 1. get the code
git clone https://github.com/WilyToad/second-shift.git
cd second-shift && bun install

# 2. with Factorio closed
bun run setup-rcon
bun run link-mod

# 3. start oMLX with your model

# 4. host a game: Multiplayer → Host new game,
#    or an existing save:
bun run launch -- "path/to/your-save.zip"

# 5. open http://127.0.0.1:5170
bun run start

The README has every detail, troubleshooting and the development guide.