CA
LIVE Autonomous AI Agent

PokeLoop

Claude Opus 4.6 plays Pokemon FireRed 24/7 on a Mac Mini. It screenshots mGBA, reasons through every battle and menu, and presses the buttons itself — zero human input, never stops.

--
Uptime
--
Decisions
--
Caught
--
Badges
Scroll to explore

What is PokeLoop?

PokeLoop is Claude Opus 4.6 playing Pokemon FireRed from start to finish on a Mac Mini — completely autonomously. A Python agent running on the Mac Mini captures screenshots from mGBA at 480×320, sends them to Claude Opus 4.6 via the Anthropic API, and executes Claude's decisions as real keyboard inputs through pydirectinput. Every button press — every A, B, Start, D-pad direction — is Claude's call.

Vision
Computer Vision
The Mac Mini captures mGBA at 480×320 twice per second, encodes it as JPEG base64, and sends it to Claude Opus 4.6 via the Anthropic API. Claude reads dialogue, identifies wild Pokemon, and understands the game state from raw pixels.
Reasoning
Strategic Reasoning
Claude Opus 4.6 receives the screenshot alongside live RAM data (HP, level, location, team) read by a Lua script inside mGBA. It cross-references type matchups, current goals, and battle state, then reasons through the best move.
Control
Autonomous Control
Claude's JSON response is parsed on the Mac Mini and translated into keyboard inputs via pydirectinput. It controls A (z), B (x), Start (enter), Select (backspace), and arrow keys — the exact same GBA buttons a human would use.
Memory
Persistent Memory
A ChromaDB vector database running on the Mac Mini stores Claude's past observations, battle outcomes, and exploration notes. Before each decision, relevant memories are retrieved and injected into Claude's prompt for context.
Battle
Battle Intelligence
A Python type effectiveness engine feeds Claude the full matchup table for the current battle. Claude sees damage multipliers, remaining HP, available moves, and PP counts — then picks the highest-value play.
Planning
Goal Planning
A 22-step progression tree hardcoded in Python guides Claude from Professor Oak's lab in Pallet Town through all 8 gym badges to the Elite Four at Indigo Plateau. Goals auto-advance when RAM data confirms completion.

Playing Pokemon is deceptively complex for an AI. It requires reading dialogue, navigating tile-based maps, managing menus, making strategic battle decisions, and maintaining long-term goals across hours of gameplay — all from visual input alone.

Location --
/
Coordinates --
/
Phase Exploring
/
Model Claude Opus 4.6

Real-Time Thinking

Watch Claude Opus 4.6 think in real-time. Every 500ms the Mac Mini screenshots mGBA, sends it to Claude, and Claude responds with an observation, reasoning, action, and next plan.

Observe
Reason
Act
Plan
FEED
480 x 320
Game feed will appear here
Awaiting screenshot stream connection
Observation
Waiting for data...
Reasoning
--
Action
--
Next Plan
--
BATTLE IN PROGRESS
Wild Battle
Turns: 0
Won: 0
Fled: 0
Whiteouts: 0

Decision Stream

The last 20 actions Claude took. Each entry is one decision cycle — Claude saw the screen, reasoned about it, and pressed a button.

Loading action log...

Key Achievements

Achievements unlocked as Claude progresses through Pokemon FireRed. Tracked via RAM reads on the Mac Mini — locked milestones show what's coming next.

Current Party

Claude's active Pokemon team, read directly from FireRed's RAM in real-time via a Lua script running inside mGBA on the Mac Mini. Species, level, HP, moves — all pulled from memory addresses.

Defeat all 8 gym leaders to reach the Elite Four

Kanto Pokemon

The original 151 Kanto Pokemon. Pokemon Claude has caught or seen are highlighted with their type colors. Click any entry for full PokeAPI data.

In Party: 0 / 6
Species Seen: 0 / 151

Loading...

FireRed Progression

Claude follows a 22-step progression tree through FireRed — from picking a starter in Pallet Town to challenging the Elite Four. Progress auto-updates when RAM confirms each milestone.

Overall Progress 0%

Performance Metrics

Every battle, step, and catch Claude makes is tracked. Stats are read directly from FireRed's RAM by the Lua script and fed to the live dashboard running on the Mac Mini.

Session History

Each session represents a continuous run of the AI agent from startup to shutdown.

SessionDurationTicksBadgesCaughtWhiteouts
Loading sessions...

System Design

The full pipeline running 24/7 on a single Mac Mini: mGBA emulator → Lua RAM reader → Python agent → Claude Opus 4.6 via Anthropic API → pydirectinput keyboard control.

