Chapter 6 — Cost and spending
Status: DRAFT 1 (2026-09-21), DESIGN v6 §4, §8. Merges v5's Chapter C (methods, worksheet) with the spend loop. Every number here is a credit count read from a ledger row; no money figure appears in this chapter (Appendix A).
6.0 Objective
Given a rate card and your shotlist, you can fill the job-type worksheet, set a stop threshold and a take budget per card, run one spend loop end to end (fence → price at the button → one job → verify it queued → ledger row), and read the result with valid evidence.
6.1 What you are deciding
Two things before the first credit of the film is spent:
- How much, in which job types, and where you stop. Not a total. A worksheet with one row per job type (video takes, stress videos, stills, voice lines, voice change, score, a rewrite reserve), each row count × billable quantity × today's rate on your tool. Usable runtime is not generated runtime: every video row carries handles and trim loss. Ours was 71 % measured over every generated second, rejected takes and tests included (Appendix A), so that one number already contains our retakes; do not add a retake share on top of it. If you budget attempts per card (ours: about 0.64 extra per card on average; 46 % of cards had at least one retake), apply a trim loss for kept takes only, which we did not measure. The sheet ends with a stop threshold: the credit count at which you stop generating and rewrite or cut instead.
- How a single spend happens, every time. The loop below. It is the same for a 0.15-credit voice line and a 54-credit video.
6.2 How we did it
The eight methods (LESSONS.md:10–36)
Our protocol was written after the first week of spending and applied to the rest. In its own words, headwords only:
- "Documentation before credits." A test is for what the documentation does not settle.
- "One variable per test." Same card text, same seed where the UI allows, one thing changed. Two arms, not four.
- "Shortest duration and lowest resolution that still shows the beat." On our tool at 720p: 6 s cost 27, 11 s cost 50 (LESSONS.md:18).
- "Free arms first." Test a hypothesis on the near-free tool before the 50-credit one.
- "Preflight the references before the spend." Fixing a reference cost 2; finding it after a take cost 50 (LESSONS.md:25).
- "Read every take five ways before the Director does": contact sheet, two-timestamp crops, 6 fps strip, 12 fps first-second track, transcript.
- "Defect → rule → source." Fix the source, sweep the cards, then generate.
- "Ledger every job" with settings, the price read from the button, the file id, and the read. Duplicate clicks and silent hangs are logged as such.
The spend loop
fence written → price read at the button (zoom, screenshot) → ONE click → a "Generating" tile or a new job id in the API → ledger row (queued, price) → result read five ways → ledger row (read, actual charge from the account)
Three ledger rows show why each step exists (production/phase3/ledger.csv):
- Row 3, 5A take 2, 27 credits: "UNPLANNED duplicate: first Generate click submitted silently (no toast seen)"; the re-click "started a second identical job". Step 4 exists because of this row.
- Row 217, 6M take 1: "the GENERATE click did nothing three times (no request left the page), cmd+Return in the prompt box submitted". Step 4 again, from the other side: verify a job exists, not that a button was pressed.
- Row 225, 6A take 1, 32 credits, status
queued-BY-MISTAKE: "a click aimed at the sound On/Off toggle landed on the lower edge of the GENERATE button and submitted at the slider's interim 7 s with sound On and NO Audio 1 attached". Step 1 exists because the fence had said 5 s, sound off, audio attached; the job that ran matched none of it, and the fence is how anyone knew.
The price is read at the button because the button is where the tool commits: ours showed a struck list price and a discounted one ("30 struck → 23"), and the account was charged a third number (22.5; row 589). The ledger carries the read price on the queued row and the account's charge on the read row.
Reading a result with valid evidence
A read is a measurement with a file, and a measurement can be invalid. Our own gate tool printed PASS on an empty measurement (LESSONS.md:128: "media.sh firstsec can print PASS when the colour mask is empty and drift is NaN … This is invalid measurement, never evidence of a passed gate"). The fix was not to the tool first; it was to the rule: a read that did not measure the thing claimed is unverified, and unverified blocks.
6.3 Case 6-A — the gate that passed on nothing
- What I saw: ledger row 326, 4F take 1: "Firstsec NaN invalid despite printed PASS. Mouth early; audio onset 1.124785." The first-second drift check had printed PASS. The colour mask it tracks (a saffron bodice) found no pixels in this shot, so drift was NaN, and NaN compared with the 5 px threshold is never greater, so the script printed PASS.
- Why I think so: tools/media.sh:184 writes
float('nan')on an empty mask and line 193 tests> 5; a comparison with NaN is false. Confirmed on take 4F take1_v12 (LESSONS.md:128). - What I changed: the reading rule (a PASS with no pixel count behind it is unverified) and, later, the ledger status
done-OFF-CARDfor reads that measured the wrong thing. - Would this happen on your tool? Yes, on any script you or the agent writes: a gate that cannot fail is not a gate. Ask every measurement "what would this print if the input were empty?" before trusting its PASS.
6.4 Do it with your tools
| Method | We used | Any tool | If yours lacks it |
|---|---|---|---|
| Price visible before the click | the composer's GENERATE button, zoom-read | any UI or API that quotes before commit | compute from the rate card and ledger it as computed, not read |
| Proof a job exists | a "Generating" tile, then the jobs API id | any job list, email receipt, or account history | wait for the account balance to change before any second click |
| Actual charge | account API balance before and after | any account page | the read row says "charge not readable"; never copy the quoted price into it |
| Cheapest arm | 2-credit image edits, 0.15-credit voice lines | your tool's cheapest job type | run the experiment as words on paper with the second reader first |
| Reading five ways | ffmpeg strips and sheets, whisper | same, free everywhere | — |
6.5 Your turn
Time cap: one evening for the sheet, one hour for the loop. Spend: the cheapest still on your tool, once (you priced it in Chapter 2).
- Fill the worksheet (Appendix C has the columns; DESIGN §8 the arithmetic). One row per job type. For video rows use your Chapter 5 shotlist: cards × (1 + assumed extra attempts per card) within the tier budget, running time + handles, × rate; then usable seconds = kept seconds × (1 − trim loss of kept takes). Use our numbers as a first guess, write "assumed from HALFWAY" beside each, and do not use both our 71 % and an attempts figure on the same row (DESIGN §8 says why). Check Σ usable ≥ your runtime floor + margin.
- Set the take budget per tier and write it on every planning card: turn shots 3, dialogue singles 2, inserts and plates 1. Set the stop threshold in credits and ledger it as a decision.
- Run the loop once on your film's first still (a location plate or a character sheet you will need anyway): fence, price read, one click, proof it queued, queued row, read five ways (for a still:
media.sh imgsize, aspect, mean luma, palette; a crop of the face or the prop), read row with the actual charge. - Break a gate on purpose. For each check the agent wrote in step 3, name the input that should make it fail (a zero-byte file for the probe; a frame with none of the colour it tracks for a mask check; a silent file for a transcript) and run it. A check that prints PASS on the input that should fail it is unverified until fixed. A check that legitimately passes (a black frame has a size and an aspect) is not the target. Ledger each check, its failing input, and what it printed.
6.6 Gate
Each line needs valid evidence per DESIGN §5; outcomes are pass / fail / unverified, and unverified blocks.
- The worksheet exists with every job type your shotlist implies, handles and trim loss on video rows, and a stop threshold (evidence: the sheet; the threshold's ledger row).
- Every planning card carries its tier and take budget (evidence: the cards).
- One complete loop is in the ledger: fence file, queued row with the read price, read row with the actual charge, and the five-way read files (evidence: the rows and files).
- Performance task: for each check, a named failing input was run and the check failed, or the check is marked unverified (evidence: the ledger rows with each check's input and output).
- The agent's report on the still used the three-line format; the judgment on whether the still is usable is yours, by name (evidence: the report).
Pass example from HALFWAY: ledger row 571, the 5C retake: fence verified, "GENERATE zoom read 30 → 23. One Cmd+Return", job id, then row 572's read with the strip named. Fail example: row 225, the job submitted by a mis-aimed click at settings the fence did not say.