Skip to content
プロジェクト

Shyboy0499/precondition-library

GitHubで見る

概要

Gitのメンテナンス作業を再利用可能なプログラムにコンパイルし、作業が見覚えのあるものか推測するのではなく、チェックを実行して再生するかどうかを判断するエージェントです。

科学・工学

この数値の測り方

計測したスター増加

24時間
+11
7日間
+63
15日間
+133
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

precondition-library
Does deciding what to replay by running checks beat deciding by similarity?
A benchmark for an open measurement in skill reuse: which replay decision mis-fires less.

MIT License Status: the rarely-mis-fires claim is falsified on real merges Python 3.12+ Paper DOI 10.5281/zenodo.24544472 Dataset DOI 10.5281/zenodo.24544756

Use it: lockmerge

lockmerge is the practical tool this research produced. It is a git merge driver that resolves package-lock.json and composer.lock conflicts package by package, and refuses, naming the packages, whenever a merge would not be safe.

pipx install "git+https://github.com/Shyboy0499/precondition-library#subdirectory=lockmerge"
lockmerge install        # in your repository; lock-file conflicts now merge themselves when safe

We replayed it on 895 real conflicts from 68 projects. It merged 17% of npm conflicts and 36% of Composer ones (once composer.json was merged). Every merge it made passed npm's or Composer's lock-file consistency rules, checked offline, except where the maintainer's own committed file failed them too. It declined the rest, mostly cases where both branches moved the same package to different versions (measurements).

Dataset. datasets/lockfile-conflicts/ holds 1,559 real lock-file merge conflicts from 109 open-source repositories, across npm, Composer, Yarn, pnpm, Bundler, Cargo, Poetry, Pipenv and uv. Each is given by its commits and labelled by what the maintainer committed. Use it to test any tool, rule or AI agent that resolves lock-file conflicts.

How to cite

  • The paper: Executable Preconditions versus Text Similarity for Replaying Compiled Agent Programs: A Pre-registered Test on Real Lock-file Merges (preprint, Zenodo, 2026), doi:10.5281/zenodo.24544472.
  • The dataset: Real lock-file merge conflicts, labelled by what maintainers committed (Zenodo, 2026), doi:10.5281/zenodo.24544756.

Each record's Zenodo page gives the full citation in any style, BibTeX included (the Citation and Export boxes).

In plain language

This library tests two ways to decide whether a saved fix should run: inspect the repository, or choose the fix whose description sounds most similar. On states made by this project, the checks chose the wrong fix 0 times in 563 attempts; three text methods were wrong on 71–90% of their attempts. On new generated names, paths and history shapes, the checks chose wrongly 42 of the 581 times they acted, all involving a file name with a space or a non-ASCII character. In the 22 libraries built since the instructions were changed to handle such names, that mistake is gone; one library still acted wrongly 20 times in 403, because it recognised lock files only by a fixed list of names. On 274 real lock-file merges, graded by what each maintainer committed, the checks were wrong on 8–54% of their attempts, depending on the library. That is still less often than text similarity when both acted equally often, but mostly because the checks chose a plain merge where there was no conflict; on the real conflicts, every method was almost always wrong. This does not yet measure complete task runs.

Read as sets of packages rather than lines, those conflicts look different. In four more studies, each registered before its data and run on 92 repositories this project had never mined:

  • A merge computed from the conflict's three sides reproduces the maintainer's lock file on about two conflicts in three.
  • A check that fires that merge only when no package changed differently on both sides roughly halves its error, but it is still wrong about a third of the time.
  • Adding the ecosystem's own consistency check widens what can be resolved, at about the same error. Much of that gain disappears once the check cannot see the maintainer's resolved manifests.

Is declining what sets the checks apart? Study 2, registered before its data, built the library 20 times and tested every build on 209 new real merges:

  • How often a build declines a conflict no fix can resolve depends on the build. Under the usual build rules, ten builds acted on anywhere from 1% to 100% of those conflicts.
  • Requiring builds to decline known examples works: they then acted on 0–6% of them.
  • But a simple model that reads the repository's state, taught the same examples, declined about as often and got more ordinary merges right. Running checks did not beat reading the state, which was the study's main question.

Read Results graded outside this project, Primary result, Held-out states, Running it, and the issue tracker.

