The factory workshop · Rod Rivera
Give the coding agent one bounded change
The coding agent now has a specific job: replace one Python module so the application satisfies C1. It does not need permission to alter the evaluator, the simulated customer system or the release decision.
You can complete the workshop with the hand-authored reference implementations without using a model account. To generate your own candidate, install and authenticate Claude Code using its official setup instructions. Provider charges or subscription usage apply. Keep credentials out of the project and its run directories.
Read the builder boundary
build.py starts a fresh tool-free model request from a temporary directory. It sends the change contract and current candidate, receives source text and records the response. It does not import or execute the generated file on your computer.
The model has no shell, file-editing tools or connected MCP servers in this request. Its credentials stay with the outer CLI. Later, factory.py copies the resulting source into a read-only container volume. The candidate can write its own state and call the synthetic dependency inside an internal Docker network.
This design has two distinct boundaries. Restricting the builder’s tools prevents it from editing the checking machinery. Restricting the generated application’s runtime limits what that code can do when tested. One boundary does not replace the other. Containers also share a kernel with their Docker host; this is a disposable teaching environment, not a claim of protection against every hostile program.
Record one generation attempt
From the project folder, run:
python3 build.py c1 reference/b0.py --model claude-sonnet-4-6 --budget-usd 2 --out runs/c1-build-01
This records a requested model ID, a USD 2 CLI budget limit and a ten-minute timeout before starting. Budget accounting depends on the provider and account; inspect the recorded usage rather than assuming that a subscription run was a cash charge of that amount. If the model is unavailable on your account, choose an available explicit model ID and record a new attempt. Do not describe two different models as the same configuration.
Expected result: "candidate_written": true. That proves only that the response contained a parsable Python module with the required operate function. It says nothing about whether the feature works.
The run folder contains:
| File | Why you keep it |
|---|---|
prompt.txt |
The exact task and starting source given to the model. |
response.json |
The provider result, including available usage information. |
attempt.json |
Timing, requested model, budget, hashes and generation outcome. |
candidate.py |
The proposed application change, if generation produced one. |
Do not upload run folders containing your own customer data. The supplied exercise uses only synthetic records and source code.
Separate production from judgment
Run the candidate through the unchanged checker:
python3 factory.py check runs/c1-build-01/candidate.py --contract c1 --out runs/c1-check-01
A rejection is an outcome to inspect. Keep the original attempt before asking for another. For your own exercise, set a maximum of two generation attempts per change. If both fail, stop that arm and compare with reference/c1.py; label any subsequent result as a worked-solution run. Do not quietly substitute the solution and call it agent-generated success. For a second attempt, pass --feedback runs/c1-check-01/report.json to the builder so the next prompt retains the observed failure. Keep its new output directory and the previous candidate.
Check your understanding
Question: The model says its implementation is correct and explains why it handles retries. Is that release evidence?
Answer: It is an argument you can inspect. Release evidence comes from running the exact candidate against the contract and checking the receiving system’s effects. A confident explanation cannot replace those observations.
Your evidence: Keep the model attempt and check report together. Record any prompt edits, manual source changes and time spent investigating failures. Otherwise you cannot tell whether automation reduced your work or merely moved it.
Continue to checking and releasing the artifact.