Skip to content
digline
ADR 0073 — The cost of a series of runs

ADR 0073 — The cost of a series of runs

  • Status: accepted 2026-12-03, by Alessandro Prandini, the way recommended (§6): (a). Proposed the same day by the session that wrote it, at his request (P-1767), and accepted with the brief of its construction (P-1768), which keeps every item marked decided here and changes one thing §3 said: MCP's run takes series and max_cost_series, read through ADR 0011 §2's probe, where §3 said it takes neither (noted in §3). Built in two pull requests, as §3's Cost plans: the name, the sum and the ceiling in the first; the reading in where, explain and the state page, and the documentation, in the second. Noted at the second, 2026-12-03: every way this record names is built, in the form noted in §3
  • Shipped: 1.5.0
  • Date: 2026-12-03
  • Opens: under the recommended way, two options on digline run, --series NAME and --max-cost-series USD, and a reading of a series' spend in where, explain and digline view's state page, with added keys under OUTPUT_VERSION 6. No SCHEMA_VERSION: the name is written in Run.metadata, which --meta already writes. No config_hash moves. Under (b), the reading alone; under (c), nothing
  • Amends, under the recommended way, by a dated note beside the place it amends, the text kept as written: ADR 0064 §2, which gains a second ceiling that it reduces to: the run's own, set to what the series has left
  • Assumes: fixed decision 4, "Cost and latency are budgets, not metrics. A declared ceiling fails the run."; ADR 0064 §1 and §2 (the estimate, and the ceiling read after each case, exit 2 where it stops a run); ADR 0017 (the journal, and a run that did not finish writes no document); ADR 0025 (a run's bill, the target's line and the judges')
  • Touches, in CLAUDE.md's fixed section: decision 4, which the recommended way applies to a series and does not change. Decision 5: no way here makes a call nobody configured
  • Number: 0073, and ADR 0074 beside it in the same pull request: the brief asked one record if the two questions fit in one, and they do not. This one is about the spend of a suite's runs, read from the store; that one about the reviewed answers in a cases file, read against the recordings. They share no object, no option and no ruling, and one may be accepted without the other. Swept on 2026-12-03 across origin/main (00864f3f), every branch on the remote (seventeen), every worktree of this repository and the open pull requests (two, Dependabot's). The highest number taken anywhere was 0072
  • Owed: the three lines on digline.dev that every new record needs

Context

One friction, from a Java application with a judged suite. Three runs of the suite to reach a comparison where nothing got worse cost 5.15 USD in all, each run under --max-cost 6. The figures are as the brief reports them; they were not measured here. --max-cost and the estimate are about one run (ADR 0064 §1, §2): nothing adds up the runs a person makes toward one measurement, and nothing stops the fourth because of what the first three spent.

What was measured, at 00864f3f.

  1. The bill is in every run that finished. A run's spend, the target's line and the judges', is recorded on the document (ADR 0025), and the estimate reads it from the newest run (src/digline/host/estimate.py). Summing several runs' bills needs nothing the documents do not hold.
  2. A run that did not finish leaves no bill in the store. A run stopped by --max-cost, or one that crashed, writes no document (ADR 0064 §2); its spend is in its journal, as Pending.spent, and only for the target's calls. The journal's header, JournalHeader in src/digline/store/protocol.py, records the tenant, the suite, the configuration, the commit and the times, and no run metadata. So a sum read from the store under-reads every run that did not finish, and an unfinished run cannot be told to belong to any series but the suite.
  3. A run already carries a name a person gives it. digline run --meta KEY=VALUE, repeatable, writes Run.metadata; the driver's docstring says it "describes this launch", and nothing in it travels across a boundary unless the suite's Disclosure names it. A series can be named today as --meta series=NAME, and read back by nobody.
  4. The commit is a weak series. Run.git_commit is the head's SHA, with -dirty appended where the tree has changes (src/digline/host/environment.py). Three rounds that edit a prompt without committing share one <sha>-dirty, which every other uncommitted edit on that head shares too; three rounds that commit between them are three series.

Decision

1. What every way has to answer

  1. What a series is, and who says which runs belong to it.
  2. Where its spend is read, and what the reading cannot see.
  3. Whether a ceiling over it exists, and its exit code.
  4. What changes in ADR 0064.
  5. Schema, wire, projection, MCP.
  6. Compatibility, and the cost in pull requests.

2. What a series is: three candidates

  • By name, --series NAME, written in Run.metadata under the key series. The person says which runs belong together, on the command line of each. It costs typing the name each time; a run without it belongs to no series.
  • By commit. Nothing to type, and wrong in both directions (Context, point 4).
  • By a declared window, the suite's runs since TIME. Nothing written on the runs; the window is an argument of every reading, and a ceiling over a window needs the window on every run.

Decided here: by name. It is the only one that says what the person means, and it costs no key: --series NAME is --meta series=NAME with a name of its own, and a run given both with different values is refused.

3. (a) A reading of a series' spend, and a ceiling over it

The reading. where, explain and digline view's state page say, for the series of the newest run, "series prompt-v3: 3 runs, 5.1500 USD measured, the target's calls and the judges' together", with the same two qualifications the estimate makes: "at least: a run of it did not price every call" where one did not, and "the runs that did not finish are not counted" where the suite has an unfinished journal (Context, point 2). where --json and explain --json carry it as an added key, series: {name, runs, usd, every_cost_known}, null where the newest run names none. Read from the store, beside the run documents, and written in none.

