{
  "addendum": "AGENT_CROSSING_PILOT_001 · Addendum A · Loop residue",
  "version": "1.0.0",
  "parent_protocol_sha256": "3485140a30175353c89e0dd98e1c26cc2c12e4984837feaf9108249761e1fb2d",
  "status": "Frozen when committed to the results repository, before any outcome data is analysed. Later changes are dated amendments with reasons, appended below and never edits. The gate does not get to rewrite its own test.",
  "claim_ceiling": "Mapping crossing. Curvature and holonomy are a lens here, not a finding. 'Loop residue' is the measured quantity; the geometric words may be used as mechanism language only if HL1 and HL2 both hold, and must be dropped from public claims if HL2 fails.",
  "source": "Reconciled from LOOP_HOLONOMY_ADDENDUM.md (22 October 2026) against the frozen v1.0 protocol: hypotheses renamed HL1 to HL3, definitions bound to v1.0, and every field marked collected, reconstructed or unavailable.",

  "question": "Is late failure a property of the step, or of the loop? Step view: a change fails because something visible at approval was wrong, so better per-step auditing would catch it. Loop view: each approval is locally sound, and failure appears only when the change comes back round (approve, apply, time passes, outcome), so risk lives in what accumulates along the path. If the loop view holds, per-step gates are structurally blind to a class of failure, including the step-feature proposals of v1.0 H3.",

  "definitions": {
    "crossing": "As v1.0: one Edit, Write or MultiEdit tool call.",
    "approved": "v1.0 classes RULE_APPROVED or ASKED_ALLOWED. Both are approvals at the step; HL analyses report them pooled and separately.",
    "loop": "approve, apply, the v1.0 7-day window, outcome.",
    "late_failure": "v1.0 residual FAILED on an approved crossing. Nothing else counts. Fix commits and manual rollbacks are not separately detected; a rollback that restores the original text is already FAILED under v1.0.",
    "outcome_set": "FAILED (late failure) and HELD_UP (ok). UNRESOLVED is kept as v1.0's terminal outcome and excluded from HL models; its share is reported beside every result, and HL results are not decidable if it exceeds half of residualed approved crossings.",
    "region": "Primary partition: the top-level directory of the file inside its repository, or (root) for files at the top. Stored in packs as a salted hash. No secondary partition is pre-registered; any other partition is exploratory and labelled so.",
    "step_features": "Visible at approval: tool, lines added, lines removed, test-file flag, path depth, position in session, subagent flag, gate class (RULE_APPROVED or ASKED_ALLOWED).",
    "loop_residue": "Changes in the world between approval and cutoff that the approval held fixed: (1) other approved crossings in the same region, (2) other approved crossings to the same file, (3) changes to the participant's permission settings, (4) git commits touching the same region.",
    "cutoff": "Leakage guard. For a late failure whose evidence has a timestamp (undone by a later edit, or a failing test run), residue counts only events strictly before that timestamp, and the evidencing event itself is never counted. For a non-failure, events before window close. For a late failure graded from file state at window end, the evidence time is unknown, so its residue is recorded as unavailable and the crossing is excluded from HL2.",
    "cohort": "Model plus permission-settings hash. A cohort is a set of crossings made by the same model under the same rules."
  },

  "fields": {
    "collected": {
      "region": "Salted hash of the top-level directory, computed locally from the file path at collection.",
      "rule_set": "Salted hash of the permissions sections of the user, project and local Claude Code settings files, read at each hook event (recorder 1.1.0 and later).",
      "residue.same_region, residue.same_file": "Counted from the local log.",
      "residue.rule_changes": "Number of distinct rule_set values seen between approval and cutoff, minus one.",
      "residue.region_commits": "git log in the crossing's repository between approval and cutoff, restricted to the region. Includes the participant's and the agent's own commits; it measures movement under the change, not who moved it.",
      "residue_cutoff_known": "Whether the cutoff is the evidence time, the window end, or unavailable."
    },
    "reconstructed": {
      "model": "Read at collection from the session transcript: the model of the assistant message that issued the tool call, matched by tool_use_id. Labelled reconstructed. If the transcript is missing, the value is 'unknown'."
    },
    "unavailable": {
      "rule_id_fired": "Claude Code hooks do not report which permission rule allowed a call. Re-matching rules locally would be a guess presented as an observation, so it is not attempted. rule_set and gate class stand in.",
      "timestamp_applied": "Recorded locally but packs keep day resolution only, as in v1.0.",
      "base_drift_by_others": "Git cannot reliably tell the participant's commits from collaborators' in a local clone; region_commits counts all commits."
    },
    "instrument_rule": "Recorder 1.1.0 adds rule_set at record time. Crossings recorded by 1.0.0 have no rule_set; they are excluded from HL analyses but remain in v1.0 analyses."
  },

  "hypotheses": {
    "HL1": {
      "claim": "Late-failure rate is not uniform across regions.",
      "test": "Permutation test, 10,000 shuffles of region labels across approved graded crossings. Statistic: the maximum over regions with at least 5 graded crossings of (region failure rate / overall failure rate). Using the maximum controls for the number of regions.",
      "supports": "Permutation p < 0.05 and at least one region with rate at least 2 times the overall rate.",
      "fails": "Otherwise. Late failures look like uniform noise across regions, and regional risk has no basis in this data."
    },
    "HL2": {
      "claim": "Loop residue predicts late failure better than step features alone.",
      "test": "Two logistic regressions with identical fitting (L2 penalty 1.0, standardised features): step-only, and step plus loop residue. Train on approved graded crossings from the earliest 70% of recording days; test on the rest. No shuffling. Measure held-out AUC of each, and the difference.",
      "supports": "Held-out ΔAUC at least 0.05, with a bootstrap 95% interval (2,000 resamples of the test set, seed 20261022) excluding 0.",
      "fails": "ΔAUC below 0.05 or the interval includes 0. Per-step auditing is sufficient in this data, and curvature and holonomy language is dropped from public claims.",
      "precision_declared_in_advance": "With 30 late failures in the test set, an AUC interval is roughly ±0.1 wide (Hanley and McNeil), so ΔAUC of 0.05 is unlikely to be distinguishable from 0 at that size. A null result below about 100 test-set failures is reported as 'could not tell', not 'no effect'. evaluate.mjs prints the expected interval width for the actual counts."
    },
    "HL3": {
      "claim": "Crossings from the same cohort fail together more than crossings from different cohorts.",
      "test": "Within weekly buckets, compare the co-failure rate of same-cohort pairs with cross-cohort pairs, stratified by region (pairs must share a region). Permutation test shuffling cohort labels within region, 10,000 shuffles.",
      "supports": "Same-cohort co-failure exceeds the shuffled baseline at p < 0.05.",
      "fails": "No excess: no basis in this data for pricing correlated failure across agents sharing a model and rules.",
      "expected": "Phase 1 has one participant and probably one cohort, so HL3 cannot be tested until invitees bring different models or rules. This is stated now so that its absence later is not mistaken for a null."
    }
  },

  "when_to_test": {
    "descriptive_until": "At least 30 late failures among approved crossings recorded by recorder 1.1.0 or later, outside calibration. Before that, counts and rates only, no inferential claims.",
    "HL3_requires": "At least 2 cohorts with at least 10 late failures each.",
    "phase_1": "The protocol author's own sessions are a shakedown for these definitions: are they computable, and is attribution unambiguous? Phase 1 results are a pilot of the pilot. The operator knows the hypotheses, so invitee data is the stronger evidence.",
    "revisions": "Thresholds are rough guides, not a power calculation. A revision once the base rate is known is logged as a dated amendment."
  },

  "licenses": {
    "HL1 only": { "licensed": "Late failures concentrate in identifiable regions.", "not": "Anything about loops or curvature." },
    "HL1 and HL2": { "licensed": "Failure risk accumulates along the approval loop; per-step gates are structurally blind to part of it. Curvature and holonomy may be used as mechanism language for this measure.", "not": "Claims about other codebases, agents or participants." },
    "HL3": { "licensed": "Shared models and rules produce correlated failure, a systemic exposure.", "not": "Causal claims about why, which would need intervention." },
    "none": { "licensed": "In this pilot, late failures showed no regional, loop-level or cohort structure. A real result, published like any other.", "not": "Keeping the geometric framing." }
  },

  "threats": {
    "survivorship": "Held crossings return no outcome. v1.0 audits about 10% of them, selected by hash; audit labels are human judgements and do not enter HL models.",
    "definition_drift": "Mitigated by freezing this addendum before analysis.",
    "observer_effect": "In phase 1 the operator knows the hypotheses. Invitee data is the stronger test.",
    "small_n": "The most likely failure mode. If the thresholds above are never met, the report says so plainly.",
    "goodhart": "If rules or agents are tuned against these measures during the pilot, the measure stops measuring. Rule changes are recorded as residue (rule_changes), not hidden."
  },

  "label_addition": {
    "checked_how": "A fourth label field on every crossing: 'step only' while its window is open (v1.0 PENDING), 'round the loop' once graded (FAILED, HELD_UP or UNRESOLVED), or 'not applied' for held crossings."
  },

  "label": {
    "is": "A pre-registered secondary analysis of the pilot's data, asking whether late failure is better explained by what happened after approval than by what was visible at it.",
    "isnt": "Evidence of curvature, a measurement of agents in general, or a change to v1.0's hypotheses, which stand as frozen.",
    "stops": "The loop is a path through time, not a cycle back to the same state, so 'holonomy' names a residue proxy, not a computed geometric quantity. Residue features are counts chosen in advance, and region is one partition among many possible."
  },

  "amendments": []
}
