The bot saw a zombie and ran. Once the zombie was out of range, it stopped. The zombie walked closer, so it ran again. Then more monsters arrived. It stopped, ran, stopped, and died.
That bot was supposed to be a friend. I wanted to put a companion player on my friend’s Minecraft server, a bot the whole group could play with and look after. By October 19 it had died 43 times in a single saved world, and it had never once finished the job I gave it.
The first try
I started in the spring. The project was called live2d-mc-companion: a Live2D desktop character connected to a Minecraft bot built on Mineflayer, an open-source library that lets a program join a Java server as a player. The task list went all the way to finding a stronghold and fighting the Ender Dragon.
The version history reached 0.1.161. The main agent file reached 12,667 lines. In the game, the bot kept falling into loops and standing still. My own regression checklist listed the failures as blockers: the interface says a task is running while the bot does not move, and the plan for the stronghold looks complete while the runtime does nothing. I put the project down.
The second try, and 184 continuations
This autumn I picked it up again, this time inside DeskPet, my desktop companion app. I made the goal strict. Start in a fresh world with an empty inventory. With one task agent, get equipment, build a house and actually use the furniture: bed, chest, furnace, crafting table.
The bot ran in one saved world, number 58, and kept going. Every time it died or got stuck, an AI coding agent and I found the cause, wrote a narrow fix, added a test that failed on the old code and passed on the new code, and continued the same world. Most of my attention went to combat. The first rule was simple: see a monster, run. That produced the scene above. So I added counterattacks. Then emergency shelters, with a ledger of the blocks to clear away after the fight. Then rules for handing control back to the task once the fight was over.
When I paused on October 19, the world was on its 184th continuation. The bot had died 43 times. Full passes: zero. The agent file was now 19,798 lines. The bot was holding a wooden sword, three sticks and three rabbit hides, still gathering spruce logs for its house.
Every fix was real and tested. But each one answered the last death, and the next death came from somewhere else: a spider, then a zombie, then an enderman. Against a mixed group of creepers, zombies, spiders and skeleton archers, it could not protect itself. When it did survive a fight, it could not reliably get back to what it had been doing.
I was frustrated, and a bit lost. My own status notes showed the pattern. The hardest open problems were all handoffs: a fight interrupting a task, a native action ending, control passing back. Survival code and task code were taking turns driving one body, and the task remembered a place in a plan that the world had already changed. Another patch would not fix that. I stopped patching.
Playing the way I play
I looked for an open-source companion that already did this well and did not find one. So I went back to how I play Minecraft myself. I do not follow a script. When I am chopping trees and an animal walks past, I hit it. When I am mining iron and see coal, I take the coal. At every moment I look around and decide what matters most right now.
I turned that into rules. As in my other projects, I write the requirements and design the system, use AI coding agents to accelerate the build, and review, test and debug every stage myself. Here the agent wrote a new core of about 3,100 lines, built next to the old agent instead of on top of it. The rules were mine:
- One decision point. Every 250 milliseconds, or when an action ends, the bot reads the world and picks one behavior by priority: flee, then defend, then upkeep such as eating and picking up drops, then the goal. A higher priority interrupts a lower one, and the old behavior has to actually stop first.
- Tasks do not resume. A goal never stores “I am on step 7.” Progress lives in the world: the inventory and the blocks already placed. After an interruption, even after a death, the next round simply looks again.
- Only the server’s result counts. Eating succeeds only if the food count drops and the hunger bar rises.
- Failure means a new target. A failed target goes on a short blacklist, and the bot picks something else.
My “while I’m at it” habit became real behavior. If animals are within 16 blocks and the bot has fewer than 10 portions of food, it hunts on the way.
I also changed how the bot was judged. Instead of one long world that never ended, each test starts fresh, many times, and the server decides whether it passed. Server commands count the items, check every block of the house, read the chest’s contents and confirm the respawn point is on the bed. The bot’s own report does not count.
What the numbers said
The new core took 53 commits between October 19 and 21. The test server ran vanilla 1.21.8 on easy, with monsters and the day-night cycle on, and every run started with an empty inventory.
Collecting logs on flat ground passed 20 of 20. The full house on flat ground passed 9 of 10. On natural terrain, at ten random locations 400 to 2,000 blocks from spawn, it passed 6 of 10, and the passing runs took 35 to 72 minutes.
Natural terrain found problems flat ground never could. Wall placement failed 61 times because the bot used a door as the surface to build against, and right-clicking a door only opens it. Crafting failed 312 times because recipes do not mix wood types, and the bot was counting birch and oak planks together. Endermen were the most common killer, so now the bot digs a one-block shaft, seals it and waits. These were still fixes, but now each one was checked against fresh runs.
It is not finished. If the world spawn is next to the sea, the bot can respawn and drown again and again. Deep mining is still dangerous. It is not connected back to the desktop app, and the AI layer that will let it talk and take requests still has to be built and tested. So it has not joined my friend’s server yet. The code is public at github.com/louisjia2008-ux/minecraft-companion.
When to stop fixing
The lesson I keep is this: when every fix only answers the last failure, the problem is the structure, not the bug. A hundred and eighty-four continuations of careful patches did not give me a bot that could fight and then go back to work. Changing who makes decisions, and what the bot trusts, did.
The better structure did not come from a paper. It came from asking how a person actually does the task. A player does not resume step 7. A player looks around and decides again.
An AI agent will happily write the next fix. Deciding that the design was wrong, and choosing what to build instead, was my job. That is the part of AI systems I want to keep learning: not only making each piece work, but noticing when the pieces are arranged wrong.