Part 9 of 10All parts →Screeps + AI Slop

ScreepsAiSLP Build Log – Part 9: Watching the Machine Think

Switching it all on and watching the agent think in its live log: an agent that kept quitting early, a ghost worker that killed the gate, and how close M3 got.

8 min readBuild log#ai#screeps

Switching it on

Part 8 was the theory: measure first, test first, and a scorecard that grades every run. This post is what happened when I switched it all on and let the agent work through the night.

Installing was one script. It paused the schedule, brought my friend's changes into the project, put the protected test files where the agent can read but not change them, and installed a new launcher. A two-minute smoke test proved the scorecard worked on the real game engine: it recorded every single tick, and the bot printed zero errors. Then I turned the schedule back on and started the first run.

And then I did something I hadn't really done before. I sat there and watched it.

The best command in the whole project

Every agent run writes everything it does into the system log: what it's thinking, every command it runs, every test result. One command shows that log live, as it's written:

journalctl -u screeps-agent.service -f

The -f stands for follow. New lines appear the moment the agent writes them, and Ctrl+C stops watching without stopping the agent.

I expected a wall of noise. What I got was closer to watching someone think out loud. The AI model doesn't have a hidden plan somewhere: its reasoning is the text it writes, one step at a time, and here it scrolls past in real time. You see it read a file, form a theory, test the theory, get it wrong, and try again.

If the full stream is too much, this version shows only the commands, test results and launcher messages:

journalctl -u screeps-agent.service -f | grep --line-buffered -E "run_commands|agent-test|passing|failing|snapshot|\[scorecard\]|===|submit"

Watching it think

The start of a run is the most readable part. The new run checklist makes the agent read its inputs first and write a plan before it touches any code. Here's what that looked like:

The agent reading the last gate result and the M3 requirements, then writing a five-step plan

It read the last gate result ("M1 acceptance test fails because no builders exist", five lint warnings about random moves), summed up the M3 requirements in its own words, and wrote a plan: remove the random moves from the builder, add a tower manager, wire it into the main loop, fix the build priorities, fix the unit test that had been printing an error for days. Then it did exactly that, in that order. Run the fast lint fix, read the builder file, find the random moves on six lines, create the tower file.

Later in the night I caught it in a much stranger mood:

Left: the agent tracing the scorecard's timing through the test server's source code. Right: my real colony on shard2, still running the old code

On the left, the agent is debugging the scorecard itself. Its progress line at tick 500 didn't include tick 500's numbers yet, and it wanted to know why. So it went digging through the test server's source code and traced the order of events step by step: insert the probe, run the tick, count the tick, print the line, and only then does the result arrive. You can watch it argue with itself: "Wait, that doesn't make sense." "Actually, let me re-think this." It's genuinely good detective work.

It's also a detour. The scorecard is one of the files the agent may read but never change, and a progress line that's one tick behind doesn't affect any result. That's the honest picture of an AI agent: it can be sharp and curious and still spend a good while on the wrong problem.

On the right is my real colony on the official server, still running v0.2. Those faint rings all over the map are the old road sites from Part 7. That was my favorite part of the whole night: watching the old brain keep the colony alive while the new one was being built next to it.

The scorecard in action

The other fun part is the tests. With the scorecard on, a test isn't a silent wait anymore. Every 100 ticks it prints a progress line: how many creeps of each role, energy harvested and upgraded per tick, how full the spawn is, CPU, controller level. You can watch the colony grow inside a test.

The very first gate after the switch was short and blunt:

First gate: the M1 test fails because no builder exists

The M1 test, the oldest test in the project, failed with "at least one builder exists": expected 1, got 0. Look at the progress lines above it: 2 harvesters and 2 upgraders, never a builder. One of the agent's changes had broken spawning. That's exactly what the old tests are for. A new feature isn't allowed to break an old one.

The next run fixed it, and its gate went much further:

A full gate run: scorecard progress lines every 100 ticks, M1 and M2 passing, M3 failing

That's 34 minutes of testing on one screen: thousands of game ticks, a progress line every 100. At the bottom: 2 passing. M1 and M2, the old milestones, both passed with the new code and the scorecard running. Only M3 failed, and the snapshot line right above the result shows how close it got:

