Skip to content
Pi · claude-opus-4-5featureCLI & tooling5 files · +974 −234

Build a Tetris extension for a terminal arcade (TypeScript, Pi)

Session from pi-extensions-sessions on Hugging Face by thomasmustier · MIT · condensed by Coders Talk

37msession
2interventions
GOAL

Round out an existing terminal arcade (snake, space invaders, ping) by adding a Tetris extension for the Pi coding agent, install it, and get it working properly.

  1. Prompt · +0
    We have /snake, /space-invaders, /ping. What are we missing? Probably tetris.
  2. Agent did · +0m
    Investigated existing extensions (ping.ts pattern), wrote tetris.ts (677 lines) with tetrominoes, ghost piece, hold, DAS, updated README and long-task-harness feature tracking, committed alongside an already-uncommitted pacman.ts.
  3. Prompt · +3m
    Can you install it for me
  4. Agent did · +3m
    Updated ~/.pi/agent/settings.json to register the tetris extension, noted snake was already installed elsewhere.
  5. Intervention · +4m
    Reported the blocks couldn't be controlled and asked the agent to plan its approach before fixing.
    Why: I couldn't move any pieces so I wanted the agent to actually diagnose the input handling rather than guess.
  6. Agent did · +4m
    Compared against ping.ts and found tetris.ts used the wrong method name (onKey instead of handleInput) and an unsupported onKeyUp; rewrote input handling and committed the fix.
  7. Intervention · +10m
    Asked for movement to be one cell per keypress instead of the DAS auto-repeat behaviour.
    Why: DAS didn't make sense without key-release detection, so I wanted plain single-step movement instead.
  8. Agent did · +10m
    Removed DAS/auto-repeat state and logic, made each keypress move one cell, committed the change.
  9. Fail · +20m
    Hitting space caused instant game over, and without it pieces never reached the bottom - traced to isValidPosition rejecting pieces spawning above row 0.
  10. Outcome · +37m
    Tetris finalized, committed and pushed 10 commits to origin/main; progress/feature tracking files updated in a follow-up commit; agent confirmed long-task-harness hooks were already installed.
VERDICT

Next time I'd ask the agent to check the existing games' input-handling pattern (handleInput vs onKey) before writing a new extension from scratch, since that mismatch caused the controls to be broken initially. Telling it to 'plan your approach' before fixing the input bug was what got it to actually diff against ping.ts instead of guessing, and that's what found both the method name bug and the DAS/spawn-zone issues quickly.

I tried this · 0

Discussion · 0

How Builds work