Analyze the most recent report.json from a replay test
Analyzes replay test reports to identify root causes of failures and suggest code fixes.
/plugin marketplace add nethercore-systems/nethercore-ai-plugins/plugin install zx-dev@nethercore-ai-plugins[path to report.json]Parse a replay execution report to identify root causes and suggest fixes.
If argument provided: Use the specified path.
If no argument: Search for recent report files:
# Check common locations
ls -la report.json 2>/dev/null
ls -la *.report.json 2>/dev/null
ls -la tests/replay/*.json 2>/dev/null
If multiple reports found, use AskUserQuestion to let user select.
Read the JSON report file. Extract key sections:
{
"summary": {
"status": "PASSED" | "FAILED",
"assertions_passed": N,
"assertions_failed": N,
"frames_with_snap": N
}
}
{
"assertions": [
{
"frame": 1,
"condition": "$velocity_y < 0",
"passed": false,
"actual": 0,
"expected": "< 0"
}
]
}
{
"snapshots": [
{
"frame": 1,
"input": "a",
"pre": { "$velocity_y": 0 },
"post": { "$velocity_y": 0 },
"delta": {}
}
]
}
Report success with summary:
Identify the failure pattern:
Pattern: Variable stayed at initial value
Frame 1: $velocity_y = 0 -> 0 (delta: none)
Assertion failed: "$velocity_y < 0" (actual: 0)
Diagnosis: The expected change didn't happen.
Pattern: Variable changed unexpectedly
Frame 1: $health = 100 -> 50 (delta: -50)
Assertion failed: "$health >= 100"
Diagnosis: Something modified state unexpectedly.
Pattern: Value wrong direction
Frame 1: $velocity_y = 0 -> 5 (delta: +5)
Assertion failed: "$velocity_y < 0"
Diagnosis: Change happened but with wrong sign/value.
Based on the failure pattern, search game code:
For velocity issues:
grep -r "velocity" src/ | grep -v test
For input issues:
grep -rE "a_pressed|a_just_pressed|input\." src/
For specific variable:
grep -r "[variable_name]" src/
Read the relevant code sections to find the bug.
Structure the analysis report:
Status: FAILED (1 assertion failed)
$velocity_y < 0Frame 1 snapshot shows $velocity_y remained 0 after pressing A. The jump input was not applied.
Based on code analysis, the issue is in src/player.rs:42:
// Current code - always returns false after first frame
if input.a_pressed() {
self.velocity_y = -JUMP_FORCE;
}
Should be:
// Fixed - triggers on button press, not held
if input.a_just_pressed() {
self.velocity_y = -JUMP_FORCE;
}
Change a_pressed() to a_just_pressed() on line 42 of src/player.rs.
After fixing, re-run the test:
nether replay run tests/replay/jump_test.ncrs --report report.json
| Symptom | Likely Cause | Check For |
|---|---|---|
| Velocity stayed 0 | Input not processed | a_pressed vs a_just_pressed |
| Position unchanged | Collision blocking | Collision code, hitbox sizes |
| Wrong direction | Sign error | Negative/positive velocity |
| Gradual drift | Float precision | Fixed-point conversion |
| Random failures | Non-determinism | random() vs external random |
| State corruption | Wrong variable | Copy-paste errors, typos |