- Status: accepted 2026-12-03, by Alessandro Prandini, the way recommended (§6): (c). Proposed the same day by the session that wrote it, at his request (P-1760). The two questions Not decided here left to the code are ruled there, dated, with the construction (P-1762). Built in one pull request
- Shipped: 1.5.0
- Date: 2026-12-03
- Opens: under the recommended way, one line on standard error where a
suite.pyis slow to load, and a pointer to it where a suite is first written. NoSCHEMA_VERSION, noOUTPUT_VERSIONand noconfig_hashmoves. Under (a), a second shape of target; under (b), a substitute target inside the host (§3, §4) - Amends: nothing. Under (a) it would amend ADR 0022 §4, whose host "computes it from the target" already built; under (b), §5, whose check it would empty (§4)
- Assumes: ADR 0005 §1,
§3 and §6 (a target's configuration is asked for, recorded beside the hash
and not in it); ADR 0022 §3 to §5 (the
declared price is the only part of a target that enters
config_hash, andpromote,viewandrejudgecompute it from the target); ADR 0052 decision 1 (a suite loaded again reads its application again); theTargetcontract indocs/api.md(any callableCase -> Response, withconfig,preflight,price_digestandartifactsasked for, never required) - Touches, in
CLAUDE.md's fixed section: nothing, under any way. Decision 1 (one engine, two drivers) and decision 7 (the core accepts a single response) are about the assertions and the driver, and no way here touches either - Number: 0071. Swept on 2026-12-03 across
origin/main(d2fa5547), every branch on the remote (twenty-six), every worktree of this repository and the open pull requests (two, Dependabot's). The highest number taken anywhere is 0070 - Owed: the three lines on digline.dev that every new record needs
Context¶
One friction, from a hand-written multi-turn agent in Python with a suite of
its own. Its suite.py builds the target at import: an index read with an
embedding model of more than a gigabyte, and a request over the network. The
size and the request are as reported by whoever ran it; neither was measured
here. Every command that reads the suite paid for them, including the ones
that never ask the target anything.
What was measured, at d2fa5547. Two costs are mixed in that sentence,
and they are paid in different places.
- The import.
load_suiteimports asuite.py(src/digline/host/loader.py), and an import runs the module's top level. Every command that takes--suitedoes it:run,rejudge,compare,diff,list,promote,delete,register,migrate,explain,log,reportandview, andwhere,suggestandrecordwhere--suitenames a suite. Whatever the top level builds, every one of them builds. digline does not construct anything here: the module does. - Reading the target. Four commands ask for the target after the
import.
runcalls it.rejudge,promote(and its check, inviewandpromote) andviewread it only for its declared price, throughpricing_for(src/digline/host/promotion.py), because ADR 0022 §4 and §5 put the declared price inconfig_hashand have these commands compute the hash they check. Reading it is picking the attributetargetfrom the module already imported, thencheck_target, which readspreflight,price_digestandconfigif the target declares them. No command calls the target exceptrun, and arejudgereplays stored answers.compare,diff,list,delete,register,migrate,explain,logandreportnever ask for the target at all.
So the brief that asked for this record is right about the cost and wrong about where it is paid. In each of those nine commands it is paid by point 1, the import, before digline reaches the target. No contract on the target can spare it while the top level builds the index.
Over MCP it is paid on every call. Each tool of digline-mcp, the reading
ones included, opens the suite through load_suite, and ADR 0052 takes the
previous suite's modules out of the process before each load, so the
application is read again. A compare asked three times builds the index
three times.
The cure is already written, and it is hard to find. docs/api.md, in
suite.py runs whenever a command reads the suite, says that every command
executes the module, and shows the remedy: build the expensive part at the
target's first call, behind functools.cache, so that only the commands that
call the target pay for it. It landed on 2026-11-30 (0929800c), on main
and in no release tag. Nothing on the path a person takes to write a first
suite points to it: neither docs/guide.md nor docs/proposing-a-suite.md
says it. And nothing a command prints tells a person that the load took long.
The brief cites the same remedy as written in "L11". No record of that name
was found in this repository or in the working notes, as ADR 0070 already
found, so this record rests on the paragraph in docs/api.md.
What config_hash takes from the target. Only the declared price digest:
Suite.config_hash(pricing=…), where price_digest_of reads
target.price_digest if the target declares one (DeclaresPrice), and ""
otherwise. A plain function declares none. A ProviderTarget declares one
only where the suite declared a price, and building it costs nothing,
because the plugins create their clients at the first call (ADR 0022 §4).
The configuration a target reports goes beside the hash and never into it
(ADR 0005 §3).
Decision¶
1. What every way has to answer¶
For each way, this record says:
- what changes in ADR 0005 (the target's configuration) and in ADR 0022
(the declared price in
config_hash). The brief named ADR 0014 and ADR 0017 forconfig_hash. 0014 rules what may ride a schema bump and 0017 the journal; the price in the hash is 0022's, and that is the one read here; - the
Targetcontract indocs/api.md, and the plugins; - a
suite.toml; digline-mcpandpytest-digline;- compatibility: a suite that runs today must run unchanged;
- whether it spares the cost the friction is about, measured above;
- the cost in pull requests.
2. (a) A target built when it is first needed, by contract¶
A suite may declare its target as something digline builds only when a command needs the target itself, and not as the target already built.
The shape cannot be "a callable" or "a class". A target is already any
callable Case -> Response, and a class is callable: target = Agent today
is called as Agent(case). So the factory needs a declaration of its own, a
wrapper digline ships, say target = built_on_first_call(make_agent,
pricing=…), or an attribute of another name. The spelling would be the
code's.
- ADR 0022. The price digest is needed by
promote,viewandrejudge, which must not build the target. So the price is declared statically, on the wrapper, andprice_digest_ofreads it there. A suite whose target declares a price today, from the instance, keeps it: an instance stays a valid target. A factory whose product declares a price the wrapper does not would make two prices, and has to be refused when the product is built. - ADR 0005.
configis read from the built target, as now, byexecutebefore the first call and after the last.check_target, called as the target is picked so thatpromote --targetrefuses a malformed one without running it (#423), cannot see the product's members without building it. For a factory, those shapes would be refused atrunonly. - The contract and the plugins.
docs/api.mdgains a second shape of target.ProviderTargetand the plugins do not change: they are cheap to build already. - A
suite.toml: nothing. Its target is data, built at load, and cheap. - MCP and pytest: the same loader, so the same behaviour. The MCP
runtool builds the target on each call, as it builds the application on each call today (ADR 0052). - Compatibility. A minor: a new shape is accepted, and nothing that loads today is refused.
- Does it spare the cost? Only where the author also moves the building
out of the module's top level, into the factory. That move is exactly the
remedy
docs/api.mdalready gives, and it spares the cost without (a). (a) makes the remedy a declared shape. It does not make it happen. - Cost. Two pull requests: the wrapper, the loader, the static price and its refusal, with a test and a mutation for each; then the docs.
3. (b) A substitute target for the commands that do not measure¶
The commands that do not call the target load the suite with a stand-in
that answers only for configuration and price. Where the command has a run,
config_hash is taken from the run.
- Does it spare the cost? No. The cost is in the import, and a
suite.pyis the module that constructs theSuite. A stand-in for the target cannot be put in place before the module's top level has run, because the module is what defines the target. The nine commands that do not read the target already use none (Context, point 2), and would gain nothing. - ADR 0022 §5. Taking the hash from the run empties the check it exists
for.
promotecomputes the suite's hash today and compares it with the run's, so that a run made under other rules, or against another target, is refused as a configuration mismatch. A hash read from the run always matches the run. §5's defect would come back: a multi-target suite could sign a run of one system as the reference for another. - ADR 0005, the contract, the plugins, a
suite.toml, MCP, pytest: nothing that a reader of the contract would see. - Compatibility. Nothing is refused. Every promotion check whose answer depends on the declared price would change meaning, without a word.
- Cost. One pull request, and one ruling of ADR 0022 undone.
4. (c) Nothing new in the contract: the remedy said where it is met¶
The contract stays as it is: a target is the callable, built by the module. What changes is where a person meets the remedy, and when.
- Where. The pages where a suite is first written point to the
paragraph of
docs/api.md:docs/guide.md, where the firstsuite.pyis shown, anddocs/proposing-a-suite.mdwith the skill it describes, which writes suites for a person who does not know how. - When, the one piece of code. Ruled 2026-12-03, with the
construction (P-1762): every command that loads the suite and does not
call the target says it,
rejudge,promoteandviewamong them, and the import of the module--targetnames is timed the same way. The line readssuite.py took N s to import, and this command never calls the target; build it on first call (see <the page>), with the module's name and the paragraph ofdocs/api.mdas its address. Loading asuite.pyis timed, with a duration and not a clock, aslatency_msis. Where the import took longer than a threshold the code fixes, on a command that does not call the target, the command says so on standard error, once. For example:suite.py took 38.2 s to load, and this command does not call the target: whatever its top level builds, every command builds. Build it at the first call (docs/api.md). The sentence names the file and the duration, never what the module did, which digline cannot see. No document carries it. - ADR 0005, ADR 0022: nothing. The price is read as today, from a target
the module built. Under the remedy, a target built at its first call is a
function that declares no price, and
pricing_forbuilds nothing. - The contract and the plugins: nothing. The paragraph in
docs/api.mdstays where it is. - A
suite.toml: nothing, and no line: its load is a read of data. - MCP: the line goes to standard error, which the client keeps in its log. ADR 0052 makes every call reload the suite, so the line would repeat on every call. Printed once per process, or not at all there, is for the code to say.
- pytest-digline: the line beside the plan it already prints.
Ruled 2026-12-03, with the construction (P-1762): a session that only
compares says it; one with
--digline-runcalls the target and does not. - Compatibility. A patch: a line on standard error that 1.4 does not print. Nothing is refused, and no output a program reads moves.
- Does it spare the cost? Only where the author applies the remedy, as with (a). It is the one way that tells them, at the moment they pay.
- Cost. One pull request: the timing, the line, the two pointers, and a
test with a mutation for the line and for its absence on
run.
5. Found while measuring: what none of the three can do¶
The cost the friction names is spent by the user's code, at the user's top
level, before digline holds anything it could make lazy. Under every way, a
suite.py that builds an index at import builds it on digline list. Only
its author can move that, and the remedy is the same under (a) and (c):
build at the first call. What the ways differ on is whether digline gives
the remedy a declared shape (a), changes what a promotion checks to avoid a
cost it does not avoid (b), or says the remedy where and when it is needed
(c).
6. Recommended: (c)¶
Because only the author can spare the cost, and (c) is the way that tells
them. (a) asks the author to do what docs/api.md already shows, and adds
a second shape of target to the contract, a static price beside the
instance's, and a refusal for when the two disagree. It also costs #423's
check of a target's shape on every command that does not run. (b) does not
reach the import, where the cost is, and to save the price lookup it
reverses ADR 0022 §5, a correction made because a promotion could sign the
wrong system.
(c) costs one line and two pointers. It leaves every contract where it is, and it puts the remedy in front of a person at the two moments that matter: when they first write a suite, and when a command they did not expect to be slow was slow. If the remedy turns out not to be enough, (a) can still be added later, and nothing (c) does stands in its way.
What it costs, said beside the recommendation: a threshold, which is a number somebody chose, and a line a person may read as noise on a machine where a slow load is not the suite's fault. The line names the duration, so a reader can judge it.
Consequences¶
- Accepted as recommended, one pull request.
- Under every way, the paragraph in
docs/api.mdstays, and it is the remedy. - Under (a), the
Targetcontract indocs/api.mdgains a second shape, and ADR 0022 §4 a note on where a factory's price is read.
Not decided here¶
- ~~The threshold under (c), and whether the MCP server prints the line.
Both are the code's to fix and to say.~~ Ruled 2026-12-03, with the
construction (P-1762). Five seconds,
SLOW_IMPORT_SECONDSinsrc/digline/host/loader.py: well above what importing an application and its SDKs costs, and well below an index read with a model of its own, which is the case the line exists for. The MCP server prints it once per process, through its logger on standard error, which the client keeps in its log, the first time a tool that does not call the target loads a slow suite; never in a tool's answer. Every call reloads the suite (ADR 0052), and a line per call would repeat one fact into the log. - A suite whose module must do expensive work at import for another
reason, a service it starts for its own target to talk to, as
examples/langchain4j/suite.pydoes on purpose. The line under (c) would name it too. It says what happened, not that it was wrong.