syx-mcp (Unattended Agents Playing a City Builder)

Role: Solo. I set the goal, corrected the agents in chat, approved configuration changes and read the reviews. Agents wrote nearly all of the code and made nearly all of the commits.
Tech Stack: Java 21 (in-game mod), Python 3.11 with the MCP SDK, pytest, bash loop scripts, Claude Code with project agent types and hooks
Repository: Private. Walkthrough available on request

Songs of Syx is a commercial game by Gamatron AB. This is an unofficial personal project with no connection to the developer. It needs a purchased copy of the game to run, and nothing from the game (code, art, or data files) is in the repository or on this page.

Overview

syx-mcp gives a coding agent the controls to Songs of Syx, a city builder where a settlement of ten people can grow into thousands. A small Java mod inside the game opens a loopback connection, a Python MCP server turns that connection into tools, and an agent plays: it reads the city’s state, places rooms, sets workers, trades, answers events, and steps the clock.

I started it on 2026-10-15 with one instruction: get it working, survive two years of seasons, then keep surviving as long as possible so the run produces data to improve the tool. The game turned out to be the easy part to state and the hard part to do. Keeping one agent playing for days needed other agents to build the tools it lacked, and keeping those agents from breaking each other needed rules, a work queue, a reviewer, a single git writer, and a few hard guards. None of that was designed up front. It accreted, usually the same day something went wrong.

So this page is mostly about agent operations: what it took to keep agents working while I slept, and what failed. The repository holds 4,307 commits across 14 days (2026-10-15 to 2026-10-28), with commits on every one of those days. All but one carry my git identity, because the agents committed as me, and 3,378 of them (78%) carry a model co-author trailer. I have not found a commit in there that I typed myself. My part arrived as chat, which the agents copied into a rules file word for word.

Why it stopped: I ran the game around the clock on my computer for weeks, identified the strong points and the weak points of the setup, and moved on to the next iteration of my agent orchestration work with those lessons. Of all my unattended-agent projects, this was the most successful at still being running when I woke up.

System Architecture

graph TD
    subgraph Game["Game process"]
        MOD["Bridge mod (Java)<br/>loopback TCP, runs calls on the game thread"]
    end
    subgraph Tools["Tool layer"]
        MCP["MCP server (Python)<br/>tools, guards, dry runs, action log"]
        LOOP["Day loop and supervisor<br/>report, alerts, proposals"]
    end
    subgraph Agents["Agent organization"]
        RUN["Runner<br/>plays, dispatches, only one that restarts the game"]
        RES["Research workers<br/>read-only"]
        IMP["Implementers<br/>one queue row, own worktree"]
        REV["Reviewer<br/>read-only, PASS or FIX"]
        CM["Code manager<br/>the only git writer on main"]
    end
    OWNER["Me, in chat"] --> RULES["rules.md<br/>numbered rules, verbatim"]
    RULES --> RUN
    RUN --> MCP --> MOD
    LOOP --> MCP
    LOOP --> RUN
    RUN --> RES
    RUN --> IMP
    IMP --> REV --> CM
    RES --> CM

Components

  • Bridge mod. A script mod that starts a loopback-only TCP server when the game loads it and runs each request on the game thread. The bridge package has no game imports, so the whole thing also runs against a fake game loop with no game installed, which is what the test suites use.
  • MCP server. Python, one tool per game action or read. 88 tools at the 2026-10-18 review, 120 at the last commit. Every write goes through one function and lands in an action log.
  • Day loop. Plain scripts with no model in them: advance the clock, build a report from game state, raise alerts, print proposals. A supervisor (added 2026-10-22) keeps the loop running between the runner’s turns.
  • Runner. The main session, a chain of sessions that restart when context fills, each one picking up from a handoff file.
  • Workers. Research, implementer, reviewer and code manager are project agent types with their own briefs. Over 48 runner sessions measured on 2026-10-18 the runner dispatched 178 research agents, 90 implementers, 39 reviewers and 33 code manager runs.

Engineering Details

1. A Bridge That Refuses Late Work

A game action that fires 30 seconds after the agent gave up on it is worse than one that never fires, because the agent has already moved on and may have done something else to the same spot. So a call that the game thread does not pick up within 5 seconds is dropped and never executed.

The same thinking shaped the tool defaults. A tool that spends credits or knowledge, takes apart something citizens built, or cannot be undone defaults to a dry run and reports what it would do. That rule came from an incident: the first review (2026-10-16) records a refused furniture change that tore down five bakeries during a food shortage. Every game read is also isolated, so a method renamed by a game update shows up as an error field in the status reply and does not crash the game loop.

2. My Corrections, Written Down Verbatim