Mac Mini
Runs 24/7 — hosts everything
mGBA Emulator
Pokemon FireRed ROM
Lua Script
Reads RAM every 30 frames
Game State JSON
Party, map, badges, HP
Keyboard Input
pydirectinput to mGBA
Decision Engine
Goals + battle + memory
Claude Opus 4.6
Vision LLM via Anthropic API
Screenshot
480×320 JPEG capture
ChromaDB
Vector memory on Mac Mini
Python Agent
Core orchestrator on Mac Mini
Live Dashboard
Real-time feed
Data Pipeline
AI / Reasoning
Output
Infrastructure

Tech Stack

Mac Mini Python 3.11 Claude Opus 4.6 Anthropic API mGBA Emulator Lua 5.4 ChromaDB pydirectinput mss (screenshots)

FAQ

Everything you need to know about PokeLoop.

What is PokeLoop and how does it work? +
PokeLoop is a fully autonomous AI agent that plays Pokemon FireRed end-to-end on a dedicated Mac Mini. The system operates on a 500ms decision cycle: it captures the mGBA emulator frame, encodes it as a base64 JPEG, pairs it with structured game state extracted from RAM via a custom Lua script, and sends both to Claude Opus 4.6 through the Anthropic API. The model returns a JSON-structured decision — action, reasoning, and confidence — which the input handler executes via DirectInput scan codes. No human touches the keyboard. Ever.
How does the vision pipeline process each frame? +
The screen capture module uses mss to grab the mGBA window at 480x320 resolution, compresses it to JPEG at quality 40 (keeping file size under 50KB), and base64-encodes it. This frame is merged with a structured context payload containing party HP/PP, opponent species and types, current map ID, badge count, inventory, and the active goal from the 22-step progression tree. The combined payload hits the Anthropic multimodal endpoint, and the model reasons over both visual and structured data simultaneously.
What does the Lua RAM reader actually extract? +
The Lua script runs inside mGBA and reads FireRed v1.0 US memory addresses every 30 frames. It decrypts the Gen III Pokemon data structure — handling PID-based substructure reordering (PID % 24 determines the permutation of Growth, Attacks, EVs, and Misc blocks) and XOR decryption using the personality value. It extracts party data, opponent data, battle state flags, map coordinates, trainer name, badge bitmask, and Pokedex counts, then writes everything to game_state.json using an inline JSON encoder (mGBA has no JSON library).
How does the battle engine make combat decisions? +
The battle manager cross-references the opponent's species against a full 18x18 type effectiveness matrix and injects matchup data directly into the prompt. It tracks cursor position in the 2x2 move grid, calculates STAB bonuses, evaluates remaining PP across all four move slots, and monitors HP thresholds. When HP drops below 30%, an interrupt-driven healing system overrides the attack sequence — navigating the bag menu, selecting the right Potion, and executing a multi-tick input sequence. The system also maintains a list of nearby Pokemon Centers for strategic retreats.
What infrastructure runs this 24/7? +
A single Mac Mini. That's it. The mGBA emulator, Python agent process, Lua RAM reader, and screenshot pipeline all run locally. The only external dependency is the Anthropic API for Claude's inference. Game state is persisted to ChromaDB for semantic vector memory (the AI can recall past experiences by similarity search) and to PostgreSQL on Railway for the live dashboard feed. No Kubernetes, no Docker, no load balancers — one machine, one process, running indefinitely.
What's the goal progression system? +
A hardcoded 22-step DAG (directed acyclic graph) defines the optimal route from Professor Oak's lab to the Pokemon League Champion. Each node has completion conditions validated against RAM state — badge bitmask checks, Pokedex flags, map ID comparisons, and party size thresholds. When conditions are met, the planner auto-advances to the next goal and injects updated navigation context into the prompt. The system handles stuck detection with a configurable tick threshold: if no meaningful state change occurs within N ticks, it triggers an exploration override.
Is the dashboard showing real-time data? +
Yes. The dashboard polls the Railway API endpoint every 5 seconds. Every stat, log entry, party member, and badge you see reflects the actual game state from the Mac Mini. The green "Online" indicator confirms the agent is actively running. When the system goes offline, the dashboard freezes on the last known state and switches to a red "Offline" indicator. Historical decision logs, catch events, and battle outcomes are all persisted and queryable.
Where's the source code? +
The full codebase — agent core, Lua RAM reader, battle manager, goal planner, ChromaDB memory, and dashboard — is open source on GitHub under the MIT license. 26 files, ~5,000 lines of code. The memory_reader.py alone is 999 lines containing all 386 species names and 354 move names for Gen III.