@tiphys/kernel 0.0.0 → 0.2.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 (207) hide show
  1. package/AGENTS.md +663 -0
  2. package/LICENSE +202 -0
  3. package/assurance-modes.yaml +299 -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 +92 -0
  11. package/dist/src/adapters/load.d.ts +202 -0
  12. package/dist/src/adapters/load.js +440 -0
  13. package/dist/src/brief.d.ts +32 -0
  14. package/dist/src/brief.js +66 -0
  15. package/dist/src/checklists.d.ts +169 -0
  16. package/dist/src/checklists.js +310 -0
  17. package/dist/src/checks.d.ts +1539 -0
  18. package/dist/src/checks.js +5025 -0
  19. package/dist/src/cli.d.ts +9 -0
  20. package/dist/src/cli.js +68 -0
  21. package/dist/src/commands/brief.d.ts +92 -0
  22. package/dist/src/commands/brief.js +343 -0
  23. package/dist/src/commands/checklist.d.ts +42 -0
  24. package/dist/src/commands/checklist.js +168 -0
  25. package/dist/src/commands/cutover.d.ts +35 -0
  26. package/dist/src/commands/cutover.js +448 -0
  27. package/dist/src/commands/doctor.d.ts +264 -0
  28. package/dist/src/commands/doctor.js +1546 -0
  29. package/dist/src/commands/gates.d.ts +9 -0
  30. package/dist/src/commands/gates.js +360 -0
  31. package/dist/src/commands/init.d.ts +30 -0
  32. package/dist/src/commands/init.js +177 -0
  33. package/dist/src/commands/lock.d.ts +34 -0
  34. package/dist/src/commands/lock.js +340 -0
  35. package/dist/src/commands/mode.d.ts +40 -0
  36. package/dist/src/commands/mode.js +134 -0
  37. package/dist/src/commands/next.d.ts +130 -0
  38. package/dist/src/commands/next.js +597 -0
  39. package/dist/src/commands/plan.d.ts +20 -0
  40. package/dist/src/commands/plan.js +105 -0
  41. package/dist/src/commands/pool.d.ts +1 -0
  42. package/dist/src/commands/pool.js +139 -0
  43. package/dist/src/commands/resume.d.ts +1 -0
  44. package/dist/src/commands/resume.js +88 -0
  45. package/dist/src/commands/spawn.d.ts +1 -0
  46. package/dist/src/commands/spawn.js +195 -0
  47. package/dist/src/commands/status.d.ts +21 -0
  48. package/dist/src/commands/status.js +122 -0
  49. package/dist/src/commands/sync.d.ts +47 -0
  50. package/dist/src/commands/sync.js +341 -0
  51. package/dist/src/commands/teardown.d.ts +1 -0
  52. package/dist/src/commands/teardown.js +87 -0
  53. package/dist/src/commands/tuition.d.ts +21 -0
  54. package/dist/src/commands/tuition.js +218 -0
  55. package/dist/src/commands/validate.d.ts +78 -0
  56. package/dist/src/commands/validate.js +430 -0
  57. package/dist/src/commands/watch.d.ts +1 -0
  58. package/dist/src/commands/watch.js +172 -0
  59. package/dist/src/cutover.d.ts +584 -0
  60. package/dist/src/cutover.js +1444 -0
  61. package/dist/src/exclusion.d.ts +389 -0
  62. package/dist/src/exclusion.js +843 -0
  63. package/dist/src/exec/env.d.ts +278 -0
  64. package/dist/src/exec/env.js +334 -0
  65. package/dist/src/fleet.d.ts +223 -0
  66. package/dist/src/fleet.js +298 -0
  67. package/dist/src/gates/adapters/http-json.d.ts +5 -0
  68. package/dist/src/gates/adapters/http-json.js +283 -0
  69. package/dist/src/gates/adapters/migrations-command.d.ts +1 -0
  70. package/dist/src/gates/adapters/migrations-command.js +373 -0
  71. package/dist/src/gates/citations.d.ts +408 -0
  72. package/dist/src/gates/citations.js +1169 -0
  73. package/dist/src/gates/coverage.d.ts +375 -0
  74. package/dist/src/gates/coverage.js +836 -0
  75. package/dist/src/gates/credentials.d.ts +233 -0
  76. package/dist/src/gates/credentials.js +752 -0
  77. package/dist/src/gates/deploy.d.ts +1 -0
  78. package/dist/src/gates/deploy.js +33 -0
  79. package/dist/src/gates/gate-classes.d.ts +56 -0
  80. package/dist/src/gates/gate-classes.js +633 -0
  81. package/dist/src/gates/manifest.d.ts +99 -0
  82. package/dist/src/gates/manifest.js +208 -0
  83. package/dist/src/gates/merge-preconditions.d.ts +319 -0
  84. package/dist/src/gates/merge-preconditions.js +932 -0
  85. package/dist/src/gates/migrations.d.ts +1 -0
  86. package/dist/src/gates/migrations.js +36 -0
  87. package/dist/src/gates/pin.d.ts +114 -0
  88. package/dist/src/gates/pin.js +154 -0
  89. package/dist/src/gates/red-witness.d.ts +22 -0
  90. package/dist/src/gates/red-witness.js +482 -0
  91. package/dist/src/gates/release.d.ts +283 -0
  92. package/dist/src/gates/release.js +820 -0
  93. package/dist/src/gates/result.d.ts +116 -0
  94. package/dist/src/gates/result.js +91 -0
  95. package/dist/src/gates/run.d.ts +614 -0
  96. package/dist/src/gates/run.js +1614 -0
  97. package/dist/src/gates/schemas/citation-config.schema.json +59 -0
  98. package/dist/src/gates/schemas/coverage-config.schema.json +77 -0
  99. package/dist/src/gates/schemas/gate-manifest.schema.json +125 -0
  100. package/dist/src/gates/schemas/gate-result.schema.json +160 -0
  101. package/dist/src/gates/schemas/phase-declaration.schema.json +87 -0
  102. package/dist/src/gates/schemas/release-record.schema.json +119 -0
  103. package/dist/src/gates/schemas/verifier-config.schema.json +101 -0
  104. package/dist/src/gates/schemas/witness-spec.schema.json +110 -0
  105. package/dist/src/gates/scope.d.ts +131 -0
  106. package/dist/src/gates/scope.js +1018 -0
  107. package/dist/src/gates/suite.d.ts +217 -0
  108. package/dist/src/gates/suite.js +968 -0
  109. package/dist/src/gates/validate.d.ts +121 -0
  110. package/dist/src/gates/validate.js +414 -0
  111. package/dist/src/hooks.d.ts +84 -0
  112. package/dist/src/hooks.js +125 -0
  113. package/dist/src/index.d.ts +31 -0
  114. package/dist/src/index.js +30 -0
  115. package/dist/src/liveness.d.ts +321 -0
  116. package/dist/src/liveness.js +396 -0
  117. package/dist/src/lock.d.ts +256 -0
  118. package/dist/src/lock.js +792 -0
  119. package/dist/src/model-resolution.d.ts +159 -0
  120. package/dist/src/model-resolution.js +307 -0
  121. package/dist/src/modes.d.ts +149 -0
  122. package/dist/src/modes.js +258 -0
  123. package/dist/src/path-identity.d.ts +34 -0
  124. package/dist/src/path-identity.js +48 -0
  125. package/dist/src/plan.d.ts +73 -0
  126. package/dist/src/plan.js +153 -0
  127. package/dist/src/pool.d.ts +326 -0
  128. package/dist/src/pool.js +988 -0
  129. package/dist/src/roles.d.ts +461 -0
  130. package/dist/src/roles.js +776 -0
  131. package/dist/src/spawn.d.ts +482 -0
  132. package/dist/src/spawn.js +1003 -0
  133. package/dist/src/status.d.ts +116 -0
  134. package/dist/src/status.js +148 -0
  135. package/dist/src/task.d.ts +504 -0
  136. package/dist/src/task.js +307 -0
  137. package/dist/src/teardown.d.ts +39 -0
  138. package/dist/src/teardown.js +422 -0
  139. package/dist/src/tuition.d.ts +159 -0
  140. package/dist/src/tuition.js +311 -0
  141. package/dist/src/validate.d.ts +263 -0
  142. package/dist/src/validate.js +742 -0
  143. package/dist/src/version.d.ts +3 -0
  144. package/dist/src/version.js +38 -0
  145. package/dist/src/watcher.d.ts +275 -0
  146. package/dist/src/watcher.js +849 -0
  147. package/dist/src/witness/run.d.ts +299 -0
  148. package/dist/src/witness/run.js +1373 -0
  149. package/dist/src/witness/spec.d.ts +270 -0
  150. package/dist/src/witness/spec.js +475 -0
  151. package/dist/tsconfig.src.tsbuildinfo +1 -0
  152. package/gate-registry.yaml +526 -0
  153. package/gates.manifest.json +257 -0
  154. package/package.json +72 -3
  155. package/role-model-config.yaml +88 -0
  156. package/roles/README.md +128 -0
  157. package/roles/_shared-dispatch-contract.md +87 -0
  158. package/roles/adversarial-plan-reviewer.md +80 -0
  159. package/roles/clean-room-reviewer.md +140 -0
  160. package/roles/implementer.md +463 -0
  161. package/roles/investigator.md +138 -0
  162. package/roles/plan-writer.md +95 -0
  163. package/schemas/README.md +82 -0
  164. package/schemas/assurance-modes.schema.json +264 -0
  165. package/schemas/charter.schema.json +185 -0
  166. package/schemas/checklist.schema.json +114 -0
  167. package/schemas/cutover-state.schema.json +64 -0
  168. package/schemas/decision-record.schema.json +88 -0
  169. package/schemas/executor-record.schema.json +36 -0
  170. package/schemas/final-report.schema.json +90 -0
  171. package/schemas/finding.schema.json +106 -0
  172. package/schemas/gate-registry.schema.json +260 -0
  173. package/schemas/mechanism-index.schema.json +94 -0
  174. package/schemas/model-resolution.schema.json +362 -0
  175. package/schemas/plan.schema.json +300 -0
  176. package/schemas/report.schema.json +579 -0
  177. package/schemas/role-brief.schema.json +105 -0
  178. package/schemas/role-model-config.schema.json +90 -0
  179. package/schemas/status-line.schema.json +40 -0
  180. package/schemas/tuition.schema.json +191 -0
  181. package/schemas/verdict.schema.json +295 -0
  182. package/schemas/work-history.schema.json +183 -0
  183. package/schemas/write-bypass.schema.json +69 -0
  184. package/templates/charter.example.yaml +54 -0
  185. package/templates/decision-record.example.yaml +27 -0
  186. package/templates/final-report.example.yaml +80 -0
  187. package/templates/plan.example.yaml +87 -0
  188. package/templates/report.example.yaml +236 -0
  189. package/templates/warnings.md +74 -0
  190. package/templates/work-history.example.yaml +185 -0
  191. package/tuition/README.md +76 -0
  192. package/tuition/T-001.yaml +48 -0
  193. package/tuition/T-002.yaml +51 -0
  194. package/tuition/T-003.yaml +100 -0
  195. package/tuition/T-004.yaml +52 -0
  196. package/tuition/T-005.yaml +72 -0
  197. package/tuition/T-006.yaml +81 -0
  198. package/tuition/T-007.yaml +56 -0
  199. package/tuition/T-008.yaml +111 -0
  200. package/tuition/T-009.yaml +50 -0
  201. package/tuition/T-015.yaml +36 -0
  202. package/tuition/T-016.yaml +36 -0
  203. package/tuition/T-017.yaml +46 -0
  204. package/tuition/T-018.yaml +84 -0
  205. package/tuition/T-021.yaml +40 -0
  206. package/tuition/T-022.yaml +36 -0
  207. package/tuition/mechanism-index.yaml +256 -0