Status: measured on real merges, where the near-zero mis-fire rate does not hold. Results here come in two tiers, named by what grades them (#300).

Graded outside this project. On 274 real lock-file merges from 11 public repositories, labelled by what each maintainer committed and pre-registered before the data was seen, precondition dispatch mis-fired on 62 of 150, 10 of 122 and 132 of 244 fires across the three libraries. So the registered claim that it rarely mis-fires is falsified on real merges (ADR-0052). It still mis-fired less than text similarity at matched coverage in every library, but almost all of that margin is merge fired on merges that had no conflict. On real lock-file conflicts every dispatcher is almost always wrong: precondition dispatch was right on 1 of 177 fires there. Maintainers regenerate or hand-edit lock files, which none of this project's resolutions does: they express 1 of 161 conflicts. See Results graded outside this project.

Studies 3–6 then read lock-file conflicts as package sets, on 92 more repositories, each registered before its data.

  • A computed merge reproduces the maintainer on 0.64–0.76 of conflicts.
  • Gating it on "no package diverges" roughly halves its error, to about 0.30.
  • The ecosystem's own check widens coverage without making it rarely wrong.

Each figure is in What survived an external test.

An LLM reading the state (#295 item 2) mis-fires on 5–17% of its fires at matched coverage, against text scorers' 71–81% and arm 3's 0%, on the two libraries where it is a usable baseline (LLM judge).

With a sixth family outside git history and a second compiling model (#266), precondition dispatch still mis-fired on none of its fires (0/215 and 0/238), one build each (six-family replicates).

Study 2 (#307, registered before its data) tested 20 builds on 209 real merges from 8 repositories. Its primary hypothesis was not supported: a state reader taught the same refusal evidence declines inexpressible conflicts about as often as the refusal-tested builds, 0.083 against 0.023 fired, interval [−0.009, +0.153], and is right on more clean merges. Under the current admission, the 10 builds fire on anywhere from 1% to 100% of those conflicts. Refusal-tested admission makes every build decline, at a cost on clean merges that this size cannot resolve (study 2).

Unseen lock-file paths on the 22 libraries built since the compile prompt asked for -z: 20 of 403 fires wrong, all one library whose check knows lock files only by name. A test at six new paths finds one more such program, which the held-out paths could not reach (held-out, unseen paths, exploratory).

Graded by this project's own labels. On states its own injectors build, judged by its own rules, precondition dispatch mis-fired on 0 of 563 fires, against text similarity's 71–90% across three scorers (Primary result). These figures show that the dispatchers agree, or not, with rules this project wrote. They are not evidence about states it did not make, and on the one external test the near-zero rate did not carry over.

Nothing at episode level is measured yet: not the frozen benchmark, the admission factorial or the online arms. An earlier smoke pass, First demonstration, is kept as the record of the mechanism, not of the claim. The apparatus's suite is green in CI.

Per-module status is deliberately not restated below, because prose that describes the code drifts the moment the code moves (CONTRIBUTING rule 5). Every stub and every skipped test is declared and asserted against the code in tests/meta/test_declared_state.py, and what is outstanding is in the issue tracker. Those are the places to look for what is done.

The design was reframed on 2026-09-13 after a prior-art sweep and a hostile method review. The reasoning, and the claims that were dropped, are recorded in docs/decisions/ADR-0001-reframe-after-prior-art.md.

What this is not

Stated first, because the prior art is real and the honest framing depends on it:

Not claimed Because
That compiling a task into a persistent program and replaying it without an LLM is novel Already published: PreAct, SkillDroid, and Auto each compile a trace and replay it cheaply or with no per-step LLM calls (see Prior work).
That dispatching a cached plan by testing executable preconditions is a new mechanism It is MACROPS, 1972: a cached generalized plan is dispatched by testing precondition kernels against live state, with an explicit replan fallback.
That "the most similar case is not the most reusable" is a new insight Smyth & Keane argued it in 1998, in a peer-reviewed journal, at length.
That these token counts are a cost They are tokens; no run computes money, because the provider's rates differ by peak and off-peak hours. The provider's own dashboard puts the whole programme from 20 October to 18 November at CNY 95.49. That includes study 2's 20 builds at about CNY 49, an estimate, since the dashboard splits spend only by model and day (API cost).
That executing checks declines unfamiliar states better than reading them Study 2's primary hypothesis was not supported: a state reader given the same refusal evidence declined about as often and was right on more clean merges (study 2).
That precondition dispatch rarely mis-fires On this project's own states it did not mis-fire (0 of 563). On real lock-file merges, graded by maintainers, it mis-fired on 8–54% of its fires depending on the library, and the registered claim is falsified there (Results graded outside this project, ADR-0052).
That an episode-level comparison has been made Only the pair-level primary metric has been measured (Primary result). The frozen benchmark, the admission factorial and the online arms have not been run at scale; the one smoke pass that ran them (First demonstration) demonstrates the mechanism and measures nothing.
That no text scorer could close the gap Three were measured on the same three libraries: the shipped lexical arm (ADR-0003), the pinned embedding arm (#104) and a pinned local reranker, the strongest of thirteen models screened on arm 2's floor (lower bounds 0.571 and 0.508 against chance 0.333, where the other two only just clear it). The reranker narrows the gap to +0.71 to +0.76, from lexical +0.76 to +0.81, and no further. That is a screen of local models, not a search. A scorer reading the state through an LLM call (ADR-0034) narrows it to +0.05 to +0.17 on the two libraries where it clears the floor, and arm 3 still mis-fires less, in both of two repeats (LLM judge). That is one model and one prompt, not every judge.

Amortization is still what makes the project useful — it is an engineering assumption here, not a finding. It is reported as a cost model, never as a contribution.

The open question

The mechanism is old. The measurement is not. No confirmed work runs this head-to-head:

At matched dispatch coverage, does executable-precondition dispatch mis-fire less often than text-similarity dispatch — where a mis-fire is a program that fires, claims it succeeded, and did not?

Two published results bracket the question without answering it — one deployed gate and one benchmark:

  • A production deterministic executability gate removes 59.4% of matched skill–message pairs and 59.1% of skill-description tokens, and in a gate-removed counterfactual the model selected a skill blocked as non-executable in 7.8% of conversations (78/1,000). But the gate runs as a cascade after semantic recall: it can only prune candidates, never rescue one that recall missed. No head-to-head comparison is reported.
  • A retrieval-risk benchmark measures top-K exposure of "harmful sibling" skills at HSR@3 0.346–0.372 for public semantic retrievers, versus 0.007 for a controlled resolver. But that is retrieval exposure, not wrong-program execution, and again no precedence-versus-similarity dispatch comparison.

So the gap is narrow, and narrow is the point: it is small enough to close with one person and one well-controlled experiment, and it is the only measurement claim here that prior art does not already settle. The negative-sandbox admission criterion is a second candidate, and its novelty is not confirmed.

On real lock-file merges this project now has an answer to the question, with a qualification. Precondition dispatch mis-fired less than text similarity at matched coverage, but it mis-fired often, and almost all of its advantage came from merges that had no conflict (Results graded outside this project).

How the measurement works

The primary metric is not episode cost. An episode-level comparison is confounded by LLM sampling variance and too underpowered to support the claim. The measurement moves to dispatch level:

  labelled (repo-state, candidate-program) pairs
        │
        ├─ arm 3 needs no LLM:    pure predicate evaluation
        └─ arm 2 scores text similarity (lexical today; an embedding model
                behind the same seam is the intended replacement)
        │
  arm 2 sweeps its threshold; arm 3, which has no score, is one operating point
        │
  mismatch-vs-coverage curve, Wilson intervals, explicit power statement

Matching on coverage rather than library size is the load-bearing detail: a dispatcher that fires on nothing achieves a perfect mismatch rate and is useless. Both mechanisms are therefore swept across thresholds and compared at equal coverage.

Two properties make a mis-fire visible rather than invisible:

  1. Mismatch is scored orthogonally to success. A program that fires, fails its postconditions, and falls back to the agent may still end the episode "successfully" — which is exactly why success rate alone cannot detect a wrong-program fire. mismatch is its own outcome.
  2. Admission is two-sided. A program is replayable only if it satisfies its postconditions on a freshly faulted sandbox and its preconditions reject negative sandboxes — states where firing would be wrong. A precondition set that accepts everything is recorded as a defect, not a convenience.

The request text is held to the same standard. It has two declared channels: the shared uninformed phrasings list — what someone says when they do not know what is wrong, or when nothing is wrong — and an informed entry in a resolution's variant_phrasings, wording that reveals the situation. A bag-of-words classifier trained on the text alone (bench/textcontrol.py, over the test state grid, train n=120 / eval n=120 on disjoint seed sets) reports AUC 0.500 for uninformed requests on every converted intent and 0.962 / 0.945 / 1.000 / 1.000 / 1.000 for informed requests (diverged's, submodule_moved's, dirty_tree's, branch_renamed's and lockfile_conflict's intents, in that order). The uninformed figure is an identity, not a measurement: on that channel the sampler never consults state, so every state receives the same text for a given seed, every positive has a negative with an identical score, and the AUC is 0.500 for any classifier and any phrasing list — including a deliberately leaky one. The test on that regime is a plumbing tripwire: it fails if the sampler starts consulting state, the regression that would restore the original flaw; it cannot certify the phrasing distribution. The informed figure is the genuine measurement — the boundary condition, where state-aware wording nearly determines the resolution and the mechanism is not needed. An earlier draft pooled the two regimes into one number (0.795–0.801, the control's pre-split pooled figures) that described neither. The uninformed regime is gated; the informed AUC is reported, never gated. Every fault now has a registered intent (ADR-0027 to ADR-0029), so none is excluded from dispatch measurement; tasks/registry.py's EXCLUDED_FROM_BENCHMARK is empty, and would name any later fault whose request is a fixed sentence.

The end-to-end episode loop survives as a small demonstration, explicitly labelled underpowered. It is not the claim; its first run is reported in First demonstration.

The artifact

Preconditions are executable probes, not prose and not embeddings:

# library/sync-fork-dirty-tree/program.yaml   (illustrative shape, not yet admitted)
intent: bring a fork into sync with upstream while preserving uncommitted work
parameters: [work_dir, upstream_remote, upstream_branch]

preconditions:                      # ALL must hold to fire; run with no LLM
  - name: has_uncommitted_changes
    probe: 'test -n "$(git status --porcelain)"'
  - name: upstream_is_ahead
    probe: 'test "$(git rev-list --count HEAD..{upstream_remote}/{upstream_branch})" -gt 0'
  - name: not_mid_rebase
    probe: 'test ! -d .git/rebase-merge'

body: |                             # model-authored; runs unattended later
  git stash push -u -m pl-sync
  git fetch {upstream_remote}
  git rebase {upstream_remote}/{upstream_branch}
  git stash pop

postconditions:
  - name: upstream_contained
    probe: 'git merge-base --is-ancestor {upstream_remote}/{upstream_branch} HEAD'
  - name: no_residual_changes
    probe: 'test -z "$(git status --porcelain)"'

status: candidate   # admission has not run; nothing is replayable yet

Probes are shell commands rather than Python callables for three reasons: they serialize into the committed library, they are reviewable in a diff, and the runtime can execute them without importing program code. A reviewer can verify a dispatch decision by hand — that would not be true of a similarity score.

The YAML above is a shape, not a solution. The body in particular is not claimed correct: git stash pop after a rebase can conflict, and a real program would have to handle that.

The task family

Branchy maintenance work, on disposable sandboxes: five git faults, and one config fault whose state is files rather than history (ADR-0041). A fault is admitted only if it recurs, is checkable without a model (so scoring costs no tokens), and is branchy — a fault solvable by one aliased command has a baseline cost of zero, so nothing can be saved on it.

fault why it is branchy
dirty_tree recovery depends on whether local edits conflict with upstream's changes
diverged merge vs rebase vs discard depends on whether local commits are worth keeping
submodule_moved recovery differs by whether the submodule is initialised, dirty, or absent
branch_renamed requires noticing a remote-tracking branch disappeared and re-pointing the local one
lockfile_conflict the right fix is regeneration, not marker-editing — and marker-editing looks like success
config_renamed an old config key alone, beside its new name, or only in a git-ignored override each needs a different fix

lockfile_conflict is included as much for the negative sandboxes it supplies as for its positive ones: it is the fault most likely to produce a program that reports success while being wrong.

What would falsify this

  • No difference at any coverage. Then the honest finding is that executable preconditions buy no dispatch accuracy over text similarity in this domain, and the negative-sandbox admission factor becomes the whole contribution.
  • The faults leak a marker. If injected faults are recognisable from the task text, similarity dispatch wins for the wrong reason. A phrasing that names a resolution is caught directly: test_no_phrasing_names_a_resolution rejects any whole-word variant id in either wording channel, which is precisely what the AUC gates cannot see — the uninformed one is fixed at 0.500 by construction, whatever the words say. A paraphrase that reveals the answer without naming it stays a review obligation rather than a test, and is stated as such in the spec.
  • Probes encode the answer. If writing the precondition vocabulary requires the very knowledge being measured, the comparison is confounded by author effort rather than measured.
  • Text-similarity dispatch is already good enough. Falsifies the claim, and leaves the benchmark as a null result with intervals attached — which is still a publishable-shaped outcome, and the reason this design is cheap to falsify.
  • The result does not carry to states this project did not make. This one has happened, on real lock-file merges: precondition dispatch mis-fired on 8–54% of its fires there, and the registered claim that it rarely mis-fires is falsified (ADR-0052). The synthetic result stands as a measurement of agreement with this project's own rules, and is reported as such.

Layout

src/precondition_library/          the library itself
├── program.py        the artifact: intent, parameters, pre/postconditions, body
├── library.py        storage on disk and both dispatch strategies
├── signatures.py     how a task and its environment state are described
├── similarity.py     arm 2's seam: the text-similarity function it ranks with
├── provider.py       the only module allowed to talk to an LLM
├── sandbox.py        disposable repositories for episodes
├── intent_key.py     arm 2c: dispatch by the request string itself
├── checkout.py, dispatch.py, learn.py, __main__.py
│                     the library on your own repository (`python -m precondition_library`)
├── agents/           the arms: react.py (arm 1), compile.py (solution -> program, and the
│                     two-sided admission gate), dispatch.py (arms 2 and 3), the agent's tools
├── runtime/          replaying programs with no model: replay.py, probes.py, guard.py, confine.py
└── tasks/            the task family: spec.py, intent.py, registry.py, faults/ (one injector each)

src/precondition_library/          the measurements
├── experiment/       the synthetic benchmark: build a library (build_library, live), run episodes
│   │                 (run, ledger), label pairs (pairs, library_pairs, splits), Figure 1
│   │                 (coverage, primary), rescore, and report/ (stats, tables, floor, render)
│   ├── scorers/      arm 2's scorers and the dispatchers built on them: embedding, cross-encoder,
│   │                 LLM judge, soft vote (2b), hybrid, and the floor probe
│   └── stages/       further measurements on the same libraries: held-out and real-host states,
│                     consequences of a fire, abstentions, instance diversity
├── controls/         dispatchers that read the state without compiled preconditions
├── studies/          the pre-registered studies on real merges (one module each, plus
│                     preregistration.py, which refuses to run a study whose registration changed)
├── audits/           checks on the instruments: grader mutation, gold sweep, human labels, injection
└── bench/            old module paths, kept as aliases: frozen registrations and committed
                      results quote `python -m precondition_library.bench.<module>`

tests/                one folder per area above, plus meta/ for checks on the repository itself
results/              every measurement, one dated folder each; results/README.md indexes them
docs/                 decisions/ (ADRs), preregistration/, design/ (the spec), figures/
paper/                the technical report
library/, bench/gold/ committed programs, and the hand-written gold resolutions

paper/ holds a technical report of the results so far, written for arXiv, with how to build and submit it.

library/ holds every compiled program, admitted or not, and is committed on purpose — it is the artifact, and the point of committing it is that a program demoted after it mis-fired stays visible in the history. bench/gold/ holds the hand-written gold resolutions. What runs today for the two ambiguous intents is form validation only: sync_fork_with_upstream.yaml and restore_submodule_state.yaml must parse, be well-formed, cover every declared resolution, and have distinct bodies (tests/tasks/test_gold_programs.py). No gold checker has been executed against a sandbox — tests/tasks/test_checkers_against_gold.py is skipped for every fault until the checker execution phase lands (issue #9), because a checker cannot be validated without a state to check. (Probes did run against sandboxes in the smoke pass below: admission's two-sided gate and arm 3's dispatch both evaluate them, which is why this sentence is now about the gold checkers only.)

One structural invariant is enforced by test rather than convention: runtime/replay.py cannot reach provider, directly or transitively. It is worth being precise about what that buys, because it is easy to overstate:

It is a cost invariant, not a safety invariant. It guarantees a replay spends no tokens. It says nothing about whether a replayed program is safe. Safety is the guard's job, and the guard is a seatbelt, not a sandbox boundary.

State of play

The pieces run end to end. bench/run.py injects a fault into a disposable sandbox, one arm acts, the fault's own checker grades the result, and a ledger row is written; bench/report.py turns the ledger into the ablation table and the two demo figures. The suite covering that path is green in CI, and the seed sets a run would use are already fixed in bench/splits.py. Live runs against a real model are tracked on #163 and #214. The early ones exercised the whole pipeline -- build, frozen benchmark, Figure 1 from a compiled library, the online arms -- at smoke scale, and each found defects that were then fixed; the first is written up under First demonstration. The eleventh to thirteenth are the three replicate builds behind Primary result. The episode-level stages have not been run at the registered scale (--episode-seeds 40 --replicates 3).

What is done is deliberately not tracked here: a table in this file went stale the last time a module moved, which is why it is gone. Status is recorded in two places, both checked:

  • What the code is now. Every stub and every skipped test is declared in tests/meta/test_declared_state.py, alongside a small claims table pinning the status sentences that reduce to a mechanical fact. CI fails when the declaration and the code disagree.
  • What is outstanding. The issue tracker. The detail lives there, not here. The primary comparison is measured at the registered pair-level scale and #5 is closed; the episode-level stages are what remains (the one command is in Running it); #163 records the live runs so far. Using the library on a repository of your own is #181 (dispatch, and replay on confirmation) and #188 (learning a program there). Which faults are still excluded from dispatch measurement is declared in code, not here: tasks/registry.py's EXCLUDED_FROM_BENCHMARK, asserted against every fault by a test. Since #189, #190 and #191 (ADR-0027 to ADR-0029) every fault is measured, and the set is empty.

What survived an external test, and what did not

The reconstruction (#294) asked whether the core claim survives labels and states this project did not make. This is the answer as of the studies below; each line links to where it is measured.

Survived, on labels someone else made

claim evidence
On real lock-file merges, precondition dispatch is wrong less often than text similarity Study 1, H1, in all three libraries (stage B). The margin comes almost entirely from merges without a conflict.
A merge computed from a conflict's three sides, read as package sets, reproduces the maintainer on most real lock-file conflicts Coverage 0.686, 0.760 and 0.643 in studies 3, 4 and 5, on 67 repositories nobody here had mined (3, 4, 5).
The ecosystem's resolver predicts which package-level merge maintainers keep Study 4: 91 of 91 discordant files, 17 repositories to 0.
A precondition over the conflict's sides ("no package diverges") roughly halves the merge's error, and is not enough Study 5: mean mismatch 0.352 [0.178, 0.527] with the gate, against an always-firing merge wrong on 0.57 of conflicts.
Precondition dispatch declines inexpressible conflicts more often than a state reader fitted as study 1 fitted it Study 2, H2: +0.461 [+0.191, +0.741] over 10 builds. That reader fires on every one of them; the builds' own rates range from 1% to 100% (study 2).
Admission that requires declining known inexpressible states makes builds decline new ones Study 2, H3: the fire rate falls from 0.54 to 0.02, a difference of +0.516 [+0.255, +0.774]. Whether it costs clean merges (H4) is not resolved: [−0.687, +0.098] against a −0.10 margin.
The graders do what their tests say 138 of 138 verdict-changing mutants killed, and property-based tests on generated states (report §7).
The maintainer's-set labels agree with the ecosystem's own consistency check npm, pnpm and Composer checked each side's lock file against the merged manifests on 610 conflicted files of studies 3–5 (lock-tool-check, descriptive). The tool rejects 61 sides that are the maintainer's set; in 60 of them it rejects the maintainer's own merged file too.
Resolving a lock-file conflict leaves the lock file inconsistent more often than an ordinary commit does Study 6, H1, on 25 repositories nobody here had mined: mean gap 0.067 [0.003, 0.130], narrowly. Pooled, the check rejects 0.16 of merged files and 0.08 of ordinary commits' lock files: twice the rate, not the five times found exploratorily. Leaving out any one of seven repositories puts the interval's lower end below 0 (study 6).
Where a package diverges and the check accepts exactly one side, that side rarely loses to taking your own branch Study 6, H3: 1 loss in 100 such files, Wilson upper bound 0.054. That is below the registered 0.10, not below 0.05. It won on 9. But the check judged each side against the maintainer's committed manifests. On the 52 files where those are git's own merge, as a resolver at merge time would have them, it won on 3 and lost on 1 (upper bound 0.101) (manifest audit, exploratory).

Did not survive

claim what happened
Precondition dispatch rarely mis-fires (0 of 563 on this project's states) Falsified on real merges: wrong on 62/150 and 132/244 fires in two of three libraries (study 1, rule 2).
Executing checks is what beats text similarity On this project's states a decision tree reading the state, and one reading only the library's own precondition verdicts, matched it. On real merges the only difference left was refusal.
Executing checks declines better than reading the state, given the same evidence Study 2's primary hypothesis, H1: not supported, +0.060 [−0.009, +0.153]. Control-R, a state reader taught the refusal set, fires on 8% of inexpressible conflicts and is right on 94 of 97 clean merges; the refusal-tested builds fire on 0–6% and are right on 38% of clean merges on average (study 2).
Refusal is a property of the method Study 2: under the current admission, ten builds fire on 1% to 100% of inexpressible conflicts (SD 0.44). It is a property of the build.
The lock-file task's line-level resolutions express what maintainers do They express 1 of 161 real conflicts (study 1); package sets replaced them (studies 3–5).
Compiled probes generalise to unseen states On held-out paths, absence probes failed open: 41 of 101 lock-file fires wrong. On the 22 libraries built since the compile prompt asked for -z, the quoting defect is gone: 0 wrong in 205 fires on the spaced and non-ASCII paths. But one library failed open another way, recognising lock files by a fixed list of names: 20 of 403 fires wrong (held-out, 22 new libraries, exploratory).
The ecosystem's tool, held to the merge's date, labels what the computed merge cannot It recovers 30 of 156 such files: npm 14 of 52, Composer 11 of 84, pnpm 5 of 20 (npm, pnpm and Composer, exploratory). Composer cannot replay branch dependencies, and maintainers changed more than their manifests required. No study is registered on it.
A lock file the tool accepts is the right one The tool also accepts 52 npm and 154 Composer sides that are not the maintainer's set. Where exactly one side passes, it is the maintainer's in about two files in three. One merge in seven is committed in a state the tool rejects, five times the rate of ordinary commits, and in 61 of those 85 both parents' files had passed: resolving the conflict made the defect (lock-tool-check, exploratory). As a tie-breaker after study 5's gate, the check lifts coverage from 0.40 to 0.69 at mismatch 0.32, beating "take your own branch" on 20 files and never losing.
Rule D, the gate's merge then the side the check alone accepts, rarely mis-fires Study 6, H2 (expected to fail as a claim, and it did): mean mismatch 0.320 [0.228, 0.412]. It covers 0.71 of files at mismatch 0.27, against the gate's 0.45 at 0.30 (study 6). Run before the manifests are resolved, it covers 0.58 at 0.30. Most of what the check added came from files where it read the maintainer's resolved manifest (manifest audit, exploratory).

Not yet tested

question blocked on
Does it hold outside this provider, or across several builds per compiling model? (#266) One build each of two DeepSeek models agreed with runs 11–13 (six-family replicates). A second provider needs its key; study 2 has now measured the spread between builds of one model (SD 0.44 under the current admission), which sizes that study (ADR-0061)
Does a stronger judge, or one shown the probes, match arm 3? ADR-0034 ran one model without the probe strings (LLM judge); either is a new registration
Do people agree with the labelling rules? (#299 step 3) independent raters; the kit is built
Do the projects' own tests accept a resolution? (#297's third oracle) Piloted, sandboxed (project-tests pilot). Where a suite ran (2 repositories), the wrong side's lock file was refused by npm ci before any test ran, so the tests added nothing beyond the check. The next cases are those where both sides pass the check. Composer projects need a host this session cannot reach.

What someone else needs to replicate it

  • The studies graded outside this project need no model and no key. Each is one command from a checkout. Each refuses to run unless its registration is committed and unchanged, and writes a fresh directory. Each mines public repositories from GitHub, which takes network access, roughly 8 GB of disk for twenty repositories, and from twenty minutes to a few hours. Study 6 also runs npm, pnpm and Composer (no install scripts), which needs a package registry and took about nine hours.

    python -m precondition_library.studies.real_merges --stage B           # study 1
    python -m precondition_library.studies.lock_oracle --out <dir>          # study 3
    python -m precondition_library.studies.ecosystem_unify --out <dir>      # study 4
    python -m precondition_library.studies.divergence_gate --out <dir>      # study 5
    python -m precondition_library.studies.tool_precondition --out <dir> --scratch <dir>  # study 6
    

    These commands pin each repository's tip on the day they run (real_merges.pin). So a run on a later date mines newer merges: it is a replication, not a re-derivation. To re-derive the published figures exactly, use each result directory's verification/ scripts:

    • one recomputes every figure from the released files, without importing the project;
    • the other re-reads the labels from git, at the SHAs in that directory's manifest.json.
  • The results graded by this project's own labels rescore from the three committed libraries with no model call. Rebuilding those libraries needs a DeepSeek API key: the model is deepseek-flash at temperature 0, and the commands are under Running it.

Results graded outside this project

Graded by: the merge commit each maintainer made in a public repository, read from git, under a study registered before its data was mined (ADR-0048, ADR-0049). The label is what the maintainer committed. This project's code only compares a dispatcher's choice with it, by a rule fixed in the registration: it neither builds the states nor decides what is right.

Real lock-file merges

results/real-merges-2026-10-26/stage-B/ holds 274 merges from 11 public repositories. 161 of them conflicted in a lock file, and 113 changed a lock file on both sides and merged cleanly. Each library from the three replicate builds dispatched every case, read-only, with no model call. A fire is right if it is what the maintainer did: one of the lock-file intent's resolutions that reproduces their lock file, or merge on a clean merge whose tree is the one they committed.

replicate 1 (run 11) replicate 2 (run 12) replicate 3 (run 13)
precondition dispatch: fires, wrong (95% Wilson) 150, 62 (0.34–0.49) 122, 10 (0.05–0.14) 244, 132 (0.48–0.60)
of those, right on clean merges 87 of 113 112 of 113 112 of 113
of those, right on conflicts 1 of 37 0 of 9 0 of 131
text similarity at matched coverage: wrong 140 of 150 122 of 122 239 of 244
state-reading control: wrong 159 of 160 159 of 160 159 of 160

What it decides, by the registered rules in order:

  • Precondition dispatch rarely mis-fires: falsified. The lower bound of its mis-fire rate is above the registered 0.10 in two of the three libraries.
  • It mis-fires less than text similarity at matched coverage: supported in every library.
  • It mis-fires less than reading the state: supported as registered, but not read as a win for executing checks (ADR-0052). The control decides with the lock-file intent's own resolutions, so it can never fire merge, and almost all of precondition dispatch's right fires are merge on clean merges. On conflicts, where both can fire, both are almost always wrong.
  • It declines more of the conflicts nothing can resolve than the control does: supported, by a wide margin in two libraries and barely in the third.

What it shows. No library resolves a real lock-file conflict. Maintainers regenerated the file on 79 of the 161 conflicts and did something else on 48; the lock-file intent's resolutions reproduce 1 of the 161. The synthetic result's near-zero mis-fire rate does not carry to these states. What does carry is narrower: precondition dispatch fires merge on clean merges, where text similarity does not, and two of three libraries mostly decline the conflicts they cannot resolve.

What it does not show. It covers only lock-file merges in 11 repositories, and it says nothing about episodes. An LLM state judge (#295) has run only on this project's own states, not on these, and the external oracles of #297 (the ecosystem's lock-file tools, the project's own tests) are not built. Every figure here was recomputed by a script that does not use this project's code. For 55 of the cases, the labels were re-derived from git and all agree. Afterwards, and exploratory because the data had been seen, a state-reading control given arm 3's scope was right on clean merges as often as arm 3, but fired on every conflict where two of three libraries mostly declined (library-scoped control). A pilot stage on 44 merges came first (stage A). It motivated the amendment, so it tests nothing.

Real lock-file conflicts, read as package sets (studies 3 and 4)

The lock-file intent's line unions reproduce almost nothing maintainers commit. Read as sets of resolved (package, version) pairs, the picture changes. Two studies, each registered before its data and run on repositories this project had never mined, label each conflict by which action computed from the merge's base and two sides alone reproduces the maintainer's exact package set. Those actions are:

  • take either side;
  • a package-level three-way merge;
  • the same merge with compatible versions unified.

No tool or registry is involved in any of them.

study 3 (lock-oracle) study 4 (ecosystem-unify)
conflicts, repositories 360, 27 266, 20
coverage: some computed action reproduces the maintainer (mean over repositories, 95% t) 0.686 [0.601, 0.770] 0.760 [0.674, 0.845]
study 1's line unions reproduce 0.072 —
the merge the resolver predicts wins where the two merges disagree — 91 of 91 discordant files, 17 repositories to 0
  • External labels for two conflicts in three. The lock-file task has an external oracle for about two real conflicts in three: the maintainer's own resolution, computed without judgement.
  • Which merge to compute, per ecosystem. Unify versions where the resolver installs one version of a package (composer, bundler, poetry). Keep compatible duplicates in npm's family, where the plain merge won all 67 of its discordant files.
  • One hypothesis tested less than its sign test suggests. Study 4's one-version hypothesis proved near-definitional, which was found after the data and is said plainly in its README.
  • Verification. Both studies' figures were recomputed by scripts that import nothing from this project, and every file was re-read from git with independent parsers.

Why it works, and what a dispatcher would get (exploratory, lock-anatomy).

  • Half of these line conflicts are not package conflicts. In 49% and 56% of conflicted files, no package was changed by both sides to different versions. Two sides that bump different packages simply touch neighbouring lines.
  • Where nothing diverges, the merge reproduces 0.66–0.82 of files. In npm's family a single divergent package almost always defeats it. Where packages do diverge, maintainers keep their own branch's versions about twice as often as the incoming side's.
  • Coverage is an oracle's figure. A dispatcher that always fires the merge is wrong on 0.56 and 0.45 of conflicts. Firing only when no package diverges, a check computed from the three sides, cuts that to 0.32 and 0.22. That is still far from the 0.10 that "rarely wrong" would need.
  • Most of the rest is decided outside the lock files. The maintainer dropped a side's change when settling the manifest, or ran a resolver. For npm, replaying the tool at the merge's date (lock-tool-dated) labels 14 more of 172 conflicted package-lock.json files, 0.78 in all.

Study 5 tested the gate after it was found (divergence-gate). It was registered before its data (ADR-0059) and run on 20 more fresh repositories, 223 conflicts:

estimate [95% interval] decision
H1 (primary): the gate's mean mismatch, above 0.10 0.352 [0.178, 0.527] supported
H2: its gain over always firing the merge 0.236 [0.089, 0.384] supported
H3: one-version cases, within repositories 0.248 [−0.022, 0.476] not supported, uninformative by its stated power

The precondition roughly halves the merge's error (pooled 0.570 → 0.296), and the merge is still wrong on about a third of the gate's fires. Both halves of the anatomy's conclusion replicate.

The ecosystem's own check, as a second precondition (study 6)

npm, pnpm and Composer each check whether a lock file is consistent with its manifests, without installing anything. Run on studies 3–5's conflicts after they were seen (lock-tool-check), the check suggested two things:

  • Merges break lock files. The merged files fail it five times as often as ordinary commits' lock files.
  • It makes a precondition. Where the gate refuses, take the one side the check accepts (rule D).

Study 6 tested both on 25 more fresh repositories, 395 conflicted lock files, registered before its data (ADR-0060, tool-precondition):

estimate [95% interval] decision
H1 (primary): merged files fail the check more often than ordinary commits' (mean gap) 0.067 [0.003, 0.130] supported, narrowly
H2: rule D's mean mismatch, above 0.10 0.320 [0.228, 0.412] supported: rule D is not rarely wrong
H3: the check's side loses to the first parent's file (Wilson upper bound, below 0.10) 1 of 100, 0.054 supported at 0.10, not at 0.05
  • Merges do break lock files, by less than first seen. Twice the ordinary rate, not five times, and leaving out any one of seven repositories puts H1's lower end below 0.
  • The check read the maintainer's answer. It judged each side against the maintainer's committed manifests, which hold the maintainer's resolution of any manifest conflict. An audit made after the study (manifest-leak) restricted it to files whose manifests are git's own merge, as a resolver at merge time would have them. On those, rule D covers 0.58 of files at mismatch 0.30, against 0.71 at 0.27 as recorded. The gate alone covers 0.45 at 0.30.
  • Merging the manifests first recovers little (manifest-merge). A key-level merge gives the maintainer's manifests on 165 of 380 conflicted files. The check is accurate there, so its accuracy on conflicted manifests reflects the kind of conflict, not the leak. But coverage only rises to 0.60. What remains needs the maintainer's own decision on a dependency both sides edited.

Results graded by this project's own labels

Graded by: states built by this project's injectors, and labels from its own rules and checkers. These sections measure whether each dispatcher agrees with rules this project wrote. They are kept because they are the controlled comparison the design registered. They are not evidence about states the project did not make: on the one external test above, the near-zero mis-fire rate did not carry over (#300).

Primary result

Graded by: each pair's acceptable resolutions, computed from the injected state by this project's rules (ADR-0022).

The question, as The open question states it, measured as the spec registers it (ADR-0022): Figure 1 over 400 labelled dispatch pairs from the eval seeds, uninformed regime, each arm's fires judged against the pair's acceptable resolutions, arm 2 swept to arm 3's coverage. Three whole-run replicates (spec §7 item 2), each building its own library from the admit set (ADR-0032) with bench.live --primary-only; no model call is made after the build.

replicate 1 (run 11) replicate 2 (run 12) replicate 3 (run 13)
programs admitted (two-sided) 13 14 13
arm 2's baseline floor (spec §7 item 11) not measurable usable (top-1 111/240, lower bound 0.401 > 0.333) usable (111/240, 0.401)
arm 3: coverage, mis-fires 187/400, 0/187 187/400, 0/187 189/400, 0/189
arm 2 at matched coverage: mis-fires 148/187 149/185 143/187
difference (arm 2 − arm 3) +0.79 +0.81 +0.76
smallest detectable difference 0.145 0.145 0.144
embedding arm 2 (#104): floor not measurable usable (112/240, 0.405) usable, barely (96/240, 0.340)
embedding arm 2 at matched coverage: mis-fires 143/185 168/189 169/187
difference (embedding arm 2 − arm 3) +0.77 +0.89 +0.90
reranker arm 2: floor not measurable usable (152/240, 0.571) usable (137/240, 0.508)
reranker arm 2 at matched coverage: mis-fires 142/186 133/187 134/189
difference (reranker arm 2 − arm 3) +0.76 +0.71 +0.71
LLM judge arm 2 (ADR-0034): floor, runs A / B not measurable usable (129/240, 0.474 / 136/240, 0.503) usable (121/240, 0.441 / 97/240, 0.344)
LLM judge at matched coverage: mis-fires, A / B 5/188 / 0/183 38/230 / 23/213 13/196 / 10/190
difference (judge − arm 3), A / B +0.03 / +0.00 +0.17 / +0.11 +0.07 / +0.05
Mis-fire rate at matched coverage, one dot per replicate with its 95% Wilson interval. Precondition checks: 0 of 563 fires wrong. Text similarity: lexical 76–81%, embedding 77–90%, reranker 71–76%.

How to read coverage. Half of each run's 400 pairs are fault-free negatives, where the correct decision is not to fire, so a dispatcher that never mis-fires covers at most 0.5; anything above that is fires on negatives. Arm 3's 187–189 fires are 93.5–94.5% of the 200 positives, not a dispatcher that sits out half the time.

What it shows. Precondition dispatch never fired a program that the pair's state did not accept; text similarity, at the same coverage, did so on roughly four fires in five. The difference is about five times the smallest one the pair count can detect, and it holds in every replicate. Where arm 2's floor is usable -- replicates 2 and 3 -- the claim may be worded as registered: a win over text similarity. Swapping arm 2 for the pinned embedding scorer (#104) does not narrow the gap: it mis-fires on 77–90% of its fires at matched coverage, the gap widens in replicates 2 and 3 and narrows by 0.02 in replicate 1, and arm 3 is unchanged (Embedding arm 2). A pinned local reranker, which clears the floor clearly where those two only just do, narrows it to +0.71 to +0.76 and no further: still about five times the smallest detectable difference. An LLM judge that reads the state, not the probes (ADR-0034), narrows it much further, to +0.05 to +0.17 where its floor is usable. Arm 3 still mis-fires less, in both of two runs, and the two runs differ by less than either's gap from arm 3. On replicate 1 they differ by as much as the gap, so nothing is worded there (LLM judge).

Two more builds agree (#266, ADR-0061). A six-family build with the same model, adding config_renamed, a family whose state is config files rather than git history, and one with a second compiling model (deepseek-v4-pro) mis-fire on 0 of 215 and 0 of 238 fires, against the lexical arm 2's 192 of 220 and 190 of 234 at matched coverage (+0.87 and +0.81). The config family's programs were admitted and fired on 26 and 40 of its 40 positive pairs, none wrongly. Each rests on one build, so the two models are not compared (six-family replicates).

What reading the state alone does (ADR-0047). Each pair's correct resolution is a rule over the observed state, so the comparison above does not separate executing compiled checks from reading the state at all. A decision tree per intent over generic fingerprint features, fit on the build's 56 states with no model call and no compiled program, fires on 190 of the 400 eval pairs with none wrong, and on 200 held-out pairs with none wrong where arm 3 had 8–21 (state-reading control). So the claim this table supports is that a dispatcher that reads the state beats one that does not, and compiled preconditions are one such dispatcher. A control limited to what the probes see (#295 item 3, exploratory) narrows it further. A tree per intent over only the verdicts of each library's own preconditions, allowed to fire only what the library holds, makes no more wrong fires than arm 3 in all six library-blocks, and fewer in two: 8 against 13, and 5 against 21 on held-out states (probe-verdict control). On these states, arm 3's advantage lies neither in the facts it reads nor in executing them as a conjunction. #296 has run on real merges, but its registered control could not fire merge, so it cannot separate the two either (Results graded outside this project, ADR-0052).

What it does not show.

  • Replicate 1 may not be worded as a win. Its library held one lockfile resolution, so arm 2 had nothing to choose between there and the floor could not be measured. It was also built on earlier code, before the fixes in #244 and #245; re-gated offline under the final admission, its figure is 0/187 against 141/186.
  • The gap is measured against local text scorers, not every text scorer. The lexical and embedding arms clear the floor only just (lower bounds 0.340 to 0.405 against chance 0.333). The reranker -- the strongest of thirteen pinned local models screened on the floor -- clears it clearly (0.571 and 0.508), and narrows the gap by 0.03 to 0.09 and no more: it still mis-fires on 71–76% of its fires (Reranker arm 2). A scorer reading the state through a model call (an LLM judge, ADR-0034, spec §7 item 14) ran on 2026-11-15. On libraries 12 and 13, where it clears the floor, it mis-fires on 5–17% of its fires at matched coverage, against arm 3's 0%, in both of two repeats; library 11's floor is not measurable, so nothing is worded there (LLM judge). It is one model and one prompt, without the probe strings.
  • States outside the generators, except in part. Every pair here comes from the injectors admission tests each program against. Five held-out sources are measured below, one per git fault. On one of them, file names with a space or a non-ASCII character, arm 3 mis-fired often. A sixth builds the same states over real repositories' histories. Real faults, ones no injector built, are measured only for lock-file merges, in the tier above, and there arm 3 mis-fired often.
  • Nothing at episode level, except replayed fires. Replaying each fire shows what it leaves (Measured since). A fire is not an episode: cost, the misses the agent would solve, the admission factorial and the online arms are separate stages, not run here.
  • Arm 2b cannot separate the two. At arm 3's coverage the soft vote's matched point is the hard rule itself, so Claim 2 keeps its wording without showing that requiring every probe adds anything over a vote.

Provenance. deepseek-flash; builds of 14–17 episodes spending 144k–204k uncached input, 280k–372k cached input and 402k–539k output tokens each. Code: run 11 on main a6ff042, run 12 on d524978, run 13 on 44a1ffc. The per-run table, the re-gate and the defects found on the way are in #214.

Held-out states

Graded by: the same rules, on seeds and paths no build drew. The states are still built by this project's injectors.

The 0 of 563 describes this generator: admission tests every program on states built by the same injectors as the evaluation pairs (#263). The held-out stage (ADR-0033, ADR-0037, ADR-0039, ADR-0042) reads each committed library again, read-only, on 40 seeds no build ever drew (3000–3039). It uses five sources, one per git fault, each reported on its own:

  • dirty_tree with held-out paths. States write paths no shipped seed uses: deeper directories, a space, a non-ASCII name, a dotfile.
  • diverged with a held-out shape. Upstream is 2–3 commits ahead across two files, and there are 4–5 local commits.
  • lockfile_conflict with held-out paths. The conflicting file is moved from deps.lock to a nested path, a path with a space, a non-ASCII name or a dotfile.
  • branch_renamed with held-out names. Upstream renames its branch to names no shipped seed uses, two of them with a / (release/2026, team/integration).
  • submodule_moved with held-out paths. The submodule lives somewhere other than vendor/libcore: deeper, in a dot directory, or under another name.

Each block is 40 positives and 40 fault-free negatives.

replicate 1 (run 11) replicate 2 (run 12) replicate 3 (run 13)
dirty_tree, held-out paths: arm 3 fires, mis-fires 40, 0 40, 0 40, 1
diverged, held-out shape: arm 3 fires, mis-fires 40, 0 40, 0 40, 0
lockfile_conflict, held-out paths: arm 3 fires, mis-fires 33, 13 33, 8 35, 20
branch_renamed, held-out names: arm 3 fires, mis-fires 40, 0 40, 0 40, 0
submodule_moved, held-out paths: arm 3 fires, mis-fires 40, 0 40, 0 40, 0
fires on the fault-free negatives (each block) 0 0 0
Arm 3's mis-fire rate summed over the three libraries. In distribution 0 of 563. Held out: dirty_tree at new paths 1 of 120; diverged in a new shape 0 of 120; branch_renamed with new names 0 of 120; submodule_moved at new paths 0 of 120; lockfile_conflict at new paths 41 of 101, all 41 on a path with a space or a non-ASCII name.

Both figures are drawn from the committed result files by docs/figures/make_readme_figures.py; nothing in them is typed in.

What it shows. Four sources carried: one mis-fire in 480 fires (0.2%, 95% Wilson upper bound 1.2%). The lock-file source did not: 41 of 101 fires were wrong. Every one of those 42 mis-fires is on a path with a space or a non-ASCII name. On the lock file's spaced and non-ASCII paths, 41 of 60 fires were wrong. On its nested and dotfile paths, none of 41 was.

  • What broke. Five learned checks read a git path list without -z. Then they compared it with another list, used it as a file name or pathspec, or split it on spaces. On a name git quotes or escapes, each finds nothing. Each is an absence check, so finding nothing means it holds, and the program fires. Two of them are diverged discard programs firing on a lock-file conflict, which throws the local dependency changes away.
  • Why admission passed them. Each check is right on every shipped state, because no shipped path needs quoting.
  • Why the names and submodule paths carried. No compiled program for those faults names a branch or a submodule path: each binds {upstream_branch} or {submodule_path}, so a new value reaches it as the parameter it already reads. The lock file's path is not a parameter; a program has to find it in git's output, and that reading is what broke (ADR-0042).
  • How common the defect is. Reading the libraries found at least 16 probes in 10 of the 40 admitted programs that such a path could break (ADR-0038, corrected by ADR-0039). The lock-file block ran them: four of its probes cause all 41 of its mis-fires.
  • What changed.
    • The compile prompt now tells the model to read path lists with -z. On the 22 libraries built since, no fire misread a quoted path, but one library's lock-file check recognised lock files by a fixed list of names and failed open on two of the held-out paths (held-out, 22 new libraries).
    • The harness's own fingerprint had the same bug, and is fixed.
    • The hand-written reference programs had a hard-coded file name, and now refuse rather than mis-fire.

What it does not show.

  • A comparison with arm 2. No held-out floor is measured, so no sentence may say arm 3 beats text similarity on these states (ADR-0033).
  • States of a different kind. All five sources keep the fault's kind of state, with new names, paths and counts.

Over real repositories (ADR-0043). The five sources above change something inside the generator's base: two files, one commit, no .gitignore. A sixth changes the base. Each state's history starts from a pinned public repository and its last 50 commits (psf/requests, pallets/click, junegunn/fzf, expressjs/express), with the fault injected on top as before. The seeds are the eval block, so each state is paired with one Figure 1 measured.

replicate 1 (run 11) replicate 2 (run 12) replicate 3 (run 13)
real-host base: arm 3 fires on 200 positives, mis-fires 187, 0 187, 0 189, 0
synthetic base, same seeds (Figure 1) 187, 0 187, 0 189, 0
fires on the 200 fault-free negatives, real-host base 0 0 0

The real base changed nothing measured: the same fire counts, no wrong fire, and the positives arm 3 sat out are the same lockfile_conflict seeds it sits out on the synthetic base. An independent recount, evaluating every program directly, agrees on all 60 blocks. It found one real interaction: fzf ignores vendor, where the submodule goes, so the injector now adds it with --force. Four projects are not a sample of repositories, and the faults are still the generator's.

The details are in results/realhost-2026-10-20/ (real repositories' histories), results/heldout-2026-10-19/ (branch names and submodule paths), results/heldout-2026-10-18/ (the lock-file block), results/heldout-2026-10-16/ and results/heldout-2026-10-10/.

Measured since

Graded by: each fault's own checker, written here, applied to what a replayed fire leaves.

All three re-read the committed libraries, with no model call:

  • What a fire does when it is replayed (ADR-0044, exploratory, results/consequences-2026-10-21/). Each of Figure 1's fires is replayed on a fresh build of its state and graded the way an episode is.

    • A correct choice is not always a correct outcome. Arm 3's 563 fires fixed 536. The other 27 are all in replicate 3, from two admitted programs that pass their own postconditions while the checker refuses what they leave. One was compiled from a solve the checker had refused, which admission may not read (issue #9).
    • Arm 2's mis-fires mostly do nothing. Its 318 fires on fault-free states changed nothing. On a fault's state, 147 of its 241 fires fixed it and 86 left it wrong.
    • Nothing was destroyed. No replay of either arm lost a recorded commit or rewrote upstream.
    • Held out and over real histories (ADR-0045, held-out, real-host).
      • Over the four pinned real histories every replayed fire has the synthetic base's outcome.
      • On the held-out block arm 3's 539 correct choices fixed 503, and its 42 wrong ones fixed none. The worst are diverged discard programs that drop the local dependency change on a lock-file state.
      • Getting there found four grader defects, each refusing a correct resolution, now fixed.
  • Retrieve by text, then gate by checks (ADR-0035, results/hybrid-2026-10-11/).

    • As a filter, it costs coverage. The hybrid never mis-fired and never fired more often than arm 3, because its fires are a subset of arm 3's by construction. So as a filter, text only removes correct fires.
    • As an order, it saves checks. Used as the order to try programs in, stopping at the first whose checks hold, it makes arm 3's exact decisions with 29–37% fewer checks evaluated. Arm 3 tried most-specific-first saves 20%.
  • Why arm 3 sits out (results/abstentions-2026-10-12/).

    • Where the misses are. All 37 positives arm 3 did not fire on are lockfile_conflict states.
    • The dead program. Replicate 2's 13 misses came from one program admitted unable to fire on its own state. Admission now refuses such a program (ADR-0036).

First demonstration

The first smoke pass against a real model -- 48 episodes, two faults, three arms -- showed the mechanism end to end: a compiled program replayed with zero LLM calls on a later occurrence, and the compiled arms' cost fell across occurrences while the baseline stayed flat. It measured nothing about the claim. Its tables, provenance and limits are in results/first-demonstration.md.

Installing

Two things the commands alone do not tell you:

  • Obtain the repository with git clone. The suite proves it leaked nothing into this repository's own tree by comparing git status --porcelain against a snapshot taken at import (tests/conftest.py). A GitHub Download ZIP snapshot has no .git to compare against, so those tests skip with that reason instead of failing and the rest of the suite still runs — but the guarantee they carry is only meaningful in a clone.

  • Install the dev extra, which is what provides pytest, ruff, mypy and pandas (see pyproject.toml). CI runs exactly these four gates:

    git clone [email protected]:Shyboy0499/precondition-library.git
    cd precondition-library
    uv sync --extra dev
    uv run pytest                      # the suite
    uv run ruff check .                # lint
    uv run ruff format --check .       # formatting, including Python inside markdown
    uv run mypy src                    # types
    

Python 3.12 or newer is required (requires-python in pyproject.toml).

Platform support. CI runs ubuntu-latest only, so Linux is the only platform this repository has evidence for. A Windows verification pass is recorded in #87, which found four deterministic defects there — two of which fail silently, reporting success while doing nothing — and none of which the CI above could have caught.

Running it

The invocation, the seed sets and the ledger format are fixed in the spec's §7, "The seed plan and the run invocation"; that section is the source, and this one does not repeat it. Two properties matter before anything runs:

  • The split is frozen in code, not chosen at run time. bench/splits.py names the admit, tune and eval seed sets before any episode exists, because a split chosen after seeing scores is not a split. Changing a seed there is a pre-registration revision (CONTRIBUTING rule 8), not a config tweak.
  • Every occurrence carries a role, and the two figures use different ones. bench/splits.py derives, from the injector's own seed-to-instance mapping, which occurrences are variants (the first sight of an instance — the independent observations) and which are replays (a genuine repeat of one — what the cost curve is read from). bench/run.py writes the role onto every ledger row; bench/report.py computes the cost curve over the replays and the mismatch comparison over the variants, says so in each figure, and carries the achieved instance count per resolution. The arithmetic for the eval set is in the spec's §7: 32, 15, 14, 30, 28 and 27 variant occurrences (146 distinct environments across the six families), not forty seeds.
  • The API key is the caller's. provider.py reads no environment variables and no files; DeepSeekProvider takes the key at construction, and the spec's §7 example is what passes DEEPSEEK_API_KEY into it. That is a deliberate boundary, not an omission — credential handling stays with the caller, and nothing in the package will find a key on its own.

A whole live run is one command. bench/live.py chains the stages in the spec's order: build and gate the frozen library twice, learn arm 2b's threshold on the tune seeds, run the frozen benchmark and the admission factorial, produce Figure 1 from the library's own matchers, and run arms 1 and 1b online. Every artifact goes into one fresh directory, with summary.txt and summary.json saying what ran and where each artifact is:

uv run python -m precondition_library.experiment.live \
  --api-key-env DEEPSEEK_API_KEY --out ../live-run   # or --api-key-file PATH

You name where the key is, so the package still finds none on its own. --episode-seeds (default 4, the first live run's; the plan is 40) sizes the episode stages, --replicates (default 1; the plan is 3) repeats each of them as a whole run, and --skip-online drops arms 1 and 1b. The registered plan is --episode-seeds 40 --replicates 3. The summary also carries arm 2's baseline floor (spec §7 item 11) and the instance-clustered interval over the episodes (ADR-0012).

On your own repository

The library can also be used outside the harness, on a repository you already have (issues #181 and #188). Nothing model-written ever reaches a real remote: the tool fetches your upstream once, with your own git, into a local mirror, and every probe, body and agent command then runs screened, without network where the host allows it, and with your upstream read from that mirror; every other remote -- your own fork included -- is unreachable. Commits it makes carry your git identity.

Dispatch reports which admitted program would fire on your repository and why, probing a copy of it, and with --replay dry-runs it on a second copy, shows what it did, and replays on your repository only after you confirm:

uv run python -m precondition_library dispatch --repo PATH --library DIR [--replay]

Learn has the agent solve a copy of your repository for a request in one of the measured families, shows you what the solve did, and -- only if you confirm -- compiles it and admits it through the same two-sided gate the harness uses, plus a check that it fires where it was learned (ADR-0026). It calls a model, so it needs a key:

uv run python -m precondition_library learn --repo PATH --library DIR \
  --fault diverged --request "sync my fork with upstream" --api-key-env DEEPSEEK_API_KEY

A learned program is marked learned_on: checkout, and a measured run refuses any library that holds one: the measurement stays harness-only.

Prior work

Every citation below was checked against the source before publication — title, authors, venue, and each attributed figure. Five attributions from the original sweep were wrong and are corrected here rather than repeated.

This is not independent review. The check was performed by the author, so treat it as a hygiene pass rather than external validation, and open an issue if you find an error.

Compile-once, replay-cheaply (settles the amortization claim)

work what it does status
PreAct — arXiv:2606.17929 Compiles a successful computer-use trace into a state-machine program with per-state verification predicates and parameter lifting; replays 8.5–13× faster with no per-step LLM calls; documents a cov=100%/score=0 "lossy replay" failure single-author industry preprint; all figures checked against the paper by the author
SkillDroid — arXiv:2604.14872 Compiles GUI trajectories into parameterized templates; replays with zero LLM calls; 49% fewer LLM calls, 2.4× speedup, 85.3% success preprint. Note: its dispatch is a semantic matching cascade, so it is prior art for amortization only
Auto: The AGI Compiler — arXiv:2607.04542 Compiles witnessed-deterministic agent spans into signed WebAssembly, gated on differential replay, deopting to the paid agent on guard trip; 2,775 vs 17,692 µ$ over 300 items; 48.9% silently wrong under a loose guard preprint; authors' own single-run measurements
LATM — arXiv:2305.17126 (ICLR 2024) A capable model builds a reusable parameterized tool from demonstrations; a cheaper model then invokes it peer-reviewed. Correction: its replay phase still calls an LLM, so it is prior art for cheaper replay, not free replay

Precondition-based dispatch (settles the mechanism claim)

work relevance
MACROPS — Fikes, Hart & Nilsson, Artificial Intelligence 3(4):251–288, 1972 Dispatches a cached generalized plan by testing executable precondition kernels against live state, with an explicit replan fallback. This is the intended mechanism, 54 years early. (1971 is the separate STRIPS paper.)
Soar chunking — Laird, Rosenbloom & Newell, Machine Learning 1(1):11–46, 1986 Compiled rules cached and re-fired on matching conditions.
Options — Sutton, Precup & Singh, Artificial Intelligence 112(1–2):181–211, 1999 An option's initiation set plays the role a precondition plays for a policy — an analogy, not an identity: options also carry a termination condition, which this project's preconditions do not.
Adaptation-guided retrieval — Smyth & Keane, Artificial Intelligence 102(2):249–293, 1998 Argues, paraphrased, that it is often unwarranted to assume the most similar case is also the most appropriate for reuse. The original abstract wording is longer; this is not a quotation.

Bracketing the open question (does not settle it)

work what it shows what it leaves open
Deterministic executability gating — arXiv:2608.01050 (Wix Helpmate) A deterministic executability gate (exit-condition inversion, applied after semantic recall) removes 59.4% of matched skill–message pairs, 59.1% of skill-description tokens; 90.5% context reduction; 7.8% counterfactual mis-selection with the gate removed The gate is a cascade after semantic recall, so it only prunes; no head-to-head comparison, no success or cost comparison, no tool-execution or customer-outcome result, 10 skills in one domain family. Preprint under review — it does not validate this project's claims.
SameCapRisk-Bench (v2 title: Right Family, Wrong Skill) — arXiv:2606.10388 HSR@3 0.346–0.372 for public retrievers; 0.128–0.182 for score-and-cluster; 0.007 for a controlled resolver; 1,190 skill-risk units, 1,686 queries Measures retrieval exposure of risky siblings, not wrong-program execution; no predicate-key versus semantic-key head-to-head. Correction: these figures are v2's, under the v2 benchmark name — the earlier title SkillResolve-Bench has different, much smaller figures.
alcheme-labs/dsh-experience-map States the thesis that similarity alone is not permission to reuse a procedure, with a "Preflight" gate; reports 65.9% token, 45.5% tool-call, and 46.2% step reductions Brand-new (created 2026-09-12), 0 stars, and the reduction is a single self-run pilot the repository itself disclaims as an average and explicitly does not claim as more accurate than lexical retrieval. It contains docs/decisions/m7-three-arm-evaluation.md and docs/release/BENEFIT_EVIDENCE.md — an earlier, unverified claim that it publishes no comparison was wrong.

If you know of work that does run the matched-coverage comparison, please open an issue — that would be the most useful contribution anyone could make to this repository, and it would let the project stop rather than duplicate it.

License

MIT © 2026 Shyboy0499

関連プロジェクトを探す

読み込み中…