{
  "protocol": "AGENT_CROSSING_PILOT_001",
  "version": "1.0.0",
  "status": "frozen on merge to risk.neverthought.org; any change is a new version, and data recorded under one version is never analysed under another",
  "governing_question": "How can a gate earn the authority to revise its own criteria, when evidence returns only from what it let through, some of what it lets through cannot be undone, and the evidence must come from something other than itself?",

  "unit": {
    "crossing": "One Edit, Write or MultiEdit tool call made by a coding agent (Claude Code) in a participant's own work, identified by its tool_use_id.",
    "recorded_for_context_only": "Bash tool calls. They supply test-run outcomes and are reported descriptively; they are not crossings under H1 to H3.",
    "not_recorded": "Read-only tools (Read, Grep, Glob and similar)."
  },

  "gate": {
    "description": "The participant's own Claude Code permission settings. The pilot observes the gate and never changes it; the recorder always exits 0 and returns nothing.",
    "classes": {
      "RULE_APPROVED": "PreToolUse then a tool result, with no PermissionRequest for that call, in a permission mode other than bypassPermissions.",
      "ASKED_ALLOWED": "A PermissionRequest for the call, then a tool result.",
      "HELD": "A PermissionRequest or PermissionDenied for the call, and no tool result.",
      "UNGATED": "Any call made in bypassPermissions mode.",
      "UNCLASSIFIED": "An event pattern none of the above covers. Reported, never silently assigned."
    },
    "validation": "The first 7 days of each participant's recording are a calibration period: the participant checks a sample of classifications against their own memory of the session. Calibration data is reported and excluded from H1 to H3."
  },

  "residuals": {
    "window_days": 7,
    "rule": "A crossing is graded only after its window has closed. Before that it is PENDING.",
    "classes": {
      "FAILED": "Evidence from outside the crossing that it did not hold: its change was undone (for Edit, the original text is back and the new text is gone), or a later test run in the same repo failed and this is the only crossing on a non-test file since the last passing run.",
      "HELD_UP": "Its change is still present at the end of the window, and no attributable test failure followed it.",
      "UNRESOLVED": "Evidence arrived but supports more than one reading: the new text was replaced by something else, the file was deleted, a test failure is shared between several crossings, or the residual is not independent. Kept as a terminal outcome, not forced into FAILED or HELD_UP.",
      "NO_RESIDUAL": "Nothing could be checked, for example the repo is gone or the crossing was HELD."
    },
    "independence": "A test failure counts as a residual only if no test file was edited in that session before the test run. Tests the agent wrote or changed in the same session do not grade the agent's own work; such cases are UNRESOLVED.",
    "persistence_caveat": "HELD_UP means the change survived and no attributable test failed. It does not mean the change was correct."
  },

  "selective_labels": {
    "problem": "HELD crossings never return evidence, so the gate cannot learn from what it refused.",
    "audit": "About 10% of HELD crossings are selected for audit by hashing their tool_use_id (first byte below 26), so selection is fixed and not chosen by the participant. The participant records whether the held change would have held up, using the label WOULD_HOLD, WOULD_FAIL or CANNOT_TELL.",
    "declared_limit": "Audit labels are human judgements, not outside residuals. They are reported separately and never mixed into FAILED or HELD_UP counts."
  },

  "location": {
    "codes": {
      "FORMATION": "The crossing's own change was wrong.",
      "PASSAGE": "The change was right, but tools, environment or configuration broke it on the way.",
      "CONTINUATION": "The change was right when made, and a later change made it wrong."
    },
    "how": "Participants code the location of each FAILED crossing and each audited WOULD_FAIL, or leave it UNCODED. Location codes are human judgements and are reported as proportions, never as a single rate.",
    "source": "After Škrinjar's formation, passage and continuation as locations of support loss."
  },

  "hypotheses": {
    "H1": {
      "question": "Do permission rules approve file changes that later fail?",
      "measure": "Among RULE_APPROVED crossings graded FAILED or HELD_UP, the share FAILED, with a Wilson 95% interval. UNRESOLVED share reported alongside.",
      "falsifier": "With at least 300 graded RULE_APPROVED crossings pooled across participants, an upper bound below 5% means the gap is small, and the proposed claim that rule-approved failure is a measurable opportunity is downgraded on the site.",
      "undecidable_if": "UNRESOLVED exceeds half of all residualed RULE_APPROVED crossings. Then H1 is reported as not decidable with this residual design, which is itself a finding."
    },
    "H2": {
      "question": "Where does failure live?",
      "measure": "Proportions of FORMATION, PASSAGE, CONTINUATION and UNCODED among FAILED crossings, and a reliability table of failure share by tool and permission class.",
      "falsifier": "None. H2 is descriptive and pre-registered so that its categories cannot be chosen after seeing the data."
    },
    "H3": {
      "question": "Can a proposed revision to the gate earn authority?",
      "procedure": "Anyone may submit a sealed proposal: a predicate over pack features naming crossings the gate should hold. Its SHA-256 is merged into the results repo first, and the git commit time is its timestamp. The predicate and salt are revealed later. A proposal is graded only on RULE_APPROVED crossings recorded after its seal time, which its author could not have seen.",
      "measure": "Lift: the failure share among crossings the proposal would hold, divided by the share among those it would let through, with a Katz log 95% interval.",
      "success": "At least one revealed proposal has a lift whose lower bound, Bonferroni-corrected for the number of revealed proposals, exceeds 1, with at least 20 graded FAILED crossings in its window.",
      "falsifier": "If no proposal succeeds by the end of the pilot, a generator has not yet shown measured value over the rule it would revise.",
      "guardrail": "A proposal's author cannot grade it. Grading uses residuals recorded after the seal, from crossings the author did not choose."
    }
  },

  "redaction": {
    "leaves_the_machine": "Only what a participant chooses to submit: random participant id, salted hashes of session, call and file identifiers, tool name, permission mode and class, file extension, path depth, a test-file flag, lines added and removed, the call's position in its session, day of recording, residual class, audit label and location code.",
    "never_leaves": "Code, prompts, file contents, file paths, command text, tool output, and the old and new text of edits. These stay in the local log so residuals can be checked, and the participant can purge it at any time.",
    "check": "verify.mjs rejects any pack containing a field or value outside this list."
  },

  "duration": {
    "phase_1": "The protocol author's own sessions, starting at the freeze.",
    "phase_2": "Invited participants, from 14 days after the freeze.",
    "end": "2027-01-31, or earlier if H1 reaches 300 graded crossings and every revealed proposal has 20 graded failures in its window."
  },

  "label": {
    "is": "A pre-registered observation of volunteers' own coding-agent sessions, graded by what later happened in their repos.",
    "isnt": "A measurement of coding agents in general, of any model's quality, or of anyone's permission settings as good or bad.",
    "stops": "Volunteers choose whether to take part and what to submit, residual windows and attribution rules are our choices, and persistence is a weak stand-in for correctness."
  }
}
