ghost/chess

Square Chess (F-Droid): start a game (side, engine level 1-9), play moves like e2e4 one at a time or as a list, read the position (placement, status, opening, move list), take back a move or resign. Offline engine, no account.

Proven 25× fewer tokens Score 38/100 Official hard skill python

Token savings

96% fewer tokens
Tokenswithout739,454with29,666 (96% fewer)
Timewithout57.5 swith131 s (128% more time)
Tool callswithout18with4 (78% fewer)

Agent run: finished without the skill, finished with it (not independently checked).

One recorded run each way, claude-haiku-5-5, same phone and same prompt. Watch it in the Before / after tab.

Recorded: new_game · live agent session on a real phone

Control Square Chess on Android with an AI agent — play chess against the computer

Control Square Chess on Android with an AI agent. Play chess against the computer on your phone: an agent starts a game, plays moves like e2e4, reads the position and the engine's replies, takes back or resigns.

Target search phrase: AI agent plays chess on Android

Demo shows: new_game (side=white, level=3)

Ghost in the Droid seed skill for Square Chess (com.dataespresso.squarechess), an offline chess game against a built-in engine from F-Droid (DroidFish was blocked by Google Play Protect on the test phone, so this skill uses Square Chess). Offline, no account.

ActionWhat it doesParams
new_gameStart a game against the computer (white/black, level 1-9)side, level
make_movePlay one UCI move (e2e4, e7e8q to promote) and wait for the replymove
make_movesPlay several of your moves in a rowmoves
undo_moveTake back your last movenone
resignResign the running gamenone
get_boardRead FEN placement, status, opening, SAN moves, last movenone

Toolkit

An agent can drive the whole app with these; compose them.

RoleAction
Entrynew_game
Primitivesmake_move, make_moves, undo_move, resign
Read stateget_board

Install

The app: F-Droid, or https://f-droid.org/packages/com.dataespresso.squarechess/. The skill:

pip install "ghost-in-the-droid>=1.6.0"   # 1.6.0 is not on PyPI yet: until it ships, git clone the repo and `pip install -e .`
ghost skill install ghost/chess

Use

ghost skill run ghost/chess new_game --param side=white --device <serial>
ghost skill run ghost/chess make_moves --param moves=e2e4,g1f3,f1c4 --device <serial>
run_skill(name="ghost/chess", action="get_board")
# {"board": {"placement": "rnbqkb1r/pppppppp/5n2/8/4P3/8/PPPP1PPP/RNBQKBNR", "status": "Your move", "opening": "B02 Alekhine Defense", "moves": ["e4", "Nf6"], "last_move": "Nf6"}}

Try asking: "Start a chess game as white and play the Italian opening: e2e4, g1f3, f1c4."

Tested on

Real Samsung phone, Android 13 (720x1600, 300 dpi, en-GB), Square Chess 1.4.1. License: MIT.

Known failure modes and versions tested

Versions tested

App versionAndroidDeviceSkill versionDates
1.4.113Samsung real phone (720x1600, 300 dpi, en-GB)1.0.02026-11-02

Recorded failures

  • The computer's reply varies between runs: assert the move list grew and the position changed, never a specific reply.
  • The accessibility tree can lag (62 of 64 squares) right after a tap or a new game: the helpers poll until all 64 are present.
  • Reopening the app can leave a menu or resign dialog on top: the board subroutine closes it (Back to board / Keep playing).
  • FEN has only the piece placement and the side to move (castling and en passant rights are not shown by the app).
  • The SAN move list is only readable inside Menu > Move list: make_move and get_board open and close it (about 6 s extra).
  • Take back asks for a confirmation ("Take back the last turn?"); against the computer both plies are removed.
  • Needs the Portal build shipped with this repo; older Portal builds drop the legal-target squares while a piece is selected and moves fail.
  • Portal reads take 0.5-0.9 s (plain uiautomator took 3.3 s), so actions take 10-35 s.

Popups and first-run screens handled

  • None at first launch; the menu and resign dialogs are closed by the helpers.

Try a sample prompt or run an action by name. Replace any parameters in braces with your own values.

new_game

Play demo

Try asking

  • Start a chess game as white
  • play chess against the computer
  • new chess game as black, level 5
  • start an easy chess game
ghost skill run ghost/chess new_game

make_move

Play demo

Try asking

  • Play e2e4 in chess
  • move the knight to f3
  • play d2d4
  • advance the king pawn two squares
ghost skill run ghost/chess make_move

make_moves

Play demo

Try asking

  • Play the Italian opening in chess: e2e4, g1f3, f1c4
  • play e4, Nf3 and Bc4 for me
  • open with d4 then c4
ghost skill run ghost/chess make_moves

undo_move

Play demo

Try asking

  • Take back my last chess move
  • undo that chess move
ghost skill run ghost/chess undo_move

resign

Play demo

Try asking

  • Resign the chess game
  • I give up
  • resign this game
ghost skill run ghost/chess resign

get_board

Play demo

Try asking

  • What is the chess position?
  • what did the computer just play
  • show me the board
  • which opening is this
ghost skill run ghost/chess get_board