SDD ledger — plan: C:/Users/megahefm/Dropbox/Miami/Code/claude/fine_tuned_jev/replication_materials/plans/2026-11-24-decisions-0.2.0-case-study-plan.md
plans/2026-11-24-decisions-0.2.0-case-study-ledger.md · Status: Closed
| Item | Value |
|---|---|
| Status | Closed |
| Version | 1.0 (2026-11-25) |
| Written by | Claude Code |
This ledger is a copy of the working ledger for the plan `C:/Users/megahefm/Dropbox/Miami/Code/claude/fine_tuned_jev/replication_materials/plans/2026-11-24-decisions-0.2.0-case-study-plan.md`. It was copied on 2026-11-25 at the end of the work. Internal agent IDs are removed.
# SDD ledger — plan: C:/Users/megahefm/Dropbox/Miami/Code/claude/fine_tuned_jev/replication_materials/plans/2026-11-24-decisions-0.2.0-case-study-plan.md
Setup: branch case-study-gemini of decisions, from vignettes-gemini-venn at 6c88883; spec section 3 of the 0.2.0 design (D313); plan approved (D322).
Pre-flight: Task 1 -> 2: the loops consume the model setting of the kit (DECISIONS_LOOP_MODEL=gemini, sandbox root, file prefix). Task 2 -> 3: read_loops() consumes the gemini loop files gemini_<dataset>_loop_log.csv. Task 3 -> 4: the rerun consumes STUDY_AGAIN_DIR and the save path. Task 3/4 -> 5: the vignette consumes study_again.rds (gemini rows, reruns). OK.
Task 1: complete (commits 6c88883..624e9f5, tests: bash -c 'cd data-raw/study_again/loop && md5sum -c --quiet /c/Users/megahefm/AppData/Local/Temp/claude/b8d1c381dafe19cb/a1132f63-df4a-45a2-893c-15b73325d4b3/scratchpad/openai_loop_files.md5 && cd /c/Users/megahefm/decisions-gemini-loops/textiles && DECISIONS_LOOP_CHECK_ONLY=true bash score.sh 1 | tail -1 && echo "openai files unchanged; gemini rehearsal passes"' → openai files unchanged; gemini rehearsal passes)
Task 3: Step 1 done before the loops end: study_again.R gets gemini (services, caps 2700 and 1050, prefix_of(): decisions-0.2.0-study- and, for the rerun, decisions-0.2.0-study-rerun-), STUDY_AGAIN_DIR (rerun), loop_dir, loop_models, the save before the test (tested), the .env key. Step 2: a save with jev, openai and clef (replay) gives study_again.rds identical to HEAD and setups.md5 identical.
Task 3: Ruling: the rerun of D311 scores the Gemini candidates again in its wording step (the branch of Jev and Clef-Flash), while run 1 takes the AUCs of the loops (as gpt-6-luna) — a rerun that copied the loop AUCs would measure nothing — cost if wrong: about USD 0.6 more (the candidates of four datasets scored again).
Task 2: textiles: 6 candidates; best candidate 3, AUC 0.897 (generic 0.801); audit: blind. The agent saw a change of the package version at candidate 6 (624e9f5 to 9cce2f7: my commit of study_again.R during the loop); git diff of R/, NAMESPACE, DESCRIPTION, the loop kit and log_call.R between them is empty, so candidate 6 is comparable.
Task 2: Ruling: no commit in the decisions repository while a loop runs (the agent sees the package version) — cost if wrong: an agent that doubts its scores.
Task 2: Ruling: keep each transcript in data-raw/study_again/loop/transcripts/gemini_<dataset>.jsonl (the plan: keep the transcripts; data-raw is outside the package build) — cost if wrong: a few MB in the repository.
Task 2: the textiles transcript held the email of fmm twice (the session context of claude -p); replaced with '[email removed]' and the unpushed commit amended, so no commit holds it. Each later transcript gets the same redaction before its commit.
Task 2: extrusion 6 candidates, best 3 (0.874; generic 0.789); microstructure 5, best 3 (0.918; 0.823); pipe_staple 1 (0.996, the agent stopped); audits blind; transcripts kept with the email removed.
Task 2: complete (commits 624e9f5..eaa2e18, tests: Rscript -e 'for (d in c("textiles","extrusion","microstructure","pipe_staple")) { a <- read.csv(sprintf("data-raw/study_again/loop/gemini_%s_audit.csv", d)); stopifnot(nrow(read.csv(sprintf("data-raw/study_again/loop/gemini_%s_loop_log.csv", d))) %in% 1:6) }; cat("4 loops, 4 audits\n")' → 4 loops, 4 audits)
Task 3: the test of Gemini: 1,027 calls; one row failed (extrusion row 129, extrusion_images/over/frame351.jpg, 224 x 224): HTTP 400 'prohibited_content' (the safety filter of Gemini; a debug call with the saved setup gave the same answer; 3 calls in all for this image).
Task 3: Ruling: when every failed test row of a dataset is a safety refusal of the provider (HTTP 400 prohibited_content), score_test() writes the test once with these rows as row errors, out of the AUC (as score_setup() treats a failed row), and records refused = n; check_errors() does not count them; other errors still stop the write — evaluate_once() can never write a dataset with a permanent refusal — cost if wrong: Gemini's extrusion AUC uses 198 of the 199 distinct test images; the vignette must say so.
Task 3: test AUCs of Gemini: extrusion 0.781 (198 of 199 distinct images), microstructure 0.965, pans 1, pipe staple 1, textiles 0.947; save with four models: the parts of jev, openai and clef equal those before (all.equal); test input tokens summed with na.rm (the refused row has none).
Task 3: complete (commits eaa2e18..1c8b529, tests: Rscript -e 's <- readRDS("inst/extdata/study_again.rds"); stopifnot(nrow(s$chosen) == 20, "gemini" %in% s$test$runs$model, sum(s$test$runs$model == "gemini") == 5, sum(s$test$calls$model == "gemini") == 1); cat("study_again.rds: 4 models, Gemini tested\n")' → study_again.rds: 4 models, Gemini tested)
Task 4: Ruling: the rerun cap of gemini is 4,500 calls (wording about 1,728 + grid 2,280 + calibration 202), not the 3,000 of the plan for the grid and calibration — the rerun scores the loop candidates in its wording step, as Jev did (cap 4,000) — cost if wrong: none (budget row of D301: 30,000 calls).
Task 4: case_save() in the rerun folder writes only platt.rds and setups.md5 (what its test step checks), never inst/extdata/study_again.rds; a save of run 1 after the change is identical.
Task 4: rerun of D311 in data-raw/study_again_rerun: 5,237 new calls (wording 1,728, grid 2,280, calibration 202, test 1,027; 23:04 to 23:18 UTC), the same safety refusal; compare: largest change of a wording AUC 0, of a grid AUC 0, no changed choice, test AUCs identical, all 1,028 test probabilities bit for bit identical (response times differ: no replay). study_again.rds gets the element reruns; the parts of run 1 are identical.
Task 4: complete (commits da70846..6a897b8, tests: Rscript -e 's <- readRDS("inst/extdata/study_again.rds"); stopifnot(!is.null(s$reruns), s$reruns$grid_max_change == 0, nrow(s$reruns$test) == 5); cat("reruns saved: grid change", s$reruns$grid_max_change, "\n")' → reruns saved: grid change 0 )
Task 5: the vignette: model_label and the lists of models, the deciders chunk (= the script), keys, loops, chosen k, '15 setups' from the data, the score_test chunk (= the script, with the refusal), the Platt prose rewritten from the data (both scores worse only for the pans of Jev and gpt-6-luna; Gemini pans mixed; Gemini extrusion and microstructure lose 1 and 2 test images with both scores better) with checks, the refused image, the tokens of four models (tuning: Jev 7,385, Gemini 6,208, gpt-6-luna 2,798, Clef-Flash 2,795 per image), and the rerun (5,237 calls, no change). Renders; every check passes; spelling clean; R CMD check --as-cran: 0 errors, 0 warnings, 0 notes.
Task 5: complete (commits 7b10856..5c47b25, tests: Rscript -e 'devtools::load_all(quiet = TRUE); rmarkdown::render("vignettes/industrial-image-inspection.Rmd", output_dir = tempdir(), quiet = TRUE); cat("case study renders; all checks pass\n")' → case study renders; all checks pass)
Final: review by a fresh reviewer (Fable): ready to merge with fixes; no Critical; the data, the rerun and the test integrity hold under independent recomputation.
Final: fixed Important 1 (the pushed transcripts held the Claude accountUuid and organizationUuid of fmm) — D323: git filter-branch on case-study-gemini (10 commits) with a redaction of both fields and of emails; every rewritten commit checked against the two saved values (0 left); force-push with lease (5c47b25 to 60e6be1); the merge still points at 8bb93dd. Old commits can stay reachable by SHA on GitHub until it purges them.
Final: fixed Important 2 (score_test() used the internal roc_auc()) — yardstick::roc_auc_vec(..., event_level = 'second'); GREEN: 0.7806061 = the saved AUC.
Final: fixed Important 3 (no bound on the refusal rule) — a named allow-list known_refusals (gemini, extrusion_images/over/frame351.jpg); any other refusal stops the write.
Final: fixed Important 4 (a saved refused row was logged again on each run and broke the replay) — RED: replay stops ('1 rows ... not in the ledger') → GREEN: 'Replay: 0 requests', no new log line.
Final: fixed Important 5 (audit.R in the default mode wrote over a gpt-6-luna audit file) — audit.R refuses a transcript whose cwd is not the sandbox of the selected model; run_loop.sh prints the model in the audit hint; GREEN: the wrong-model audit refuses, textiles_audit.csv unchanged; the four committed (redacted) transcripts re-audited: blind (fixes Minor 1 too).
Final: fixed Important 6 (the token-ratio sentence was true for no model) — per model, with a check (49 % for Jev, gpt-6-luna and Clef-Flash; Gemini the same at both sizes).
Final: fixed Important 7 ('the study loop' for a Gemini loop) — 'the loop stopped'.
Final: minor (deferred): log_rows 1,029 for 1,027 images is not explained in the text.
Final: minor (deferred): n = 200 for Gemini extrusion while the metrics use 199 rows; the text names only the AUC.
Final: minor (deferred): the claim 'the same probability for every image' is checked only through the AUCs (true, verified by hand); case_compare() does not assert calls == n.
Final: minor (deferred): the prefix decisions-0.2.0-study- is a string prefix of the rerun and debug purposes, so the main cap of run 1 now counts them (never under-counts; a new grid run of run 1 would stop at planned = 0).
Final: minor (deferred): plan deviations (cap 2,700 not 3,000; the check of the old models before a save was manual).
Final: minor (deferred): stale comments (three models in study_again.R; 'of gpt-6-luna' in kit headers; evaluate_once() warns 'was not written' before 'Saved with').
Final: minor (deferred): wording ('a new call cannot score it' stronger than 5 of 5; 'for the same images' loose for the tokens; literal counts 'four', 'All four', 'three hosted' unchecked).
Final: minor (deferred): 'failed' uses .error only, while score_row() also drops a missing probability; 'rerun' comes from a path comparison.
Final: minor (deferred): ledger line 14 says 3 calls for the refused image; the log has 4 in run 1 and 1 in the rerun.