When I told an agent to stop doing something, it had forgotten by the next session. So the agents were told to copy each instruction into one table, rules.md, with an id, my words unedited, the date, which roles it binds, and a “check” cell naming the test or alert that would catch a violation. A check cell may say “none”, with a reason, and the file’s own header calls that the list of work still to do.

That table grew to 147 rows in 13 days, 37 of them on 2026-10-17 alone. The check column turned out to be the most useful part, because it made the weakness countable. On 2026-10-18 a review found that 41 of 79 rules had no check and 8 more cited a document as their check. At the last commit, 92 of 147 rows still had a check starting with “none”. The review’s own summary of the pattern: the one class of rule that stopped recurring was the class that got a test or a tool.

3. One Git Writer, One Row Per Worker

Several agents committing into one checkout is how you get conflict markers in live code, and that happened: on 2026-10-18 the day loop loaded the server file mid-merge and every tool call failed with a syntax error.

So the organization settled into this shape:

  • Work lives in a queue table. An implementer takes one row, in its own git worktree, tests first.
  • A read-only reviewer gives PASS or FIX on the branch before merge.
  • One standing code manager is the only session allowed to write git in the main checkout. A file names it, and a git-write hook reads that file. It resolves conflicts in a scratch worktree, so main only ever fast-forwards.
  • A test fails if any tracked source file contains a conflict marker.

At the 2026-10-18 review, branch life had a median of 8 minutes and there were 196 merges with 3 mentions of a conflict. The cost was a single serial bottleneck, which the same review says plainly, and a lot of bookkeeping: by commit subject, 1,019 of the 4,307 commits are merges.

4. The Review That Killed the Game

On 2026-10-18 I had ten read-only agents review the repository, one area each. At about 20:15 the agent reviewing the bridge had started its own fake game for probing, and cleaned up by killing every Java process by image name. It ran that three times. The live game was a Java process.

The game came back two minutes later from a save about twenty minutes old. A rule went into the agent briefs within the hour: agents never kill, restart or launch the game, only the runner does. The review then pointed out the problem with that fix in its own first paragraph. The agent that did it was an ad hoc agent spawned by the review session. It read only its own brief, so a rule in the project briefs “would not have prevented this.”

What actually closed it was structural. The fake game got its own port, refuses the live port outright, writes a PID file, and stops only that PID. A deny entry for process kills by name was drafted as a proposal waiting on my yes, since one of my earliest rules was that agents propose configuration changes and wait. The review’s line on the whole thing is the one I have carried into later projects: “Rules in text do not bind a subagent that never read them; permissions and PID files do.”

5. Fencing Self-Modification

By day four the agents were editing the rules file, their own briefs, and the mod and server they acted through, and nothing separated a play-time edit from a change to the system. The same evening as the incident, the repository got a two-tier boundary:

  • Tier 1 is play-time state the runner may edit: config numbers, holds, plans, the event log, queue rows, handoffs.
  • Tier 2 is system code (server, mod, dev scripts, agent briefs, settings, the rules file beyond appending my words). It moves only through a queue row, an implementer branch, the reviewer and the code manager.

A pre-tool hook classifies every path against the agent’s role and refuses the write, and an unknown role is refused everything. The code manager tags known-good builds, and the restart script can rebuild from the newest tag.

6. Checkpoints: Too Few, Then Too Many

The runner survives context limits by writing a handoff file that the next session reads. Early on, those were stale when the context was compacted in 13 of 103 cycles, so the guard was changed to ask for a refresh every 20,000 tokens. That fixed staleness and created a new problem. A measurement over 28 runner segments (2026-10-17 to 10-19) found that 37% of the runner’s calls were game tools, that handoff checkpoints were 23% of everything it wrote against 5% for game tool inputs, and that it wrote about five characters of bookkeeping for every character of game action.

I cut handoffs to three context marks on 2026-10-27. A memory note and a rule did not stop the mid-stretch edits. On the last day of commits a hook was added that refuses a handoff write unless the session has crossed a new mark, and the mechanical sections of the handoff are rendered by code.

7. What It Cost in Context

Two measurements changed how I set up agent sessions afterwards:

  • Session baseline. The runner’s first call carried 60,111 tokens before it read anything. Denying tools it never used, turning off unused plugins and skills, and dropping instructions that did not apply to a game steward cut that to 21,368 (2026-10-18).
  • Tool list. The tool descriptions had filled up with incident history: about 33,000 tokens for 88 tools on 2026-10-18. A 300-character cap per description, long notes moved behind a lookup tool, and a budget test brought it to an estimated 17,000 tokens for 113 tools by 2026-10-22.

Over the first week (from session transcripts, the seventh day partial) the agents made about 52,600 model calls and wrote about 27.6 million output tokens. Output tokens per game year went from 43K on day one to 280K on day four and back down to 121K, a 6.5x rise and fall that tracks how much of the effort was going into the harness and not the game.