Noted at the second pull request, 2026-12-03: built with three differences, each a reading of this paragraph and none a change of way. explain reads the series of the run it explains, which is the newest one under --run latest, since a reading of one run that summed another's series would be read as this run's. The key carries a fifth field, unfinished_runs, the count the second qualification states, so a program is told what the sentence tells a person. And the sentence says that count: "1 run of this suite did not finish, and a run that did not finish is not counted". Under MCP's --names project the key is null, as §3's Projection says a projected run names no series.

The ceiling. digline run --series NAME --max-cost-series USD:

  • before the first call, the spend of the series' stored runs is summed. At or above USD, the run is refused with the sum and the runs it read: "series prompt-v3 has spent 5.1500 USD over 3 runs, at or above its ceiling of 5.0000 USD: nothing was called";
  • otherwise the run gets the series' remainder as its own --max-cost, the smaller of the two where both are given. During the run nothing new is read: ADR 0064 §2 stops it after the case that crosses, exit 2, and its sentence names the series and the remainder.

The exit before the first call. The brief asks exit 2, "as ADR 0064". ADR 0064 §2 gives 2 to a run it stopped, "the request was taken, and the run did not judge every case it declares", and says why not 64: "64 ... is the CLI refusing a request it never acted on". A run refused before its first call is that: nothing was called and no case was judged or not. Decided here: 64 before the first call, 2 during, each by ADR 0064's own definition. The alternative, 2 before as well, would make a pipeline unable to tell the series is spent from this run stopped halfway.

  • --max-cost-series without --series is refused: there is nothing to sum.
  • What it cannot see, said beside the claim: the runs of the series that did not finish (Context, point 2), and on a resumed run the judges' spend of the earlier legs, which ADR 0064 §2 already names. A ceiling over a series reads at least what the series spent, never more. Writing the series into the journal's header would let it see the first; that is a change to the journal's format (ADR 0017) and is not decided here. Noted at the first pull request, 2026-12-03: the series is the one --series names or --meta series=NAME names, since the two write the same key, so --max-cost-series is refused only where neither does; a name --meta gives under that key is held to the same rule as one --series gives. The refusal before the first call says what is left beside what was spent and the ceiling, never below nothing.
  • ADR 0064: §2 takes a dated note. The ceiling is the same ceiling, read the same way, set from a sum instead of typed; §1's estimate is unchanged and is never compared with either.
  • Schema: nothing. Run.metadata exists, and a run written before this is in no series. Wire: the series key on where and explain, an added key under OUTPUT_VERSION 6; the refusal's sentence on standard error. Projection: Run.metadata does not cross unless a Disclosure names it and a projected document drops it, so a served or projected run names no series, and the reading is the store's owner's alone. MCP: its run takes no ceiling (ADR 0064, Not decided here), and takes no series either; its where and explain carry the key. Noted at acceptance, 2026-12-03 (P-1768): the brief that accepted this record gives MCP's run both, as series and max_cost_series, read through ADR 0011 §2's probe: before the count is asked the series is added up, a series already spent is refused there and nothing is called, and otherwise the probe's refusal says the series' sentence after the plan, so the count is typed back knowing what is left. The run carries the sentence in notes, as digline run --json does, and a stop during it is refused with ADR 0064's sentence and the series'. run still takes no max_cost of its own (ADR 0064, Not decided here).
  • Compatibility: a minor. Two options, an added key, a refusal that exists only where the new option is given.
  • Cost: two pull requests: the name, the sum and the ceiling, with a test and a mutation for the refusal, the remainder and the exit codes; then the reading in the three front ends and the docs.

4. (b) The reading alone

§3's reading, without the ceiling, and with the series still named by --series, since a reading needs something to read.

  • ADR 0064: nothing. Schema, projection, MCP: as §3.
  • Exit codes: none.
  • Cost: one pull request.
  • What it leaves: a series is a figure a person reads and nothing stops. That is a metric where fixed decision 4 asks for a budget.

5. (c) Nothing: document --meta series=NAME

The guide says to name the runs of a series with --meta series=NAME and to sum their bills from the run documents in .digline/<tenant>/runs/, by hand or with a script: digline list prints no bill and has no --json.

  • Everything: nothing changes.
  • What it leaves: the sum by hand, and no ceiling.
  • Cost: one pull request of text.

Because a series is spent like a run, and fixed decision 4 makes a run's spend a budget, not a figure. (b) gives the figure and stops nothing, which is exactly the friction: the three rounds were each under their own ceiling, and what nobody could say was stop at 6 in all. (a) costs little more than (b): the ceiling it adds is ADR 0064's, set to a remainder, so it stops a run where ADR 0064 already stops one and says so in the sentence ADR 0064 already says.

What it costs, said beside the recommendation:

  • A name typed on every run of the series. Forgotten once, that run is in no series and its spend is outside the ceiling.
  • It under-reads the runs that did not finish, until the journal carries the series. A person stopped by --max-cost and starting again from scratch spends what the stopped run spent, outside the sum.
  • It is a person's budget, not a control. digline delete removes a run, and its spend with it. That is the person's own ceiling, lowered by the person.

Consequences

  • Accepted as recommended, two pull requests; ADR 0064 §2 takes a note.
  • A run's metadata gains a key digline reads, series, beside the ones a person writes with --meta.

Not decided here

  • The series in the journal's header, so a ceiling sees the runs that did not finish (ADR 0017).
  • A series ceiling a suite declares, beside the one a command line passes, as ADR 0064 left the run's.
  • rejudge in a series. It spends the judges' calls and writes a run document whose judges' line is real (ADR 0025, on a replay's bill), so its runs are summed where they carry the name; whether it takes --series and --max-cost-series is the code's to say with the first pull request. Said by the first pull request, 2026-12-03: it takes neither. Its --meta series=NAME names a series, and its run is then summed with the series' others; a ceiling over a rejudge is left for when somebody asks.