Secret Sauce for Autonomous Bot Building
What made this loop work for bot building was feedback. Evidence from the game the agent could actually read.
That’s the job of an EventLogger class/module.
Pick the moments you care about, expansion taken, army attack, unit built. Every time one happens, write a receipt:
- frame number
- the event
- the outcome
Log it to a JSONL file and keep it lean.
Once the loop has receipts, you need a judge. A validator script reads the log and returns pass or fail, whatever “worked” means for you. Then overwrite the log each run so the loop doesn’t get sloppy with context.
The Setup Behind the Loop
None of this works if the repo is broken. Start with a bot that already builds and runs. Otherwise the loop just burns tokens on build errors.
Use a CLI agent like Claude Code or Open Code. Fresh run, fresh context window. Long sessions get sloppy.
Give it an agent.md with everything it needs to onboard. Repo map, build commands, style, what matters. Let that file carry the weight.
Give it a plan.md file. The agent grabs the next unfinished item, does the work, updates the plan. One feature at a time.
Keep prompt.md strict. One task. Validate. Update the plan. If it fails, read the log and pick the next fix.
Give the loop a kill switch. The agent replies promise complete when everything is green, you grep for it and exit.
Then run the while loop command.
Watch the first two or three iterations before you walk away. Bad task selection and fake validation are easy to spot early.
Also token cost is real. If the agent reads giant logs every run, you’ll feel it. Keep events lean. Make validators specific.