What Failed

The reviews in the repository are blunt, and they were written by agents about agents. The parts that matter most:

  • Rules without guards. Covered above. More sentences did not help; tests, hooks and tool refusals did.
  • A wrong fix, shipped. On 2026-10-17 an agent read “already paid” on a raider demand as covered, silenced the alert without checking the game’s code, and the city was sacked for 295,388 credits and 30% of warehouse stock. Both commits were reverted and a regression test pins the stop.
  • Green tests, dead game. The suites compiled only the fake game, so a compile error in the real adapter passed 10,956 tests and took the game down at the next rebuild. A build check on changed mod sources followed.
  • Alerts that never cleared. One alert appeared in 489 consecutive reports and the homeless alert in all 742. In the second city, the food warning that mattered was line 42 of a 164-line alert block.
  • A rule followed off a cliff. In the second city a growth rule with no gate had the runner raise the population cap five times in about 20 minutes. Population went from 215 to 408 with housing flat at 272, then fell to 100. The crash review’s finding: the runner followed the rule as written.
  • Knowledge that only grows. 29 lines added per line removed at the 2026-10-18 review. The lessons file reached 778 numbered lessons, and the same topics were researched 7 to 14 times each.
  • Guardrails outside the repo. The agents’ own assessment was that a clone on another machine “would carry the agent system’s intent and lose its guardrails,” because several of the hooks and the permission list lived in my local configuration. There is no CI.
  • The model was not the variable. When the second city stalled I suspected the cheaper model. A review of 36 runner sessions (2026-10-26 to 10-27) found the same turn pattern and the same city curve on both models.

How the Cities Did

The first city grew from 10 people to 1,999 at game year 140 (2026-10-18), recovering along the way from a low of 174, and peaked at 3,276 in the half-hourly samples. It was sacked by raiders three times (game years 57, 92 and 114), which the review puts down to having no working raider tool or army, and lost its throne to an invasion at game year 249. The second city, started 2026-10-24, crashed several times and sat between 216 and 346 people over the last twenty game years measured. Neither is a strong result as city building. One unattended night in the first week was net negative in game terms, by the review’s own account.

What the game did give me was an outside check. A city that empties out is a result no agent can describe its way around, and most of what I know about where this setup was weak came from that.

Features

  • Loopback bridge with expiring calls - requests run on the game thread, and a call not picked up within 5 seconds is dropped, never run late
  • Fake game loop - the real bridge over a made-up game, so the protocol and tools are tested with no game installed
  • Dry-run defaults - tools that spend, demolish or cannot be undone report first and act only when told to
  • Guards in code - refusals for building on rivers, underpaying raiders, unsafe research and overspending on trade, each tied to the incident that caused it
  • Action log - every real change is recorded; dry runs are not
  • Numbered owner rules - my words verbatim, with a check column that admits when nothing enforces a rule
  • Role-separated agents - runner, research, implementer, reviewer, code manager and a memo-only department head, each with a tracked brief
  • Single git writer - one named session writes to main, enforced by a hook, with conflicts resolved in a scratch worktree
  • Self-modification boundary - a two-tier path classifier as a pre-tool hook, with known-good build tags
  • PID-scoped fake game - its own port, refusal of the live port, and cleanup by PID file only
  • Loop supervisor - keeps the day loop running between runner turns, restarts one crash, gives up on the second
  • Handoff write guard - checkpoints only at set context marks, with the mechanical sections rendered by code
  • Process audit as code - a script that checks the process itself (queue, rules, handoffs) and reports into the daily report
  • Usage archive - a week of token use, calls and game state by day, built from transcripts with the scripts kept

Tech Stack

  • Mod: Java 21, compiled against the game’s bundled runtime with a small Python build script (no Maven needed); the build file is adapted from 4rg0n’s MIT-licensed mod example
  • Server: Python 3.11+, mcp SDK 2.x, stdio transport, one dependency
  • Protocol: newline-delimited JSON over loopback TCP, one request at a time per connection
  • Testing: pytest with pytest-xdist; the suites spin up their own fake game on a free port. About 11,000 tests passed across the two suites at the 2026-10-18 review, with a handful failing under load at the time. Coverage is strong on the Python side and thin on the Java adapter that touches the game, which is exactly where the compile error got through
  • Loop: bash scripts plus a Python supervisor, no model in the loop itself
  • Agents: Claude Code project agent types, pre-tool hooks for the boundary, the git writer and handoffs; a second host port (Codex) reads a generated copy of the same rules
  • CI: none. The code manager gated merges on a local green run, and the 2026-10-18 assessment names that as the clearest operational gap