Skip to content

About

A hacking-minigame to interfere with your agent's productivity

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

clod-coder

doc/screenshot.png

Overview

clod-coder is a hackertyper-style TUI game that hooks into Claude Code. When Claude uses tools (Bash, Write, Edit), the tool content appears in the game as text you have to “type out” before Claude can continue.

Designed to run in cool-retro-term for maximum aesthetic.

How It Works

  1. The game listens on a Unix socket ($XDG_RUNTIME_DIR/clod-coder.sock) and TCP (127.0.0.1:31337)
  2. The clod-coder hook subcommand intercepts Claude Code tool calls and sends them to the game
  3. The game presents the tool content as a typing challenge
  4. The hook blocks until you complete the task, then Claude continues

If the game isn’t running, hooks pass through silently — Claude works normally.

Game Modes

  • leet (default) — hackertyper style, any key advances N characters
  • predictive — you must type the exact next character, with a preview window ahead
  • blanks — some characters are hidden and must be typed correctly; visible ones auto-advance

Building

# Build the game binary
make game

# Or build everything (including cool-retro-term)
make

# Install to ~/.local/bin
make install PREFIX=~/.local

Dependencies

  • Go 1.21+
  • mpv (recommended, for music playback and audio-reactive visualizer)
  • ffplay (fallback audio player, no visualizer reactivity)
  • Qt5 dev packages (only if building cool-retro-term)

Setup

On first launch, clod-coder shows an onboarding screen that checks prerequisites and can install the Claude Code hook automatically.

Or install the hook manually by adding a PreToolUse hook to ~/.claude/settings.json that runs clod-coder hook. The hook is a subcommand of the main binary and intercepts Bash, Write, and Edit tool calls.

Settings (mode, keys, volume, music, CRT profile, etc.) are persisted to ~/.config/clod-coder/config.json and restored on next launch. CLI flags override saved values.

Usage

# Start the game
./clod-coder

# With options
./clod-coder -mode predictive -speed 1l -keys vim -music

In another terminal, run Claude Code as normal. Tool calls will appear in the game.

CLI Flags

FlagDefaultDescription
-modeleetGame mode: leet, predictive, blanks
-speed3cSpeed: Nc (chars), Nw (words), Nl (lines)
-blanks30Blank percentage for blanks mode
-timer0Seconds per task (0=off)
-keyscuaKeybinding scheme: cua, vim, emacs
-no-effectsfalseDisable visual effects
-no-soundfalseDisable sound
-musicfalseStart background music
-music-dirmusicDirectory containing music files
-volume80Music volume (0-100)
-audio-device(auto)Audio output device
-profileMonochrome Greencool-retro-term profile
-socket(auto)Unix socket path

In-Game

  • Press / to enter command mode
  • Press F2 to open the config view (also /config)
  • Press F1 to pause

Slash Commands

CommandDescription
/mode <name>Switch game mode
/timer <secs>Set task timer
/effectsToggle visual effects
/musicToggle background music
/skipSkip current task
/statsToggle stats display
/configOpen config view
/filterManage task filters
/helpShow available commands
/quitQuit

Keybindings

Three preset schemes are available via -keys flag or the config view:

CUA (default)

Standard keybindings. Arrow keys for navigation, Esc to cancel, Enter to confirm.

Vim

ActionKeys
Navigateh/j/k/l, arrows
Command/ or :
CancelEsc, Ctrl+[
QuitCtrl+C, Ctrl+Q

Emacs

ActionKeys
NavigateC-b/C-n/C-p/C-f, arrows
CommandM-x or /
CancelC-g, Esc
QuitC-c, C-q

Custom Overrides

Create ~/.config/clod-coder/keys.json to override individual bindings on top of any preset:

{
  "quit": ["ctrl+c", "ctrl+q", "ctrl+x ctrl+c"],
  "up": ["k", "up", "ctrl+p"],
  "open_command": ["/", ":", "alt+x"]
}

Available actions: quit, pause, open_config, open_command, up, down, left, right, confirm, cancel.

Key names match bubbletea’s KeyMsg.String() output.

Audio Visualizer

When music is playing, an audio-reactive visualizer displays at the bottom of the screen. During active tasks it renders as a single-line bar so it doesn’t compete with text. On the idle screen it expands to a multi-line display alongside the matrix rain.

With mpv, the visualizer reads real audio levels via mpv’s JSON IPC protocol (using the lavfi astats filter). RMS and peak levels drive the bar heights with a bell-curve spectral distribution across the bars.

If mpv IPC is unavailable (e.g. using ffplay), the visualizer falls back to simulated random animation.

Architecture

Claude Code ──hook──> Unix Socket / TCP ──> Task Queue ──> Game UI
                      (clod-coder hook)       (FIFO)      (bubbletea)
                            │                                  │
                            └──── blocks until ────────────────┘
                                  task.Complete()
PackagePurpose
cmd/clod-coderEntry point (multicall: game + hook)
internal/hookHook logic (clod-coder hook subcommand)
internal/gameBubbletea model, views, key handling
internal/modesTyping mode implementations
internal/effectsMatrix rain, timer, audio, visualizer
internal/keysKeybinding presets and customization
internal/configCLI flags, config persistence, setup
internal/serverUnix socket + TCP server
internal/queueFIFO task queue
music/Bundled music tracks (embed with -tags bundle)

About

A hacking-minigame to interfere with your agent's productivity

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages