feat: add Baba Is AI demo — knowing-doing gap in spatial puzzles#38
Conversation
Ollama config with qwen2.5:7b defaults and YAML template documenting the prompt context for the llm:choose-based action selection.
…egration Complete Baba Is You puzzle demo with 3 levels of increasing difficulty: - Level 1: Navigate (baseline path-finding) - Level 2: Break the Wall (push STOP word-block to disable wall rule) - Level 3: Push and Rearrange (rocks + walls + spatial reasoning) Includes ABM rule engine that scans horizontal/vertical word-block 3-tuples, recursive push chain system, text observation builder for LLM, and win/defeat detection. Uses llm:choose for constrained action selection with accumulating history.
Covers the BALROG knowing-doing gap experiment context, setup prerequisites, 3 level descriptions with expected results, provider swapping instructions, and extension points.
…ules - Add llm:set-history system message in setup so the LLM knows game mechanics (push word-blocks, break rules, reach the flag) - Remove llm:clear-history from go loop so the agent remembers past moves and learns from failures - Move BABA IS YOU and FLAG IS WIN to row 8 (top edge) across all levels so the agent never accidentally pushes permanent rules - Improve observation builder with directional hints, fixed-width grid map, loop detection, and explicit blocked-move feedback
- Rewrite system prompt with explicit push mechanics and priority (break STOP first, then head to flag) - Observation now shows exact STOP block coordinates when WALL IS STOP is active - Extend wall columns to y=0-7 in levels 2 and 3 so agent cannot navigate around walls — must break the rule - Cap history to system msg + last 10 exchanges to avoid token bloat - Handle rate limit errors with 2s wait and retry on next tick
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9dd2168a6a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| create-word-block-at 0 5 "ROCK" "noun" | ||
| create-word-block-at 1 5 "IS" "verb" | ||
| create-word-block-at 2 5 "PUSH" "property" |
There was a problem hiding this comment.
Prevent level 3 from becoming a straight-line solve
With these coordinates, the baba starts directly above the ROCK noun. Moving down twice breaks ROCK IS PUSH, and two more down moves push ROCK onto the IS STOP row, creating ROCK IS STOP and disabling WALL IS STOP. From there the wall column is passable and the player can walk straight to the flag without interacting with the rocks at (3,2) / (3,3) or solving the intended rearrangement puzzle, so the advertised hard level no longer tests the behavior described in the model.
Useful? React with 👍 / 👎.
| let action llm:choose obs ["up" "down" "left" "right"] | ||
| set last-action action | ||
| set total-moves total-moves + 1 | ||
| set move-history lput action move-history |
There was a problem hiding this comment.
Handle malformed
llm:choose replies as failed turns
If the provider returns anything other than an exact option (for example right. or a brief explanation), llm:choose throws before total-moves or move-history are updated, and the error handler only logs the failure. In that scenario the forever go loop keeps resubmitting the same state indefinitely and never reaches max-moves, so a single non-conforming model response can wedge the demo while still burning LLM calls.
Useful? React with 👍 / 👎.
Summary
Key Features
llm:choosewith constrained choices["up", "down", "left", "right"]Test Plan