Skip to content

Instantly share code, notes, and snippets.

@gubatron
Created February 17, 2026 22:33
Show Gist options
  • Select an option

  • Save gubatron/dc753051aefc344cbb113fdd26cc6bae to your computer and use it in GitHub Desktop.

Select an option

Save gubatron/dc753051aefc344cbb113fdd26cc6bae to your computer and use it in GitHub Desktop.
CloudLLM RALPH Planner powered orchestration with Claude Sonnet 4.6 one shotting a Tetris Game in a single HTML File
MBP14inchDec2024:cloudllm gubatron$ cargo run --example tetris_planner_team
Compiling cloudllm v0.10.6 (/Users/gubatron/workspace/cloudllm)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.35s
Running `target/debug/examples/tetris_planner_team`
╔════════════════════════════════════════════════════════════════╗
║ TETRIS BUILDER — RALPH Orchestration Demo ║
║ Claude Sonnet 4.6 Agent Team ║
╚════════════════════════════════════════════════════════════════╝
📐 ORCHESTRATION SETUP:
Mode: RALPH (Iterative task-based coordination)
Max Iterations: 8
Agents: 4 specialists (researcher, architect, programmer, tester)
Model: Claude Sonnet 4.6
Shared Tools: Memory, file I/O
🎯 PROCESS:
1. Agents read current HTML from Memory
2. Each agent works on assigned task
3. Agent writes updated HTML via write_tetris_file
4. Mark [TASK_COMPLETE:task_id] when done
5. Repeat until all 4 tasks complete
📊 TASKS:
1. board_engine — Board state, pieces (SRS), canvas shell
2. gameplay_loop — Game loop, gravity, input, scoring, hold
3. rendering_ui — Draw board, ghost, next/hold panels, legend
4. polish_audio — Web Audio effects, mute toggle, start screen
═══════════════════════════════════════════════════════════════
🗑️ Cleared previous output: /Users/gubatron/workspace/cloudllm/tetris_planner_output.html
📄 Fresh game shell written at /Users/gubatron/workspace/cloudllm/tetris_planner_output.html (1010 bytes)
📋 Registering tool protocols...
├─ Memory protocol (GET/PUT/LIST for shared state)
├─ Custom protocol (read_file, write_tetris_file)
└─ Done: 3 tools available
🔍 TOOL DESCRIPTIONS (exactly as agents will see them):
══════════════════════════════════════════════════════════════════════
[1] memory — Shared key-value store for agent coordination. Pass a 'command' string. Supported commands:
Parameters:
• command (string) [REQUIRED]
Command string: 'G key', 'P key value [ttl]', 'L', 'D key', 'C'. Full-word aliases (GET/PUT/LIST/DELETE/CLEAR) also accepted.
• key (string)
Key for GET/PUT/DELETE when using split-parameter style instead of embedding the key in the command string.
• value (string)
Value for PUT when using split-parameter style. Must be a single token (no spaces). Use write_tetris_file for HTML content.
Full description:
READ a value:
{"command": "G mykey"} — get key 'mykey'
{"command": "GET", "key": "mykey"} — same, split-param style
WRITE a value (small values only; for large content use write_tetris_file):
{"command": "P mykey myvalue"} — put without TTL
{"command": "P", "key": "mykey", "value": "val"} — same, split-param style
{"command": "P mykey myvalue 3600"} — put with 1-hour TTL
LIST all keys:
{"command": "L"} — list keys
{"command": "LIST"} — same
DELETE a key:
{"command": "D mykey"} — delete key
{"command": "DELETE", "key": "mykey"} — same
CLEAR everything:
{"command": "C"} or {"command": "CLEAR"}
NOTE: PUT stores values as a single token — use write_tetris_file to persist HTML.
[2] write_tetris_file — Write the COMPLETE Tetris HTML/CSS/JS bundle to disk AND memory (CRITICAL: must include full document)
Parameters:
• path (string)
Output path (defaults to tetris_planner_output.html if not specified)
• content (string) [REQUIRED]
Complete, valid HTML document including DOCTYPE, html, head (with style), body (with canvas and script)
[3] read_file — Read a UTF-8 text file from disk (returns content)
Parameters:
• path (string) [REQUIRED]
Absolute or relative file path to read
══════════════════════════════════════════════════════════════════════
Starting RALPH orchestration with 4 agents and 4 PRD tasks...
[00:00] [orch] 🚀 Run started: RALPH Tetris Build [Ralph, 4 agents]
[00:00] [agent] 📝 Gameplay Researcher system prompt set
[00:00] [agent] 📝 Gameplay Programmer system prompt set
[00:00] [agent] 📝 QA & Polish system prompt set
[00:00] [agent] 📝 System Architect system prompt set
[00:00] [orch] 🔄 RALPH iteration 1/8 (0/4 tasks done)
[00:00] [orch] ── Round 1 ──
[00:00] [agent] ▶ Gameplay Researcher starting turn: === RALPH Iteration 1/8 ===
## Original Request
Build a fully playable Tetris game as a single HTML...
[00:00] [agent] ├─ Gameplay Researcher LLM call #1 started
[01:39] [agent] ├─ Gameplay Researcher LLM call #1 done (24736 chars, 11384 tokens)
[01:39] [agent] ✓ Gameplay Researcher completed (24736 chars, 11384 tokens, 0 tool calls)
[01:39] [orch] Gameplay Researcher responded (24736 chars, 11384 tokens)
[01:39] [orch] ✅ Gameplay Researcher completed: board_engine, gameplay_loop, rendering_ui, polish_audio → 4/4
[01:39] [agent] ▶ System Architect starting turn: === RALPH Iteration 1/8 ===
## Original Request
Build a fully playable Tetris game as a single HTML...
[01:39] [agent] 📨 System Architect received routed message
[01:39] [agent] ├─ System Architect LLM call #1 started
[01:40] [agent] ├─ System Architect LLM call #1 done (85 chars, 11420 tokens)
[01:40] [agent] ├─ System Architect tool call #1: memory({"command":"G tetris_current_html"})
[01:40] [agent] ├─ ✅ System Architect tool 'memory' succeeded [iter #1]
[01:40] [agent] ├─ System Architect LLM call #2 started
[03:22] [agent] ├─ System Architect LLM call #2 done (25075 chars, 32852 tokens)
[03:22] [agent] ✓ System Architect completed (25075 chars, 32852 tokens, 1 tool calls)
[03:22] [orch] System Architect responded (25075 chars, 32852 tokens)
[03:22] [orch] ✅ System Architect completed: board_engine, gameplay_loop, rendering_ui, polish_audio → 4/4
[03:22] [agent] 📨 Gameplay Programmer received routed message
[03:22] [agent] 📨 Gameplay Programmer received routed message
[03:22] [agent] ▶ Gameplay Programmer starting turn: === RALPH Iteration 1/8 ===
## Original Request
Build a fully playable Tetris game as a single HTML...
[03:22] [agent] ├─ Gameplay Programmer LLM call #1 started
[05:00] [agent] ├─ Gameplay Programmer LLM call #1 done (21574 chars, 29301 tokens)
[05:00] [agent] ✓ Gameplay Programmer completed (21574 chars, 29301 tokens, 0 tool calls)
[05:00] [orch] Gameplay Programmer responded (21574 chars, 29301 tokens)
[05:00] [orch] ✅ Gameplay Programmer completed: board_engine, gameplay_loop, rendering_ui, polish_audio → 4/4
[05:00] [agent] 📨 QA & Polish received routed message
[05:00] [agent] 📨 QA & Polish received routed message
[05:00] [agent] 📨 QA & Polish received routed message
[05:00] [agent] ▶ QA & Polish starting turn: === RALPH Iteration 1/8 ===
## Original Request
Build a fully playable Tetris game as a single HTML...
[05:00] [agent] ├─ QA & Polish LLM call #1 started
[05:02] [agent] ├─ QA & Polish LLM call #1 done (85 chars, 29344 tokens)
[05:02] [agent] ├─ QA & Polish tool call #1: memory({"command":"G tetris_current_html"})
[05:02] [agent] ├─ ✅ QA & Polish tool 'memory' succeeded [iter #1]
[05:02] [agent] ├─ QA & Polish LLM call #2 started
[06:46] [agent] ├─ QA & Polish LLM call #2 done (24604 chars, 68201 tokens)
[06:46] [agent] ✓ QA & Polish completed (24604 chars, 68201 tokens, 1 tool calls)
[06:46] [orch] QA & Polish responded (24604 chars, 68201 tokens)
[06:46] [orch] ✅ QA & Polish completed: board_engine, gameplay_loop, rendering_ui, polish_audio → 4/4
[06:46] [orch] ── Round 1 complete ──
[06:46] [orch] ✅ Run finished: 1 iterations, 141738 tokens, complete=true
╔════════════════════════════════════════════════════════════════╗
║ RALPH RUN SUMMARY ║
╚════════════════════════════════════════════════════════════════╝
📊 RESULTS:
Iterations Executed : 1
Task Completion Rate : 100% (4.0/4 tasks)
Total Tokens Used : 141738
Elapsed Time : 6m 46s
Status : ✅ COMPLETE
📝 AGENT ACTIVITY:
✓ Gameplay Researcher (tetris-researcher)
✓ System Architect (tetris-architect)
✓ Gameplay Programmer (tetris-programmer)
✓ QA & Polish (tetris-playtester)
📋 DETAILED TURNS:
[01] iter=1 agent=Gameplay Researcher completed=board_engine,gameplay_loop,rendering_ui,polish_audio
[02] iter=1 agent=System Architect completed=board_engine,gameplay_loop,rendering_ui,polish_audio
[03] iter=1 agent=Gameplay Programmer completed=board_engine,gameplay_loop,rendering_ui,polish_audio
[04] iter=1 agent=QA & Polish completed=board_engine,gameplay_loop,rendering_ui,polish_audio
💾 FILE STATUS:
⚠️ write_tetris_file was NOT called — scanning response text for HTML...
🔧 Extracted HTML from response text (rescue mode)
856 lines, game_loop=true, pieces=true
✅ Written 23965 bytes to /Users/gubatron/workspace/cloudllm/tetris_planner_output.html
🎮 NEXT STEPS:
✅ Open /Users/gubatron/workspace/cloudllm/tetris_planner_output.html in a web browser
(Rescued from response text — tool flow did not work as intended)
@gubatron
Copy link
Author

Screenshot 2026-02-17 at 10 12 33 PM Screenshot 2026-02-17 at 10 12 41 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment