DEV Community

Cover image for Giving OpenClaw a Body: How I Turned an AI Agent into a Minecraft Survival Expert ⛏️🤖
Prema Ananda
Prema Ananda Subscriber

Posted on

Giving OpenClaw a Body: How I Turned an AI Agent into a Minecraft Survival Expert ⛏️🤖

OpenClaw Challenge Submission 🦞

This is a submission for the OpenClaw Challenge.

What I Built

I built ClawCraft-bot — a bridge application that gives OpenClaw an avatar inside a Minecraft world.

Instead of just chatting or processing text, OpenClaw can now perceive a three-dimensional environment, gather resources, craft tools, navigate complex terrain, and even defend players against hostile mobs in real time. The bot acts as an independent agent running through a local HTTP API, translating OpenClaw's high-level reasoning into precise in-game actions.

How I Used OpenClaw

OpenClaw serves as the "brain" of the entire operation, making strategic decisions, while ClawCraft-bot acts as the "nervous system."

The Tech Stack & Environment

  • Launcher: SKLauncher 3.2.18 (Offline mode)
  • Minecraft Version: Java Edition 1.21.11
  • Bridge API: Node.js + Express.js
  • Bot Engine: Mineflayer + pathfinder, pvp, collectblock

The system runs on a local Minecraft world. One important detail: after launching the game, you need to open the world to the network (Open to LAN) on port 25565 (default) so the Bridge API can connect the bot to your game session.

Integration Architecture

I implemented a Bridge API architecture that allows OpenClaw to interact with the world through:

  1. Read-only Observation: OpenClaw polls /status, /inventory, and /nearby to analyze the environment.
  2. Action Queueing: Complex commands (e.g., "collect 3 cherry logs" or "craft a stone sword") are placed in a queue.
  3. Job Polling: Since in-game actions take time, OpenClaw receives a jobId and tracks progress until completion, preventing command conflicts.

Setup

1. Launch Minecraft

  1. Use SKLauncher (or any other launcher) to start Minecraft Java Edition 1.21.11.
  2. Load a world and select "Open to LAN" on port 25565.

2. Install ClawCraft-bot

git clone https://github.com/premananda108/ClawCraft-bot.git
cd ClawCraft-bot
npm install
# Edit .env if needed (specify the port from MC)
npm start
Enter fullscreen mode Exit fullscreen mode

3. Configure OpenClaw

  1. Install OpenClaw by following its official documentation.
  2. Create a new Skill in OpenClaw. As the skill instructions, simply provide your agent with the contents of the SKILL.md file from this repository. It contains all the necessary behavior rules and API descriptions for the AI.

Setup name
Create skill
First time in game
Message in chat

Intelligence & LLM Efficiency

One of the key features of the project is the use of a detailed SKILL.md file. This allowed me to:

  • Lower model requirements: Thanks to clear instructions and API descriptions in the SKILL file, the bot can be controlled even by inexpensive or local LLMs.
  • Optimize costs: Minecraft involves a very high number of "check-act" cycles. Using local models (via Ollama or similar tools) lets you run the bot for hours without burning through expensive API tokens.

Demo

ClawBot exploring the world
ClawBot inventory and status
Mining wood
Check attack modeon

GitHub logo premananda108 / ClawCraft-bot

OpenClaw-powered Minecraft bot that mines, crafts, navigates, and fights — all driven by LLM decisions through a local HTTP API.

ClawCraft-bot

Secure Minecraft bot with a high-level API for control via OpenClaw.

Quick Start

# 1. Installation
npm install

# 2. Setup (copy and edit)
cp .env.example .env
# Edit .env: MC_HOST, MC_PORT, MC_USERNAME

# 3. Run
npm start
Enter fullscreen mode Exit fullscreen mode

API

Bridge API is available at http://127.0.0.1:3001 (default).

Read Data (GET)






































Endpoint Description
/health Bridge status (always available)
/status Health, food, position, gameMode
/position Bot coordinates
/inventory Items in inventory
/nearby?radius=32 Nearby entities (default radius 32)
/scan-blocks?radius=8 Scan nearby blocks (default radius 8)
/findblock?name=oak_log&maxDistance=32 Find specific block by name

Actions (POST)









































Endpoint Body Description
/actions/goto { x, y, z } Navigate to coordinates
/actions/follow { player, distance? } Follow a player
/actions/chat { message } Send message to global chat
/actions/whisper { player, message } Send private message
/actions/stop Stop everything (tasks and movement)
/actions/dig
{ name } or { x, y, z }
Dig block (by name or coordinates)





What I Learned

Building a bridge between an LLM and a real-time game engine turned out to be full of hidden pitfalls:

  • Visualization traps: I originally planned to use prismarine-viewer to stream a video feed. However, it turned out to work incorrectly with Minecraft Java 1.21.11. In the end, I decided to drop visualization from the final build in favor of control stability.
  • LLMs need strict feedback loops: Initially, the AI would try to eat food while holding a pickaxe. I had to explicitly write into SKILL.md that a tool must be put away before eating. Designing an API for AI is a balancing act between flexibility and hard rules.
  • Lifecycle chaos: Minecraft bots sometimes die. I learned that handling automatic respawns requires strict event decoupling — otherwise the system starts injecting multiple pathfinding plugins into the same bot instance, leading to massive memory leaks.

ClawCon Michigan

Unfortunately, I wasn't able to attend ClawCon Michigan this time around, but it's wonderful to see the OpenClaw community growing and building incredible things!

Top comments (0)