Appendix D — Towards Determinism
Compare what contracts, scripts, assets and byte-identical reruns can make repeatable.
Felix Reyes · The Skills Pack · First edition, 2026 · CC BY 4.0 · Router
“Deterministic” has two meanings in this book, and this appendix keeps them apart. For what a script writes it means same bytes: run the script twice on the same input and the two files are identical, which a hash shows in one line. For what the model writes it means same figures and structure: two runs produce notes with the same sections, the same figures where the contract places them and only figures the script printed. The words differ. The four rules of the Preface push a deliverable from free prose towards both: numbers from scripts fix the figures, a contract fixes the structure, the shared layer narrows the words, and the tests say how far each run got.
Two kinds of same
A run folder (Chapter 9) contains three kinds of file, and each has its own meaning of same. The script’s JSON is the same bytes on every run with the same input: the golden check compares it key by key, all but the input block, and the repository test compares the whole file (Section 9.5). The note is the same in structure and in figures and free in its words: the contract check reads its structure, the provenance check matches every figure against the display block, and the binding check holds each one-record figure to its record’s name (Chapter 6). None of the three reads a sentence for its sense. The transcript is free, and only the trace check reads it, to learn which files the model read. The deck is a fourth file, and it behaves like the script’s JSON: a script writes it from a slide map, the same bytes for the same map. Table D.1 puts the four together.
What is the same on every run, file by file, in the budget-vs-actual and deck cases.
File (under output/) |
The same on every run | Said by | Who reads the rest |
|---|---|---|---|
bva.json |
Every byte | The repository test; golden, key by key |
Nobody; nothing is left |
bva-note.md |
From 1.1.0, every section but Drivers, the same as the script renders it; in Drivers, every figure a display string, every one-record figure beside its record | rendered_ sections_ match; contract; provenance; binding |
The reviewer, for the Drivers |
| The transcript | Nothing | sentinels reads the trace tokens only |
A reviewer, after a failure |
IS_MBR_ 2025-12.pptx |
Every byte, for the same slide map | sha256 run twice (D.3); golden on structure, labels, schema |
The reviewer, for the slide map’s bullets |
The ladder
The ladder has five rungs. Each is a file, and each leaves less to the model than the one below it. Chapter 1 added the script first, out of this order, because until then nothing could check the model’s arithmetic. Figure D.1 draws what each rung fixes, what a check can say and what is left to the model.
Figure — text equivalent.
| Rung | What it fixes | What a check can say | What stays free |
|---|---|---|---|
| 1. Free prose | Nothing | None; a person reads it all | Everything |
| 2. Output contract | Sections, rows and Headline figures | Contract check | Words and figures' values |
| 3. Computing scripts | Every figure, its rounding and unit | Identity twice; golden | Words and which figures to name |
| 4. Layout assets | Slide order, titles, table columns, colours, fonts, footer | Golden structure keys; required brand keys | Words |
| 5. Golden files and byte-identical reruns | Whole script output | Golden, repository test, SHA-256 twice | Words |
Higher rungs make more of the output the same on every run.
The determinism ladder. Each rung is a file that fixes more; the model’s words stay free at every rung.
Free prose. The first stage of Chapter 1 is instructions alone. Nothing is the same twice, the book’s checks have no contract or display string to hold it to, and a person reads all of it.
An output contract. The sections, their order, the rows of the table, which figures the Headline includes (Chapter 6). The contract check reads it. The words and the figures’ values are still free, because nothing yet computes them.
Scripts that compute. Every figure, its rounding and its unit (Chapter 5). The leaf gives one exact command, and the model adds nothing to it but the input path and a flag the user named. The identity checks say the figures reconcile and the golden file says they are the figures the case expects. The model still chooses which figures to name, and the words around them. A leaf may also render the note’s fixed sections from the display block, which moves them from the second meaning of same to the first (Section 5.2).
Assets that fix layout. The brand file, and the deck script’s constants for slides, titles and columns (Section D.5).
Golden files and byte-identical reruns. The whole script output, compared key by key by the golden check and as a whole file by the repository’s tests, and shown the same by a hash taken twice (Section D.3).
Each rung is a preventive control in the auditor’s sense: a script computes, an asset fixes a layout. The top rung is what a reviewer may rely on without re-performing the work.
Same bytes: the scripts rerun
The sixteen pack scripts were run twice on the case data and each output hashed both times. Four things in the scripts make the hashes equal. Fifteen of the sixteen do their arithmetic in Decimal with ROUND_HALF_UP, with no floating point. The sixteenth, the deck builder, does no arithmetic and copies strings. The result is built in one place and written in one call, json.dumps(result, indent=2), in all sixteen. Lists that could come out in any order are sorted, such as bva.py’s periods and bridge.py’s movers. The input’s hash is in the output, so a changed input changes the file, and no script reads the clock or a random source.
The deck builder, the one script that writes a binary file, fixes the two things that would otherwise differ between runs. The document’s created and modified dates are one fixed date:
File: packs/management-reporting/skills/deck-assembly/scripts/build_deck.py (lines 185–186).
prs.core_properties.created = prs.core_properties.modified = datetime(2000, 1, 1)
prs.core_properties.last_modified_by, prs.core_properties.revision = brand["company"], 1and the archive is rewritten with every entry’s time stamp set to one value:
File: packs/management-reporting/skills/deck-assembly/scripts/build_deck.py (lines 227–232).
# Same slide map, same bytes: rewrite the archive with fixed timestamps.
out = io.BytesIO()
with zipfile.ZipFile(raw) as src, zipfile.ZipFile(out, "w", zipfile.ZIP_DEFLATED) as dst:
for item in src.infolist():
dst.writestr(zipfile.ZipInfo(item.filename, (1980, 1, 1, 0, 0, 0)), src.read(item.filename),
compress_type=zipfile.ZIP_DEFLATED)The exhibit, examples/appD/outputs/rerun-hashes.txt, opens with the sixteen commands and then hashes each output from both runs. Its first hash lines are the deck’s:
File: examples/appD/outputs/rerun-hashes.txt (lines 21–23).
$ cd /tmp/run && for f in $(ls 1/output); do sha256sum 1/output/$f 2/output/$f; done
acc98a688b2ce8791fd3c0d00758118c146ccfb4d3f54b7b297cd425ad5fd2e0 1/output/IS_MBR_2025-12.pptx
acc98a688b2ce8791fd3c0d00758118c146ccfb4d3f54b7b297cd425ad5fd2e0 2/output/IS_MBR_2025-12.pptx
It goes on through all eighteen outputs, the sixteen results, the deck and its slide map, each with the same hash twice, and closes in one line:
File: examples/appD/outputs/rerun-hashes.txt (lines 58–59).
$ diff -r /tmp/run/1 /tmp/run/2 && echo 'run 1 and run 2: every file byte-identical'
run 1 and run 2: every file byte-identical
Then it compares each result with its pack’s golden file, and all sixteen lines read same bytes as the golden file. A repository test checks the exhibit against the current golden files.
Same figures: what the model writes
In the repeat runs of Section 9.10, made on version 1.0.0 of Variance and Bridge, each of the two primary models wrote the revenue-bridge and budget-vs-actual notes three times. Their figures are in that version’s display format: $1.2M where 2.0.0 prints $1,211K. The script’s files are the same bytes in all twelve runs: every bridge.json and every bva.json equals that version’s golden file. The notes differ. All six revenue-bridge notes passed every check, and examples/appD/fixtures/figure_sets.py compares their figure sets, section by section: every figure token in a note, found by the provenance check’s tokenizer. Compared with the first model’s first note, each of the other five has the same 3 figures in the Headline, the same 6 in the Bridge and the same 2 in the Data notes. The Drivers differ every time. The two below come from different models and different runs:
File: runs/20261004-0335-repeat-variance-bridge-claude-sonnet-5-5/revenue-bridge-fy25/claude/r1/output/bridge-note.md (lines 15–19).
## Drivers
- Fenwick Legal lost ($686K) and Birchway Foods lost ($503K), the two largest of 4 lost customers.
- Harbor Freight Partners added $148K and Ember Analytics added $136K, the largest of 23 upsell customers.
- Driftwood Media declined ($113K) and Juniper Schools declined ($107K), the largest of 11 declines.
- 6 new customers added $463K, led by Thistle Gardens at $116K.File: runs/20261004-0335-repeat-variance-bridge-claude-opus-5-5/revenue-bridge-fy25/claude/r2/output/bridge-note.md (lines 15–19).
## Drivers
- 4 lost customers removed ($1.3M).
- Fenwick Legal was lost, removing ($686K), the largest single loss.
- 23 upsell customers added $1.2M.
- 6 new customers added $463K.The first listing (first model, first run) names seven customers and counts all four movements. The second (second model, second run) names one customer, totals three movements and leaves the declines out. Every figure in both is a display string, and binding found each one-record figure beside its name. Two notes can both pass the allowlist and still name different subsets of the display block, and choosing the subset is the judgment the Drivers leave to the model.
The budget-vs-actual notes show the same pattern. The Data notes line is the same in all six, and the Results table contains the same 17 figures in every note that passed the contract. Two Headlines have only the four figures the contract requires, and the other four add the actuals and budgets. The Month and the Drivers differ in every pair. Two of the six notes failed a check: the contract check, for a percentage added to a Results cell, and the binding check, for a line’s figure placed in Drivers under the category’s name (Section 6.8). The other four passed every check.
Assets that fix layout
Layout is fixed by files. In the four packs the layout values are in one asset, the brand file: colours, fonts, the footer, the deck’s file name, and the number formats the display functions print. The slide order, the six titles, the table columns and the bullet counts are constants in the deck script:
File: packs/management-reporting/skills/deck-assembly/scripts/build_deck.py (lines 35–38).
SLIDES = (("{period_name} Monthly Business Review", "title"), ("Headline", "bullets"),
("P&L vs budget", "table"), ("KPI scorecard", "table"), ("Drivers", "bullets"), ("Watch list", "bullets"))
COLUMNS = {3: ["Measure", "Actual", "Budget", "Variance"], 4: ["KPI", "Actual", "Target", "Status"]}
BULLETS = {2: (2, 4), 5: (2, 4), 6: (1, 4)}The model writes only the slide map: the bullets, the subtitle and the rows it copies from the two sources’ display blocks. The script writes no deck from a map that does not fit these constants (exit 2) or that contains a figure from outside the sources (exit 3). Because the map is the model’s, the deck case’s golden file compares structure, labels and schema only (Section 9.5).
What stays free
The rungs fix figures, structure and layout. The words they leave are what a reader reads, so a person reviews them however the checks came out, for what no check sees (Section 9.1). Any word rule a program can check is already in the contract, the provenance check or the binding check: one sentence in the Headline, parentheses for negatives, a one-record figure beside its own record’s name. A reviewer applies the rest of the voice, the four rules of the voice audit that no program checks (Chapter 8), by reading, once every figure has been matched to the script. In the terms of Section 3.1, only judgment, in the words, keeps high freedom.