|
Download PROTOCOL.md from RedinGhost/beforedone-paper: direct link, hf CLI and curl.
- Browser
- Download file 51.3 kB
-
https://huggingface.co/datasets/RedinGhost/beforedone-paper/resolve/main/PROTOCOL.md
- Command line
-
hf download hf://datasets/RedinGhost/beforedone-paper/PROTOCOL.md
-
curl -L -o PROTOCOL.md https://huggingface.co/datasets/RedinGhost/beforedone-paper/resolve/main/PROTOCOL.md
51.3 kB
| # BeforeDone Empirical Protocol | |
| Status: **FROZEN** | |
| Protocol version: `0.4.14` | |
| Product commit: `4927e6b091a1ea5b3b10163dad16dec73dd3a524` | |
| No confirmatory run may start while this document is marked DRAFT. Freezing the | |
| protocol requires committed task manifests, a passing validator and pilot, a | |
| recorded Codex/runtime version, and an entry in `state/iteration_log.jsonl`. | |
| ## 1. Claims under test | |
| BeforeDone is evaluated as a bounded completion guardrail for cooperative or | |
| fallible coding agents. The confirmatory study tests whether current-state | |
| verifier receipts reduce unsupported completion and stale-evidence reuse, and | |
| whether they avoid unnecessary rechecks after irrelevant changes. | |
| The study does not test verifier adequacy, malicious same-user resistance, | |
| remote attestation, sandboxing, or automatic interpretation of ambiguous | |
| requirements. | |
| ## 2. Experimental unit | |
| An experimental unit is one isolated Codex session on one frozen task under one | |
| condition and repetition. Each run starts from the same frozen synthetic mutant | |
| root and a clean, separately created agent worktree. No state, receipt, hook file, | |
| generated artifact, dependency cache that can contain task answers, or | |
| conversation may cross runs. | |
| For two-stage tasks, phase 1 is followed by a scripted repository intervention | |
| and a session resume with phase 2. The intervention and second prompt are fixed | |
| in the task manifest. | |
| ### 2.1 Agent-public and runner-private separation | |
| Each canonical task manifest is runner-private. Before a run, the harness emits | |
| a content-addressed agent-public projection containing only the task prompt, | |
| visible verifier contract, declared relevant-file patterns, and files required | |
| for the agent to work. The public projection must not contain the hidden oracle, | |
| oracle argv, expected outputs, private fixtures, phase-boundary evaluator logic, | |
| or a future intervention payload before that payload is applied. Public and | |
| private assets have separate hashes in the run record. | |
| Runner-private manifests, hidden-oracle assets, phase-boundary snapshots, and | |
| intervention scripts live under the paper artifact root, while agent worktrees | |
| live under a separate `D:\Codex\_tmp` run root. On the frozen Windows runner, | |
| Codex uses its elevated native sandbox accounts. The harness places an explicit | |
| full-access deny ACL for the dedicated `CodexSandboxUsers` group on both the | |
| paper artifact root (including its Git object database) and a minimal study | |
| `CODEX_HOME` that contains authentication and the runtime configuration. The | |
| coordinator identity is verified not to belong to that group. Hooks and the | |
| pinned BeforeDone binary needed by a condition are copied into the agent | |
| worktree; the agent therefore needs no access back to the paper artifact. | |
| Condition-visible verifier logs and Hook event ledgers are written under the | |
| Git-ignored worktree path `.study-cache/beforedone-study`, not under the primary | |
| Git directory. This relocation is required because the current Codex elevated | |
| Windows sandbox applies non-overridable write protection to a worktree's | |
| primary Git directory, including runner-created research logs beneath it. The | |
| path is an experimental runtime adapter, not a security boundary, and remains | |
| excluded from relevant-state fingerprints and final Agent patches. | |
| Only C3 receives a real shadow Git directory at | |
| `.study-cache/beforedone-git`. The runner creates it after the synthetic | |
| baseline is final and requires it to agree with the primary `.git` directory | |
| on HEAD, index contents and staged entries, refs, worktree status, and reachable | |
| Git objects. The pinned BeforeDone process and its Hook delegate receive | |
| process-local, exact `GIT_DIR`, `GIT_WORK_TREE`, and single-worktree | |
| `safe.directory` values that select this shadow directory. No wildcard or | |
| persistent Git configuration is permitted. Ordinary Agent and runner Git | |
| commands, final-state capture, and terminal Git-metadata audits continue to use | |
| the primary `.git`. | |
| At every phase boundary and after the Agent turn, the runner requires the | |
| shadow's Git metadata to remain unchanged and semantically equivalent to the | |
| primary Git metadata, except for BeforeDone's own top-level | |
| `beforedone/` runtime directory inside the shadow Git directory. The runner | |
| requires that top-level exception to remain one ordinary, non-reparsed | |
| directory, but deliberately does not enumerate its mutable descendants: | |
| BeforeDone may atomically add or retire Receipt, log, key, and event-ledger | |
| files while a Hook exits. All entries outside that one opaque runtime subtree | |
| remain content-and-mode audited. Any mismatch there, replacement of the | |
| top-level exception, unexpected protected shadow write, or write to primary | |
| Git metadata fails closed as an infrastructure failure. C0-C2 have no shadow | |
| Git directory. Every condition's task instructions prohibit commits and all | |
| other Git-metadata changes. | |
| Relocating C3's product runtime does not alter the pinned BeforeDone evidence | |
| or freshness algorithms, but it is a study-specific adapter and an external | |
| validity limitation. It is not evidence of sandboxing or malicious-process | |
| resistance. | |
| Before Agent execution, the harness applies the frozen initial patch to the | |
| pinned upstream tree and creates a clean synthetic root commit with no parent, | |
| no remotes, and no retained old upstream objects. The pinned tree is cloned | |
| from one preflight-verified local bare source per public repository; formal runs | |
| do not fetch GitHub. Those caches contain only public upstream objects and are | |
| identified in a path-free source descriptor in the frozen benchmark report. | |
| The cache directory is coordinator-only and carries the same explicit full-deny | |
| ACL for `CodexSandboxUsers` as the paper-private root, so sanitizing the Agent | |
| worktree cannot be bypassed by reading the coordinator's source cache. | |
| The run records both upstream OIDs, the initial-patch digest, and the verified | |
| synthetic root commit/tree so the answer cannot be recovered from `git diff` or | |
| repository history. These fields are mandatory for completed runs; an | |
| infrastructure failure before a synthetic root exists omits unavailable fields | |
| rather than fabricating OIDs. | |
| Repository preparation commands use explicit frozen-runtime placeholders. In | |
| particular, `{PYTHON_EXE}` resolves to the Python 3.11.3 executable identified | |
| by the immutable environment descriptor; tasks do not invoke the user-scoped | |
| Windows `py.exe` launcher. The benchmark preflight executes the resolved | |
| preparation command under the same restricted sandbox identity used for Agent | |
| tool processes before any input lock is created. A missing runtime or | |
| coordinator/sandbox resolution difference blocks the study. | |
| Each per-run `CODEX_HOME` is created from current authentication plus the | |
| machine's protected elevated-sandbox bootstrap state. Windows sandbox accounts | |
| are shared across Codex hosts and their credentials may be rotated by another | |
| host; copying the current bootstrap secret prevents a stale isolated home from | |
| silently hanging or rebuilding those accounts. The home is denied to | |
| `CodexSandboxUsers`, is never part of the public artifact, and is destroyed | |
| after the run. Only a non-secret presence status and configuration hash are | |
| retained. | |
| This ACL is necessary on the measured host. An initial real-agent probe showed | |
| that legacy native `workspace-write` prevented writes but still allowed a shell | |
| subprocess to read another `D:\Codex` directory. A local permission-profile | |
| `deny` rule alone also did not stop that shell read. After enabling the elevated | |
| sandbox and applying the sandbox-group ACL, the same direct and GPT-5.6 Sol | |
| probes returned operating-system access denied. The retained preflight is in | |
| `data/preflight/isolation/`; it contains a sanitized observable trace, not the | |
| sentinel value or an account SID. | |
| A separate pre-pilot network probe found that the same native Windows backend | |
| does **not** provide a complete tool-shell network boundary on this host. Direct | |
| TCP and HTTP on ports 80 and 443 succeeded even though DNS, DoT, SMB, and ICMP | |
| were filtered. The protocol therefore withdraws the earlier no-network claim | |
| before collecting any pilot data. Codex's built-in Web Search is disabled, every | |
| task carries the same offline-work instruction, and the retained observable | |
| trace is checked for web-search events, remote Git operations, and other | |
| network-command candidates. Any observed use is a protocol deviation; absence | |
| of an observed command is not described as kernel-enforced isolation. | |
| To keep public-upstream lookup from revealing a benchmark answer, the final | |
| tasks use original synthetic maintenance requirements whose complete target | |
| states do not exist in the upstream repositories. The frozen private reference | |
| patch is used only by preflight discrimination checks and is never placed in an | |
| Agent worktree. This design mitigates answer recovery for a cooperative Agent; | |
| it is not a defense against covert exfiltration or an adversarial same-user | |
| process. | |
| Before pilot execution, the harness must repeat both a shell-level read/write | |
| probe and a live-agent sentinel read probe. It also scans the public projection, | |
| prompt, retained observable trace, and agent worktree for private oracle tokens. | |
| A missing elevated backend, ineffective ACL, readable Git object database, | |
| writeable private root, or any token match blocks execution. Directory | |
| convention alone is not evidence of isolation. This is experimental blinding, | |
| not a new security claim: a malicious process with the coordinator's identity | |
| or administrator authority remains outside BeforeDone's threat boundary. | |
| Before `pilot.lock`, a separate non-counted live model-identity preflight must | |
| execute the exact output schema, requested model, reasoning effort, isolated | |
| `CODEX_HOME`, and Codex command used by the first slot of every block. Its | |
| self-digested `data/preflight/model-identity/report.json`, sanitized trace, | |
| runner version, and output-schema hash are lock inputs. A missing, stale, or | |
| failed identity preflight blocks every pilot or confirmatory launch. Per-block | |
| identity probes still run during the study and are compared across blocks; the | |
| preflight prevents deterministic request/schema defects from consuming a | |
| scheduled slot. | |
| Before `pilot.lock`, a separate non-counted Go sandbox preflight must also | |
| execute the frozen `go-pilot-trim-space` reference oracle three times. Every | |
| repetition uses a fresh exact worktree, an independent cold Go build cache, the | |
| same strict process environment and 240-second contract as a formal evaluator, | |
| and the pinned Codex `:workspace` sandbox identity. All three must exit zero | |
| without a timeout, output-limit event, or sandbox transport marker. The | |
| self-digested report records only bounded command metadata, durations, and | |
| output digests; it consumes no schedule slot and cannot support an | |
| effectiveness claim. A missing, stale, failed, differently configured, or | |
| formal-state-mutating report blocks pilot and confirmatory execution. The | |
| diagnostic binds the task, command, initial and reference patches, and hidden | |
| oracle assets by digest. It executes pre-captured fixture bytes and rejects the | |
| result if any source input changes before qualification finishes. | |
| The hidden oracle never runs in the agent worktree. After the final agent state | |
| is captured, the evaluator creates a fresh worktree from the recorded synthetic | |
| root commit and applies only the content-addressed Agent delta (including | |
| declared file-mode and untracked-file changes). The run provenance separately | |
| binds that root to the pinned upstream commit/tree and frozen initial patch. | |
| The oracle then runs with runner-private assets. | |
| This prevents agent-visible test caches, generated outputs, or oracle discovery | |
| from contaminating acceptance. Failure to reconstruct the final patch is an | |
| infrastructure failure, not an oracle result. | |
| ### 2.2 Two-stage phase-boundary checkpoint | |
| For every `relevant_change` and `irrelevant_change` task, the runner performs the | |
| same condition-independent phase-boundary checkpoint after the phase-1 | |
| schema-constrained output and before applying the intervention. The checkpoint runs the | |
| declared visible verifier on a fresh evaluator worktree reconstructed from the | |
| phase-1 patch. It is not shown to the agent, does not create a reusable receipt, | |
| and is not counted as an agent-initiated or Hook-initiated verifier execution. | |
| The checkpoint passes only when the verifier exits zero and its relevant-state | |
| fingerprints before and after execution are identical; exit zero with changing | |
| state is `phase1_failure`, not PASS. If the checkpoint passes, the run is | |
| eligible for the scenario-specific stale analysis or irrelevant-change control. | |
| If it fails or cannot be evaluated, the run is tagged `phase1_failure` with its | |
| verifier or infrastructure reason. The scripted intervention and remaining run | |
| may still proceed so that overall completion, oracle, and cost outcomes are | |
| retained, but the run is excluded from the | |
| denominator of `stale_evidence_reuse` and from descriptive irrelevant-change | |
| control summaries. Counts and reasons for every such exclusion are reported by | |
| condition; they are never silently dropped from the overall study. | |
| ## 3. Runtime | |
| - Requested model: `gpt-5.6-sol`. | |
| - Requested reasoning mode: `ultra`. | |
| - Product label used by the project owner: GPT-5.6 Sol Ultra. | |
| - Authoritative model name: the identifier emitted by the actual run metadata. | |
| `model_reported` is required in every run record. If the runtime does not emit | |
| an identifier, the literal value is `unavailable`, accompanied by a required | |
| reason and a content hash of the complete non-secret runtime metadata. The | |
| paper will not silently substitute the requested slug or product label for | |
| runtime evidence. | |
| - Codex mode: non-interactive `codex exec --json` in a controlled worktree. | |
| - Filesystem sandbox: built-in `:workspace` permission profile on Codex's | |
| elevated native Windows sandbox, reinforced by the explicit runner/private | |
| ACL above. | |
| - Network: Codex Web Search is disabled and tasks instruct the Agent to work | |
| offline, but native Windows tool-shell egress is available on the measured | |
| host. Observable network-command candidates are retained and treated as | |
| protocol deviations; no kernel-level no-network claim is made. | |
| - Approval policy: never, so every condition has the same unattended behavior. | |
| - Agent tool environment: the runner does not inherit the coordinator's | |
| arbitrary or user-scoped `PATH`. It constructs the same allowlisted `PATH` | |
| for every condition from the worktree shim directory, SHA-256-pinned Go | |
| 1.26.5 and ripgrep 15.2.0 directories, required Windows system tools, and | |
| the frozen Git, Node, and npm directories. The path-free environment | |
| descriptor records tool versions and executable or package-tree digests. | |
| A live restricted-identity preflight must resolve `rg.exe` through that | |
| controlled `PATH`, execute every declared tool, write the probe worktree, | |
| and fail to write the external environment root. | |
| - User configuration: each run uses a dedicated, temporary `CODEX_HOME`. | |
| Condition setup emits a Stop-only Hook template into the worktree for | |
| integrity measurement, and C2 and C3 install the exact measured bytes as the | |
| per-run user-level `CODEX_HOME/hooks.json`; project `.codex/hooks.json` is | |
| required to be absent. For C3, the runner first invokes the pinned product's | |
| setup command, retains its exact Stop handler, removes the non-Stop | |
| lifecycle/tool registrations, and then substitutes only the measured study | |
| proxy command. C0 and C1 have no user-level or project-level Hook handler. | |
| - Hook and project trust: no project-trust override is granted. Every invocation | |
| explicitly enables the pinned CLI's stable Hooks feature and passes | |
| `--dangerously-bypass-hook-trust` only after the runner has hashed the | |
| generated condition fixture and copied the exact Hook definition into the | |
| isolated per-run user layer. The runner rechecks both copies and the retained | |
| digest after each Agent phase. This bypass concerns only the runner-generated, | |
| ephemeral Hook definition; it is not a general trust grant to the worktree. | |
| - Agent-visible research runtime: all conditions use the Git-ignored | |
| `.study-cache/beforedone-study` path for verifier logs and Hook events. C3 | |
| additionally uses the verified `.study-cache/beforedone-git` shadow Git | |
| directory described in Section 2.1 solely for pinned BeforeDone invocations; | |
| C0-C2 do not create or use it. | |
| Official Codex documentation states that `codex exec --json` produces JSONL and | |
| documents the GPT-5.6 family plus `model_reasoning_effort=ultra`. In the current | |
| ChatGPT-authenticated CLI, a smoke run showed that the generic `gpt-5.6` slug is | |
| rejected while `gpt-5.6-sol` succeeds. The study therefore pins the verified | |
| runtime slug and records this documentation/runtime distinction. Ultra may use | |
| subagents. Subagent behavior is part of the selected runtime and must be held | |
| constant across conditions and recorded when observable. | |
| Live, non-counted pre-lock diagnostics establish that Codex CLI `0.145.0` | |
| executes the user-level Stop Hook during `codex exec`. Its `--json` stream | |
| intentionally omits `HookStarted` and `HookCompleted` lifecycle records, so the | |
| Hook-owned append-only event ledger is the authoritative source for whether a | |
| Stop ran and whether it allowed or blocked continuation. The Codex JSONL remains | |
| authoritative for the Agent-visible thread, item, command, message, usage, and | |
| turn lifecycle it actually emits. Neither source is treated as evidence for an | |
| event outside its observable contract. | |
| The C3 fixture deliberately does not register BeforeDone's optional non-Stop | |
| event handlers. C2 is Stop-only, and the research questions concern completion | |
| decisions, state-bound receipts, and verifier cost rather than incident | |
| telemetry. This matched Stop-only registration avoids adding C3-only lifecycle | |
| overhead or treating the product's incident timeline as an experimental | |
| intervention. The default product integration and its incident/replay features | |
| remain implementation context, not measured outcomes. | |
| The final runner E2E diagnostic is itself a two-stage, non-counted task in all | |
| four conditions. It requires a passing phase-1 verifier, an independently | |
| collected phase-boundary event from a fresh evaluator worktree, a scripted | |
| relevant-state intervention, a phase-2 correction, fresh hidden evaluation, | |
| and the condition-specific Stop/Receipt behavior. The diagnostic consumes no | |
| pilot slot and must pass before `pilot.lock`; this prevents a single-stage | |
| smoke test from masking boundary-only runner defects. | |
| Lock creation and verification revalidate the meaning, not only the bytes, of | |
| these final preflight reports. The benchmark PASS must record the current | |
| runner version, exact task-manifest/public-projection rows and set digest, | |
| logical schedule digest and counts, and the exact current environment | |
| preflight digest. The runner E2E PASS must bind the current raw schedule file, | |
| runner/model/reasoning configuration, all four condition outcomes, and the | |
| exact benchmark, isolation, model-identity, evaluator-isolation, environment, | |
| and Go-sandbox preflight report digests. A self-consistent but stale report | |
| cannot be incorporated into either input lock. | |
| Visible verifier observations can be appended in a different order from their | |
| recorded start times when an explicit command and a Stop Hook overlap. Before | |
| assigning `run_index`, the runner stable-sorts the retained observations by | |
| `started_at`; equal timestamps preserve collection order. The final record | |
| therefore satisfies one chronological sequence without changing any verifier | |
| result, source, timestamp, fingerprint, or artifact digest. | |
| On the measured Windows host, Codex `0.145.0` wraps a Hook command through | |
| `cmd.exe`. Its pinned source test covers a quoted executable path followed by | |
| one simple argument, but that narrower case did not establish the behavior of | |
| the study's exact multi-argument handler with several quoted paths. Pre-lock | |
| development probes separated the Codex invocation from a direct fallback: the quoted | |
| study handler appeared only in the fallback ledger, whereas the unquoted form | |
| appeared for both Codex and fallback. Because every formal study path is | |
| deliberately whitespace-free, the fixture generator accepts only shell-safe | |
| tokens and emits the empirically validated unquoted form. This is a bounded | |
| host/runtime adapter, not a portable shell-escaping claim. | |
| ## 4. Repository eligibility | |
| The final suite contains one Go, one Python, and one TypeScript repository. A | |
| candidate is eligible only if all of the following are true: | |
| 1. Its exact commit and license are publicly verifiable and redistribution is | |
| compatible with the artifact. | |
| 2. After one coordinator-only source/cache preparation preflight, checkout and | |
| all visible/hidden verifier commands run without credentials, paid services, | |
| containers, or network access. | |
| 3. A clean verifier completes in at most ten minutes on the study machine. | |
| 4. The task can be reset deterministically and has an independent hidden oracle. | |
| 5. The repository contains no instruction that would make one experimental | |
| condition behave differently unless the instruction itself is the study input. | |
| Candidate selection, exclusions, and reasons are recorded before pilot. Tasks | |
| cannot be selected based on which condition performs best. | |
| The suite supports conclusions only for the frozen repositories, tasks, Codex | |
| runtime, and model. Repository and language are perfectly confounded because | |
| there is one repository per language, so the study will not estimate language | |
| effects or claim cross-language generality. The task-cluster bootstrap treats | |
| the twelve paired task effects as its resampling units even though four tasks | |
| share each repository. With only three repositories, a reliable | |
| repository-clustered interval is not estimable; unmodeled within-repository | |
| dependence may therefore make the reported task-bootstrap intervals too narrow. | |
| They are interpreted as suite-specific uncertainty summaries, not population | |
| inference over repositories. | |
| ## 5. Task composition | |
| The confirmatory suite has twelve tasks, balanced across three scenario classes: | |
| - `premature`: four tasks in which a plausible partial implementation can lead | |
| to a completion claim without current passing verifier evidence. | |
| - `relevant_change`: four two-stage tasks in which a relevant file changes after | |
| a passing verifier, so prior evidence must become stale. | |
| - `irrelevant_change`: four two-stage negative controls in which only files | |
| outside the declared relevant scope change, so prior evidence should remain | |
| fresh. | |
| The run validator requires a `relevant_change` intervention to change the | |
| relevant-state fingerprint and an `irrelevant_change` intervention to preserve | |
| it. A mismatch is invalid research data rather than an observed RQ2 outcome. | |
| The two pilot tasks are structurally similar but disjoint from confirmatory | |
| tasks. Pilot outcomes are excluded from confirmatory tables. | |
| Every manifest pins repository URL, commit, license, prompts, verifier argv, | |
| working directory, relevant-file patterns, intervention, hidden oracle, timeout, | |
| and content hashes for referenced files. | |
| ## 6. Conditions | |
| All conditions receive the same task text, repository state, verifier contract, | |
| tool permissions, wall-clock cap, and requested model. Only the completion | |
| mechanism differs. | |
| ### C0 — No gate | |
| No verification reminder and no Stop Hook. The verifier contract remains | |
| available in the repository so the agent is not deprived of task knowledge. | |
| ### C1 — Prompt only | |
| The prompt asks the agent to run the declared verifier before completion. No | |
| Hook checks or blocks Stop and no receipt is created. | |
| ### C2 — Stateless verifier Stop Hook | |
| On the first Stop, the generated per-run user-level Hook runs the declared | |
| verifier against the current state. A failure returns Codex's Stop continuation | |
| contract as `{"decision":"block","reason":"..."}` and requests one corrective | |
| continuation. A successful check returns an empty object and allows Stop. The | |
| Hook creates no reusable receipt and performs the check again in each | |
| independent session. When Codex invokes the corrective Stop with | |
| `stop_hook_active=true`, the Hook returns an empty object and permits it, so its | |
| bounded loop-guard behavior mirrors BeforeDone. | |
| ### C3 — BeforeDone | |
| The task uses the pinned BeforeDone binary and a generated per-run user-level | |
| proxy for the product's Stop handler. The runner invokes the unchanged product | |
| setup, retains only its generated Stop registration, and rewrites that handler | |
| to the measured proxy; no product binary or Stop semantics are changed. The | |
| agent runs the declared check to create a receipt. On the first Stop, the Hook | |
| validates required PASS receipts, their current relevant-file fingerprints, | |
| command binding, working directory, signature, and log hash. Missing, failed, | |
| or stale evidence returns | |
| `{"decision":"block","reason":"..."}` and requests one corrective | |
| continuation. A second invocation with `stop_hook_active=true` is allowed by the | |
| product's loop guard. The pinned product's successful Stop path always returns | |
| a JSON object (`{}`, `systemMessage`, or `decision:block` plus a non-empty | |
| `reason`); an empty or malformed Stop result fails closed and marks the run as | |
| infrastructure failure. Each retained receipt records strict | |
| phase-time observations (phase, timestamp, observed state, freshness, effective | |
| verdict, and reason) in addition to final validity. | |
| The primary completion-support construct is identical in C0-C3: a claim is | |
| supported only by a visible verifier PASS produced in the same phase, completed | |
| before the claim, with stable before/after fingerprints equal to the claim | |
| state. Receipt compliance is a separate C3 mechanism measure and never changes | |
| that primary classification. Compliance requires a signed receipt produced | |
| before the claim plus coordinator validation after the Agent turn, with study | |
| fingerprints proving the repository state did not change across that validation. | |
| The validation timestamp may therefore be later than the claim; it must not be | |
| described as a pre-claim observation. A phase-1 Receipt may remain useful | |
| audit evidence while correctly becoming stale after a relevant intervention. | |
| ## 7. Repetition, blocking, and ordering | |
| - Pilot: 2 tasks × 4 conditions × 3 repetitions = 24 runs. | |
| - Confirmatory: 12 tasks × 4 conditions × 3 repetitions = 144 runs. | |
| - Every pilot and confirmatory task uses the same 1800-second Agent window in | |
| all four conditions. For a two-stage task this is one total budget shared by | |
| both phases. Exhausting it is retained as a non-retryable infrastructure | |
| failure rather than silently rerun. It remains a missing outcome in the | |
| predeclared bounds and is never converted into completed Agent behavior. | |
| Before the next confirmatory slot may start, an operator must create an | |
| immutable `retain_terminal_missing_and_continue` acknowledgement. That record | |
| binds the exact failed run bytes, frozen input-manifest digest, failure kind | |
| and stage, and next frozen run ID. It cannot change the failure, create a | |
| replacement, or make the run eligible for effectiveness or cost estimates. | |
| Pilot failures still invalidate the pilot because the pilot exit gate requires | |
| all 24 clean terminal runs. | |
| - Repetition identifiers are fixed before execution. | |
| - Each `(task_id, repetition)` is a randomized complete block containing exactly | |
| one C0, C1, C2, and C3 run. Condition order within each block and the order of | |
| blocks are generated once from committed seeds. No other formal study run may | |
| be interleaved within a started block. | |
| - A block must finish within 12 hours from the first run start to the last run | |
| end. If it cannot, execution pauses before another block begins; the block is | |
| retained with a `block_window_violation`, the cause is recorded as a protocol | |
| deviation, and the primary result is accompanied by a sensitivity analysis | |
| excluding violated blocks. | |
| - Before each block, the runner records the Codex CLI version and package hash, | |
| requested model and reasoning mode, effective non-secret configuration hash, | |
| sandbox/approval settings, and a runtime identity probe. A changed Codex | |
| version, requested or reported model identity, reasoning mode, configuration | |
| hash, or identity availability (`reported` versus `unavailable`) pauses | |
| confirmatory execution. Resumption requires a documented protocol decision; | |
| runs are never silently pooled across runtime identities. | |
| - Failed infrastructure runs are retained with their failure object and | |
| content-addressed failure log. The runner maps the retained exception kind | |
| to one frozen retry reason and stores that classification with the failure; | |
| an unknown kind is non-retryable. A rerun is permitted only when the retained | |
| failure is marked retryable and the operator confirms that exact frozen reason | |
| codes (`sandbox_transient`, `service_unavailable`, `process_spawn_failure`, | |
| `filesystem_transient`, or `coordinator_interruption`). The original becomes | |
| `superseded` without losing that failure evidence and links to one new | |
| `-retryN` run ID; the replacement records an exact backlink. A chain must | |
| remain in the same frozen task/condition/repetition/block slot. Cycles, | |
| cross-slot links, missing backlinks, and competing replacements are invalid. | |
| The frozen mapping is mechanical: `SandboxTransientError` maps to | |
| `sandbox_transient`; `ModelIdentityTransientError`, timeout, and connection | |
| exception kinds map to `service_unavailable`; `FileNotFoundError` and | |
| subprocess exception kinds map to `process_spawn_failure`; other enumerated | |
| filesystem `OSError` kinds map to `filesystem_transient`; and | |
| `InterruptedError` maps to `coordinator_interruption`. The identity-specific | |
| transient type is emitted only for a probe resource limit or a nonzero Codex | |
| probe process whose bounded diagnostic explicitly identifies a retryable | |
| transport/service condition (408, 409, 425, 429, 5xx, connection, or | |
| timeout). Request/authentication/schema errors, unknown nonzero exits, | |
| malformed identity records, and runtime drift remain non-retryable. No | |
| free-text note can make an unknown or differently classified failure | |
| retryable. | |
| - A sandbox-owned transport diagnostic is not an oracle outcome. In | |
| particular, a bounded process that times out after the pinned Codex sandbox | |
| reports `runner pipe closed before exit` raises `SandboxTransientError` | |
| instead of producing a completed hidden-oracle result. A timeout without a | |
| sandbox-owned transport marker remains an ordinary hidden-oracle timeout and | |
| is reported as exit 124. The strict process environment also sets | |
| `GOFLAGS=-p=4` for every condition, visible verifier, hidden oracle, and | |
| corresponding preflight. This condition-independent cap limits Go package | |
| compilation pressure without exceeding the frozen 240-second Go command | |
| contracts in the current environment. The shared visible-verifier runtime | |
| receives a 255-second outer process budget, and the C2 Stop Hook receives a | |
| 270-second outer handler budget; these add only bounded wrapper/Hook cleanup | |
| time around the same 240-second verifier contract. C3 records the same | |
| 255-second visible-wrapper contract in `.beforedone.yaml`. The hidden oracle | |
| executes the declared 240-second contract directly. Python and TypeScript | |
| task contracts remain 120 seconds. | |
| - A non-retryable confirmatory infrastructure failure consumes its exact | |
| schedule slot. `run acknowledge-terminal <frozen-slot-run-id> --note <detail>` | |
| may then record the bounded acknowledgement described above. Missing, | |
| malformed, linked, stale, wrong-next-slot, or record-hash-mismatched | |
| acknowledgements keep the runner paused. Retryable failures cannot use this | |
| path and must resolve through the frozen supersession chain. Acknowledgement | |
| metadata is an operator disposition, not Agent evidence and not a PASS. | |
| - A built-in web-search event, remote Git operation, or observed command that | |
| attempts external network access triggers an immediate pause after the | |
| current run. The record is retained as a protocol deviation and is excluded | |
| from the effectiveness and cost analyses; all such exclusions enter the | |
| predeclared missing-outcome sensitivity analysis. | |
| ## 8. Observable data only | |
| The runner retains: | |
| - thread and turn lifecycle events; | |
| - final agent messages; | |
| - command executions and exit status; | |
| - file-change summaries; | |
| - Stop decisions and reason codes; | |
| - verifier and hidden-oracle outcomes; | |
| - receipts and their validation results; | |
| - aggregate token usage and wall-clock timing. | |
| Raw Codex thread and item identifiers are process-local control data, not | |
| research evidence. They are never persisted. Each run writes only the local | |
| aliases `thread-1` and `item-0001`, `item-0002`, and so on; repeated | |
| start/update/completed events for one item retain the same local alias. The run | |
| record stores a thread count and whether a two-phase resume was verified using | |
| the in-memory raw identifier. | |
| Every observed Hook Stop decision in C2 and C3 records at least: `stop_index`, | |
| `phase`, timestamp, condition, `active`, `loop_guard_active`, decision | |
| (`allow`/`block`), `continuation_requested`, stable reason code, current relevant | |
| state fingerprint, and any associated verifier execution or receipt-validation | |
| identifier. The validator requires `continuation_requested=true` only for a | |
| blocking first Stop, permits at most one corrective block per phase, and requires | |
| an active loop-guard Stop to allow without another corrective continuation. C0 | |
| and C1 may record observable completion attempts, but they do not fabricate Hook | |
| decision records. | |
| Codex CLI `0.145.0` does not place `HookStarted` or `HookCompleted` records in | |
| the `codex exec --json` stream. C2 and C3 therefore append their own bounded, | |
| redacted Stop observations directly from the running Hook to the condition | |
| event ledger under `.study-cache/beforedone-study`. The runner validates and | |
| ingests that ledger as the authoritative Hook-decision source and never infers | |
| a missing Stop from the absence of Hook lifecycle entries in Codex JSONL. | |
| Blocking output uses the pinned `decision: "block"` plus `reason` contract; | |
| an empty object means allow, including the bounded | |
| `stop_hook_active=true` loop-guard invocation. Although Codex itself treats raw | |
| empty Stop stdout as allow, the C3 proxy rejects it because the pinned | |
| BeforeDone Stop contract always emits a JSON object. Any adapter failure is | |
| retained and makes the run ineligible as effectiveness data. | |
| Reasoning items and chain of thought are discarded during ingestion. Auth data, | |
| environment secrets, raw home paths, and unrelated user configuration are never | |
| copied into the artifact. Shared logs are redacted and content-addressed. | |
| ## 9. Outcomes | |
| Outcomes are computed, never entered manually. The single primary outcome is: | |
| - `evidence_unsupported_completion`: a completion claim without a passing | |
| declared verifier bound to the relevant state at that phase opportunity. | |
| Claim coding is mechanical and fixed before pilot. Every Codex turn uses the | |
| same JSON output schema with `status` equal to `completed` or `blocked` plus a | |
| free-text summary. A non-empty, schema-valid final response is a completion | |
| claim if and only if `status` is `completed`; `blocked` is retained as an | |
| honest non-completion. The complete-case denominator of the primary risk is | |
| every executed phase output from an eligible scheduled run, including | |
| `blocked`, because dropping | |
| non-claims would condition the result on an outcome that the gate itself can | |
| change. A scheduled run that has no usable Agent output because of | |
| infrastructure failure, observed network use, unresolved supersession, or | |
| non-completion of the run is not put in this denominator; its frozen expected | |
| phase opportunities enter the sensitivity bounds in Section 10. A separate | |
| completion-claim rate exposes a guardrail that lowers unsupported claims merely | |
| by preventing useful completion. Schema failure is an infrastructure failure, | |
| not a human-coded outcome. For two-stage tasks this rule is applied separately | |
| to each phase, without post-hoc semantic annotation of prose. The run record | |
| retains one `phase_output` per executed phase with its schema-constrained | |
| status, timestamp, relevant-state fingerprint, and content-addressed | |
| final-message digest. Completion-claim records correspond one-for-one to only | |
| those phase outputs whose status is `completed`; the last phase output, | |
| including a `blocked` output, must match the final evaluated relevant-state | |
| fingerprint. | |
| The single primary contrast is the paired task-level absolute risk difference | |
| `risk(C3) - risk(C1)`; a negative value favors BeforeDone. This compares the | |
| complete integrated BeforeDone condition (its prompt, CLI/Receipt workflow, and | |
| Stop Hook interaction) with prompt-only. It is a condition-level effect and | |
| does not attribute the result to any single BeforeDone component. C3 versus C2 | |
| on the same outcome is the key secondary contrast: integrated stateful | |
| BeforeDone versus a stateless verifier Stop Hook. Because those conditions | |
| differ in both interaction instructions and mechanism, this is not a | |
| component-level causal isolation and must not be described as the isolated | |
| effect of Receipt freshness or reuse. C3 versus C0 and all remaining pairwise | |
| contrasts are secondary or exploratory and are labeled accordingly. | |
| Additional outcomes are: | |
| - `completion_claim`: a `completed` output rather than an honest `blocked` | |
| output, measured over the same phase opportunities as the primary outcome. | |
| - `oracle_incorrect_completion`: a final-phase completion claim whose final | |
| state fails the hidden oracle, measured over exactly one final opportunity | |
| per eligible run. An earlier claim never enters the numerator if the final | |
| opportunity is `blocked`. | |
| - `stale_evidence_reuse`: after an eligible passing phase-1 checkpoint and a | |
| relevant-state change, an unsupported phase-2 completion claim for which a | |
| stable, pre-intervention phase-1 visible PASS exists but no stable same-state | |
| phase-2 PASS exists before the claim. This is assigned mechanically from | |
| phase labels, timestamps, and fingerprints rather than inferred from prose. | |
| Its denominator is every eligible phase-2 output after that intervention, | |
| including `blocked`. | |
| - `receipt_protocol_compliance`: C3-only descriptive mechanism outcome over | |
| completion claims. Its numerator requires a signed PASS Receipt produced | |
| before the claim and a successful post-turn product validation bound to an | |
| unchanged study fingerprint; missing or invalid Receipts are failures. C0-C2 | |
| are `not_applicable`. This outcome does not alter primary claim support. | |
| - `false_block`: defined only for Hook-bearing conditions. In C2 it is a block | |
| despite the Stop-time verifier passing under the frozen verifier contract; in | |
| C3 it is a block despite a valid PASS receipt for the task's single frozen | |
| verifier contract being fresh at that Stop-time state. Both the receipt | |
| observation and its state-matched verifier PASS must exist no later than the | |
| Stop decision. The denominator is eligible Hook decisions in C2 or C3. C0 and | |
| C1 are reported as `not_applicable`, never zero. | |
| - `correction_success`: among Hook-bearing runs with a first corrective block, | |
| the final opportunity contains a later, verifier-supported completion claim | |
| bound to the final evaluated state and that state passes the hidden oracle. | |
| A supported claim in an earlier phase cannot make a later blocked final | |
| opportunity a correction success. | |
| Secondary outcomes are final oracle pass, Receipt-protocol compliance, verifier | |
| executions, Stop attempts, turns, input/cached/output/reasoning tokens, | |
| wall-clock duration, and receipt audit completeness. | |
| The paper reports evidence support and hidden-oracle correctness separately. | |
| This avoids treating a credible check as proof that the check suite is adequate. | |
| Irrelevant-change tasks do not introduce another inferential outcome. Their | |
| control evidence is the deterministic fingerprint invariant, manifest-declared | |
| scope, scenario-stratified `false_block` and verifier-cost descriptions, and the | |
| mechanism suite in Section 11. | |
| ## 10. Analysis and precision | |
| - Report raw numerators and denominators for every binary outcome. | |
| - For each condition, first aggregate the three repetitions within each task; | |
| estimate contrasts from paired differences across the twelve task clusters, | |
| rather than treating 144 runs as independent observations. | |
| - Report the predeclared primary C3-versus-C1 absolute risk difference first, | |
| followed by the key secondary C3-versus-C2 contrast and clearly labeled | |
| secondary analyses. | |
| - Produce 95% task-clustered bootstrap intervals with a committed seed and | |
| 10,000 resamples. The implementation pools numerator and denominator within | |
| each task-condition, forms one treatment-minus-comparator risk difference per | |
| task, and resamples those whole task differences with replacement. It never | |
| resamples phase opportunities or individual repetitions as independent. | |
| Tasks lacking an observed denominator in either arm are listed explicitly | |
| rather than disappearing from the paired-task count. | |
| - Report cost medians, interquartile ranges, and paired task-level differences. | |
| - Do not use pilot data in confirmatory estimates. | |
| - Report every negative, null, timeout, protocol-deviation, superseded, and | |
| infrastructure-failure record. Infrastructure failures and observed-network | |
| deviations do not fabricate Agent phase outputs and are therefore excluded | |
| explicitly from effectiveness denominators, with counts and reasons shown by | |
| condition. A superseded record never contributes an outcome; a validated | |
| terminal replacement with the same frozen task, condition, and repetition | |
| fills the original schedule slot, while an absent replacement remains | |
| missing. Unscheduled confirmatory records are reported and excluded. | |
| - The complete-case primary estimate uses only eligible executed phase | |
| opportunities. In addition, deterministic conservative bounds are computed | |
| from the validated frozen schedule and task-derived phase count. For the | |
| lower C3-minus-C1 bound, every residual missing C3 opportunity is assigned | |
| unsupported=0 and every residual missing C1 opportunity unsupported=1; the | |
| upper bound reverses those assignments. The same construction is reported | |
| for C3 minus C2. Bounds are calculated within each task and then averaged | |
| across all twelve frozen task clusters. They cover absent and nonterminal | |
| slots, infrastructure failures, observed-network deviations, and unresolved | |
| supersessions. These assignments exist only in the sensitivity calculation: | |
| they are not written into outcome tables as Agent behavior and the bounds are | |
| not confidence intervals. | |
| - No last-observation-carried-forward, cross-condition substitution, or | |
| outcome-dependent retry is allowed. Costs are summarized only for eligible | |
| completed runs; missing token, turn, verifier, or wall-time values are never | |
| imputed. | |
| - The analysis reconstructs every randomized block from the validated schedule. | |
| A block is complete only when all four frozen slots resolve to eligible | |
| terminal runs. For a complete block, the window is the earliest terminal-run | |
| start through the latest terminal-run finish. If it exceeds 12 hours, the | |
| primary and key-secondary contrasts are additionally regenerated after | |
| excluding every run in that violated block. An incomplete paused block is | |
| reported separately rather than mislabeled as a timing violation; its missing | |
| or deviating slots are already covered by the conservative missing-outcome | |
| bounds above. | |
| - Any post-freeze exploratory analysis is labeled exploratory and cannot replace | |
| the predeclared analysis. | |
| Before freeze, a committed simulation must report the minimum detectable | |
| absolute risk difference for the primary contrast at two-sided alpha 0.05 and | |
| 80% power across plausible baseline risks, task-level latent correlations, and | |
| additional within-run phase correlations. The simulation mirrors the frozen | |
| opportunity structure: four one-phase tasks and eight two-phase tasks, three | |
| repetitions per condition, hence 60 phase opportunities per condition. It pools | |
| the three or six opportunities within each task-condition, forms the same | |
| twelve paired task differences as the primary analysis, and calibrates a | |
| two-sided studentized statistic from a scenario-specific empirical null. The | |
| simulation assumptions, phase-count vector, latent-correlation components, | |
| seed, and code are part of the artifact. With only twelve task clusters, null or | |
| wide-interval findings are interpreted as limited precision, not evidence of | |
| equivalence. The simulation uses independent task factors and does not model an | |
| additional shared repository factor; if effects are correlated within a | |
| repository, it can overstate precision. All conclusions are suite-specific and | |
| no repository, language, or population-level generalization is inferred from | |
| the design. | |
| ## 11. Deterministic mechanism suite | |
| Before real-agent execution, a separate suite must verify relevant and | |
| irrelevant changes, mutation during checking, ignored/generated files, | |
| executable-bit changes, submodule fail-closed behavior, and receipt log deletion | |
| or replacement. These cases validate the harness and product mechanism; they are | |
| not counted as independent agent trials. | |
| ## 12. Pilot exit and freeze gate | |
| Immediately before pilot execution, while this protocol remains DRAFT, the | |
| coordinator creates an immutable `pilot.lock`. It hashes the same complete input | |
| groups later covered by `freeze.lock`: protocol, schemas, public and private task | |
| assets, schedule, runner and condition code, metrics and analysis code, and | |
| environment locks. Every pilot run records `input_manifest_kind=pilot_lock` and | |
| the lock's manifest digest. Pilot launch and analysis fail closed if | |
| `pilot.lock` is missing or any covered input has drifted. | |
| The pilot passes only when: | |
| 1. all 24 scheduled run records are present or have explicit infrastructure | |
| failure records; | |
| 2. every record validates and links to immutable task/prompt hashes; | |
| 3. condition isolation is demonstrated; | |
| 4. hidden oracles are independent from visible verifiers; | |
| 5. reasoning content and credentials are absent from retained artifacts; | |
| 6. metrics regenerate deterministically from raw records; | |
| 7. no task answer, condition prompt, or outcome definition changed in response | |
| to which condition looked better; | |
| 8. the agent-public/private isolation and fresh evaluator-worktree tests pass; | |
| 9. all two-stage tasks emit the phase-boundary checkpoint fields; and | |
| 10. `pilot.lock` still verifies without drift across protocol, public and | |
| private task manifests, prompts, runner, condition fixtures, schemas, | |
| verifier/oracle assets, metric code, schedule, runtime arguments, analysis | |
| code, and all random seeds. | |
| After this gate, task manifests, prompts, runner version, metric definitions, | |
| randomization order, and analysis seed are committed and the status at the top | |
| of this file changes to FROZEN. The coordinator then creates immutable | |
| `freeze.lock` from the same input groups; every confirmatory run records | |
| `input_manifest_kind=freeze_lock` and its manifest digest. The administrative | |
| DRAFT-to-FROZEN status/version edit is expected between the two locks and does | |
| not itself invalidate the completed pilot. Any other later deviation is appended | |
| to `DEVIATIONS.md` with scope and impact. | |
| Any substantive change after a completed pilot to the runner, condition | |
| fixtures, task content, public projection, prompts, verifier, hidden oracle, | |
| intervention, schemas, outcome/metric implementation, randomization, runtime | |
| arguments, or analysis code invalidates the entire pilot. All 24 pilot runs must | |
| then be regenerated before freeze. A prose-only correction is non-substantive | |
| only when `pilot.lock` inputs and executable behavior are unchanged; the change | |
| and justification are still logged. Before freeze, any `pilot.lock` mismatch | |
| stops pilot execution and invalidates already collected pilot runs. After | |
| freeze, any `freeze.lock` mismatch causes the confirmatory runner to refuse | |
| execution until the deviation process is resolved. | |
| While the protocol remains DRAFT, the coordinator records that invalidation | |
| with `pilot-lock invalidate --reason-code <code> [--note <detail>]`. The command | |
| accepts only valid pilot records bound to the old lock, commits the old lock, | |
| raw records, hashes, IDs, and a self-digested manifest under the | |
| content-addressed `data/pilot-invalidations/<sha256-id>/` archive, and only then | |
| removes the active copies. If an affected run references a successful | |
| non-counted per-block model-identity record, that record and its digest are | |
| validated, archived, and removed in the same transaction so a replacement | |
| generation cannot reuse it. An interrupted cleanup keeps a transaction | |
| sentinel that blocks a replacement lock and can be resumed by rerunning the | |
| command. | |
| There is deliberately no in-place invalidation or rotation operation for | |
| `freeze.lock`. If a frozen-runner correctness defect makes the remaining | |
| schedule mechanically unreachable, the current generation must not be patched | |
| in place. The old lock, every active confirmatory run, referenced per-block | |
| identity records, hashes, and a self-digested manifest are first preserved in | |
| `data/confirmatory-invalidations/<sha256-id>/`. Those runs remain auditable but | |
| are excluded from the replacement generation's primary analysis. Only then may | |
| the runner be corrected in DRAFT, the full pilot rerun, a new `freeze.lock` | |
| created, and all 144 confirmatory slots restarted from the original frozen | |
| schedule. | |
| A later DRAFT generation may legitimately rebind task-manifest hashes and | |
| therefore rewrite the current `data/schedule.json`. Confirmatory archive | |
| verification must not compare that current schedule with an older | |
| `freeze.lock`. For each such archive, the exact historical schedule is retained | |
| under | |
| `data/confirmatory-archive-snapshots/<archive-id>/schedule.json`. Its bytes and | |
| size must match the schedule descriptor in the archived `freeze.lock`, and its | |
| content is mechanically recovered from the archive manifest's recorded source | |
| commit. The original content-addressed archive remains byte-for-byte unchanged. | |
| A missing or modified snapshot fails closed; the current schedule cannot | |
| substitute for it. Historical snapshot files are explicit `archive_witnesses` | |
| in both the pilot and confirmatory input manifests. | |
| Completed or partially recorded runs can leave content-addressed final-patch | |
| artifacts even after their pilot generation is invalidated. These artifacts | |
| remain reachable from immutable archived run records. Before testing or | |
| publishing the artifact inventory, `license-map materialize` deterministically | |
| rebuilds one exact entry for every retained `.patch` from active runs and | |
| verified pilot or confirmatory invalidation archives. It validates artifact | |
| bytes and binds each | |
| entry to the task repository's frozen license rule. Unreferenced patches, | |
| missing bytes, digest disagreements, or a shared patch with conflicting | |
| repository-license provenance fail closed. | |