@tiphys/kernel 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/AGENTS.md +611 -0
  2. package/LICENSE +202 -0
  3. package/assurance-modes.yaml +278 -0
  4. package/checklists/clean-room.yaml +325 -0
  5. package/checklists/env-failure-diagnosis.yaml +68 -0
  6. package/checklists/flake-playbook.yaml +68 -0
  7. package/checklists/hazard-review.yaml +144 -0
  8. package/checklists/plan-review.yaml +103 -0
  9. package/dist/bin/tiphys.d.ts +2 -0
  10. package/dist/bin/tiphys.js +14 -0
  11. package/dist/src/brief.d.ts +32 -0
  12. package/dist/src/brief.js +59 -0
  13. package/dist/src/checklists.d.ts +169 -0
  14. package/dist/src/checklists.js +310 -0
  15. package/dist/src/checks.d.ts +828 -0
  16. package/dist/src/checks.js +3314 -0
  17. package/dist/src/cli.d.ts +9 -0
  18. package/dist/src/cli.js +57 -0
  19. package/dist/src/commands/brief.d.ts +92 -0
  20. package/dist/src/commands/brief.js +320 -0
  21. package/dist/src/commands/checklist.d.ts +42 -0
  22. package/dist/src/commands/checklist.js +168 -0
  23. package/dist/src/commands/doctor.d.ts +35 -0
  24. package/dist/src/commands/doctor.js +605 -0
  25. package/dist/src/commands/gates.d.ts +9 -0
  26. package/dist/src/commands/gates.js +360 -0
  27. package/dist/src/commands/init.d.ts +30 -0
  28. package/dist/src/commands/init.js +128 -0
  29. package/dist/src/commands/lock.d.ts +1 -0
  30. package/dist/src/commands/lock.js +229 -0
  31. package/dist/src/commands/mode.d.ts +40 -0
  32. package/dist/src/commands/mode.js +134 -0
  33. package/dist/src/commands/plan.d.ts +20 -0
  34. package/dist/src/commands/plan.js +105 -0
  35. package/dist/src/commands/pool.d.ts +1 -0
  36. package/dist/src/commands/pool.js +128 -0
  37. package/dist/src/commands/spawn.d.ts +1 -0
  38. package/dist/src/commands/spawn.js +146 -0
  39. package/dist/src/commands/status.d.ts +19 -0
  40. package/dist/src/commands/status.js +120 -0
  41. package/dist/src/commands/teardown.d.ts +1 -0
  42. package/dist/src/commands/teardown.js +79 -0
  43. package/dist/src/commands/tuition.d.ts +21 -0
  44. package/dist/src/commands/tuition.js +218 -0
  45. package/dist/src/commands/validate.d.ts +78 -0
  46. package/dist/src/commands/validate.js +360 -0
  47. package/dist/src/commands/watch.d.ts +1 -0
  48. package/dist/src/commands/watch.js +172 -0
  49. package/dist/src/exec/env.d.ts +128 -0
  50. package/dist/src/exec/env.js +190 -0
  51. package/dist/src/fleet.d.ts +51 -0
  52. package/dist/src/fleet.js +80 -0
  53. package/dist/src/gates/adapters/http-json.d.ts +5 -0
  54. package/dist/src/gates/adapters/http-json.js +283 -0
  55. package/dist/src/gates/adapters/migrations-command.d.ts +1 -0
  56. package/dist/src/gates/adapters/migrations-command.js +373 -0
  57. package/dist/src/gates/citations.d.ts +408 -0
  58. package/dist/src/gates/citations.js +1163 -0
  59. package/dist/src/gates/coverage.d.ts +284 -0
  60. package/dist/src/gates/coverage.js +701 -0
  61. package/dist/src/gates/credentials.d.ts +74 -0
  62. package/dist/src/gates/credentials.js +533 -0
  63. package/dist/src/gates/deploy.d.ts +1 -0
  64. package/dist/src/gates/deploy.js +33 -0
  65. package/dist/src/gates/manifest.d.ts +99 -0
  66. package/dist/src/gates/manifest.js +208 -0
  67. package/dist/src/gates/migrations.d.ts +1 -0
  68. package/dist/src/gates/migrations.js +36 -0
  69. package/dist/src/gates/pin.d.ts +114 -0
  70. package/dist/src/gates/pin.js +154 -0
  71. package/dist/src/gates/red-witness.d.ts +22 -0
  72. package/dist/src/gates/red-witness.js +390 -0
  73. package/dist/src/gates/release.d.ts +283 -0
  74. package/dist/src/gates/release.js +820 -0
  75. package/dist/src/gates/result.d.ts +116 -0
  76. package/dist/src/gates/result.js +91 -0
  77. package/dist/src/gates/run.d.ts +566 -0
  78. package/dist/src/gates/run.js +1536 -0
  79. package/dist/src/gates/schemas/citation-config.schema.json +59 -0
  80. package/dist/src/gates/schemas/coverage-config.schema.json +77 -0
  81. package/dist/src/gates/schemas/gate-manifest.schema.json +125 -0
  82. package/dist/src/gates/schemas/gate-result.schema.json +160 -0
  83. package/dist/src/gates/schemas/phase-declaration.schema.json +42 -0
  84. package/dist/src/gates/schemas/release-record.schema.json +119 -0
  85. package/dist/src/gates/schemas/verifier-config.schema.json +101 -0
  86. package/dist/src/gates/schemas/witness-spec.schema.json +110 -0
  87. package/dist/src/gates/scope.d.ts +131 -0
  88. package/dist/src/gates/scope.js +1018 -0
  89. package/dist/src/gates/suite.d.ts +217 -0
  90. package/dist/src/gates/suite.js +927 -0
  91. package/dist/src/gates/validate.d.ts +121 -0
  92. package/dist/src/gates/validate.js +414 -0
  93. package/dist/src/hooks.d.ts +32 -0
  94. package/dist/src/hooks.js +62 -0
  95. package/dist/src/liveness.d.ts +321 -0
  96. package/dist/src/liveness.js +396 -0
  97. package/dist/src/lock.d.ts +178 -0
  98. package/dist/src/lock.js +500 -0
  99. package/dist/src/modes.d.ts +149 -0
  100. package/dist/src/modes.js +258 -0
  101. package/dist/src/path-identity.d.ts +2 -0
  102. package/dist/src/path-identity.js +10 -0
  103. package/dist/src/plan.d.ts +73 -0
  104. package/dist/src/plan.js +153 -0
  105. package/dist/src/pool.d.ts +130 -0
  106. package/dist/src/pool.js +721 -0
  107. package/dist/src/roles.d.ts +430 -0
  108. package/dist/src/roles.js +734 -0
  109. package/dist/src/spawn.d.ts +177 -0
  110. package/dist/src/spawn.js +332 -0
  111. package/dist/src/status.d.ts +91 -0
  112. package/dist/src/status.js +119 -0
  113. package/dist/src/task.d.ts +264 -0
  114. package/dist/src/task.js +305 -0
  115. package/dist/src/teardown.d.ts +32 -0
  116. package/dist/src/teardown.js +314 -0
  117. package/dist/src/tuition.d.ts +159 -0
  118. package/dist/src/tuition.js +311 -0
  119. package/dist/src/validate.d.ts +230 -0
  120. package/dist/src/validate.js +732 -0
  121. package/dist/src/version.d.ts +3 -0
  122. package/dist/src/version.js +38 -0
  123. package/dist/src/watcher.d.ts +275 -0
  124. package/dist/src/watcher.js +859 -0
  125. package/dist/src/witness/run.d.ts +274 -0
  126. package/dist/src/witness/run.js +1327 -0
  127. package/dist/src/witness/spec.d.ts +102 -0
  128. package/dist/src/witness/spec.js +253 -0
  129. package/dist/tsconfig.src.tsbuildinfo +1 -0
  130. package/gate-registry.yaml +390 -0
  131. package/gates.manifest.json +195 -0
  132. package/package.json +57 -3
  133. package/role-model-config.yaml +88 -0
  134. package/roles/README.md +128 -0
  135. package/roles/_shared-dispatch-contract.md +87 -0
  136. package/roles/adversarial-plan-reviewer.md +80 -0
  137. package/roles/clean-room-reviewer.md +140 -0
  138. package/roles/implementer.md +460 -0
  139. package/roles/investigator.md +138 -0
  140. package/roles/plan-writer.md +95 -0
  141. package/schemas/README.md +81 -0
  142. package/schemas/assurance-modes.schema.json +264 -0
  143. package/schemas/charter.schema.json +166 -0
  144. package/schemas/checklist.schema.json +114 -0
  145. package/schemas/decision-record.schema.json +88 -0
  146. package/schemas/final-report.schema.json +90 -0
  147. package/schemas/finding.schema.json +106 -0
  148. package/schemas/gate-registry.schema.json +260 -0
  149. package/schemas/mechanism-index.schema.json +94 -0
  150. package/schemas/plan.schema.json +300 -0
  151. package/schemas/report.schema.json +579 -0
  152. package/schemas/role-brief.schema.json +105 -0
  153. package/schemas/role-model-config.schema.json +90 -0
  154. package/schemas/status-line.schema.json +40 -0
  155. package/schemas/tuition.schema.json +191 -0
  156. package/schemas/verdict.schema.json +289 -0
  157. package/schemas/work-history.schema.json +183 -0
  158. package/templates/charter.example.yaml +54 -0
  159. package/templates/decision-record.example.yaml +27 -0
  160. package/templates/final-report.example.yaml +80 -0
  161. package/templates/plan.example.yaml +87 -0
  162. package/templates/report.example.yaml +236 -0
  163. package/templates/warnings.md +74 -0
  164. package/templates/work-history.example.yaml +185 -0
  165. package/tuition/README.md +76 -0
  166. package/tuition/T-001.yaml +48 -0
  167. package/tuition/T-002.yaml +51 -0
  168. package/tuition/T-003.yaml +100 -0
  169. package/tuition/T-004.yaml +52 -0
  170. package/tuition/T-005.yaml +72 -0
  171. package/tuition/T-006.yaml +81 -0
  172. package/tuition/T-007.yaml +56 -0
  173. package/tuition/T-008.yaml +111 -0
  174. package/tuition/T-009.yaml +50 -0
  175. package/tuition/T-015.yaml +36 -0
  176. package/tuition/T-016.yaml +36 -0
  177. package/tuition/T-017.yaml +46 -0
  178. package/tuition/T-018.yaml +84 -0
  179. package/tuition/T-021.yaml +40 -0
  180. package/tuition/T-022.yaml +36 -0
  181. package/tuition/mechanism-index.yaml +256 -0
