Skip to content

Tell agents to read the whole recipe before running it - #215

Merged
davanstrien merged 1 commit into
mainfrom
docs/index-read-first
Nov 26, 2026
Merged

davanstrien merged 1 commit into
mainfrom
docs/index-read-first

Conversation

@davanstrien

Copy link
Copy Markdown
Owner

Tell agents to read the whole recipe file before they run it, and give them a URL that prints it.

Changes

  • README.md (agent prompt): "read its header and docstring" becomes "read the whole file: the header sets the hardware, the docstring has an example command, and the argument definitions near the end list every flag."
  • ocr/AGENTS.md: remove | head -100 from the curl example. The first 100 lines usually stop before the arguments.
  • jobs-utils/list-recipes.py: print /raw/main/ URLs instead of /resolve/ URLs, and tell the agent to curl a recipe before running it. Tested locally: it prints 136 raw URLs.

No script changes. The hub-sync will republish ocr/AGENTS.md and jobs-utils/list-recipes.py.

Agent test

Haiku with curl only. Each run got the task, the index text from main (A) or this branch (B), and the script URL. It had to fetch the script itself. Six tasks (OCR, transcription, classification, training, embeddings), three trials each, 36 runs, $0.24. Scored against each script's real arguments.

A (main) B (this branch)
Correct commands 15 / 18 16 / 18
Read the whole script 5 / 18 18 / 18
Partial read (head, sed, grep) 13 / 18 0 / 18
Tool calls 54 38
  • Correct commands are the same within noise. The change is in what the agent reads.
  • With the old wording, agents read only part of the script on all six tasks, not only the two OCR tasks.
  • Three of the five failures (both conditions) put script flags before the script URL, where hf jobs takes them as its own flags. The docstring example has the correct order. This PR does not address that.

🤖 Generated with Claude Code

https://claude.ai/code/session_016isSPo9kUNVE79vUKWm9i7

Agents pick a recipe from an index and then read the file. In a test
(Haiku, 6 scripts x 2 trials), the docstring alone gave 8 of 12 correct
commands; the argument definitions or the full source gave 12 of 12.

- README.md: the agent prompt says to read the whole file, not only the
  header and docstring.
- ocr/AGENTS.md: drop `| head -100`, which stops before the argparse block.
- jobs-utils/list-recipes.py: print raw URLs (was /resolve/) and a
  read-first line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@davanstrien
davanstrien merged commit c26541a into main Nov 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant