# Alarmed Grasp Loop

One command runs a MuJoCo grasp trial, raises metric alarms, then lines up the exact visual evidence across semantic phases so a coding agent can decide what to edit next without a human replay ritual.

Metric Alarm +14 mm drift

Grasp accuracy regressed against the last passing baseline.

Phase Alarm Approach diverged

Failure appears before contact. No need to inspect lift or placement first.

Perf Alarm 9.8 s loop

Still inside the target autonomous retry budget for CC/Codex.

Safety Alarm Possible collision

Side view suggests elbow-body interference mid-trajectory despite final success.

## Phase Timeline

### plan_start

Policy loaded
object pose seeded
baseline selected

### pre_grasp

Robot safe
bottle localized
path ready

### approach

First visual drift

- side offset grows
- wrist pitch overshoots

### contact

Contact happens but is asymmetric.

### lift

Object leaves table, but the path quality is already degraded.

## Multi-Angle Phase Diff

### front · approach

Looks acceptable at a glance. This is the trap.

Delta vs baseline: gripper centerline shifted 6 mm right.

### side · approach

Failure is obvious here: elbow path cuts through the body envelope.

This frame should trigger the collision suspicion banner.

### top · approach

Yaw alignment started clean, then drifted late in the trajectory.

Useful for telling planning error from contact error.

### wrist · contact

Finger symmetry breaks right before squeeze closes.

Helps the agent decide whether to tune approach or grip.

### front · lift

Task “passes” in scalar terms, but path quality is still ugly.

Important because success-rate-only tooling would stop here.

### baseline overlay

Reference card reminds the agent what “good” looked like.

This is the bridge from one-off report to repeatable harness.

## One Command In, One Artifact Pack Out

    python examples/demos/mujoco/grasp.py --report --compare baseline/grasp_good

    outputs/
      trial_041/
        alarms.json
        phase_manifest.json
        report.html
        approach/front_rgb.png
        approach/side_rgb.png
        contact/wrist_rgb.png

Agent Next Action

Inspect `approach/side_rgb.png` first. Ignore lift. Re-tune approach waypoint spacing or torso offset before modifying grip force.

## Phase Manifest

    {
      "task": "mujoco_grasp",
      "failed_phase": "approach",
      "suspected_root_cause": "mid_path_collision",
      "primary_views": ["side", "top"],
      "regressions": [
        "grasp_accuracy_mm",
        "path_clearance_mm"
      ],
      "rerun_hint": "restore:pre_grasp"
    }

## Why This Matters

The report is not just for humans to admire. It is the compact handoff format that lets a coding agent stop guessing from logs and start editing the right part of the code.