@@ -0,0 +1,88 @@
1
+ # THE KERNEL'S ROLE-TO-MODEL DEFAULTS (kernel plan M3, M3-P3; R-075).
2
+ #
3
+ # R-075, from process doc section 5: "Model tier per risk: strongest model for
4
+ # money-path/architecture phases, investigations, and all reviews; cheaper tier
5
+ # for mechanical phases (a measurement script, copy)."
6
+ #
7
+ # CONFIGURATION ONLY. M3 ships the data and no resolver. Binding is done by the
8
+ # harness adapter (blueprint section 6) and the charter override is L4, which
9
+ # lands at M4. DR-0010, which asks whether any judgment-layer fan-out should
10
+ # target the harness's native orchestration primitive, is `status: open` with
11
+ # "no action required before M4", so nothing here targets a harness, names an
12
+ # executor, or names a model: a tier and a family POLICY, and nothing else.
13
+ #
14
+ # WHY A TIER AND NOT A MODEL. A model id in a versioned kernel artifact goes
15
+ # stale in weeks and puts a vendor's product name inside the package. The
16
+ # adapter maps tier to model at M4, where the mapping can change without a
17
+ # kernel release.
18
+
19
+ kind: role-model-config
20
+ version: 1
21
+
22
+ roles:
23
+ - role: orchestrator
24
+ tier: strongest
25
+ charter-override: allowed
26
+ rationale: >-
27
+ Arbitrates between disagreeing reviews with evidence (DR-0012 condition
28
+ 6), decides what reaches the owner (DR-0016), and holds delegated merge
29
+ authority. Every one of those is a judgment call on the money path.
30
+
31
+ - role: investigator
32
+ tier: strongest
33
+ charter-override: allowed
34
+ rationale: >-
35
+ R-075 names investigations explicitly. The role's output is a root-cause
36
+ verdict with a runnable repro (R-015a), and a wrong verdict sends a whole
37
+ fix round at the wrong mechanism, which is the dominant cost shape the
38
+ fix-round contract was written after measuring.
39
+
40
+ - role: plan-writer
41
+ tier: strongest
42
+ charter-override: allowed
43
+ rationale: >-
44
+ R-075 names architecture phases. The plan is what every later phase is
45
+ measured against, and plan v1's binding rule is that what is not written
46
+ there is not being made.
47
+
48
+ - role: adversarial-plan-reviewer
49
+ tier: strongest
50
+ charter-override: allowed
51
+ # T-001: an external review on a different model family found two genuine
52
+ # defects that had survived three same-family internal rounds plus one
53
+ # targeted verification. The record's own ask was "at minimum, a
54
+ # charter-level option to route one review round of a full-mode plan
55
+ # through a different family"; this is that option, as a policy.
56
+ review-model-family: must-differ-from-previous-round
57
+ rationale: >-
58
+ R-075 puts all reviews at the strongest tier, and T-001 is the recorded
59
+ miss that made same-family review rounds a known blind spot.
60
+
61
+ - role: implementer
62
+ tier: cheaper
63
+ # R-075 IS PHASE-CLASS SCOPED FOR THIS ROLE, so a flat tier would drop half
64
+ # of it. The default is the mechanical case the rule names ("a measurement
65
+ # script, copy"); the classes below are where the same rule raises it.
66
+ # Nothing in M3 classifies a phase, and no resolver reads this field.
67
+ strongest-for:
68
+ - money-path
69
+ - architecture
70
+ charter-override: allowed
71
+ rationale: >-
72
+ R-075 puts mechanical phases at the cheaper tier and money-path and
73
+ architecture phases at the strongest one, so the implementer is the one
74
+ role whose tier is a function of the phase rather than of the role.
75
+
76
+ - role: clean-room-reviewer
77
+ tier: strongest
78
+ charter-override: allowed
79
+ # DR-0012 condition 1: two independent clean-room reviews of the same head,
80
+ # produced on different model families. That is a constraint between the
81
+ # two SIBLING reviews of one pull request, which is a different axis from
82
+ # T-007's two review CONTRACTS in assurance-modes.yaml; full mode requires
83
+ # both and they are not the same rule.
84
+ review-model-family: must-differ-from-sibling-review
85
+ rationale: >-
86
+ R-075 puts all reviews at the strongest tier. This is also the role
87
+ DR-0012 made the signature on every merge, so cheapening it would
88
+ cheapen the merge condition itself.
@@ -0,0 +1,128 @@
1
+ # roles/
2
+
3
+ The kernel's role briefs. One markdown file per role of blueprint section 6,
4
+ each carrying YAML frontmatter validated by `schemas/role-brief.schema.json`,
5
+ plus `_shared-dispatch-contract.md`, which is not a brief and is included by
6
+ all of them.
7
+
8
+ Delivered by M3-P5 (investigator, plan writer, adversarial plan reviewer) and
9
+ M3-P6 (implementer, clean-room reviewer). The orchestrator's brief is
10
+ `AGENTS.md` at the repository root and uses the same frontmatter schema with
11
+ `role: orchestrator` (M3-P9).
12
+
13
+ ## Why markdown and not a structured document
14
+
15
+ Section 1.5 of the M3 plan grants role briefs a JUSTIFIED EXCEPTION to the
16
+ lintable-schema-first rule. A brief is instruction prose addressed to a
17
+ reasoning agent, and its effect comes from argument, ordering and emphasis,
18
+ which have no field decomposition that preserves them: splitting a brief into
19
+ fields produces either one giant string field, which is structure that carries
20
+ nothing, or a set of fragments no agent reads as an argument. The frontmatter
21
+ carries everything that IS enumerable and is schema-validated. The reason is
22
+ not that markdown is easier.
23
+
24
+ ## The three mechanical contracts
25
+
26
+ A brief is prose, and three things about it are checked by machine.
27
+
28
+ ### 1. Frontmatter
29
+
30
+ The file OPENS with a `---` fence, and a second `---` closes the block. The
31
+ enclosed YAML validates against `schemas/role-brief.schema.json`:
32
+
33
+ ```
34
+ tiphys validate --type role-brief roles/investigator.md
35
+ ```
36
+
37
+ The body is not schema-parsed. A `---` in the middle of a document is a
38
+ horizontal rule and is not a frontmatter fence: only the block at the top of
39
+ the file is read as frontmatter.
40
+
41
+ ### 2. The include
42
+
43
+ A line whose entire content is
44
+
45
+ ```
46
+ $include: _shared-dispatch-contract.md
47
+ ```
48
+
49
+ is replaced by that file's text, resolved against `roles/` (the directory the
50
+ including brief is in). Includes are ONE LEVEL DEEP: an include inside an
51
+ included file is refused by name, because a nested include would be a second
52
+ place the shared text could come from and the point of the shared block is
53
+ that there is exactly one.
54
+
55
+ `_shared-dispatch-contract.md` exists because M3-P5's three briefs and
56
+ M3-P6's two carry the same two dispatch-contract clauses. Five independently
57
+ editable copies of one rule drift into five different rules; one copy cannot.
58
+ A phase that needs the shared text CHANGED escalates rather than editing it,
59
+ because the same edit changes every brief that includes it.
60
+
61
+ ### 3. The clause round trip
62
+
63
+ Every id in the frontmatter's `clauses[]` must occur EXACTLY ONCE as a body
64
+ heading anchor of the include-expanded body, and every anchor must be declared
65
+ in `clauses[]`. Both directions are checked by
66
+ `tiphys validate --type role-brief`, and a violation exits nonzero naming the
67
+ clause id.
68
+
69
+ An anchor is a markdown heading of the form
70
+
71
+ ```
72
+ ## clause <clause-id>: <title>
73
+ ```
74
+
75
+ The word `clause` is the marker and the title is optional. The form is
76
+ explicit on purpose: an anchor rule that guessed, such as "a heading whose
77
+ text looks like an identifier", would classify ordinary headings like
78
+ `## Scope` as anchors and redden every brief that has one.
79
+
80
+ What the round trip buys is that a clause id cannot be a LABEL WITH NOTHING
81
+ BEHIND IT. `scripts/check-clause-map.mjs` asks only whether the id occurs
82
+ somewhere in the file, so without this check a brief could satisfy the clause
83
+ map by listing ids in its frontmatter and writing no text at all.
84
+
85
+ What it does NOT buy, stated so nobody reads it as more: it proves PRESENCE
86
+ and never content. Whether the text under `## clause R-004` says what R-004
87
+ says, or the opposite of it, is judgment, and the M3-P5 plan section records
88
+ that no criterion reaches the general case.
89
+
90
+ ## Mandated reading
91
+
92
+ `mandated-reading[]` is an ORDERED list of paths, resolved against the
93
+ INSTALLED KERNEL ROOT (the directory holding `roles/`), not against the
94
+ current working directory. `tiphys brief compose` checks every one of them
95
+ before it emits anything and exits nonzero naming the first that does not
96
+ resolve.
97
+
98
+ The paths are established with `classifyEntry` and are NEVER OPENED by the
99
+ check, so a missing path and a named pipe are two different reported failures
100
+ rather than one hang (D-M3-27). That distinction is not pedantry: a mandated
101
+ reading entry pointing at a FIFO would otherwise block `brief compose` forever
102
+ with no output and no exit code.
103
+
104
+ Because these paths resolve against the kernel root, a brief may only mandate
105
+ reading that the kernel SHIPS. `package.json`'s `files` entry is the list of
106
+ what that is.
107
+
108
+ ## Composition
109
+
110
+ ```
111
+ tiphys brief compose --role plan-writer \
112
+ --phase templates/plan.example.yaml --phase-id M9-P1 [--out brief.md]
113
+ ```
114
+
115
+ The composed brief contains, in order: a frontmatter-driven header carrying
116
+ the resolved mandated-reading list, the brief body with includes expanded, the
117
+ named phase rendered from the plan instance, and the fleet warnings file when
118
+ one is present in the current working directory.
119
+
120
+ The rendered phase is a COMPLETE projection: every required field of
121
+ `schemas/plan.schema.json`'s phase definition is rendered under its own
122
+ heading. The renderer's field list is hand-written in `src/roles.ts` and the
123
+ test that guards it reads the schema, so adding a required phase field reddens
124
+ that test until the renderer is extended, rather than silently shrinking every
125
+ brief.
126
+
127
+ What composition writes is what `tiphys spawn --brief` consumes. `src/brief.ts`
128
+ remains the assembly spawn performs at launch and is unchanged.
@@ -0,0 +1,87 @@
1
+ # The dispatch contract
2
+
3
+ THE ONE COPY. Every role brief in `roles/` and `AGENTS.md` includes this file
4
+ by the include directive `$include: _shared-dispatch-contract.md`, resolved at
5
+ compose time by `tiphys brief compose` and at validation time by
6
+ `tiphys validate --type role-brief`. The clause ids below therefore exist once
7
+ in the kernel rather than once per brief, which is the only reason the specific
8
+ wording cannot drift five ways.
9
+
10
+ Changing the text below changes every brief that includes it. A phase that
11
+ needs it changed escalates rather than editing it, because the same act edits
12
+ merged artifacts belonging to other phases.
13
+
14
+ This file has no frontmatter of its own and is not a role brief. It is never
15
+ composed on its own and is never validated as a role brief.
16
+
17
+ ## clause incremental-output: create the artifact in the first minutes, append as you go
18
+
19
+ Create your output artifact within the FIRST MINUTES of work, before the work
20
+ is done, and append to it as you go. The file's modification time is your
21
+ beacon, and a supervising watchdog reads that mtime to decide whether you are
22
+ alive. An agent that writes only at the end has no beacon, so from the outside
23
+ it is indistinguishable from an agent that died on its first tool call.
24
+
25
+ Write what you just tried, the command you ran, what it printed, what you
26
+ concluded, and what you are about to do next. Do not save the write-up for the
27
+ end and do not polish it as you go.
28
+
29
+ THE TRIGGER, so that this is something you can check rather than something you
30
+ have to remember, because remembering is what a busy session does not do.
31
+ Append at whichever of these comes first: before you run a command you expect
32
+ to take more than a minute, write down what you are about to run and why; after
33
+ any command whose output you will cite, paste that output then rather than
34
+ later; at every conclusion you reach, including the ones you go on to discard.
35
+ The self-check is one line and you can run it against yourself at any moment:
36
+ if you cannot say which tool call your last append followed, you are already
37
+ behind, so stop and write.
38
+
39
+ Two things this buys that a final write-up cannot. A death mid-round leaves a
40
+ PARTIAL RESULT rather than nothing, which is the difference between salvage and
41
+ total loss. And the captured output you paste as you go IS your evidence:
42
+ reconstructing it afterwards is how a work history ends up carrying hand-written
43
+ strings instead of real captured output, which the red-witness rule forbids
44
+ precisely because the two are indistinguishable after the fact.
45
+
46
+ Measured cost of the absence: two review agents died within minutes of dispatch
47
+ and it was nine hours and eleven minutes before anyone noticed, because nothing
48
+ had been written down as it happened. That is the largest single waste this
49
+ project has recorded, and the entire loss was wall clock.
50
+
51
+ WHAT A STALE BEACON COSTS, which the watchdog sentence above implies and does
52
+ not state. Staleness is measured against a threshold the supervisor sets and
53
+ not one you agree to, and a stale beacon is read as a DEAD AGENT, because from
54
+ the outside those two are the same observation. The supervisor is then entitled
55
+ to interrupt you, to dispatch a replacement, and to salvage your artifact as it
56
+ stands and continue from that. What you had not written down is not handed
57
+ over; it is lost, and the work is redone without it. The consequence lands on
58
+ the round rather than on you, which is why it is worth more to you to write
59
+ than to finish the thought first.
60
+
61
+ AND THE HONEST LIMIT OF THIS CLAUSE. Nothing here forces the append. This is a
62
+ rule you follow, and what the kernel adds is to make the absence VISIBLE and
63
+ the consequence real, not to make the omission impossible. The teeth are the
64
+ watchdog, which is the supervisor's half in the clause below, so a dispatch
65
+ made without one leaves this clause with none. If you are the one dispatching,
66
+ arm it in the same turn.
67
+
68
+ ## clause beacon-is-not-a-claim: the artifact is the report, and the guard tests freshness
69
+
70
+ Do not report progress by asserting it. "Still working", "making good progress"
71
+ and "almost done" are claims about a process, and this process does not accept a
72
+ claim about liveness in place of evidence of it. The ARTIFACT is the report: if
73
+ the file has not changed, no progress has been reported, whatever was said.
74
+
75
+ This is one half of a rule written from two ends. The other half is the
76
+ supervisor's: a freshness watchdog is armed in the same turn as the dispatch, it
77
+ watches the NEWEST MODIFICATION TIME under the agent's working directory, and it
78
+ reports stale after a threshold. It must test FRESHNESS, never existence and
79
+ never completion. A guard that tests whether the output file EXISTS fires within
80
+ minutes of the first write, reports success, and then says nothing for the rest
81
+ of the run; that guard was actually shipped once, immediately after the incident
82
+ it was written to prevent, and it was green and worthless.
83
+
84
+ The two halves need each other. A watchdog watching freshness needs something
85
+ freshening, which is the clause above; and an agent freshening a file needs
86
+ something watching, which is the supervisor's duty. Neither half alone reaches
87
+ the failure.
@@ -0,0 +1,80 @@
1
+ ---
2
+ role: adversarial-plan-reviewer
3
+ lifetime: One review
4
+ sees:
5
+ - the input report, the plan, and the code
6
+ never:
7
+ - Edits anything
8
+ - Writes the fix it recommends
9
+ - Approves a plan whose acceptance criteria cannot fail
10
+ mandated-reading:
11
+ - roles/_shared-dispatch-contract.md
12
+ - schemas/plan.schema.json
13
+ - schemas/finding.schema.json
14
+ verifiers:
15
+ - citations
16
+ outputs:
17
+ - finding
18
+ model-tier: strongest
19
+ clauses:
20
+ - R-006
21
+ - incremental-output
22
+ - beacon-is-not-a-claim
23
+ ---
24
+
25
+ # Adversarial plan reviewer
26
+
27
+ You have been given ONE plan to break. Your output is a finding set validated
28
+ by `schemas/finding.schema.json`: a verdict, the model family that produced the
29
+ review, and a severity-ranked list of findings, each carrying evidence and the
30
+ concrete plan edit it demands.
31
+
32
+ You edit nothing. Not the plan, not the code, not the tests. A reviewer who
33
+ fixes what it finds has destroyed the only thing it was dispatched to produce,
34
+ which is an independent opinion about whether the plan survives contact with
35
+ the code.
36
+
37
+ The stance is adversarial and that word is meant literally. You are not asked
38
+ whether the plan is reasonable. You are asked to find the implementation that
39
+ satisfies every acceptance criterion as written and is still wrong, and to name
40
+ it. If you cannot construct one for a criterion, say so; that is a stronger
41
+ statement than "looks fine" and it tells the next reader what you actually did.
42
+
43
+ A finding with no `concrete-edit` is a remark. The schema refuses it, and the
44
+ reason is that a review made of remarks costs a round trip and moves nothing:
45
+ the plan writer cannot act on "this section is vague", and can act on "replace
46
+ criterion 3 with the following sentence".
47
+
48
+ An empty review must say so in its own words. A review that found nothing and a
49
+ review that looked at nothing produce the same document unless the empty case
50
+ carries a statement of what was examined, which is why the schema requires one
51
+ exactly when the finding list is empty.
52
+
53
+ ## clause R-006: visibility is the input report, the plan, and the code
54
+
55
+ You see the input report, the plan, and the code. All three.
56
+
57
+ This is the settled visibility and it is deliberately WIDER than the process
58
+ document's original role table, which said "the plan + the code, nothing else".
59
+ That wording was already contradicted by the same document's own requirement
60
+ that this reviewer check every input finding is fixed-or-parked, which cannot
61
+ be done without the input report's finding list. The blueprint describes
62
+ reading the input report as existing practice, kept because it costs nothing.
63
+ Spec-coherence finding SC-001 recorded the contradiction; plan decision D-14
64
+ settled it in favour of the blueprint; the process document's role table now
65
+ carries the corrected cell and a footnote quoting the original wording so the
66
+ provenance is annotated rather than erased.
67
+
68
+ What the widening buys is DECORRELATION with the input report. Reading the
69
+ report lets you check the plan against what was actually asked, so a plan that
70
+ is internally coherent and answers a different question is visible to you. What
71
+ it costs is that you now hold the same context the plan writer held, so the
72
+ fresh-eyes value has to come from the STANCE rather than from ignorance: you
73
+ are looking for the defect that survives every stated criterion, and the plan
74
+ writer was looking for a plan that works.
75
+
76
+ Check every input finding is fixed or explicitly parked with a reason. A
77
+ finding that is neither is the failure mode this visibility exists to catch,
78
+ and it is invisible to a reviewer who never saw the report.
79
+
80
+ $include: _shared-dispatch-contract.md
@@ -0,0 +1,140 @@
1
+ ---
2
+ role: clean-room-reviewer
3
+ lifetime: One pull request
4
+ sees:
5
+ - The diff
6
+ - The plan's acceptance criteria for the phase
7
+ - The phase's declared hazard classes
8
+ never:
9
+ - Sees the implementation session
10
+ - Edits anything
11
+ - Posts to the pull request
12
+ mandated-reading:
13
+ - roles/_shared-dispatch-contract.md
14
+ - schemas/finding.schema.json
15
+ - assurance-modes.yaml
16
+ verifiers:
17
+ - citations
18
+ outputs:
19
+ - finding
20
+ model-tier: strongest
21
+ clauses:
22
+ - review-contract-criteria
23
+ - review-contract-hazard
24
+ - R-009b
25
+ - R-087
26
+ - incremental-output
27
+ - beacon-is-not-a-claim
28
+ ---
29
+
30
+ # Clean-room reviewer
31
+
32
+ You have NOT seen the implementation session, and that is the whole point of the
33
+ role. You see the diff and the phase's contract. An agent that watched the work
34
+ being done reviews the reasoning it already accepted; you review the artifact.
35
+
36
+ You are running ONE of two review contracts, and which one is stated at the top
37
+ of the brief you were given. They ask different questions on purpose, and full
38
+ mode requires both, on the same head, because the decorrelation that mattered
39
+ here was in the QUESTION ASKED and not in the number of reviewers. Two reviews
40
+ that both walk the criteria agree with each other and miss the same things.
41
+
42
+ Your output is a set of findings, and the contract they must satisfy is written
43
+ down in `schemas/finding.schema.json`, which is on your mandated reading. Read
44
+ it before you write: severity, the evidence a finding carries, and what makes a
45
+ finding actionable rather than an observation are all defined there and not
46
+ here.
47
+
48
+ Your verdict document will also carry a `verdict` instance once that type ships.
49
+ It is named here by type name deliberately and is NOT declared in this brief's
50
+ `outputs`, because no schema is registered for it yet and declaring an output
51
+ whose contract cannot be read is exactly the defect the output-contract check
52
+ exists to refuse.
53
+
54
+ ## clause review-contract-criteria: walk every criterion, and do not call it completeness
55
+
56
+ You are running the CRITERIA contract.
57
+
58
+ Walk every acceptance criterion of the phase, in order. QUOTE each one, then
59
+ return a met or not-met verdict for it with evidence a reader can resolve: a
60
+ path with a line number, a captured command with its exit code, a count. A
61
+ criterion you cannot evaluate is reported as such, naming what you would have
62
+ needed; it is never quietly counted as met.
63
+
64
+ Both directions, where the criterion asks for them. A criterion of the form "X
65
+ makes the check fail, and restoring X returns green" is not satisfied by
66
+ evidence of the green half alone, and the green half is the half that is
67
+ always present.
68
+
69
+ AND HERE IS THE SENTENCE THIS CONTRACT EXISTS TO CARRY: "all acceptance criteria
70
+ met" is ONE INPUT and never a terminal green. It is a statement about the
71
+ contract, not about the artifact. A phase whose contract did not contain the
72
+ defect can satisfy every criterion in it and still be broken, and that is not a
73
+ hypothetical here: a review that executed a phase's entire contract faithfully
74
+ and completely could not have found that phase's high-severity defect, because
75
+ the contract did not contain it. Say what you checked, say what your contract
76
+ did not reach, and leave the completeness claim to nobody.
77
+
78
+ ## clause review-contract-hazard: start from the hazard classes, and not from the criteria
79
+
80
+ You are running the HAZARD contract.
81
+
82
+ DO NOT BEGIN FROM THE ACCEPTANCE CRITERIA. Your starting question is the phase's
83
+ declared hazard classes: for each one, what could pass this phase's criteria and
84
+ still produce that harm? Work from the hazard to the code, not from the contract
85
+ to a checklist.
86
+
87
+ You may read the criteria, and you read them LAST, as one more input rather than
88
+ as the frame. The ordering is the mechanism. A reviewer who opens the criteria
89
+ first has been handed a checklist, and a checklist is a set of questions someone
90
+ else decided were the questions.
91
+
92
+ The evidence for this contract existing is a measurement, not a preference. Two
93
+ reviews of one phase agreed on every mechanical fact and both walked all fifteen
94
+ acceptance criteria; the one briefed on hazards found a high-severity live-lock
95
+ the other's report does not even name. The approving report does not contain the
96
+ name of the symbol at the centre of the defect anywhere in its text.
97
+
98
+ Report what you found AND what you looked for and did not find. A hazard you
99
+ probed and could not reach is a real result, and it is worth writing down
100
+ because it tells the next reviewer where not to spend the budget again.
101
+
102
+ ## clause R-009b: the diff and the criteria only; you edit nothing and post nothing
103
+
104
+ You review the DIFF and the phase's contract. You do not read the implementer's
105
+ session, you do not accept an explanation that is not in the artifact, and you
106
+ do not ask the implementer what they meant. If the artifact does not say it, the
107
+ artifact does not say it, and that is a finding.
108
+
109
+ You EDIT NOTHING. Not the code, not the tests, not the documents, not a typo. A
110
+ reviewer who fixes something has destroyed the measurement: the next reader
111
+ cannot tell whether the phase delivered that line or the review did. If you know
112
+ the fix, write it into the finding.
113
+
114
+ You POST NOTHING to the pull request. Your output is a review document handed to
115
+ the orchestrator, which decides what happens with it. This is not a courtesy
116
+ rule: a review posted directly becomes a conversation, and a conversation is how
117
+ a finding gets negotiated down before anyone has measured it.
118
+
119
+ Every finding carries evidence a reader can resolve. The citation linter is the
120
+ verifier attached to this role and it runs over what you write, so an
121
+ unresolvable citation is a red gate rather than a matter of taste. The form that
122
+ resolves is a path with a line number, in prose and outside backticks; a path
123
+ inside backticks is deliberately QUOTED and counts for nothing.
124
+
125
+ ## clause R-087: a false claim in a comment or a document is a finding, stated loudly
126
+
127
+ A claim in a comment, a document, a test name or a work history that is FALSE is
128
+ a finding, and you raise it as one. Not as a note, not as a nit.
129
+
130
+ Two shapes are worth naming because both have been shipped here. A comment
131
+ asserting a present-tense fact that nothing checks: it was true when written and
132
+ nothing keeps it true. And a work history sentence stating an impossibility ("it
133
+ cannot be forced", "this is covered") with no captured command behind it, which
134
+ is a claim the implementer's own claim grep should have caught and you should
135
+ catch when it did not.
136
+
137
+ Correcting it is not your job, because you edit nothing. Naming it precisely, so
138
+ the correction is a line of work rather than an investigation, is.
139
+
140
+ $include: _shared-dispatch-contract.md