This is a workflow log. It does not discuss the task itself or the results.
The task is a binary image classification problem. Two studies were run one after the other:
- Study A: hand-crafted features (radiomics) with tabular models, started in plan mode.
- Study B: deep learning on the same data and split as Study A, started in auto mode.
Both used the same loop: experiment → verify → design or adjust → next round, until a clear target is met.
Target and rules go into files first#
Before starting, three things were stated. All of them ended up in the project’s CLAUDE.md:
- A clear stopping condition: validation AUC > 0.85. Once it is met, keep improving until several rounds bring no gain; if it is not met, keep adjusting or change direction.
- Evaluation rules: the split is made once and its hash recorded; it is never redone. Model selection and tuning use only 5-fold CV inside the training set. The validation set only evaluates a setting that CV has already chosen. The test set stays sealed and is run once, after the user decides to freeze the final model.
- Data constraints: which fields may be used, which directories are read-only, and that all output stays inside the experiment directory.
Two more files:
EXPERIMENTS.md: one row per round, with the hypothesis, settings, CV, validation and conclusion.- An iteration ladder: a list of directions ordered from simple to complex. Each layer has its signal source confirmed before moving on.
With the rules in files, the work can continue after the conversation is compacted (automatically summarized when context runs out) or a new session starts. Each study went through one compaction, and neither lost progress.
What one round looks like#
Propose a hypothesis (next feature layer / new architecture)
→ Run in the background, resumable, with a status file per item
→ Check: number of successes, no duplicate IDs, AUC recomputable from the prediction file
→ Decide whether to adopt it from CV alone
→ Once CV has chosen, evaluate validation once and log it in EXPERIMENTS.md
→ Ablation and error analysis decide the next roundIn practice, the next round was usually driven by one of these observations:
- Ablation locates the signal: whichever feature group costs the most when removed is the direction where new information gets added.
- A bug is found: in the first round, a wrong column filter meant a whole feature group was barely produced. The next round fixed it.
- The model side saturates: the five models’ predictions correlated at 0.88–0.97 with each other. Switching models made no sense; the remaining lever was new information, not tuning.
- Shortcut checks: some features separated the two classes only because the two groups happened to be imaged differently (for example, how much area the images covered), not because of any difference in the target itself. A model that scores on such cues fails on a new batch of data. So a sensitivity analysis removed all such features and retrained. The result barely changed, and only then was it accepted.
- No gain, no adoption: an extra set of hand-designed features and a per-group late fusion both failed to raise CV. They were logged and dropped.
Study A’s validation AUC by round:
| Round | Main change | val AUC |
|---|---|---|
| 1 | Baseline features | 0.757 |
| 1 | Four groups of regional features added layer by layer | 0.815 |
| 2 | Bug fix, new regions, derived features, five-model ensemble | 0.841 |
| 3 | New features from a second batch of segmented structures | 0.872 (target met) |
| 3 | Sensitivity analysis: suspected shortcut features removed | 0.872 |
Study B ended the other way. Pure deep learning reached 0.838, short of the target. Claude Code reported the gap and the bottleneck (which kind of sample the errors concentrated in) instead of tuning against validation to push the number up. The target was met only by late fusion with Study A’s frozen model, labelled as a hybrid.
“When the target is not met, report it honestly; do not overfit validation, touch the test set or take shortcuts outside the rules” is also a rule written in CLAUDE.md.
What Claude Code handled#
- The environment (uv), the data list, the split and the code for the whole pipeline.
- Scheduling and watching long jobs: run in the background with a notification on completion; Monitor follows each epoch’s log during training.
- In Study B, sshing to other lab machines to run experiments, checking first whether anyone was using the GPU.
- Each round’s ablation, error analysis and suggested next step.
- Checking the numbers: before anything is logged, AUC is recomputed from the prediction file and the counts are verified.
What I kept#
- The rules and the target themselves.
- When to freeze a model and when to run the test set.
- Directions from past experience, for example “a pretrained model should fine-tune a larger share of its weights”.
- The design of the final ensemble.
- Before a study ends, asking to “settle the results into documents” and then commit, so the next session can pick up.
Plan mode and auto mode#
Study A did not use plan mode throughout. Plan mode covered only the initial planning; once the plan was approved, execution ran in auto mode. Study B was in auto mode from the first message.
| Study A: started in plan mode | Study B: started in auto mode | |
|---|---|---|
| Opening | Described the task and target; Claude Code explored the directory and proposed a plan | A longer list of constraints |
| How the plan came about | Rejected twice, approved the third time | Claude Code wrote PLAN_DL.md, edited CLAUDE.md and started directly |
| When corrections happened | Before execution, added as rules on rejection | During execution, as questions and adjustments in the conversation |
| Duration | About 1.6 days | About 1 day |
The value of plan mode was in those two rejections. In the first plan, Claude Code had found earlier conclusions in a parent directory and planned its direction around them. That was not what I wanted: this study was meant to be independent. Everything added on rejection went into CLAUDE.md before any code ran, and for the next day and a half almost no intervention was needed.
Auto mode skips that gate, so corrections happen during execution. The upside is reacting to intermediate results, for example suggesting full fine-tuning only after seeing that a pretrained model had been fine-tuned on just some layers. The downside is checking in more often.
Overall the two felt about the same. One caveat: Study B reused Study A’s locked split, segmentations and CLAUDE.md, so it started further along. The difference here is mainly when the user’s corrections came in; it cannot be said that the mode itself changed the outcome.
Observations#
- A clear numeric target plus fixed evaluation rules is what lets Claude Code run many rounds without confirmation each time.
- “The numbers check out” matters more than “it finished”. The rules require verifying success counts and recomputing AUC from prediction files after every run. Before the real experiments, Claude Code also ran the pipeline once with shuffled labels; CV AUC came out around 0.46, confirming there was no leakage.
- Claude Code ran the shortcut checks and sensitivity analysis on its own initiative, and logged the results as they were.
- The two modes felt about the same in use; they differ only in when corrections arrive. Plan mode suits the case where I already know there are things I don’t want but haven’t said them yet; auto mode suits adjusting while watching results. Boris Cherny, who created Claude Code, has said he now uses auto mode instead of plan mode, and that his team has used auto mode exclusively for months (1, 2). One of his examples when introducing auto mode is letting the model iterate “until it hits a performance benchmark” (3), which is the same use as here.
- Both studies ended by settling results into documents and committing, so the next session (for example, preparing meeting material) starts from the documents.
Try it yourself#
The task and data above cannot be shared, so I made a small demo you can run yourself: claude-loop-demo.
- Classify 28×28 breast ultrasound images as benign or malignant, CPU only, with numpy, scikit-learn and matplotlib.
- The folder holds only data. You give the rules in one pasted prompt, as in Study B above: Claude Code writes
CLAUDE.md, the experiment log and the code itself, then starts the loop. - The rules in the prompt all come from this post: a fixed split, val evaluated once per round, a shuffled-label leakage check first, a shortcut check before any result counts, and AUC recomputed from prediction files.
- My run took about 18 minutes.
Spoiler · read after your runHow the data was modified, and my resultsShow
The data is derived from BreastMNIST (MedMNIST v2, CC BY 4.0), re-split, and seeded with a deliberate shortcut: in some images the top-left pixels [1:3, 1:3] are brightened by 70, like a marker burned in by a machine. In train, 76% of malignant images carry the marker versus 4% of benign; in val, 93% versus 4%. The marker is artificial, so the data is suitable for practice only, not for research.
My run:
| Round | Setup | Marker | CV | val | Counts? |
|---|---|---|---|---|---|
| R0 | shuffled-label check | – | 0.50–0.54 | – | no leakage |
| R1 | raw pixels + logistic regression | unmasked | 0.898 | 0.953 | ✗ signal on the top-left marker |
| R2 | same as R1 | masked | 0.783 | 0.741 | ✗ below target |
| R3 | HOG + pixels → PCA → SVM, flip augmentation | masked | 0.802 | 0.804 | ✓ |

