Skip to content

LilMGenius/AFK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AFK β€” Eyes & Hands for AI Agents

You go AFK. AI opens its eyes, grabs your mouse.

License: MIT Works with Cursor Works with Claude Code Works with Codex


100 lines of code. Everything else is Markdown. AFK gives any CLI agent eyes to see and hands to control web games β€” autonomously.

What Is AFK?

AFK is not a bot. It's a skill layer for your existing AI CLI agent.

  • Eye β€” reads game state from the DOM (no screenshots needed)
  • Hand β€” controls the game via keyboard/mouse events
  • Brain β€” that's your CLI: Cursor, Claude Code, or Codex

You don't build a new AI. You give your existing AI agent a new pair of eyes and hands.

graph TB
    subgraph Brain["🧠 Your CLI Agent (= Brain)"]
        direction LR
        Eye["πŸ‘ Eye\nDOM / CDP"]
        Hand["βœ‹ Hand\nkeys / clicks"]
        GAME["πŸ“„ GAME.md\nstrategy cache"]
    end
    Browser["🌐 Web Game"]
    Eye -->|read state| Browser
    Hand -->|key / click| Browser
Loading

Quick Start

0) Start Chrome on 9222 (required)

# Chrome 136+: --remote-debugging-port must be used with --user-data-dir

# Windows (PowerShell)
$chrome=(Get-Command chrome.exe -ErrorAction SilentlyContinue).Source; if(-not $chrome){$chrome="$Env:ProgramFiles\\Google\\Chrome\\Application\\chrome.exe"}; & $chrome --remote-debugging-port=9222 --user-data-dir="$Env:TEMP\\afk-chrome-profile"

# macOS (zsh/bash)
CHROME_BIN="$(command -v google-chrome || command -v chromium || echo '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome')"; "$CHROME_BIN" --remote-debugging-port=9222 --user-data-dir="${TMPDIR:-/tmp}/afk-chrome-profile"

# Linux (bash)
CHROME_BIN="$(command -v google-chrome || command -v chromium || command -v chromium-browser || command -v chrome)"; "$CHROME_BIN" --remote-debugging-port=9222 --user-data-dir=/tmp/afk-chrome-profile

If CHROME_BIN is empty, install Chrome/Chromium or set the absolute browser path manually.

Then verify: open http://localhost:9222/json/version and confirm JSON is returned.

Cursor

# .cursor/rules/afk.mdc is auto-loaded
# Just tell Cursor:
"2048 λŒ€μ‹  ν”Œλ ˆμ΄ν•΄μ€˜"
"play minesweeper for me"
"afk:play 2048"

Claude Code

# SKILL.md and CLAUDE.md are auto-loaded
claude "afk:play 2048"
claude "afk:coach minesweeper"

Codex / OpenCode

# AGENTS.md is auto-loaded
opencode "afk:play 2048"

Two Modes

Play (afk:play <game>) β€” AI reads the board, decides the move, presses the key. Repeats.

Coach (afk:coach <game>) β€” AI reads the board, suggests the best move. You play.

Supported Games

Game URL Status
2048 play2048.co βœ… Ready
Minesweeper minesweeperonline.com βœ… Ready
Any web game your URL πŸ”„ Auto-discover

Auto-discovery: Point AFK at any web game. It reads the DOM, searches for a strategy guide, creates a GAME.md, and starts playing. No code changes needed.

Chrome Extension (Optional)

For visual overlay (Play badge + Coach panel):

node server.js  # WebSocket bridge on ws://localhost:38377
# chrome://extensions β†’ Load unpacked β†’ select chrome-extension/

Why AFK?

Traditional Approach AFK
Build your own Brain CLI is the Brain
Build your own web search CLI has web search built-in
Build your own planner CLI plans natively
~700 lines of architecture ~100 lines + Markdown
One game hardcoded Any game via GAME.md

10Γ— simpler. 10Γ— faster to build. Same result.

Contributing

The best contribution is a new GAME.md.

cp games/_template.md games/your-game.md
# fill in strategy + DOM selectors + Eye/Hand scripts
# submit a PR β€” your GAME.md becomes a plugin for everyone

Every GAME.md is a plugin. The more games the community adds, the smarter AFK gets.

Roadmap

  • MVP (now): Web games via DOM + CDP. Cursor / Claude Code / Codex.
  • Phase 1: Community GAME.md ecosystem. npm package.
  • Phase 2: Desktop games via screen capture (OpenCV).
  • Phase 3: Distributed GAME.md β€” agents share learned strategies.

Built at Eureka Cursor Seoul Hackathon 2026

"You go AFK. AI opens its eyes, grabs your mouse."

About

Eyes & Hands for AI Agents. πŸ‘€πŸ¦Ύ You go AFK. AI opens its eyes, grabs your mouse.

Topics

Resources

License

Stars

Watchers

Forks

Contributors