@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,257 @@
1
+ {
2
+ "note": "This is the KERNEL'S OWN manifest and is repository-local by construction: gate commands invoke bin/tiphys.ts, which npm pack does not ship (files is [\"dist\"]). In CI the RUNNER is the compiled entry (dist/bin/tiphys.js, per kernel plan M2 step 9) while this gate is the source entry, so the runner resolves dist/src/gates/schemas and the gate resolves src/gates/schemas. Both copies are therefore exercised on every CI run, the runner's by its manifest load and record ingest and the gate's by self-check. Recorded here rather than left ambiguous (CR-813).",
3
+ "version": 1,
4
+ "gates": [
5
+ {
6
+ "id": "manifest-self-check",
7
+ "command": [
8
+ "node",
9
+ "bin/tiphys.ts",
10
+ "gates",
11
+ "self-check",
12
+ "--manifest",
13
+ "gates.manifest.json"
14
+ ],
15
+ "unitLabel": "schema documents validated",
16
+ "applicability": "required"
17
+ },
18
+ {
19
+ "id": "coverage",
20
+ "command": [
21
+ "node",
22
+ "src/gates/coverage.ts"
23
+ ],
24
+ "unitLabel": "finding ids checked",
25
+ "applicability": "required",
26
+ "precondition": {
27
+ "id": "coverage-inventory-exists",
28
+ "kind": "file-exists",
29
+ "path": "delivery/requirements/migration-table.md"
30
+ }
31
+ },
32
+ {
33
+ "id": "credential-scrub",
34
+ "command": [
35
+ "node",
36
+ "src/gates/credentials.ts",
37
+ "credential-scrub"
38
+ ],
39
+ "unitLabel": "credential sources probed",
40
+ "applicability": "required"
41
+ },
42
+ {
43
+ "id": "credential-token",
44
+ "command": [
45
+ "node",
46
+ "src/gates/credentials.ts",
47
+ "credential-token"
48
+ ],
49
+ "unitLabel": "tokens probed",
50
+ "applicability": "conditional",
51
+ "precondition": {
52
+ "id": "implementer-token-present-owner-action-a-3",
53
+ "kind": "command-exit-zero",
54
+ "command": [
55
+ "node",
56
+ "-e",
57
+ "process.exit(process.env.TIPHYS_IMPLEMENTER_TOKEN === undefined ? 1 : 0)"
58
+ ]
59
+ }
60
+ },
61
+ {
62
+ "id": "suite",
63
+ "command": [
64
+ "node",
65
+ "src/gates/suite.ts",
66
+ "--pin-root",
67
+ "src",
68
+ "--pin-root",
69
+ "bin",
70
+ "--pin-root",
71
+ "test"
72
+ ],
73
+ "unitLabel": "tests reported",
74
+ "applicability": "required",
75
+ "parameters": [
76
+ "base"
77
+ ]
78
+ },
79
+ {
80
+ "id": "citations",
81
+ "command": [
82
+ "node",
83
+ "src/gates/citations.ts"
84
+ ],
85
+ "unitLabel": "citations resolved",
86
+ "applicability": "required",
87
+ "precondition": {
88
+ "id": "citations-diff-touches-documents",
89
+ "kind": "diff-touches",
90
+ "paths": [
91
+ "delivery/plan/",
92
+ "delivery/verification/",
93
+ "delivery/decisions/",
94
+ "delivery/tuition/",
95
+ "delivery/requirements/",
96
+ "delivery/STATE.md"
97
+ ]
98
+ }
99
+ },
100
+ {
101
+ "id": "scope",
102
+ "command": [
103
+ "node",
104
+ "src/gates/scope.ts",
105
+ "--declarations",
106
+ "delivery/plan/phase-declarations"
107
+ ],
108
+ "unitLabel": "changed paths audited",
109
+ "applicability": "required",
110
+ "parameters": [
111
+ "base",
112
+ "head"
113
+ ],
114
+ "precondition": {
115
+ "id": "scope-branch-is-a-phase-branch",
116
+ "kind": "branch-matches",
117
+ "pattern": "claude/m[0-9]+-p[0-9]+-.*"
118
+ }
119
+ },
120
+ {
121
+ "id": "deploy",
122
+ "command": [
123
+ "node",
124
+ "src/gates/deploy.ts"
125
+ ],
126
+ "unitLabel": "release verifications satisfied",
127
+ "applicability": "conditional",
128
+ "precondition": {
129
+ "id": "deploy-release-verification-declared (an unmet result here is STRUCTURAL in any pre-merge bundle, not local to this repository: release verification runs post-merge against a commit that exists only once the merge has happened; kernel plan M2 section 1.4, investigation observation O-3)",
130
+ "kind": "file-exists",
131
+ "path": "release-verification.json"
132
+ }
133
+ },
134
+ {
135
+ "id": "migrations",
136
+ "command": [
137
+ "node",
138
+ "src/gates/migrations.ts"
139
+ ],
140
+ "unitLabel": "migrations compared",
141
+ "applicability": "conditional",
142
+ "precondition": {
143
+ "id": "migrations-release-verification-declared (an unmet result here is STRUCTURAL in any pre-merge bundle, not local to this repository: release verification runs post-merge against a commit that exists only once the merge has happened; kernel plan M2 section 1.4, investigation observation O-3)",
144
+ "kind": "file-exists",
145
+ "path": "release-verification.json"
146
+ }
147
+ },
148
+ {
149
+ "id": "clause-map",
150
+ "command": [
151
+ "node",
152
+ "scripts/check-clause-map.mjs"
153
+ ],
154
+ "unitLabel": "clause-map rows checked",
155
+ "applicability": "required"
156
+ },
157
+ {
158
+ "id": "red-witness",
159
+ "command": [
160
+ "node",
161
+ "src/gates/red-witness.ts"
162
+ ],
163
+ "unitLabel": "witnesses evaluated",
164
+ "applicability": "required",
165
+ "parameters": [
166
+ "base",
167
+ "head"
168
+ ],
169
+ "precondition": {
170
+ "id": "red-witness-diff",
171
+ "kind": "diff-touches",
172
+ "paths": [
173
+ "src/",
174
+ "bin/",
175
+ "plugin/"
176
+ ]
177
+ }
178
+ },
179
+ {
180
+ "id": "brief-drift",
181
+ "command": [
182
+ "node",
183
+ "scripts/check-brief-drift.mjs",
184
+ "--check"
185
+ ],
186
+ "unitLabel": "generated brief gate rows compared",
187
+ "applicability": "required"
188
+ },
189
+ {
190
+ "id": "typecheck",
191
+ "command": [
192
+ "node",
193
+ "src/gates/gate-classes.ts",
194
+ "typecheck",
195
+ "--project",
196
+ "tsconfig.src.json",
197
+ "--project",
198
+ "tsconfig.test.json",
199
+ "--project",
200
+ "plugin/tsconfig.json"
201
+ ],
202
+ "unitLabel": "source files type-checked",
203
+ "applicability": "required"
204
+ },
205
+ {
206
+ "id": "gate-classes",
207
+ "command": [
208
+ "node",
209
+ "src/gates/gate-classes.ts",
210
+ "gate-classes",
211
+ "--declarations",
212
+ "delivery/plan/phase-declarations",
213
+ "--registry",
214
+ "gate-registry.yaml"
215
+ ],
216
+ "unitLabel": "declared gate classes checked",
217
+ "applicability": "required",
218
+ "parameters": [
219
+ "phase"
220
+ ],
221
+ "precondition": {
222
+ "id": "gate-classes-branch-is-a-phase-branch",
223
+ "kind": "branch-matches",
224
+ "pattern": "claude/m[0-9]+-p[0-9]+-.*"
225
+ }
226
+ },
227
+ {
228
+ "id": "merge-preconditions",
229
+ "command": [
230
+ "node",
231
+ "src/gates/merge-preconditions.ts"
232
+ ],
233
+ "unitLabel": "merge preconditions evaluated",
234
+ "applicability": "conditional",
235
+ "parameters": [
236
+ "head",
237
+ "phase"
238
+ ],
239
+ "precondition": {
240
+ "id": "merge-preconditions-verdicts-present",
241
+ "kind": "command-exit-zero",
242
+ "command": [
243
+ "node",
244
+ "scripts/check-dual-review.mjs",
245
+ "--precondition",
246
+ "."
247
+ ]
248
+ }
249
+ }
250
+ ],
251
+ "destructiveCommands": [
252
+ "pool destroy",
253
+ "teardown",
254
+ "src/pool.ts",
255
+ "src/teardown.ts"
256
+ ]
257
+ }
package/package.json CHANGED
@@ -1,7 +1,76 @@
1
1
  {
2
2
  "name": "@tiphys/kernel",
3
- "version": "0.0.0",
4
- "description": "Placeholder. Reserved for the Tiphys delivery-process kernel. Do not install.",
3
+ "version": "0.2.0",
4
+ "description": "Tiphys kernel: the fleet orchestration toolbelt, delivered as an npm package.",
5
+ "type": "module",
5
6
  "license": "Apache-2.0",
6
- "private": false
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/ThomasHendrickx/tiphys-ai-helmsman.git"
10
+ },
11
+ "engines": {
12
+ "node": ">=26"
13
+ },
14
+ "bin": {
15
+ "tiphys": "dist/bin/tiphys.js"
16
+ },
17
+ "main": "./dist/src/index.js",
18
+ "types": "./dist/src/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/src/index.d.ts",
22
+ "default": "./dist/src/index.js"
23
+ },
24
+ "./package.json": "./package.json"
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "!dist/node_modules",
29
+ "LICENSE",
30
+ "AGENTS.md",
31
+ "gate-registry.yaml",
32
+ "gates.manifest.json",
33
+ "assurance-modes.yaml",
34
+ "checklists",
35
+ "role-model-config.yaml",
36
+ "roles",
37
+ "schemas",
38
+ "templates",
39
+ "tuition"
40
+ ],
41
+ "workspaces": [
42
+ "plugin"
43
+ ],
44
+ "overrides": {
45
+ "@tiphys/kernel": "file:."
46
+ },
47
+ "scripts": {
48
+ "build": "tsc -b tsconfig.src.json tsconfig.test.json plugin/tsconfig.json && npm run build:schemas && npm run build:runtime-deps",
49
+ "build:schemas": "node --input-type=module -e \"import { cpSync } from 'node:fs'; cpSync('src/gates/schemas', 'dist/src/gates/schemas', { recursive: true });\"",
50
+ "build:runtime-deps": "node --input-type=module -e \"import { cpSync, readFileSync } from 'node:fs'; const lock = JSON.parse(readFileSync('node_modules/.package-lock.json', 'utf8')); for (const [path, entry] of Object.entries(lock.packages ?? {})) { if (!path.startsWith('node_modules/') || entry?.dev === true || entry?.link === true) continue; cpSync(path, 'dist/' + path, { recursive: true }); }\"",
51
+ "test": "node --test \"test/**/*.test.ts\"",
52
+ "gate:suite": "node src/gates/suite.ts --pin-root src --pin-root bin --pin-root test",
53
+ "prepack": "npm run build",
54
+ "gate:license": "node scripts/license-gate.mjs",
55
+ "prepublishOnly": "node scripts/license-gate.mjs"
56
+ },
57
+ "devDependencies": {
58
+ "@types/node": "26.1.2",
59
+ "typescript": "7.0.2"
60
+ },
61
+ "dependencies": {
62
+ "ajv": "8.20.0",
63
+ "commonmark": "0.31.2",
64
+ "yaml": "2.9.0"
65
+ },
66
+ "tiphys": {
67
+ "licenseAllowlist": [
68
+ "Apache-2.0",
69
+ "MIT",
70
+ "ISC",
71
+ "BSD-2-Clause",
72
+ "BSD-3-Clause"
73
+ ],
74
+ "thirdPartyCode": []
75
+ }
7
76
  }
@@ -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.