One malignant image
lesion in the center, marker top-left

R1: where the signal is
masking the corner costs 0.18 AUC

R3: after masking the marker
no single patch costs more than 0.006 AUC
- The data audit before any modeling already spotted the bright square, noted that “the square alone gives val AUC 0.95”, and stated that this number was used for nothing.
- The shuffled-label check passed, and the log says plainly that this check only catches pipeline leakage, not a shortcut in the data itself. That difference is exactly what the demo is meant to show.
- After R1 first “met” the target, it did not stop: the shortcut-check figures showed the signal sat almost entirely on the marker, so the result did not count.
- After R3 met the target, it checked stability on 5 other CV splits (mean 0.814), then stopped without tuning further on val.
Recap#
Whether in the two original studies or this 18-minute demo, the same pieces are what let Claude Code keep going on its own:
- The loop: experiment → verify → adjust → next round. Building the loop is easy; knowing when to stop is the hard part. So the stopping condition is a concrete number plus a cap on rounds, and if the target is not met, it reports the gap honestly instead of running forever.
- Rules go into files first. The target, the split and how val may be used go into
CLAUDE.md; each round’s results go intoEXPERIMENTS.md. Conversations get compacted and sessions end; only rules written into files survive that, and the next session can pick up from them. - Verification: “the numbers check out” beats “it finished”. Shuffled labels to rule out leakage, AUC recomputed from prediction files, prediction counts checked, val looked at once per round. Only when results can be verified is it safe to let go.
- Shortcut checks: meeting the target is not success. A shuffled-label check catches pipeline leakage, not a shortcut in the data itself. In the demo, the first “success” came from the top-left marker; because the rules required checking where the signal lay, it did not stop there.
- Self-correcting iteration. Each round’s direction comes from the previous round’s checks: ablations show where the signal is, bugs get fixed, shortcuts are removed and the run repeated, and methods with no gain are logged and dropped. Claude is good at finding faults; this loop keeps it finding faults in its own work.
- People make the calls. The target and rules, when to freeze, when to run test: those stay with me. Claude expands and critiques within the rules.