Add cogames-watch-replay skill and headless frame capture script#7
Add cogames-watch-replay skill and headless frame capture script#7SolbiatiAlessandro wants to merge 5 commits intoMetta-AI:mainfrom
Conversation
scripts/capture_frames.py: runs an episode headlessly and saves emoji grid snapshots to a text file at regular intervals. Works with any policy (defaults to StarterPolicy, no LLM required). Useful for diagnosing navigation, gear acquisition, and routing without a GUI. .claude/skills/cogames-watch-replay/SKILL.md: Claude skill that invokes the script and guides analysis — extract agent coordinates programmatically, detect stuck agents by movement delta, zoom into blocked areas with a 15x15 subgrid, compare 1/3/8-agent configs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
0454f65 to
46ca0e3
Compare
|
let's ship this? @daveey |
cbb95f7 to
5340aa9
Compare
16e7904 to
a1623f6
Compare
26f2bef to
71ab990
Compare
ec17523 to
87261c8
Compare
faac734 to
ed54be8
Compare
|
The symbol legend (line 119) is hardcoded to 4 agents ( Worth making the legend dynamic: agent_syms = " ".join(
f"{self._map_buffer._symbol_map.get(f'agent{i}', '?')}=agent{i}"
for i in range(self._sim.num_agents)
)
f.write(f"# Symbols: {agent_syms} ⬛=wall · =empty\n\n")Side note: flipping mettagrid from workspace to git-pinned in |
|
Depends on whether |
20578ae to
80a3706
Compare
750885c to
bd5f6be
Compare
What this adds
scripts/capture_frames.py— runs an episode headlessly and saves emoji grid snapshots to a text file at regular intervals. No GUI, no TTY, no interactive input. Works with any policy; defaults toStarterPolicy(no LLM required)..claude/skills/cogames-watch-replay/SKILL.md— a Claude Code skill that invokes the script and guides structured analysis of the output.Why
Watching what the policy is actually doing spatially is the highest-leverage debugging tool — are agents stuck, are they reaching gear stations, are they spreading across the map? The existing unicode renderer requires interactive keyboard input (SPACE to unpause), which makes it unusable by autonomous Claude agents or in CI.
This script hooks into
Rollout.event_handlersdirectly, runs headlessly, and writes a plain text file that Claude (or a human) can read and parse.Real example: StarterPolicy gets stuck after step 50
Running the script on the default
machina_1mission with 4 agents reveals an immediate problem in the starter policy:All 4 agents freeze near their spawn point around step 50 and never move again. This is exactly the kind of spatial insight the script is designed to surface — numbers alone (reward=0) don't tell you why, but the frame sequence makes it unambiguous.
How to use
From Claude Code:
/cogames-watch-replay --steps 500 --every 50What the skill teaches Claude to do
The skill guides structured analysis beyond just reading the grid visually:
🟦🟧🟩🟨symbols, record (row, col) per frame🤖 Generated with Claude Code