M3 checkResult
Build energy into roads while tower or extension sites existed0
Build energy into everything else5,230
Sources and controller reached by roads2 of 2, yes
Farthest extension from the spawn4 tiles
Extensions finished1
Tower finished0

The layout half of the milestone is done: perfect build priorities, roads that actually go somewhere, extensions close to the spawn. What's missing is the tower, and here's the failure up close:

The M3 failure up close: a tower is finished, expected 1, actual 0

Expected 1, actual 0. A later run did get the tower built, but it only ever held 50 energy, and the test wants 500. The colony simply doesn't collect enough energy yet: about 3 per tick out of a possible 20. That's the next mountain.

What broke while I was watching

Watching live also showed me three problems that the summaries had hidden.

1. The agent kept quitting early. Cline, the program that runs the agent, has a "submit and exit" command. The AI model is allowed to decide it's done. Several runs ended after 16 minutes, one after 4, others after an hour or so, every time with a cheerful summary like "I've successfully completed the task." It hadn't: it had fixed one small thing and run the quick tests, never the milestone test. I added a paragraph to the standing task: don't finish before the milestone test passed or the time is nearly up. One run used its full time after that, and then the next ones quit after 18 and 4 minutes anyway. Written rules only go so far with this model. So now the launcher enforces it. If the agent stops with more than 45 minutes left and no milestone ticked off, the launcher starts it again with a note: "Round 2 of this run, you have 170 minutes left, continue where you stopped." That's up to six rounds.

2. The ghost. This was the strangest one. When the 4-hour limit hit, the launcher stopped Cline and started the gate. But in the live log, lines kept appearing after "Agent run finished":

=== Agent run finished: Wed Oct 21 06:30:51 AM EDT 2026 ===
[run_commands] cd /home/agent/projects/ScreepsAiSLP && agent-test status 1
The test keeps crashing. Let me restart and check if it works:

The time limit had only stopped Cline's front end. A background worker kept going. The launcher's clean-up had just stopped the agent's own test, so the worker saw it "crashing" and restarted it. Restarting means first stopping every running test, and the gate's test run was one of them ("Killed", exit code 137). On top of that, the worker kept the run's log open, so the run never officially ended, and the next one started two hours late. The fix took two tries. The first version of the launcher's clean-up looked for processes in the wrong place and missed the worker. The second simply stops everything that the launcher didn't start itself. Since then, every gate has given a real result, and the next run starts 15 minutes after the last one, like it should.

3. The gate stops at the first failure. One gate showed "1 passing, 1 failing" after 16 minutes, when the full suite takes about an hour. I suspected a crash. It turned out to be a setting that came with the starter project: the test runner stops at the first failing test. After the agent added a new hauler role, the old M1 test failed again: a harvester stood still and full for 64 ticks, and the limit is 30. That's the freeze detector from Part 5, catching a brand-new version of an old bug. Because M1 runs first, M2 and M3 never even ran in that gate. I kept the setting for now, because it keeps failing gates short, and the agent sees its M3 numbers in its own test runs.

Where it stands

After one night and one day of watching, the scoreboard looks like this:

  • Layout and build priorities: working. Roads only where creeps walk, none on walls, extensions next to the spawn, zero build energy wasted on roads while something more important waits.
  • Tower: built once, never filled. The economy is the bottleneck now, and the scorecard says so in plain numbers.
  • Two bugs found by measuring, not by guessing: energy going in circles through the spawn, and harvesters freezing again after the new hauler role.
  • The machinery is sturdier: no more ghost workers, no more killed gates, and a run that quits early now gets started again. That last part is brand new, so the next few nights will tell.

What I learned

  • Watch it at least once. Summaries said "run finished, gate failed". The live log showed why: a ghost worker, a model that gives up early, a test runner that stops at the first failure.
  • An AI agent thinks in text. Its reasoning is right there on the screen, sharp detective work and wrong turns included. That makes it easy to see when it's chasing the wrong problem.
  • Old tests are worth their weight in gold. M1 caught two new bugs this week that had nothing to do with M1.
  • Rules are suggestions, machinery is not. "Don't finish early" in the instructions did almost nothing. A launcher that simply starts the agent again doesn't need to convince anyone.

Next time: a fresh look at how the whole system fits together now, because quite a lot has changed since Part 6.

Questions, or did I get something wrong?herrera9604@gmail.com