Play chess in your terminal while waiting for AI responses
A terminal-based chess game designed to run while you're waiting for AI coding agents (like OpenCode/Crush, Claude Code, etc.) to process your prompts. Turn dead wait time into productive chess practice!
chess-demo-1080p.mp4
- Two Game Modes: Classic (no timer) and Blitz (timed games)
- Built-in AI Opponent: Play as White against an approximately 1000 Elo engine
- Theme Matching: Dark, light, and classic themes that match your terminal
- Game Persistence: Games are automatically saved and restored between sessions
- Vim Motions: Intuitive arrow key navigation
- Blitz Timer: Configurable time controls with turn-based countdown
- Move Undo: Oops? Just press 'U' to undo
# Clone or download this directory, then:
cd /path/to/prompt-chess
npm install
# Run interactive setup (writes config + wrapper)
./bin/setup-opencode-overlay
# Launch OpenCode with overlay wiring
./bin/opencode-with-chessThe setup wizard supports:
--check(diagnostics only; no writes)--yes(accept defaults)--scope repo|global(plugin config scope)
Optional alias (so opencode always uses the wrapper from this repo):
# zsh/bash
alias opencode='/path/to/prompt-chess/bin/opencode-with-chess'Add the alias to your ~/.zshrc or ~/.bashrc if you want it to persist.
cd prompt-chess
npm install
npm start# Classic mode (default)
prompt-chess
# 5-minute blitz
prompt-chess --mode blitz
# 3-minute blitz
prompt-chess -m blitz --time 3
# Light theme
prompt-chess --theme light
# Two-player local game (disable AI)
prompt-chess --opponent human
# All options
prompt-chess -m blitz -t dark -T 10 -o ai
# Overlay preset (for popup sessions)
prompt-chess --overlay| Option | Short | Description | Default |
|---|---|---|---|
--mode |
-m |
Game mode: classic or blitz |
classic |
--theme |
-t |
Theme: dark, light, or classic |
dark |
--time |
-T |
Blitz time in minutes | 5 |
--opponent |
-o |
Opponent: ai or human |
ai |
--overlay |
- | Overlay preset (blitz, 1 min, AI) |
off |
--help |
-h |
Show help | - |
| Key | Action |
|---|---|
↑↓←→ |
Move cursor |
Enter |
Select piece / Make move |
Escape |
Cancel selection |
U |
Undo last move |
N |
Start new game |
Q |
Quit |
prompt-chess now includes a companion OpenCode plugin package that opens chess in a tmux popup while OpenCode is actively working and closes it when OpenCode goes idle.
Requirements:
- OpenCode running inside
tmux tmuxavailable inPATH- Node.js 18+
Quick setup:
cd /path/to/prompt-chess
npm install
./bin/setup-opencode-overlay
./bin/opencode-with-chessManual check mode:
./bin/setup-opencode-overlay --checkPath handling:
- Uses
XDG_CONFIG_HOME/XDG_CACHE_HOMEwhen set. - Falls back to
~/.configand~/.cacheon macOS/Linux. - Falls back to temp directories if config/cache roots are not writable.
- Avoids hardcoded user paths by resolving repo and binaries dynamically.
Optional config file (~/.config/prompt-chess-opencode/config.json):
{
"enabledByDefault": true,
"repoAllowlist": [],
"repoDenylist": []
}Rule order:
- If repo matches
repoDenylist: disabled - Else if
repoAllowlistis non-empty: only allowlisted repos enabled - Else
enabledByDefaultapplies
If OpenCode is not running in tmux, the plugin exits safely and does not open overlays.
Implementation notes for setup internals are in tooling/ABOUT.md.
This repo includes a minimal shell.nix for reproducible development:
nix-shell
./bin/setup-opencode-overlay --checkWhen Nix is detected, setup guidance prefers Nix-native commands first.
If you prefer manual sidecar workflows:
Add to your .bashrc, .zshrc, or .fishrc:
# Start chess when running crush
crush-with-chess() {
# Open chess in a split tmux pane or new terminal
tmux split-window -h "prompt-chess"
crush "$@"
}Simply open a second terminal/pane and run:
prompt-chess -m blitz -T 3Then continue using Crush in your main terminal.
Create a wrapper that launches both:
#!/bin/bash
# save as ~/bin/ai-with-chess
# Start chess in background terminal
alacritty -e prompt-chess -m blitz -T 5 &
# Run the AI agent
crush "$@"For editors with integrated terminals:
- Open integrated terminal
- Split the terminal
- Run
prompt-chessin one pane - Work in the other
Default terminal-friendly dark theme with subtle square colors.
Clean light theme with beige/cream squares.
Traditional black & white for that classic chess look.
Games are automatically saved to ~/.prompt-chess/game-state.json after every move. If you quit and restart, your game will be restored!
prompt-chess/
├── index.js # Main CLI entrypoint
├── bin/setup-opencode-overlay # interactive setup wizard
├── bin/opencode-with-chess # OpenCode launcher wrapper
├── bin/prompt-chess-overlay # tmux popup controller
├── tooling/ # setup/path detection utilities
├── opencode-plugin-prompt-chess-overlay/ # OpenCode plugin package
├── shell.nix # minimal Nix dev shell
├── package.json # Dependencies and metadata
└── README.md # This file
- React: UI components and state management
- Ink: React-based terminal UI framework
- chess.js: Chess engine (move validation, game state)
- Chalk: Terminal colors and styling
- Strong AI levels (Stockfish integration)
- PGN export/import
- Opening book hints
- Move history display
- Multiple concurrent games
- Network multiplayer
- Better integration hooks (if Crush adds plugin API)
MIT