python Canonical keep-or-revert autoresearch loop import subprocess, shutil, json from pathlib import Path METRIC CMD = ["python", "eval.py"] # returns JSON {"score": float} BUDGET = 20 # number of iterations GOAL = "maximize score" def measure() - float: result = subprocess.run(METRIC CMD, capture output=True, text=True) return json.loads(result.stdout)["score"] def run loop(agent propose fn): best score = measure() print(f"Baseline: {best score:.4f}") for step in range(BUDGET): # Agent proposes a diff/edit agent propose fn(goal=GOAL, step=step, best=best score) score = measure() if score be…