# Reproduction CLI — chain verification specification (source of truth) ## 1. Scope - Source of truth for `scripts/mechanical_refactor_reproduction_cli.py`: the **verified-chain property** (§2), the CLI contract (§3), the report (§4), and the exit codes (§5). - The single-commit clean-move property and the proof scripts themselves are specified in `spec-reproduction-utils.md`; this file only says how a whole chain of commits is checked against a folder of such proofs. - The CLI, its tests, and the guides defer to this file; on any disagreement, this file wins. ## 2. The property — a "verified chain" > A branch is a **verified chain** over a base iff every commit in `base..branch` is > **classified** (§2.1) and every `mechanical_provable` commit has exactly one **proof** > in the proof folder whose run **PASSes** (§2.2). ### 2.1 Classification — the word rule - Every commit message must contain **exactly one** of the two words: - `mechanical_provable` — the commit claims to be a machine-provable relocation; - `non_mechanical_provable` — the commit declares that **nothing in it** is expressible as the whitelisted relocations of `spec-reproduction-utils.md` §2 — it is the minimal unprovable residue, left to human review. - The declaration is an assertion, not an opt-out: labeling provable content `non_mechanical_provable` to dodge the verifier **violates the chain property**, even where no machine check catches it. A provable part hiding inside a semantic commit belongs in its own `mechanical_provable` commit with a proof (`guide-split.md` §2.2). - The rest of the message format is unconstrained **by the machine rule**: the word may appear anywhere in the subject or body, in any surrounding syntax. The authoring contract additionally fixes the subject format (`(,): `, `guide-split.md` §1.1), which satisfies this rule by construction; the verifier deliberately checks only the word, so a chain from a different convention still verifies. - A word counts only standalone: delimited by a non-`[0-9A-Za-z_]` character or the message boundary, lowercase, so `non_mechanical_provable` never also counts as the bare word, and `xmechanical_provable` counts as neither. - Repeating the same word is fine; the rule is about **which** of the two is declared: - neither word present → `UNCLASSIFIED`; - both words present → `AMBIGUOUS_KIND`. ### 2.2 The proof obligation - Each `mechanical_provable` commit must resolve to exactly one proof script (§3.3); none is `MISSING_PROOF`, several is `AMBIGUOUS_PROOF`. - The proof must run to a PASS (§3.4): the commit reproduces byte-for-byte from its parent (`spec-reproduction-utils.md` §4). Anything else is `FAIL`. - A `non_mechanical_provable` commit has no machine obligation; its verdict is `HUMAN_REVIEW` — the report marks it for eyes, never certifies it. Whether its declaration is honest is the reviewer's duty to check (`guide-verify-proof.md` §1). - The chain verdict is PASS iff every commit's verdict is `PASS` or `HUMAN_REVIEW`. ## 3. The CLI contract ### 3.1 Invocation ```bash python3 .claude/skills/mechanical-refactor-verify/scripts/mechanical_refactor_reproduction_cli.py \ --base --branch --proof path/to/proof/folder ``` - `--base` / `--branch`: any commit-ish; both must resolve, `base` must be an ancestor of `branch`. - `--proof`: the proof folder (must exist) — typically the generator's `--out` product (`guide-construct-proof.md` §1.2). - `--repo-root DIR`: run against that repo instead of the cwd's. - `--report PATH`: write the report there instead of `/chain_report.md`. - `--jobs N`: run up to N proofs concurrently (default 3). - `--skip-passed`: reuse this machine's own earlier PASS verdicts (§3.5). ### 3.2 The chain - The commits are `git rev-list --reverse base..branch`, i.e. the whole chain in order. - The chain must be **linear**: a merge commit anywhere in it is a setup error — per-commit proofs are meaningless across a merge. - An empty range is a setup error, not a trivially-green chain. ### 3.3 Proof resolution - A commit's proof is a `.py` whose stem is lowercase hex, at least 7 characters, and a prefix of the commit's full sha. - Searched locations, in order, both always considered: `/repro_scripts/` (the generator layout) and `/` flat (the gist layout, `guide-construct-proof.md` §1.3.1). - Proofs are keyed by current shas: after a rebase the shas change, so the proofs must be regenerated for the rebased chain. ### 3.4 Proof execution and the PASS criterion - Each proof runs as `python3