debug-agent
Skill2 starsChanged 6 months agoMITView on GitHub
Step through a simulation agent replay to find where and why it failed — timeout, invalid move, crash, or strategic collapse. Use when the user says "debug the agent", "why did it lose", "find the failing turn", "analyze the replay", or after a regression in local eval.
We split this skill into the rules it gives an agent
5 rules. 0 are common, 2 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 7 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 35
Run this snippet (adapt replay_path and player index):
- Distinctive: line 98
Write a structured diagnosis:
- Distinctive: line 114
Don't guess the root cause without reading the replay.
- Very specific: line 115
Don't fix and re-run without writing down what you expect the fix to achieve (log-experiment first).
- Very specific: line 116
Don't discard replays after debugging — keep them in replays/ as regression anchors.
“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Debug Agent — Replay Forensics
Turns a raw replay JSON into a structured diagnosis: which turn failed, what state the agent saw, what it returned, and why.
When to use
- Local eval showed a loss, crash, or invalid move.
- A submission scored worse than expected; you have a replay to examine.
- An agent works in 1v1 but fails in FFA (or vice versa).
- A specific seed consistently loses; others are fine.
Steps
1. Locate the replay
ls competitions/<slug>/replays/
# pick the most recent or the one from the failing seedReplays are JSON produced by kaggle-environments. Structure:
{
"steps": [ [ { "observation": {...}, "action": ..., "status": "ACTIVE|DONE|ERROR|INVALID" } ] ]
}2. Parse and summarize the replay
Run this snippet (adapt replay_path and player index):
import json
from pathlib import Path
replay = json.loads(Path("competitions/<slug>/replays/<file>.json").read_text())
steps = replay["steps"]
n_players = len(steps[0])
print(f"Total turns: {len(steps)} | Players: {n_players}")
for t, step in enumerate(steps):
for p, agent_step in enumerate(step):
status = agent_step.get("status", "?")
action = agent_step.get("action")
if status in ("ERROR", "INVALID", "DONE"):
print(f" turn {t:3d} player {p} status={status} action={action!r}")3. Diagnose by status code
| Status | Meaning | First thing to check |
ERROR | Agent raised an exception | Print agent_step["info"] for traceback; reproduce locally with debug=True |
INVALID | Agent returned an illegal action | Print the observation at that turn; check action space bounds |
TIMEOUT | Agent exceeded per-turn time budget | Instrument the slow function; check O(N²) loops or unnecessary recomputation |
DONE (early) | Agent lost — game ended before max turns | Check score/fleet at losing turn; is it a bleed or a sudden collapse? |
4. Inspect the failing turn in detail
t_fail = <turn number from step 3>
p_fail = <player index>
step = steps[t_fail][p_fail]
obs = step["observation"]
action = step["action"]
status = step["status"]
info = step.get("info", {})
print(f"Turn {t_fail} | Player {p_fail} | Status: {status}")
print(f"Action returned: {action!r}")
print(f"Info / error: {info}")
print(f"Observation keys: {list(obs.keys())}")
# Drill into the specific obs fields your agent uses5. Reproduce locally with debug=True
from kaggle_environments import make
env = make("<slug>", debug=True)
env.run(["competitions/<slug>/agents/<version>/agent.py",
"competitions/<slug>/agents/baseline/agent.py"])
# Print per-step debug output
for i, step in enumerate(env.steps):
print(f"turn {i}", step)6. Report findings
Write a structured diagnosis:
Debug report: <agent-version> vs <opponent> (seed <N>)
Failure turn : <T>
Player : <P>
Status : ERROR | INVALID | TIMEOUT | early-DONE
Root cause : <one sentence — what the agent did or failed to do>
Evidence : <observation field or exception line>
Fix candidate: <what to change in the agent>Then invoke log-experiment to record the hypothesis for the fix, and improve-agent to implement it.
Do NOT
- Don't guess the root cause without reading the replay. "It probably timed out" is not a diagnosis.
- Don't fix and re-run without writing down what you expect the fix to achieve (
log-experimentfirst). - Don't discard replays after debugging — keep them in
replays/as regression anchors.
Other versions7 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 7
- millionco/expect★ 3.6ksame name
- microsoft/powerplatform-build-tools★ 308same name
- bbvch-ai/aihub-core★ 16same name
- d-gangz/dgang-skills★ 2same name
- BryceYuuu/open-workflow-skills★ 1same name
- omson-datco/claude-skills★ 0same name
- Sw1zero/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository14 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- capture-learningSkill
- eda-auditSkill
- ensemble-blendSkill
- improve-agentSkill
- leaderboard-checkSkill
- log-experimentSkill
- new-competitionSkill
- post-submission-reviewSkill
- preflight-consultSkill
- recall-learningsSkill
- retrospect-sessionSkill
- run-local-evalSkill
- submit-competitionSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