@@ -0,0 +1,185 @@
1
+ # Tiphys work history, worked example.
2
+ #
3
+ # FILLED WITH REAL CONTENT FROM THIS REPOSITORY (kernel plan M3, M3-P4 step 4):
4
+ # this is M3-P4's own record, in the machine-readable form the contract
5
+ # defines. The prose work history at delivery/work-history/m3-p4.md is the
6
+ # same phase's record in the form this repository's own process uses; the two
7
+ # are kept in step deliberately, because a template nobody fills is a template
8
+ # nobody can tell has drifted.
9
+ #
10
+ # THE claims[], fix-round[] AND gate-evidence[] SECTIONS BELOW ARE THE REPORT
11
+ # SCHEMA'S OWN DEFINITIONS, reached by $ref rather than restated, so the
12
+ # honesty contract has one definition and not two that can drift.
13
+
14
+ kind: work-history
15
+ phase: M3-P4
16
+
17
+ prompt: |
18
+ You are the IMPLEMENTER for M3-P4 in the Tiphys kernel repository. You do
19
+ not open pull requests and you do not merge. You implement, commit, push,
20
+ and hand back. Your full brief is at the dispatch brief path; read it FIRST
21
+ and follow it. It carries ten lessons M3-P3 paid ten rounds for, and they
22
+ are repeated there rather than left to CLAUDE.md because a brief that only
23
+ says "read CLAUDE.md" is how they get skipped.
24
+
25
+ files-touched:
26
+ - schemas/report.schema.json
27
+ - schemas/final-report.schema.json
28
+ - schemas/work-history.schema.json
29
+ - templates/report.example.yaml
30
+ - templates/final-report.example.yaml
31
+ - templates/work-history.example.yaml
32
+ - templates/warnings.md
33
+ - test/report-contract.test.ts
34
+ - test/work-history.test.ts
35
+ - test/fixtures/wrapper-capture.counts.json
36
+ - test/fixtures/wrapper-capture.stdout.txt
37
+ - test/fixtures/wrapper-capture.invocation.json
38
+ - src/validate.ts
39
+ - src/checks.ts
40
+ - src/commands/validate.ts
41
+ - delivery/requirements/clause-map.json
42
+ - test/behaviors.json
43
+ - delivery/work-history/m3-p4.md
44
+
45
+ per-step-commits:
46
+ - sha: "9fd800a"
47
+ subject: "M3-P4: open the work history beacon"
48
+ - sha: "b1ddc1b"
49
+ subject: "M3-P4: record the misplaced beacon commit, and the report schema first draft"
50
+
51
+ key-decisions:
52
+ - decision: >-
53
+ Add a declared COMPANION_TABLE beside the type table and an optional
54
+ companions argument to compileSchema, rather than bundling the shared
55
+ definitions into the work-history document at load time.
56
+ why: >-
57
+ The plan requires the two schemas to resolve to the SAME definition
58
+ object rather than to two equal ones. Bundling would satisfy that by a
59
+ caching accident; a declared companion satisfies it because there is one
60
+ physical definition and the second document points at it. It also keeps
61
+ the property DR-0013 clause 4 protects: the set of documents a schema
62
+ may reach is declared in one auditable place and is never derived from
63
+ the reference itself.
64
+ - decision: >-
65
+ Record the pre-existing RangeError in collectUnits rather than fix it.
66
+ why: >-
67
+ Its red witness would have to live in test/checks.test.ts, which is not
68
+ on this phase's declaration, and a fix with no witness is the shape the
69
+ red-witness rule exists to forbid. It is re-measured at this head so the
70
+ record is a measurement rather than an inherited claim.
71
+ - decision: >-
72
+ Express the universal-quantifier rule as a two-branch oneOf rather than
73
+ the if/then the criterion's letter names.
74
+ why: >-
75
+ One object level carries one if/then, the finding object already spends
76
+ it on T-004's source-pinned coupling, and allOf is outside the declared
77
+ authoring vocabulary. Declared as a deviation rather than done quietly.
78
+
79
+ verification-first:
80
+ - finding: >-
81
+ compileSchema builds a fresh Ajv per document and registers nothing
82
+ beside it, and makeAjv withholds loadSchema on purpose, so a $ref that
83
+ leaves the document fails compilation. Shipping the plan's cross-document
84
+ $ref without a change to the compile path would fail acceptance
85
+ criterion 1 on this phase's own example.
86
+ contradicts-plan: true
87
+ stopped-and-reported: >-
88
+ Reported in delivery/work-history/m3-p4.md as VF-1 before any schema was
89
+ authored, with the decision and its reasoning recorded above rather than
90
+ taken silently.
91
+ - finding: >-
92
+ The M2-P6 coverage checker exposes checkFindingOutcomeParity as a
93
+ function and its CLI accepts only --result, --evidence and --config, so
94
+ there is no flag that reaches finding-to-outcome parity mode.
95
+ contradicts-plan: false
96
+
97
+ deviations:
98
+ - plan-clause: M3-P4 acceptance criterion 2(e)
99
+ why: >-
100
+ The criterion calls for an if/then over a pattern on the same object;
101
+ the object's one if/then slot is spent on T-004's coupling and allOf is
102
+ outside the declared authoring vocabulary, so the rule is a two-branch
103
+ oneOf. It remains Kind A and is witnessed by removing and restoring
104
+ oneOf.
105
+ - plan-clause: M3-P4 acceptance criterion 4
106
+ why: >-
107
+ The criterion says the M2-P6 coverage checker is RUN in
108
+ finding-to-outcome parity mode with an exit code on both arms. That mode
109
+ has no CLI flag and src/gates/coverage.ts is not on this phase's
110
+ declaration, so the registered test invokes the exported checker in a
111
+ subprocess. The checker itself is unmodified and the exit code is a real
112
+ process exit code.
113
+
114
+ gate-evidence:
115
+ - gate: suite
116
+ result: green
117
+ wrapper-exit-code: 0
118
+ discovered: 507
119
+ passed: 505
120
+ failed: 0
121
+ skipped: 2
122
+ todo: 0
123
+ did-not-run: 0
124
+
125
+ claims:
126
+ - id: W-1
127
+ kind: open-question
128
+ statement: >-
129
+ I did not find a way to express "this array is empty" in the declared
130
+ authoring vocabulary, so the rule that a report with no findings must
131
+ carry a no-findings-statement is not schema-enforced.
132
+
133
+ - id: W-2
134
+ kind: coverage
135
+ statement: >-
136
+ Registering report.schema.json as a companion is what makes the
137
+ work-history schema compile; without it the compilation fails closed.
138
+ settled-by:
139
+ executed-construction:
140
+ command: >-
141
+ node --input-type=module -e "import {compileSchema} from
142
+ './src/validate.ts'; import {readFileSync} from 'node:fs'; const s =
143
+ JSON.parse(readFileSync('schemas/work-history.schema.json','utf8'));
144
+ const r = compileSchema(s); console.log(r.ok ? 'compiled' : r.reason);"
145
+ exit-code: 0
146
+ output: |
147
+ INVALID # schema reference report.schema.json#/$defs/gateResult does not resolve
148
+
149
+ fix-round:
150
+ - mechanism: >-
151
+ A schema document compiled without the sibling documents its references
152
+ reach, so a reference that leaves the document fails closed at
153
+ compilation rather than resolving.
154
+ derivation:
155
+ command: "grep -rn 'compileSchema(\\|validateInstance(\\|validateToLines(' src/ bin/ | grep -v '^src/validate.ts:'"
156
+ output: |
157
+ src/gates/run.ts:361: const diagnostics = formatDiagnostics(validateInstance(schema, decoded.value));
158
+ src/gates/validate.ts:524: return validateInstance(schema, instance) as Diagnostic[];
159
+ src/gates/validate.ts:528:export function validateToLines(
160
+ src/commands/mode.ts:125: const lines = formatDiagnostics(validateInstance(loadTypeSchema(MODES_TYPE), read.raw));
161
+ src/commands/validate.ts:273: const diagnostics = validateInstance(
162
+ src/commands/status.ts:127: const diagnostics = validateInstance(loadTypeSchema("status-line"), record);
163
+ not-covered: >-
164
+ The search covered src/ and bin/ only. It did NOT cover test/, where the
165
+ same functions are reached through a computed dynamic import and a
166
+ literal grep would find the import rather than the call; it did not cover
167
+ scripts/, which reaches the validator only through src/gates/result.ts
168
+ and compiles no schema of its own; and it did not cover dist/, which is
169
+ generated and never committed.
170
+
171
+ environment-warnings:
172
+ - warning: >-
173
+ A checkout whose node_modules predates M3-P3 fails npm run build at
174
+ build:runtime-deps, because commonmark is a dependency added by that
175
+ phase and the copy step reads its package.json directly.
176
+ evidence: >-
177
+ npm run build exited 1 with ENOENT on node_modules/commonmark/package.json;
178
+ npm ci then npm run build exited 0.
179
+ - warning: >-
180
+ This container's default toolchain is node v22.22.2, below the declared
181
+ engine floor, so EBADENGINE warnings appear on every npm operation and
182
+ two floor-gated tests skip.
183
+ evidence: >-
184
+ node --version printed v22.22.2 in the shell that ran the suite, and the
185
+ captured wrapper run reports 507 reported, 505 pass, 2 skipped.
@@ -0,0 +1,76 @@
1
+ # tuition/
2
+
3
+ The tuition feed: one document per failure mode a delivery paid for, and the
4
+ mechanism index projected out of them.
5
+
6
+ **`tuition/mechanism-index.yaml` is the index. Read it before you use a
7
+ mechanism.** It is GENERATED by `tiphys tuition index` from the `mechanisms[]`
8
+ field of the entries beside it, so a rule is recorded once, in the entry that
9
+ paid for it. Do not edit it by hand; `tiphys tuition index --check` exits
10
+ nonzero on any drift and names the mechanism and the entry it came from. It
11
+ supersedes the interim markdown table this repository kept at its root until
12
+ M3-P8, which was deleted rather than kept for reference, because two indexes is
13
+ the state T-005 exists to prevent and a file kept for reference is a file
14
+ someone will edit. Git history keeps it losslessly, and a verbatim capture of
15
+ it lives at test/fixtures/mechanisms-interim.md:1 as the independent source a
16
+ registered test uses to prove no row was dropped.
17
+
18
+ ## What is here
19
+
20
+ | Path | What it is |
21
+ |---|---|
22
+ | `T-nnn.yaml` | one tuition entry, validated by `schemas/tuition.schema.json` |
23
+ | `mechanism-index.yaml` | the generated projection, validated by `schemas/mechanism-index.schema.json` |
24
+
25
+ Two layers, deliberately. The INDEX is the read layer: dense, consulted at
26
+ every dispatch. The ENTRIES are the archive layer: longer, read when a rule is
27
+ disputed.
28
+
29
+ ## The commands
30
+
31
+ ```
32
+ tiphys validate --type tuition --context . tuition/T-005.yaml
33
+ tiphys tuition add --file <entry> # validate, then file it under its id
34
+ tiphys tuition list [--kernel-relevant] # id, date, target count
35
+ tiphys tuition index [--check] # regenerate, or fail on drift
36
+ ```
37
+
38
+ `add` writes with an exclusive create, so an id already in the feed is a loud
39
+ refusal rather than an overwrite. A `T-nnn` id is never renumbered and never
40
+ reused after retirement, and this feed shares that one id space with the
41
+ delivering project's own log.
42
+
43
+ ## Two rules that are not negotiable
44
+
45
+ **A rule with no citation is not a rule.** Every `mechanisms[]` entry requires
46
+ a non-empty `evidence[]`, and the schema rejects one without it. That is
47
+ T-005's checkability rule as a validation failure rather than as advice.
48
+
49
+ **An entry that claims kernel relevance and proposes no change to any kernel
50
+ artifact is not tuition, it is an anecdote.** `kernel-relevant: true` requires
51
+ at least one `structural-consequence`, each carrying the artifact it targets
52
+ and whether the change is `proposed`, `applied` or `ticketed`.
53
+
54
+ ## R-070: a pipeline flaw is fixed immediately
55
+
56
+ **When the flaw is in the DELIVERY PROCESS rather than in the product, the fix
57
+ is a hotfix promoted to next in queue, not a backlog item.** A process defect
58
+ keeps charging rent: every phase dispatched between discovering it and fixing
59
+ it pays for it again, which is why deferring it is more expensive than it
60
+ looks. File the tuition entry when you discover it, not at the end, and carry
61
+ the fix in the same queue position as a production defect.
62
+
63
+ The orchestrator's half of this rule (who promotes, and what happens to work
64
+ already in flight) is stated in the orchestrator brief shipped by M3-P9, whose
65
+ clause id is reserved here as `hotfix-promotion`. The checkable half that
66
+ exists today is the retention check below.
67
+
68
+ ## R-098: the retention duty
69
+
70
+ A project charter declares `retention` paths for its work histories, its
71
+ evidence and its tuition. `tiphys doctor` reads them and reports `CHECK
72
+ retention`: a declared path that is absent, or that is git-ignored in the fleet
73
+ or the project repository, is a FAIL naming the path, because evidence that is
74
+ ignored is evidence that will not survive the next clone. A fleet whose charter
75
+ declares no retention at all is a WARN under the generic profile and a FAIL
76
+ under `--for full`, never a silent pass.
@@ -0,0 +1,48 @@
1
+ # T-001: cross-model review caught findings that survived three same-model
2
+ # rounds. Promoted from the delivering project's own log by M3-P8; the
3
+ # long-form account stays there.
4
+ kind: tuition
5
+ version: 1
6
+ id: T-001
7
+ project: tiphys-kernel
8
+ date: 2026-08-04
9
+ stage: planning, before any implementation dispatch
10
+ kernel-relevant: true
11
+ what-happened: >-
12
+ The kernel plan went through three adversarial review rounds plus one
13
+ targeted verification, all by the same model family, producing 28 applied
14
+ findings. An external review by a different model family then found two
15
+ genuine defects that had survived every internal round: lease renewal was
16
+ never required to fail after expiry, so an expired-but-alive holder racing a
17
+ legitimate takeover could produce dual mutation; and fleet initialization
18
+ assumed a configured git identity, which a clean cloud environment does not
19
+ have. A second data point arrived the same day, with decorrelation in place:
20
+ two clean-room reviews of one head, given deliberately different starting
21
+ questions, found different defects, and the hazard-framed one surfaced two
22
+ highs the criteria walk did not raise at all.
23
+ lesson:
24
+ - >-
25
+ Same-family reviewers share blind spots, and the deterministic verifier
26
+ layer does not cover design-level races or environment assumptions at
27
+ planning time.
28
+ - >-
29
+ The narrower lesson is not "use two models". It is that two reviews with
30
+ different STARTING QUESTIONS find different things, and model diversity
31
+ makes that difference harder to collapse.
32
+ structural-consequence:
33
+ - target: role-model-config.yaml
34
+ status: applied
35
+ change: >-
36
+ The role-to-model binding carries a review-model-family field, so which
37
+ family produced a review is configuration rather than a dispatch habit.
38
+ - target: checklists/clean-room.yaml
39
+ status: ticketed
40
+ change: >-
41
+ The review checklists must vary the ENTRY POINT rather than only the
42
+ reviewer, so the two contracts of a dual review start from different
43
+ questions by construction.
44
+ record: delivery/plan/kernel-plan-m3.md, M3-P7 step 3
45
+ evidence:
46
+ - delivery/review/plan-review-r4-external.md, the external review with its verdict and findings
47
+ - delivery/review/plan-review-r1.md, delivery/review/plan-review-r2.md and delivery/review/plan-review-r3.md, the internal rounds that missed both defects
48
+ - delivery/review/clean-room-m1-p4.md and delivery/review/clean-room-m1-p4-second.md, the first dual review with two framings
@@ -0,0 +1,51 @@
1
+ # T-002: agent death mid fix round, and salvage exercised for real. Promoted
2
+ # from the delivering project's own log by M3-P8.
3
+ kind: tuition
4
+ version: 1
5
+ id: T-002
6
+ project: tiphys-kernel
7
+ date: 2026-08-04
8
+ stage: M1-P3 fix round (session lock and worktree pool)
9
+ kernel-relevant: true
10
+ what-happened: >-
11
+ An implementer hit a provider usage limit part way through a fix round and
12
+ stopped, leaving uncommitted work in its worktree and no turn-end record.
13
+ The stop was clean and quiet: nothing crashed, nothing timed out, and no exit
14
+ code said anything had gone wrong. The work was salvaged by hand into a
15
+ commit marked WIP-UNREVIEWED, which is the discipline the process document
16
+ mandates and which nothing in the system detects or performs.
17
+ lesson:
18
+ - >-
19
+ Agent death from a provider limit is a distinct failure class from a crash
20
+ or a timeout, and it looks exactly like an ordinary completion to anything
21
+ keyed on process exit.
22
+ - >-
23
+ A missing turn-end record must never be read as success. Task open, no
24
+ turn-end, worktree dirty is the abandoned-task state and deserves its own
25
+ wake reason rather than being discovered later.
26
+ - >-
27
+ Salvage is currently manual. Detection belongs with the watcher and the
28
+ liveness guard, because a rule that depends on somebody noticing is the
29
+ thing that failed here.
30
+ structural-consequence:
31
+ - target: src/teardown.ts
32
+ status: applied
33
+ change: >-
34
+ teardown --salvage commits a dirty worktree under a fixed
35
+ WIP-UNREVIEWED prefix, so the audit trail of a salvage is uniform rather
36
+ than per-incident.
37
+ - target: src/watcher.ts
38
+ status: applied
39
+ change: >-
40
+ The watcher treats an open task with no turn-end record as a wake
41
+ condition with its own reason line, so the human is told rather than
42
+ finding out afterwards.
43
+ - target: roles/implementer.md
44
+ status: applied
45
+ change: >-
46
+ The R-081b clause makes incremental, committed output an obligation of
47
+ the dispatched agent, so a death leaves a partial result rather than
48
+ nothing.
49
+ evidence:
50
+ - delivery/work-history/m1-p3.md, fix-round section, with the measured salvage state
51
+ - delivery/intake/orchestrated-delivery-process.md section 6, the salvage discipline
@@ -0,0 +1,100 @@
1
+ # T-003: a fix round for low-severity findings introduced two high-severity
2
+ # defects. Promoted from the delivering project's own log by M3-P8.
3
+ kind: tuition
4
+ version: 1
5
+ id: T-003
6
+ project: tiphys-kernel
7
+ date: 2026-08-04
8
+ stage: M1-P3 (session lock and worktree pool), after clean-room APPROVE
9
+ kernel-relevant: true
10
+ what-happened: >-
11
+ A fix round addressing four LOW findings introduced two HIGH defects. One
12
+ gave a worktree destroy the authority to force-delete a branch, justified by
13
+ a component scheduled for a later phase that would refuse first. The other
14
+ narrowed a git contention matcher using hand-written example strings chosen
15
+ to match the new pattern, so real racing-git messages fell outside it. The
16
+ round's own tests were green and worthless for both: the destroy test
17
+ destroyed a branch still at its base commit, so no data could be lost, and
18
+ the concurrency test never advanced the upstream, so no ref transaction was
19
+ ever opened. The work history then stated as measured fact a universal claim
20
+ that concealed the second defect from the next reader.
21
+ lesson:
22
+ - >-
23
+ A fix round is not lower risk than the work it fixes, and it receives less
24
+ scrutiny. The severity of the findings being fixed says nothing about the
25
+ severity of the defects the fixes can introduce.
26
+ - >-
27
+ Tests written alongside a fix test the fix, not the behaviour the fix
28
+ endangers. A test must be red against the DANGEROUS state, not merely
29
+ against the absence of the feature.
30
+ - >-
31
+ An unfalsified universal claim in a work history is worse than no claim:
32
+ the document whose purpose is to let a reviewer trust the round is what
33
+ hid the defect.
34
+ mechanisms:
35
+ - mechanism: Lease compare-and-swap
36
+ rule: >-
37
+ Liveness is lease freshness, never pid, process probing or signals
38
+ (constraint C-2). Expiry does not block a release, but it DOES block a
39
+ renew and it DOES block teardown's holdership check, which fails closed.
40
+ siblings:
41
+ - src/lock.ts
42
+ - src/task.ts
43
+ evidence:
44
+ - src/lock.ts
45
+ - checkHoldership in src/task.ts
46
+ - CR-680 in delivery/review/clean-room-m1-p6-round3-hazard.md
47
+ - mechanism: Append-only log
48
+ rule: >-
49
+ Never read current state from the tail of a log (constraint C-1).
50
+ Currency comes from `meta.json` and turn-end files only.
51
+ siblings:
52
+ - src/task.ts
53
+ evidence:
54
+ - plan v1 section 3, C-1 (FM-052)
55
+ - mechanism: Worktree removal and force branch delete
56
+ rule: >-
57
+ Resolve, evaluate, then apply. No policy decision may be taken after a
58
+ destructive action has begun, and destructive authority is never
59
+ inherited from a component that does not exist yet.
60
+ siblings:
61
+ - src/pool.ts
62
+ - src/teardown.ts
63
+ machine-readable-form:
64
+ path: gates.manifest.json
65
+ key: destructiveCommands
66
+ evidence:
67
+ - delivery/review/verification-m1-p3-fix-round.md V-1 and V-3
68
+ - mechanism: Classifying another program's errors
69
+ rule: >-
70
+ Derive the signature from REAL captured output under forced conditions,
71
+ never from hand-written examples chosen to match the implementation. 312
72
+ captured contention failures, every one of the dropped shape.
73
+ siblings:
74
+ - src/pool.ts
75
+ evidence:
76
+ - V-2 in delivery/review/verification-m1-p3-fix-round.md
77
+ - CLAUDE.md environment warning 10
78
+ structural-consequence:
79
+ - target: assurance-modes.yaml
80
+ status: applied
81
+ change: >-
82
+ Full mode carries a fix-round-verification stage, so an independent
83
+ verification of a fix round is a declared pipeline stage rather than
84
+ orchestrator discretion.
85
+ - target: schemas/report.schema.json
86
+ status: applied
87
+ change: >-
88
+ The shared claims[] contract makes a universal claim carry the executed
89
+ construction that could have falsified it, or be restated as an open
90
+ question.
91
+ - target: gates.manifest.json
92
+ status: applied
93
+ change: >-
94
+ The destructiveCommands list names every command that can destroy work,
95
+ which is the machine-readable view of this entry's destructive-operation
96
+ rule and the list the derived-class rule consumes.
97
+ evidence:
98
+ - delivery/review/verification-m1-p3-fix-round.md, findings V-1 and V-2 with the unrefuted candidates
99
+ - delivery/review/clean-room-m1-p3.md, the APPROVE and the four LOW findings that triggered the round
100
+ - delivery/work-history/m1-p3.md, the round's own record including the claim named above
@@ -0,0 +1,52 @@
1
+ # T-004: verification lenses sharing one worktree can manufacture a phantom
2
+ # defect. Promoted from the delivering project's own log by M3-P8.
3
+ kind: tuition
4
+ version: 1
5
+ id: T-004
6
+ project: tiphys-kernel
7
+ date: 2026-08-04
8
+ stage: M1-P3 verification and the investigation that followed it
9
+ kernel-relevant: true
10
+ what-happened: >-
11
+ Two verification lenses ran against the same worktree. One was running a
12
+ disciplined sabotage window (copy, mutate, measure, restore) while the other
13
+ ran tests. The second lens observed a failure that came from the first lens's
14
+ mutation and reported it as a defect. By the time anyone inspected the tree it
15
+ was byte-clean, so the evidence of contamination was gone while the finding
16
+ survived, and closing it took two multi-hour investigations.
17
+ lesson:
18
+ - >-
19
+ Shared mutable ground turns one lens's experiment into another lens's
20
+ discovery, and the contamination erases itself while the finding remains.
21
+ - >-
22
+ The dispatch instruction was the defect. The briefs PERMITTED isolation
23
+ rather than REQUIRING it, and permitting is not requiring.
24
+ - >-
25
+ A test run is only evidence if you can prove what it ran. A run that
26
+ cannot name what it executed is an anecdote.
27
+ mechanisms:
28
+ - mechanism: Shared worktree
29
+ rule: >-
30
+ A verification lens works in its OWN clone, never in a tree another agent
31
+ is editing, and a run that cannot pin the source it ran against is not
32
+ evidence and must label itself so.
33
+ siblings:
34
+ - src/pool.ts
35
+ evidence:
36
+ - delivery/verification/u2-race-flake-investigation.md, the U-2 phantom and the four hypotheses each run in a private clone
37
+ - delivery/review/verification-m1-p3-fix-round.md, the round whose lenses shared a tree
38
+ structural-consequence:
39
+ - target: schemas/report.schema.json
40
+ status: applied
41
+ change: >-
42
+ A report declares the source it ran against, so a finding produced by a
43
+ run that cannot pin its source is labelled unpinned rather than inherited
44
+ as fact.
45
+ - target: roles/investigator.md
46
+ status: applied
47
+ change: >-
48
+ The investigator brief requires a private clone and a reproduction, so
49
+ isolation is a role obligation rather than a dispatch-time permission.
50
+ evidence:
51
+ - delivery/verification/u2-race-flake-investigation.md, the whole investigation
52
+ - delivery/review/verification-m1-p3-fix-round.md, the run that produced the phantom
@@ -0,0 +1,72 @@
1
+ # T-005: a lesson the codebase had already paid for did not reach the next
2
+ # phase that needed it. Promoted from the delivering project's own log by
3
+ # M3-P8; the long-form account stays there.
4
+ kind: tuition
5
+ version: 1
6
+ id: T-005
7
+ project: tiphys-kernel
8
+ date: 2026-08-05
9
+ stage: M1-P5 (watcher and liveness guard), first dual review
10
+ kernel-relevant: true
11
+ what-happened: >-
12
+ M1-P3 established, in a multi-hour investigation, that a claim file which
13
+ cannot be taken must fail loudly and name the stuck file. Two phases later
14
+ M1-P5 implemented the same claim-file pattern for the watcher's seen state
15
+ and absorbed the timeout silently. A stranded claim file then made every
16
+ subsequent watcher pass report that there was nothing to surface, for a
17
+ genuinely pending signal, while the beacon kept advancing so the liveness
18
+ guard reported the fleet healthy throughout. It was the most severe defect
19
+ found in M1. The implementer had read the plan, the agent-rules file, the
20
+ constraint list, the environment warnings and three prior work histories,
21
+ and none of them carried the rule: it lived in the M1-P3 source and in an
22
+ investigation report filed under the mystery it solved rather than under the
23
+ mechanism it constrained.
24
+ lesson:
25
+ - >-
26
+ A lesson attached to a component does not travel to the next component
27
+ that needs it. Documents organised by phase, by incident or by environment
28
+ each fail this for their own reason, and none of them is carelessness.
29
+ - >-
30
+ The missing artifact is an index from MECHANISM to RULE, so an implementer
31
+ reaching for a claim file, a lease, an append-only log or a destructive
32
+ git operation can ask what the project already learned and get an answer.
33
+ - >-
34
+ That index is a PROJECTION of the tuition feed rather than a second thing
35
+ to maintain, because two copies of a rule is the state that produced this
36
+ defect in the first place.
37
+ mechanisms:
38
+ - mechanism: Claim file (mutual exclusion by O_EXCL)
39
+ rule: >-
40
+ A claim that cannot be taken must fail LOUDLY and name the stuck file. A
41
+ silent timeout is indistinguishable from an absence of contention. There
42
+ are now THREE claim-file users (the lock, the watcher seen-state, and
43
+ M2-P1's evidence-directory run claim); the next one reads `src/lock.ts`
44
+ first, and the M2-P1 instance is the worked example of doing that and
45
+ stating the one difference (no expiry, because an evidence directory must
46
+ not have a lease that lapses).
47
+ siblings:
48
+ - src/lock.ts
49
+ - src/watch.ts
50
+ - src/gates/run.ts
51
+ evidence:
52
+ - delivery/verification/u2-race-flake-investigation.md D-3
53
+ - delivery/tuition/T-005, the silent reimplementation two phases later that became M1's most severe defect
54
+ structural-consequence:
55
+ - target: tuition/mechanism-index.yaml
56
+ status: applied
57
+ change: >-
58
+ The mechanism index exists and is generated by `tiphys tuition index` as
59
+ a projection of every tuition entry's mechanisms[] field, so a rule is
60
+ recorded once and read from one place.
61
+ - target: roles/implementer.md
62
+ status: applied
63
+ change: >-
64
+ The mandated reading list names the mechanism index, and the
65
+ `mechanism-lookup` and `mechanism-sibling` clauses require an implementer
66
+ to look up every mechanism it is about to use and to record the siblings
67
+ when it establishes a rule.
68
+ evidence:
69
+ - delivery/verification/u2-race-flake-investigation.md, defect D-3 and the structural-fix section
70
+ - delivery/review/clean-room-m1-p5-second.md, finding 1, with the reproduction
71
+ - delivery/work-history/m1-p5.md, fix-round section
72
+ - delivery/intake/orchestrated-delivery-v1.md section 9, the tuition flow
@@ -0,0 +1,81 @@
1
+ # T-006: claimed impossibilities and claimed safety nets, written without
2
+ # execution. Promoted from the delivering project's own log by M3-P8.
3
+ kind: tuition
4
+ version: 1
5
+ id: T-006
6
+ project: tiphys-kernel
7
+ date: 2026-08-05
8
+ stage: M1-P5 (watcher and liveness guard), across its fix rounds
9
+ kernel-relevant: true
10
+ what-happened: >-
11
+ Three times in one phase, a work history stated something about the world
12
+ that had never been executed: an arm that "cannot be forced", a case another
13
+ guard "already catches", a path that "recovers anyway". Each was written by an
14
+ implementer who had done real work, and each survived into a document a
15
+ reviewer was expected to trust. The orchestrator then did the same thing the
16
+ same day, reporting a remote as unreachable on the strength of a read
17
+ operation that says nothing about write access.
18
+ lesson:
19
+ - >-
20
+ An impossibility claim, a coverage claim or a remedy claim must carry the
21
+ executed construction, or be restated as an open question.
22
+ - >-
23
+ The honest restatement costs nothing and is more useful: "I did not find a
24
+ way to force this arm" is true and invites the next reader to try, where
25
+ "this arm cannot be forced here" is false and closes the question.
26
+ - >-
27
+ A reminder does not survive a busy session. The mechanism is a grep over
28
+ the work history before it is submitted.
29
+ mechanisms:
30
+ - mechanism: Reading a path whose type is not established
31
+ rule: >-
32
+ lstat the link, stat what it resolves to, open ONLY a regular file. A
33
+ block is not an exception, so try/catch does not touch it.
34
+ siblings:
35
+ - src/task.ts
36
+ - src/lock.ts
37
+ - src/pool.ts
38
+ - src/brief.ts
39
+ - src/hooks.ts
40
+ evidence:
41
+ - CR-520 and the four M1-P5 rounds
42
+ - delivery/verification/cr-520-orchestrator-reproduction.md
43
+ - mechanism: Atomic file replacement
44
+ rule: >-
45
+ Stage under a name no other pass can collide with. A fixed
46
+ `${path}.stage` lets two concurrent passes share one temporary; the loser
47
+ dies on ENOENT after advancing its seen state, dropping a signal in a
48
+ protocol whose rule is duplicate-rather-than-drop.
49
+ siblings:
50
+ - src/lock.ts
51
+ - src/watch.ts
52
+ evidence:
53
+ - M1-P5 round 4, verified pre-existing against a pristine build
54
+ - mechanism: Verifying access to a remote
55
+ rule: >-
56
+ `git push --dry-run` authenticates against receive-pack and updates no
57
+ ref. `clone` and `ls-remote` are READ operations and witness nothing
58
+ about write access.
59
+ evidence:
60
+ - delivery/tuition/T-006-unexecuted-claims-about-the-world.md, the orchestrator's own instance
61
+ structural-consequence:
62
+ - target: schemas/work-history.schema.json
63
+ status: applied
64
+ change: >-
65
+ The shared claims[] section requires an executed construction beside any
66
+ impossibility, coverage or remedy claim, so the claim and its settlement
67
+ travel together.
68
+ - target: schemas/report.schema.json
69
+ status: applied
70
+ change: >-
71
+ The same claims[] definition is shared by the report contract, so a
72
+ review making an unexecuted claim is subject to the same rule as the work
73
+ it reviews.
74
+ - target: roles/implementer.md
75
+ status: applied
76
+ change: >-
77
+ The claim-grep clause carries the grep command verbatim, so hunting these
78
+ claims is a command rather than a habit.
79
+ evidence:
80
+ - delivery/work-history/m1-p5.md, the three claims and their fix rounds
81
+ - delivery/review/clean-room-m1-p5-round4-hazard.md, the review that named the pattern