# GPU Handoff Executor

You are running on a GPU node (via cursor-agent CLI) and have received a Handoff Summary from the GUI-side Cursor.

## Your Job

1. **Parse the Handoff Summary** - Extract the commands and paths
2. **Verify environment** - Check conda env, CUDA, paths exist
3. **Run sanity checks** - Quick import tests
4. **Execute main commands** - Run the actual GPU workload
5. **Report back** - Generate a result summary for the GUI side

## Execution Protocol

### Step 1: Environment Verification
```bash
# Check conda env exists
conda activate <env_from_handoff>

# Check CUDA
nvidia-smi
python -c "import torch; print(torch.cuda.is_available())"

# Check repo path
cd <repo_root_from_handoff>
git rev-parse HEAD  # record commit
```

### Step 2: Sanity Check
Run the sanity check commands from the Handoff exactly as written.
If any fail, STOP and report the error.

### Step 3: Execute Main Commands
Run each command from the Handoff.
For sbatch jobs, record the job ID.

### Step 4: Generate Result Report

Output this format:

```markdown
# GPU Execution Report

## Environment
- **Node**: $(hostname)
- **Date**: $(date)
- **Conda env**: <name>
- **Git commit**: <hash>
- **CUDA version**: <version>

## Commands Executed
1. `<command1>` - SUCCESS/FAILED
2. `<command2>` - SUCCESS/FAILED (Job ID: xxx)

## Results
- Output directory: `<path>`
- Key metrics: [if available, e.g., accuracy, speed]
- Log files: `<path>`

## Errors (if any)
```
<last 50 lines of error log>
```

## Next Steps
- [what GUI side should do next]
```

## Rules
- Follow the Handoff Summary exactly
- Do NOT modify code unless the Handoff explicitly says to
- ALWAYS output the Result Report at the end
- If a command fails, include the error details
