kibi-cli 2.31.0 → 2.32.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 (226) hide show
  1. package/dist/cli-register-proof.d.ts.map +1 -1
  2. package/dist/cli-register-proof.js +19 -7
  3. package/dist/cli-register-reporting.d.ts.map +1 -1
  4. package/dist/cli-register-reporting.js +2 -0
  5. package/dist/commands/check.d.ts +1 -0
  6. package/dist/commands/check.d.ts.map +1 -1
  7. package/dist/commands/check.js +14 -5
  8. package/dist/commands/discovery-table.d.ts.map +1 -1
  9. package/dist/commands/discovery-table.js +51 -4
  10. package/dist/commands/doctor.js +19 -4
  11. package/dist/commands/migrate.d.ts.map +1 -1
  12. package/dist/commands/migrate.js +89 -3
  13. package/dist/commands/prove.d.ts +48 -1
  14. package/dist/commands/prove.d.ts.map +1 -1
  15. package/dist/commands/prove.js +293 -8
  16. package/dist/commands/report.d.ts +1 -0
  17. package/dist/commands/report.d.ts.map +1 -1
  18. package/dist/commands/report.js +70 -5
  19. package/dist/commands/signoff.d.ts.map +1 -1
  20. package/dist/commands/signoff.js +21 -2
  21. package/dist/commands/sync/manifest.d.ts.map +1 -1
  22. package/dist/commands/sync/manifest.js +20 -4
  23. package/dist/commands/sync/persistence.d.ts.map +1 -1
  24. package/dist/commands/sync/persistence.js +16 -5
  25. package/dist/diagnostics.js +1 -1
  26. package/dist/engine.js +1 -1
  27. package/dist/extractors/markdown.d.ts +3 -1
  28. package/dist/extractors/markdown.d.ts.map +1 -1
  29. package/dist/extractors/markdown.js +17 -0
  30. package/dist/operations/bootstrap/candidate-helpers.d.ts +3 -0
  31. package/dist/operations/bootstrap/candidate-helpers.d.ts.map +1 -1
  32. package/dist/operations/bootstrap/candidate-helpers.js +4 -0
  33. package/dist/operations/migration/evidence-floor.d.ts +41 -0
  34. package/dist/operations/migration/evidence-floor.d.ts.map +1 -0
  35. package/dist/operations/migration/evidence-floor.js +230 -0
  36. package/dist/operations/migration/proof-contract-claims.d.ts +59 -0
  37. package/dist/operations/migration/proof-contract-claims.d.ts.map +1 -0
  38. package/dist/operations/migration/proof-contract-claims.js +182 -0
  39. package/dist/operations/migration/schema6.d.ts +6 -0
  40. package/dist/operations/migration/schema6.d.ts.map +1 -1
  41. package/dist/operations/migration/schema6.js +94 -0
  42. package/dist/operations/mutation/omitted-properties.d.ts +11 -0
  43. package/dist/operations/mutation/omitted-properties.d.ts.map +1 -0
  44. package/dist/operations/mutation/omitted-properties.js +76 -0
  45. package/dist/operations/mutation/serialization.d.ts.map +1 -1
  46. package/dist/operations/mutation/serialization.js +1 -0
  47. package/dist/operations/mutation/strict-fact.d.ts.map +1 -1
  48. package/dist/operations/mutation/strict-fact.js +6 -2
  49. package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -1
  50. package/dist/operations/mutation/symbol-granularity.js +5 -3
  51. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  52. package/dist/operations/mutation/upsert.js +7 -1
  53. package/dist/operations/mutation/validation.d.ts +2 -0
  54. package/dist/operations/mutation/validation.d.ts.map +1 -1
  55. package/dist/operations/mutation/validation.js +4 -0
  56. package/dist/operations/proof/claim-bindings.d.ts +23 -0
  57. package/dist/operations/proof/claim-bindings.d.ts.map +1 -0
  58. package/dist/operations/proof/claim-bindings.js +211 -0
  59. package/dist/operations/proof/code-certificates.d.ts +135 -0
  60. package/dist/operations/proof/code-certificates.d.ts.map +1 -0
  61. package/dist/operations/proof/code-certificates.js +785 -0
  62. package/dist/operations/proof/code-scope.d.ts +11 -1
  63. package/dist/operations/proof/code-scope.d.ts.map +1 -1
  64. package/dist/operations/proof/code-scope.js +20 -2
  65. package/dist/operations/proof/compact-receipts.d.ts.map +1 -1
  66. package/dist/operations/proof/compact-receipts.js +4 -3
  67. package/dist/operations/proof/explain.d.ts +32 -0
  68. package/dist/operations/proof/explain.d.ts.map +1 -1
  69. package/dist/operations/proof/explain.js +91 -0
  70. package/dist/operations/proof/ingest-proof.d.ts +9 -1
  71. package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
  72. package/dist/operations/proof/ingest-proof.js +41 -2
  73. package/dist/operations/proof/receipt-compaction.d.ts +2 -0
  74. package/dist/operations/proof/receipt-compaction.d.ts.map +1 -1
  75. package/dist/operations/proof/receipt-compaction.js +6 -2
  76. package/dist/operations/semantic-advisor/shared.d.ts.map +1 -1
  77. package/dist/operations/semantic-advisor/shared.js +4 -0
  78. package/dist/operations/semantic-advisor/strict-rules.js +3 -3
  79. package/dist/operations/semantic-advisor/types.d.ts +2 -1
  80. package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
  81. package/dist/plugins/approved-source-analyzers.generated.d.ts +6 -6
  82. package/dist/plugins/approved-source-analyzers.generated.js +6 -6
  83. package/dist/proof/command-test-report.d.ts +4 -3
  84. package/dist/proof/command-test-report.d.ts.map +1 -1
  85. package/dist/proof/command-test-report.js +4 -10
  86. package/dist/proof/evaluate.d.ts.map +1 -1
  87. package/dist/proof/evaluate.js +18 -2
  88. package/dist/proof/inspect.d.ts.map +1 -1
  89. package/dist/proof/inspect.js +58 -0
  90. package/dist/proof/producers/playwright-reporter.d.ts +3 -0
  91. package/dist/proof/producers/playwright-reporter.d.ts.map +1 -1
  92. package/dist/proof/producers/playwright-reporter.js +25 -2
  93. package/dist/proof/step-runner.d.ts +36 -0
  94. package/dist/proof/step-runner.d.ts.map +1 -0
  95. package/dist/proof/step-runner.js +234 -0
  96. package/dist/public/evidence-levels.d.ts +12 -0
  97. package/dist/public/evidence-levels.d.ts.map +1 -0
  98. package/dist/public/evidence-levels.js +19 -0
  99. package/dist/public/impact/coverage-depth-quality.d.ts +7 -0
  100. package/dist/public/impact/coverage-depth-quality.d.ts.map +1 -1
  101. package/dist/public/impact/coverage-depth-quality.js +59 -0
  102. package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
  103. package/dist/public/impact/full-kb-quality.js +3 -1
  104. package/dist/public/operations/catalog.d.ts +167 -6
  105. package/dist/public/operations/catalog.d.ts.map +1 -1
  106. package/dist/public/operations/check-executor.d.ts +2 -0
  107. package/dist/public/operations/check-executor.d.ts.map +1 -1
  108. package/dist/public/operations/check-executor.js +6 -0
  109. package/dist/public/operations/evidence-floor.d.ts +48 -0
  110. package/dist/public/operations/evidence-floor.d.ts.map +1 -0
  111. package/dist/public/operations/evidence-floor.js +143 -0
  112. package/dist/public/operations/migration-plan.d.ts +19 -5
  113. package/dist/public/operations/migration-plan.d.ts.map +1 -1
  114. package/dist/public/operations/migration-plan.js +22 -5
  115. package/dist/public/operations/node-ports.d.ts.map +1 -1
  116. package/dist/public/operations/node-ports.js +4 -1
  117. package/dist/public/operations/proof-contract-claims.d.ts +26 -0
  118. package/dist/public/operations/proof-contract-claims.d.ts.map +1 -0
  119. package/dist/public/operations/proof-contract-claims.js +71 -0
  120. package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
  121. package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
  122. package/dist/public/operations/specs/check-rules.generated.js +3 -1
  123. package/dist/public/operations/specs/check.d.ts +1 -1
  124. package/dist/public/operations/specs/mutation-schemas.d.ts +157 -5
  125. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
  126. package/dist/public/operations/specs/mutation-schemas.js +15 -2
  127. package/dist/public/operations/specs/proof.d.ts +9 -0
  128. package/dist/public/operations/specs/proof.d.ts.map +1 -1
  129. package/dist/public/operations/specs/reporting.d.ts.map +1 -1
  130. package/dist/public/operations/specs/reporting.js +19 -10
  131. package/dist/public/operations/specs/upsert.d.ts +157 -5
  132. package/dist/public/operations/specs/upsert.d.ts.map +1 -1
  133. package/dist/public/proof-certificates.d.ts +89 -0
  134. package/dist/public/proof-certificates.d.ts.map +1 -0
  135. package/dist/public/proof-certificates.js +207 -0
  136. package/dist/public/proof-protocol.d.ts +126 -3
  137. package/dist/public/proof-protocol.d.ts.map +1 -1
  138. package/dist/public/proof-protocol.js +239 -3
  139. package/dist/public/proof-receipt.d.ts +89 -6
  140. package/dist/public/proof-receipt.d.ts.map +1 -1
  141. package/dist/public/proof-receipt.js +83 -7
  142. package/dist/public/schemas/entity.d.ts.map +1 -1
  143. package/dist/public/schemas/entity.js +18 -1
  144. package/dist/public/skills/kibi-bootstrap/SKILL.md +2 -2
  145. package/dist/public/skills/kibi-commit-review/SKILL.md +4 -3
  146. package/dist/public/skills/kibi-commit-review/resources/staged-gate.md +6 -1
  147. package/dist/public/skills/kibi-decisions/SKILL.md +10 -2
  148. package/dist/public/skills/kibi-decisions/resources/decision-records.md +6 -1
  149. package/dist/public/skills/kibi-decisions/resources/signoff-views.md +3 -2
  150. package/dist/public/skills/kibi-freshness/SKILL.md +5 -1
  151. package/dist/public/skills/kibi-traceability/SKILL.md +11 -1
  152. package/dist/public/skills/kibi-usage/SKILL.md +6 -4
  153. package/dist/public/skills/kibi-usage/resources/proof.md +124 -19
  154. package/dist/public/skills/kibi-usage/resources/workflows.md +4 -4
  155. package/dist/report/html-report.css +38 -1
  156. package/dist/report/html-report.d.ts +8 -0
  157. package/dist/report/html-report.d.ts.map +1 -1
  158. package/dist/report/html-report.js +141 -6
  159. package/dist/report/report-view.d.ts +1 -1
  160. package/dist/report/report-view.d.ts.map +1 -1
  161. package/dist/report/report-view.js +7 -0
  162. package/dist/schemas/entity.schema.json +212 -4
  163. package/dist/search-answer.d.ts.map +1 -1
  164. package/dist/search-answer.js +1 -0
  165. package/dist/signoff/html.d.ts.map +1 -1
  166. package/dist/signoff/html.js +3 -0
  167. package/dist/signoff/markdown.d.ts.map +1 -1
  168. package/dist/signoff/markdown.js +3 -0
  169. package/dist/signoff/model.d.ts +20 -0
  170. package/dist/signoff/model.d.ts.map +1 -1
  171. package/dist/signoff/model.js +20 -1
  172. package/dist/traceability/impact-knowledge.d.ts.map +1 -1
  173. package/dist/traceability/impact-knowledge.js +1 -0
  174. package/dist/traceability/temp-kb.d.ts.map +1 -1
  175. package/dist/traceability/temp-kb.js +1 -0
  176. package/dist/types/entities.d.ts +4 -1
  177. package/dist/types/entities.d.ts.map +1 -1
  178. package/dist/utils/merge-driver-setup.d.ts +8 -1
  179. package/dist/utils/merge-driver-setup.d.ts.map +1 -1
  180. package/dist/utils/merge-driver-setup.js +23 -2
  181. package/dist/utils/rule-registry.generated.d.ts +10 -0
  182. package/dist/utils/rule-registry.generated.d.ts.map +1 -1
  183. package/dist/utils/rule-registry.generated.js +12 -0
  184. package/dist/utils/schema-version.d.ts +1 -1
  185. package/dist/utils/schema-version.d.ts.map +1 -1
  186. package/dist/utils/schema-version.js +5 -1
  187. package/package.json +6 -2
  188. package/schema/entities.pl +6 -0
  189. package/schema/validation.pl +4 -1
  190. package/src/public/evidence-levels.ts +23 -0
  191. package/src/public/impact/coverage-depth-quality.ts +73 -0
  192. package/src/public/impact/full-kb-quality.ts +6 -1
  193. package/src/public/operations/check-executor.ts +13 -0
  194. package/src/public/operations/evidence-floor.ts +203 -0
  195. package/src/public/operations/migration-plan.ts +39 -6
  196. package/src/public/operations/node-ports.ts +3 -1
  197. package/src/public/operations/proof-contract-claims.ts +103 -0
  198. package/src/public/operations/specs/check-rules.generated.ts +3 -1
  199. package/src/public/operations/specs/mutation-schemas.ts +17 -2
  200. package/src/public/operations/specs/reporting.ts +20 -10
  201. package/src/public/proof-certificates.ts +271 -0
  202. package/src/public/proof-protocol-types.d.ts +17 -1
  203. package/src/public/proof-protocol.ts +318 -3
  204. package/src/public/proof-receipt.ts +127 -7
  205. package/src/public/schemas/entity.ts +19 -1
  206. package/src/public/skills/kibi-bootstrap/SKILL.md +2 -2
  207. package/src/public/skills/kibi-commit-review/SKILL.md +4 -3
  208. package/src/public/skills/kibi-commit-review/resources/staged-gate.md +6 -1
  209. package/src/public/skills/kibi-decisions/SKILL.md +10 -2
  210. package/src/public/skills/kibi-decisions/resources/decision-records.md +6 -1
  211. package/src/public/skills/kibi-decisions/resources/signoff-views.md +3 -2
  212. package/src/public/skills/kibi-freshness/SKILL.md +5 -1
  213. package/src/public/skills/kibi-traceability/SKILL.md +11 -1
  214. package/src/public/skills/kibi-usage/SKILL.md +6 -4
  215. package/src/public/skills/kibi-usage/resources/proof.md +124 -19
  216. package/src/public/skills/kibi-usage/resources/workflows.md +4 -4
  217. package/src/schemas/entity.schema.json +212 -4
  218. package/dist/commands/proof-impact.d.ts +0 -7
  219. package/dist/commands/proof-impact.d.ts.map +0 -1
  220. package/dist/commands/proof-impact.js +0 -39
  221. package/dist/operations/proof/baseline-diff.d.ts +0 -41
  222. package/dist/operations/proof/baseline-diff.d.ts.map +0 -1
  223. package/dist/operations/proof/baseline-diff.js +0 -153
  224. package/dist/operations/proof/impact.d.ts +0 -51
  225. package/dist/operations/proof/impact.d.ts.map +0 -1
  226. package/dist/operations/proof/impact.js +0 -138
@@ -1,6 +1,17 @@
1
1
  import { canonicalJson, proofContractHash, } from "./proof-fingerprint.js";
2
- import { PROOF_RECEIPT_VERSION, PROOF_RESULT_OUTCOMES, PROOF_RUN_OUTCOMES, } from "./proof-protocol.js";
2
+ import { PROOF_KINDS, PROOF_RECEIPT_VERSION, PROOF_RECEIPT_VERSIONS, PROOF_RESULT_OUTCOMES, PROOF_RUN_OUTCOMES, isCertificateProofKind, } from "./proof-protocol.js";
3
3
  export const PROOF_RECEIPT_MAX_AGE_SECONDS = 7 * 24 * 60 * 60;
4
+ /**
5
+ * How a certificate binds to a claim its contract names in proves: derived
6
+ * (Kibi checked it against the claim's fact; the only verdict that proves),
7
+ * attested (the fact has no derivation; the author vouches) or rejected.
8
+ */
9
+ // implements REQ-kibi-claim-bound-proofs
10
+ export const CLAIM_BINDING_VERDICTS = [
11
+ "derived",
12
+ "attested",
13
+ "rejected",
14
+ ];
4
15
  export const PROOF_RECEIPT_OUTCOMES = [
5
16
  "passed",
6
17
  "failed",
@@ -12,7 +23,7 @@ export const PROOF_RECEIPT_OUTCOMES = [
12
23
  ];
13
24
  export const PROOF_RECEIPT_SCHEMA = {
14
25
  type: "object",
15
- description: "Kibi-derived kibi.proof-receipt.v1. Receipts are never caller-authored; kb_ingest_proof derives them from kibi.proof-run.v1 artifacts.",
26
+ description: "Kibi-derived kibi.proof-receipt.v2 (kibi.proof-receipt.v1 entries are still read). Receipts are never caller-authored; kb_ingest_proof derives them from kibi.proof-run.v1 artifacts.",
16
27
  required: [
17
28
  "version",
18
29
  "receipt_id",
@@ -34,7 +45,7 @@ export const PROOF_RECEIPT_SCHEMA = {
34
45
  "proof_results",
35
46
  ],
36
47
  properties: {
37
- version: { type: "string", const: PROOF_RECEIPT_VERSION },
48
+ version: { type: "string", enum: [...PROOF_RECEIPT_VERSIONS] },
38
49
  receipt_id: {
39
50
  type: "string",
40
51
  pattern: "^PR-[A-Za-z0-9][A-Za-z0-9._:-]{7,127}$",
@@ -131,6 +142,32 @@ export const PROOF_RECEIPT_SCHEMA = {
131
142
  additionalProperties: false,
132
143
  },
133
144
  },
145
+ kind: { type: "string", enum: [...PROOF_KINDS] },
146
+ evidence_level: { type: "string", enum: ["proved", "tested"] },
147
+ certificate: { type: "object" },
148
+ certificate_digest: { type: "string", pattern: "^[a-f0-9]{64}$" },
149
+ certificate_rejection: { type: "string", minLength: 1 },
150
+ claim_bindings: {
151
+ type: "array",
152
+ description: "Certificate kinds: how the certificate binds to each claim its contract names in proves, judged at ingest. derived means Kibi derived the certificate's obligation from the claim's grounding fact and the certificate satisfies it; attested means no derivation exists and the author vouches for it (never proved); rejected names why.",
153
+ items: {
154
+ type: "object",
155
+ required: ["claim_key", "binding"],
156
+ properties: {
157
+ claim_key: { type: "string", minLength: 1 },
158
+ requirement_id: { type: "string", minLength: 1 },
159
+ fact_id: { type: "string", minLength: 1 },
160
+ binding: {
161
+ type: "string",
162
+ enum: [...CLAIM_BINDING_VERDICTS],
163
+ },
164
+ scope: { type: "string", enum: ["code", "intent"] },
165
+ obligation: { type: "object" },
166
+ reason: { type: "string", minLength: 1 },
167
+ },
168
+ additionalProperties: false,
169
+ },
170
+ },
134
171
  gaps: {
135
172
  type: "array",
136
173
  items: {
@@ -209,12 +246,14 @@ function validFingerprintComponents(value) {
209
246
  hex64(row.bindings) &&
210
247
  hex64(row.producer));
211
248
  }
212
- /** Structural validation of one kibi.proof-receipt.v1 entry. */
249
+ /** Structural validation of one kibi.proof-receipt.v1 or v2 entry. */
213
250
  export function validProofReceiptShape(testId, receipt) {
214
251
  const row = isRecord(receipt) ? receipt : null;
215
252
  if (!row)
216
253
  return false;
217
- if (row.version !== PROOF_RECEIPT_VERSION)
254
+ if (!PROOF_RECEIPT_VERSIONS.includes(row.version))
255
+ return false;
256
+ if (row.version === PROOF_RECEIPT_VERSION && !validV2Fields(row))
218
257
  return false;
219
258
  if (typeof row.receipt_id !== "string" ||
220
259
  !/^PR-[A-Za-z0-9][A-Za-z0-9._:-]{7,127}$/.test(row.receipt_id))
@@ -268,9 +307,46 @@ export function validProofReceiptShape(testId, receipt) {
268
307
  return false;
269
308
  return !finishedAtPrecedesStartedAt(startedAt, finishedAt);
270
309
  }
310
+ // implements REQ-kibi-code-proof-kinds
311
+ function validV2Fields(row) {
312
+ if (!PROOF_KINDS.includes(row.kind))
313
+ return false;
314
+ if (row.evidence_level !== "proved" && row.evidence_level !== "tested")
315
+ return false;
316
+ if (row.evidence_level === "proved" &&
317
+ (row.outcome !== "passed" ||
318
+ !isCertificateProofKind(row.kind) ||
319
+ !isRecord(row.certificate) ||
320
+ !hex64(row.certificate_digest) ||
321
+ row.certificate_rejection !== undefined))
322
+ return false;
323
+ if (row.certificate !== undefined && !isRecord(row.certificate))
324
+ return false;
325
+ if (row.certificate_digest !== undefined && !hex64(row.certificate_digest))
326
+ return false;
327
+ if (row.certificate_rejection !== undefined &&
328
+ !nonEmptyString(row.certificate_rejection))
329
+ return false;
330
+ if (row.claim_bindings !== undefined &&
331
+ !validClaimBindings(row.claim_bindings))
332
+ return false;
333
+ return true;
334
+ }
335
+ // implements REQ-kibi-claim-bound-proofs
336
+ function validClaimBindings(value) {
337
+ return (Array.isArray(value) &&
338
+ value.every((entry) => isRecord(entry) &&
339
+ nonEmptyString(entry.claim_key) &&
340
+ CLAIM_BINDING_VERDICTS.includes(entry.binding) &&
341
+ (entry.scope === undefined ||
342
+ entry.scope === "code" ||
343
+ entry.scope === "intent") &&
344
+ (entry.obligation === undefined || isRecord(entry.obligation)) &&
345
+ (entry.reason === undefined || nonEmptyString(entry.reason))));
346
+ }
271
347
  /**
272
348
  * Full-history validation for proof_receipts: unique ids, per-test binding,
273
- * supported scope, ordered timestamps, and structurally valid v1 entries.
349
+ * supported scope, ordered timestamps, and structurally valid v1 or v2 entries.
274
350
  */
275
351
  export function proofReceiptHistoryErrors(testId, verificationScope, receipts) {
276
352
  const errors = [];
@@ -291,7 +367,7 @@ export function proofReceiptHistoryErrors(testId, verificationScope, receipts) {
291
367
  errors.push(`${prefix}.test_id must equal '${testId}'`);
292
368
  }
293
369
  if (!validProofReceiptShape(testId, receipt)) {
294
- errors.push(`${prefix} must be a structurally valid kibi.proof-receipt.v1 bound to '${testId}'`);
370
+ errors.push(`${prefix} must be a structurally valid kibi.proof-receipt.v2 (or v1) bound to '${testId}'`);
295
371
  continue;
296
372
  }
297
373
  const finishedAt = timestamp(receipt.finished_at);
@@ -1 +1 @@
1
- {"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/entity.ts"],"names":[],"mappings":"AAwTA,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAwazC,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/entity.ts"],"names":[],"mappings":"AAyTA,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAybzC,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -16,6 +16,7 @@
16
16
  along with this program. If not, see <https://www.gnu.org/licenses/>.
17
17
  */
18
18
  import { ENTITY_ORIGIN_SCHEMA } from "../entity-origin.js";
19
+ import { EVIDENCE_LEVELS } from "../evidence-levels.js";
19
20
  import { PROOF_BINDINGS_SCHEMA, PROOF_CONTRACT_SCHEMA, } from "../proof-protocol.js";
20
21
  import { PROOF_RECEIPT_SCHEMA } from "../proof-receipt.js";
21
22
  // Typed fact field enums per proposal
@@ -338,6 +339,11 @@ const entitySchema = {
338
339
  enum: ["firm", "default", "exploratory"],
339
340
  description: "Requirement and ADR only. How firmly the decision was made. firm: a human stated it as a rule; it needs a ref (origin.ref, or approval_ref on a requirement) to their words, and only a human may change it. default: a delegated or agent choice; a later agent may supersede it with evidence. exploratory: a flagged guess, expected to be revisited. When absent, it reads as default if an agent wrote the entity (origin.kind agent) and as firm otherwise (a person's, imported or migrated decision); set it explicitly when recording a decision.",
340
341
  },
342
+ required_evidence: {
343
+ type: "string",
344
+ enum: [...EVIDENCE_LEVELS],
345
+ description: "Requirement-only. The weakest evidence level this current requirement accepts; the evidence-floor check rule fails while its computed evidence level is lower. proved: a re-checkable certificate covers every case. tested: fresh passing E2E receipts cover every linked scenario. asserted: a person stands behind it. unverified: no floor. When absent, it is tested for a firm requirement and unverified otherwise.",
346
+ },
341
347
  expects: {
342
348
  type: "string",
343
349
  enum: ["success", "rejection", "error"],
@@ -509,8 +515,17 @@ const entitySchema = {
509
515
  subject_key: { type: "string" },
510
516
  property_key: { type: "string" },
511
517
  operator: { type: "string", enum: ["eq", "neq", "lt", "lte", "gt", "gte"] },
512
- value_type: { type: "string", enum: ["string", "int", "number", "bool"] },
518
+ value_type: {
519
+ type: "string",
520
+ enum: ["string", "int", "number", "bool", "set"],
521
+ },
513
522
  value_string: { type: "string" },
523
+ value_set: {
524
+ type: "array",
525
+ items: { type: "string", minLength: 1 },
526
+ minItems: 1,
527
+ uniqueItems: true,
528
+ },
514
529
  value_int: { type: "integer" },
515
530
  value_number: { type: "number" },
516
531
  value_bool: { type: "boolean" },
@@ -609,6 +624,7 @@ const entitySchema = {
609
624
  { required: ["value_int"] },
610
625
  { required: ["value_number"] },
611
626
  { required: ["value_bool"] },
627
+ { required: ["value_set"] },
612
628
  { required: ["unit"] },
613
629
  { required: ["scope"] },
614
630
  { required: ["polarity"] },
@@ -681,6 +697,7 @@ const entitySchema = {
681
697
  { required: ["approval_ref"] },
682
698
  { required: ["rationale"] },
683
699
  { required: ["exempts_claims"] },
700
+ { required: ["required_evidence"] },
684
701
  ],
685
702
  },
686
703
  },
@@ -2,7 +2,7 @@
2
2
  id: kibi-bootstrap
3
3
  name: kibi-bootstrap
4
4
  description: "Use for any Kibi bootstrap or onboarding task: seeding a new or thin knowledge base; reviewing a bootstrap or onboarding plan, preview, or evidence; judging approval readiness or coverage; diagnosing a blocked, partial, or failed bootstrap or its repair; applying an approved bootstrap plan; or asking the human which knowledge sources hold intent. Covers kb_status first, source interview, cited intent claims, read-only kb_plan_bootstrap preview, explicit approval, exact-plan kb_apply_plan, and repair-safe close-out."
5
- version: 3.16.0
5
+ version: 3.17.0
6
6
  kibiCompatibility: ">=1.0.0"
7
7
  tags:
8
8
  - kibi
@@ -43,7 +43,7 @@ Seed branch-local Kibi knowledge from cited product intent, without creating a p
43
43
  9. **Read back** with `kb_query` and `kb_search` to confirm writes and citations.
44
44
  10. **Close out** with `kb_check`, then `kb_status`.
45
45
  11. **Deepen.** Bootstrap is complete; the KB is now half-way, holding cited `req` entries and review facts but no scenarios, tests or predicates. Load `kibi-usage` and continue in the normal Kibi workflow, one area at a time, telling the human what you author:
46
- - **Unplanned claims.** For every claim suppressed as `invalid_write` and every `sourceOnlySignals` entry ("Author requirement …"), restate the claim's statement and citation (`sourceId:reference`), model it with `kb_model` (`mode: "requirement"`, or `mode: "predicates"` for domain claims), and write the result with `kb_upsert` (`dryRun: true` first) with `origin: {kind: "import", ref: "<sourceId:reference>"}` and `firmness: "firm"`, as the plan does for the claims it writes. Without an explicit origin `kb_upsert` records the requirement as the agent's own `default` choice, which a later agent may supersede without asking.
46
+ - **Unplanned claims.** For every claim suppressed as `invalid_write` and every `sourceOnlySignals` entry ("Author requirement …"), restate the claim's statement and citation (`sourceId:reference`), model it with `kb_model` (`mode: "requirement"`, or `mode: "predicates"` for domain claims), and write the result with `kb_upsert` (`dryRun: true` first) with `origin: {kind: "import", ref: "<sourceId:reference>"}` and `firmness: "firm"` and `required_evidence: "asserted"`, as the plan does for the claims it writes; raise the floor (drop `required_evidence`) only once an end-to-end proof covers the requirement. Without an explicit origin `kb_upsert` records the requirement as the agent's own `default` choice, which a later agent may supersede without asking.
47
47
  - **Scenarios.** Write scenarios from the cited ticket's acceptance criteria, one scenario per criterion, not bulk drafts from the requirement title; ask the human when the source states none. Give each a plain title, the scenario prose in `document.body` (never in `properties`), and `assumes` links to the `property_value` facts whose values the scenario relies on. Set `expects` only when the scenario links `assumes` facts (or its criterion names concrete values that become them); `expects` without `assumes` only yields a feasibility-unknown warning, so a draft tagged `needs-human-review` omits `expects`. Then link the requirement with `specified_by` (upsert the `req` with its stored `title`, a `status` and that relationship only). Example: criterion "Given an annotation in draft state, when the user deletes it, the draft is cleared" becomes `{"type":"scenario","id":"SCEN-annotation-delete-clears-draft","properties":{"title":"Deleting a draft annotation clears the draft","status":"active","expects":"success"},"document":{"body":"Given an annotation in draft state, when the user deletes it, then the draft is cleared and nothing is published.\n\nThe acceptance criterion comes from the cited ticket; reviewers asked for it so a deleted draft never reappears after reload.\n"},"relationships":[{"type":"assumes","from":"SCEN-annotation-delete-clears-draft","to":"FACT-annotation-state-draft"}]}`, where the assumed fact is a `property_value` (`annotation.state` `eq` `draft`). Link existing tests that exercise it; never invent test evidence.
48
48
  - **Predicates.** Run `kb_model` with `mode: "predicates"` and `requirementId` on each persisted requirement and apply a returned plan with `requires_predicate` to its `relationshipTarget` (the planned `FACT-PRED-…` id, never a `SUGGEST-…` candidate id), or record the `review:ontology-gap` observation it returns, with its prose in `document.body`. A non-empty `existingGrounding` means the bootstrap already grounded that claim: on `replace_grounding` leave it unless the human wants the `replacementPlan` swap; on `provide_argument_bindings` retry with the listed arguments bound; on `record_ontology_gap` still write the returned gap observation, which is not a grounding link. Count what `kb_query` shows afterwards, not the calls you made.
49
49
  - **Unrecorded ambiguity.** Record any conflict or open question you found but did not declare in step 3 as a cited `fact_kind: observation` tagged `review:conflict` or `review:open-question`.
@@ -2,7 +2,7 @@
2
2
  id: kibi-commit-review
3
3
  name: kibi-commit-review
4
4
  description: "Use when kibi check --staged or the Kibi pre-commit hook blocks a commit (kibi_impact_evidence_missing, symbols_manifest_stale, symbol_granularity_violation, symbol-coverage, kibi check-generated drift, Staged impact review failed), or when preparing a commit or pull-request impact review. Covers reading the per-file Detail lines, authoring .kb/symbols.yaml symbol entries through kb_upsert, kibi sync --refresh-symbol-coordinates, staging the tracked Kibi evidence with git add, kb_prepare_impact_review for a staged or diff scope, the kibi signoff requirements summary to show before a commit, and how merge commits and migration renames are judged."
5
- version: 1.2.0
5
+ version: 1.2.2
6
6
  kibiCompatibility: ">=1.0.0"
7
7
  tags:
8
8
  - kibi
@@ -85,8 +85,9 @@ requirement with its statement (before and after for a rewrite), firmness,
85
85
  origin, scenarios and proof state. Put it in your reply unchanged (in the
86
86
  messaging tool's message when replies go through one), then add one or two
87
87
  sentences on why the requirements changed. Offer the full page with
88
- `kibi signoff --format html --open`, or attach or publish
89
- `.kb/briefs/signoff/latest.html` when your host can carry a file or a page;
88
+ `kibi signoff --format html --open`, or publish `.kb/briefs/signoff/latest.html`
89
+ as a rendered page when your host has a page tool (the Artifact tool in Claude
90
+ apps); never attach the `.html` as a file, which chat apps show as raw source;
90
91
  past 15 requirements the Markdown stops and only the page lists them all.
91
92
  Host details: `kibi-decisions`, `resources/signoff-views.md`. `--no-proof` skips the proof lookup, which reads coverage and is slow
92
93
  on a large knowledge base. The summary is not an approval: never set
@@ -30,11 +30,16 @@ symbols_manifest_stale: .kb/symbol-coordinates.yaml is stale or missing for stag
30
30
  | `symbol-coverage` | A changed symbol, or a symbol whose staged manifest entry changed, fails the full-check rule on the staged knowledge. | The symbol `implements` the requirement and is `covered_by` a test that verifies it: through the requirement's scenario (`verified_by` scenario -> test) when it has one, else `verified_by` requirement -> test. A direct requirement -> test link does not count while a scenario exists. The finding's suggestion names the missing link (see `kibi-traceability`). |
31
31
  | `kibi_impact_override_missing_rationale` | A `Kibi-Impact: none` declaration has no `Rationale:` line. | Add the rationale, or drop the declaration and stage real evidence. |
32
32
  | `entity-context-missing` (staged entity) | A staged requirement, scenario, test, ADR or observation fact has fewer than 12 words of context. | Upsert a sectioned `document.body` (see `kibi-usage`, Entity body contract). |
33
- | `domain-contradictions`, `scenario-feasibility`, `exception-claim-keys` (staged `.kb/` change) | The staged knowledge introduces a violation the last commit did not have. | Fix the knowledge; a contradiction with a recorded rule goes to the person (`kibi-decisions`). |
33
+ | `domain-contradictions`, `kb-consistency`, `scenario-feasibility`, `exception-claim-keys` (staged `.kb/` change) | The staged knowledge introduces a violation the last commit did not have. `kb-consistency` also catches facts that contradict only together and names their requirements. | Fix the knowledge; a contradiction with a recorded rule goes to the person (`kibi-decisions`). |
34
34
  | Proposition-complete ingestion | A staged requirement's semantic inventory is missing or no longer matches its prose. | Re-derive it (`kb_model` analyze with the complete prose) or run `kibi migrate` for drift. |
35
35
  | `kibi check-generated --staged` drift | The staged `.kb/symbols.yaml` or `.kb/symbol-coordinates.yaml` differs from a refresh computed from the index. | `kibi sync --refresh-symbol-coordinates`, review the diff, stage only the intended hunks (`git add -p`). |
36
36
  | `Staged impact review failed: impact_review_invalid: ...` | The base commit has `.kibi/impact-policy.json` and the staged `.kibi/impact-review.json` is missing, stale or incomplete. The message names the cause (missing review path, stale fingerprint, ...). | Prepare a fresh record (below). Any later staged change makes the fingerprints stale again, so prepare it last. |
37
37
 
38
+ The staged gate does not judge evidence levels: the `evidence-floor` rule
39
+ runs only in a full `kibi check`. A firm requirement staged without an
40
+ end-to-end proof passes the commit and fails that check later (see
41
+ `kibi-decisions` for `required_evidence`).
42
+
38
43
  ## Advisory findings
39
44
 
40
45
  These warn but do not block. Read them; they are often the real review.
@@ -2,7 +2,7 @@
2
2
  id: kibi-decisions
3
3
  name: kibi-decisions
4
4
  description: "Use when the person states a rule or decision (must, never, always, from now on, we decided), when a Kibi hook asks to confirm or warns about an edit to code that implements a firm requirement, when the Stop hook says source files changed but nothing was recorded, when kb_check quotes requirement_statement_unverified, or when a request conflicts with a recorded requirement or ADR. Covers reading firmness and origin, recording a person's rule as firm with origin.ref, superseding with a Why this changed section, the kb_compile_intent unresolved/reviewCandidates/conflictReviews loop, asking before overriding a firm rule, and putting decisions to the person as one numbered kibi signoff --questions view."
5
- version: 1.2.0
5
+ version: 1.3.0
6
6
  kibiCompatibility: ">=1.0.0"
7
7
  tags:
8
8
  - kibi
@@ -74,6 +74,13 @@ name the missing capability. Never read or edit `.kb/` files directly.
74
74
  quoting their words and where they said them, a sectioned `document.body`,
75
75
  a scenario, and an `implements` link from the code that enforces it. Use
76
76
  `kb_compile_intent` first when the rule may touch several requirements.
77
+ A firm rule needs `tested` evidence by default, so `kb_check`'s
78
+ `evidence-floor` rule fails on it until an end-to-end test proves its
79
+ scenario. When the change includes that test, give it a proof contract and
80
+ run `kibi prove`. Otherwise set `required_evidence: asserted`, say in the
81
+ body that no end-to-end test proves the rule yet, and report it as
82
+ asserted, not tested. Kibi's bootstrap and migration give an untested firm
83
+ rule the same floor.
77
84
  - **The person changes a rule:** supersede it (new requirement linked
78
85
  `supersedes` new -> old, `firmness: firm` when the old one was firm, a
79
86
  `## Why this changed` section of at least 12 words naming their instruction
@@ -124,7 +131,8 @@ Validation is not completion. When a request conflicts with a recorded rule and
124
131
 
125
132
  End with `kb_check` (and `kb_status` when freshness matters) and say:
126
133
 
127
- - which rules you followed, asked about, recorded or changed (ids, firmness);
134
+ - which rules you followed, asked about, recorded or changed (ids, firmness,
135
+ evidence level);
128
136
  - under "Decisions I changed", each supersede and its evidence;
129
137
  - the open question, if a conflict is waiting on the person;
130
138
  - or, when the session made no decision, one line saying so.
@@ -43,7 +43,7 @@ says it, link to it instead of restating it. Otherwise write the scenario
43
43
  first, then the requirement (the requirement's write sends `specified_by`):
44
44
 
45
45
  ```json
46
- {"type":"req","id":"REQ-billing-refund-approval","properties":{"title":"Refunds above 500 EUR need a finance approval","status":"open","priority":"must","firmness":"firm","origin":{"kind":"agent","ref":"session request: \"from now on refunds above 500 EUR must be approved by finance\""}},"relationships":[{"type":"specified_by","from":"REQ-billing-refund-approval","to":"SCEN-billing-refund-approval"}],"document":{"body":"Refunds above 500 EUR need a finance approval.\n\n## Context\n\nThe person asked for this rule while changing the refund flow; reason not stated.\n\n## Source\n\n> from now on refunds above 500 EUR must be approved by finance\n\nSession request."}}
46
+ {"type":"req","id":"REQ-billing-refund-approval","properties":{"title":"Refunds above 500 EUR need a finance approval","status":"open","priority":"must","firmness":"firm","required_evidence":"asserted","origin":{"kind":"agent","ref":"session request: \"from now on refunds above 500 EUR must be approved by finance\""}},"relationships":[{"type":"specified_by","from":"REQ-billing-refund-approval","to":"SCEN-billing-refund-approval"}],"document":{"body":"Refunds above 500 EUR need a finance approval.\n\n## Context\n\nThe person asked for this rule while changing the refund flow; reason not stated. No end-to-end test proves it yet.\n\n## Source\n\n> from now on refunds above 500 EUR must be approved by finance\n\nSession request."}}
47
47
  ```
48
48
 
49
49
  Then link the enforcing symbol with `implements` (and its test with
@@ -58,6 +58,11 @@ validation, not the write.
58
58
  `origin.approved_by` to the person.
59
59
  - A rule from a document, test or ticket a person wrote is `firm` too, with
60
60
  `origin.ref` to that source.
61
+ - `required_evidence: asserted` keeps an untested firm rule from failing
62
+ the `evidence-floor` check while it is recorded. Drop it (the floor goes
63
+ back to `tested`) once an end-to-end test with a proof contract and a
64
+ passing `kibi prove` receipt covers the rule's scenario; never set it below
65
+ `asserted` on a firm rule.
61
66
  - Your own choice is `default`; a guess is `exploratory`. Write the value
62
67
  explicitly whenever you record a decision.
63
68
  - For strict modeling (claim keys, predicate facts) follow `kibi-usage`,
@@ -13,7 +13,8 @@ statements and lists that render in any chat or messaging surface. Put it in
13
13
  your reply unchanged: never wrap it in a code block, summarize it or retell a
14
14
  requirement in your own words. Every run also writes
15
15
  `.kb/briefs/signoff/latest.json`, `latest.md` and `latest.html` (git-ignored);
16
- `latest.html` is a self-contained page with the full view.
16
+ `latest.html` is a self-contained page with the full view, meant to be opened
17
+ in a browser or published as a page, not attached as a file.
17
18
 
18
19
  ## Showing it on your host
19
20
 
@@ -21,7 +22,7 @@ requirement in your own words. Every run also writes
21
22
  | --- | --- |
22
23
  | Claude Code, Codex, Cursor, ZCode, VS Code chat | Paste the default output; `/kibi-signoff` (Claude Code, Cursor, ZCode) runs it. Offer `kibi signoff --format html --open` for the page |
23
24
  | OpenCode terminal | `kibi signoff --format md` and paste the fenced block unchanged: kibi-opencode draws it as a card, and `/kibi-signoff` reopens it |
24
- | Replies sent through a messaging tool (cloud or project threads, chat bots) | Pass the default output as the message text, and attach or publish `.kb/briefs/signoff/latest.html` next to it when the tool can carry a file or a page |
25
+ | Replies sent through a messaging tool (cloud or project threads, chat bots) | Pass the default output as the message text. Share `latest.html` only as a rendered page: in Claude apps (claude.ai, the mobile and desktop apps, Claude Code on the web) publish it with the Artifact tool and give its link. Never attach the `.html` as a file: the Claude apps, Slack and most chat apps show it as raw source or a download. With no page tool, the message text is the whole view |
25
26
  | VS Code or Cursor with the kibi-vscode extension | The **Kibi: Show Requirements Signoff** panel follows every run |
26
27
  | Remote machine, no browser | Give the person the path of `latest.html` |
27
28
 
@@ -2,7 +2,7 @@
2
2
  id: kibi-freshness
3
3
  name: kibi-freshness
4
4
  description: Check exact Git attachment, branch migration/quarantine, compiled-store freshness, source linkage, and repair state before decisions or writes.
5
- version: 2.1.0
5
+ version: 2.2.0
6
6
  kibiCompatibility: ">=1.0.0"
7
7
  tags:
8
8
  - kibi
@@ -66,6 +66,10 @@ For every freshness, branch, or completion question, call `kb_status` first, the
66
66
  evidence-dependent closeout. Name the exact paths/symbol IDs and whether the
67
67
  result is fixed, accepted, or deferred.
68
68
  - If entities look stale, refresh context through an approved Kibi capability and then re-query.
69
+ - When asked whether a requirement is proven, quote its `evidenceLevel` and
70
+ `evidenceFloor` from `kb_coverage`. `pending_reproof` (receipts older than
71
+ the code) is stale evidence, not proof; `kibi prove` refreshes it, and
72
+ `kibi check --fresh-evidence` is the check that fails on it.
69
73
  - Preserve source-file traceability by carrying `sourceFile`, text references, and validation evidence through discovery, mutation, and completion.
70
74
  - Do not read or edit files inside `.kb` directly; use the selected Kibi interface instead.
71
75
  - Kibi authors tracked files but never Git-stages or commits them; ordinary Git workflows remain responsible for review and commit.
@@ -2,7 +2,7 @@
2
2
  id: kibi-traceability
3
3
  name: kibi-traceability
4
4
  description: Maintain source-first requirement, scenario, test, symbol, and proof traceability through Kibi's peer interfaces.
5
- version: 2.0.0
5
+ version: 2.2.0
6
6
  kibiCompatibility: ">=1.0.0"
7
7
  tags:
8
8
  - kibi
@@ -64,3 +64,13 @@ stale snapshots, unavailable receipts, and incomplete grounding explicit.
64
64
  Fresh proof requires a current verification snapshot, the exact contracted E2E
65
65
  command, an append-only receipt, and current symbol coordinates. Structural
66
66
  coverage and a green check are not proof by themselves.
67
+
68
+ Report each requirement's `evidenceLevel` from `kb_coverage` as it is:
69
+ `proved` only when certificate proofs (exhaustive, typecheck, arithmetic,
70
+ smt) derive every applicable claim, named in each contract's `proves`
71
+ (`claimSummary` and `unprovedClaims` say which are missing), `tested` for fresh passing E2E receipts,
72
+ `asserted` when only a person stands behind it, `unverified` otherwise. Its
73
+ `evidenceFloor` says what `kb_check`'s `evidence-floor` rule requires:
74
+ `below` is a traceability gap to close with links, tests and `kibi prove`;
75
+ `pending_reproof` means the receipts are older than the code and need
76
+ `kibi prove`. Never lower `required_evidence` to clear either.
@@ -2,7 +2,7 @@
2
2
  id: kibi-usage
3
3
  name: Kibi Usage
4
4
  description: Use Kibi's source-first, exact-Git, migration-aware, proof-aware operations safely across MCP or the trusted local CLI, including partial completion repair.
5
- version: 2.24.0
5
+ version: 2.27.0
6
6
  kibiCompatibility: ">=1.0.0"
7
7
  tags:
8
8
  - kibi
@@ -434,9 +434,11 @@ safe normative claims; use `observation` or `meta` for bug/workaround notes and
434
434
  tests, symbol ownership, and fresh proof-bearing receipts before claiming proof.
435
435
  For an existing product KB that needs semantic backfill, read
436
436
  `resources/kb-improvement.md`, and `resources/proof.md` for the proof workflow.
437
- When a proof ratchet fails, follow Debugging proof regressions in
438
- `resources/proof.md`: use `kibi proof explain` and compare current proof state
439
- to committed `proof/baseline.json` with `kibi proof impact`.
437
+ Each current requirement has an evidence floor (`required_evidence`, else
438
+ `tested` when firm); certificate proof kinds (exhaustive, typecheck,
439
+ arithmetic, smt) reach `proved` for the claims their contract names in
440
+ `proves`, and a requirement is proved only when every claim is. When the `evidence-floor` rule fails, follow Debugging
441
+ proof regressions in `resources/proof.md` and use `kibi proof explain`.
440
442
 
441
443
  ## Predicate Ontology Decision Tree
442
444
 
@@ -17,12 +17,18 @@ reports what happened as `kibi.proof-run.v1`; Kibi evaluates proof.
17
17
  ```bash
18
18
  kibi prove --test TEST-<id>
19
19
  # or: kibi prove --requirement REQ-<id> | --integration <id> | --all
20
+ # add --stale to rerun only tests without a current passing receipt
21
+ # add --resume to continue an interrupted run (same selector)
20
22
  ```
21
23
 
24
+ With `--test`, `--requirement` or `--stale`, a direct `playwright test`
25
+ integration runs only the selected tests' `proof_bindings[].source_file`
26
+ specs; wrappers get them as `KIBI_PROOF_SOURCE_FILES`.
27
+
22
28
  `kibi prove` captures the workspace snapshot, runs each integration's
23
29
  producer once (`shell: false`), revalidates the snapshot, evaluates the
24
30
  artifact against every selected contract, and appends idempotent
25
- `kibi.proof-receipt.v1` receipts.
31
+ `kibi.proof-receipt.v2` receipts (v1 receipts stay valid).
26
32
  3. Confirm with `kb_status` (fresh, current snapshot) and `kb_coverage`.
27
33
 
28
34
  Never hand-write receipts. Kibi derives them from validated
@@ -51,6 +57,13 @@ proof_bindings: # optional provenance metadata
51
57
 
52
58
  Provenance lives in `proof_bindings`; the contract stays semantic.
53
59
 
60
+ `success_policy: own_results_first_attempt` judges each obligation by its own
61
+ `native_case` result when the run failed only in execution (other cases
62
+ failed), so one unrelated failing case does not fail every receipt of a
63
+ Playwright suite. Aggregate-run obligations, run-level errors, timeouts,
64
+ interruptions and setup failures still refuse every obligation. Keep
65
+ `all_required_first_attempt` unless the user wants per-case judgement.
66
+
54
67
  - Every `required_proofs[].symbol_id` must name an existing `symbol` entity,
55
68
  or `kb_check` reports `proof-contract-symbols`. Create the symbols first
56
69
  (`kb_upsert`, narrow method-level granularity, never a `type-shape`
@@ -85,7 +98,10 @@ replacing one named integration.
85
98
  `--command` the proposal is the `package.json` `test` script or the
86
99
  detected runner again), or make the run attributable per test: have the
87
100
  command write a `kibi.proof-test-report.v1` to the path in
88
- `KIBI_PROOF_TEST_REPORT` so each test is judged by its own steps.
101
+ `KIBI_PROOF_TEST_REPORT` so each test is judged by its own steps. The
102
+ shipped `kibi proof run-steps` does that from `proof/steps.json`
103
+ (`[{test_id, steps: [[argv...]]}]`); use it as the integration command
104
+ instead of writing a producer script.
89
105
  - `producer: playwright` (or custom) — the child emits `kibi.proof-run.v1`
90
106
  itself (bundled reporter: `kibi-cli/playwright-reporter`).
91
107
  - `producer: junit` / `tap` — Kibi converts the native report at `artifact`
@@ -126,8 +142,11 @@ Every requirement row also carries `evidenceLevel`, the strength of what backs
126
142
  it, and `evidence`, the entries that earned it (each with `kind`, `scope` and
127
143
  `level`):
128
144
 
129
- - `proved`: a re-checkable certificate covers every case. No proof kind issues
130
- certificates yet, so nothing reaches it today.
145
+ - `proved`: the requirement is `tested` and every applicable claim has a
146
+ derived, code-scope binding from a fresh certificate that still re-checks
147
+ (see Certificate proof kinds). The entry has `kind: certificate` and lists
148
+ the tests. `claimSummary` counts claims per level and `unprovedClaims`
149
+ lists the claims below proved.
131
150
  - `tested`: `proofStatus` is `tested`; fresh E2E receipts cover every linked
132
151
  scenario.
133
152
  - `asserted`: a person stands behind the statement (approved, or firm by
@@ -138,6 +157,94 @@ Report the level as it is. Never call an `asserted` or `unverified`
138
157
  requirement proven or tested, and never call `tested` proved. Firmness is a
139
158
  separate axis: it says how sure the person is, not how strong the evidence is.
140
159
 
160
+ ## Certificate proof kinds
161
+
162
+ A contract's `kind` says what its evidence can reach. The runner kinds `e2e`
163
+ (the default), `example` and `property` support `tested`. The certificate
164
+ kinds support `proved`, and only when Kibi re-checks the certificate the test
165
+ left:
166
+
167
+ - `exhaustive`: the test runs a check on every member of a finite domain.
168
+ Set `domain_source: { symbol_id: SYM-<domain> }` to the symbol that defines
169
+ the domain (add `export: <name>` when the export is not named like the
170
+ symbol's title), and import that symbol in the proof file. Kibi loads the
171
+ export itself (bun, the workspace's tsx, or node; for a `.py` domain
172
+ `KIBI_PYTHON`, the active or project `.venv`/`venv`, then `python3`:
173
+ Enum values, dict keys, list/tuple/set items) and rejects a
174
+ certificate that does not cover exactly its members, so a hand-listed or
175
+ partial domain stays `tested`. An import from build output is mapped back
176
+ to its source through `tsconfig.json` `outDir`/`rootDir`.
177
+ - `typecheck`: a witness file that stops compiling when a domain member
178
+ goes unhandled (a switch ending in a `never` assignment, or a
179
+ `satisfies Record<Domain, ...>` map). Set `witness.path` and
180
+ `domain_source`; the witness must import the domain. Kibi compiles the
181
+ witness itself (strict, with the workspace's TypeScript), so `typescript`
182
+ must be installed in the workspace.
183
+ - `arithmetic`: a claim on one `int` or `real` variable decided exactly from
184
+ typed facts. Set `constraint_source: { fact_ids: [FACT-...] }` to the
185
+ numeric `property_value` facts (one subject and property); the
186
+ certificate's variable is their `property_key` and its assumptions are
187
+ exactly their constraints. To read the value from the code instead, set
188
+ `value_source: [{ symbol_id: SYM-<constant>, export: <name> }]`; Kibi
189
+ evaluates the number export itself and adds `variable eq value` as an
190
+ assumption.
191
+ - `smt`: an SMT-LIB query that declares the facts' property as a constant,
192
+ asserts each `constraint_source` fact constraint and then the claim's
193
+ negation. Kibi re-runs z3 or cvc5 on it and accepts only `unsat`.
194
+
195
+ `arithmetic` and `smt` from `constraint_source` alone prove that the
196
+ knowledge base's facts entail the claim, not that code follows the facts:
197
+ their claim bindings have scope `intent` and the claim stays `tested`. Use
198
+ `value_source` (its symbols `covered_by` the test) for scope `code`. A test
199
+ whose numbers are not in typed facts or code constants stays `tested`.
200
+
201
+ Every certificate contract names the claims it proves in `proves:
202
+ [CLAIM-...]` (blocking `proof-contract-claims` from schema 12). Kibi derives
203
+ each claim's obligation from its grounding fact: a set fact (`value_type:
204
+ set`, `value_set: [...]`) needs the `exhaustive` domain or the `typecheck`
205
+ domain type to be exactly the set; a numeric fact needs the `arithmetic`
206
+ claim or the negated `smt` assertion to be its constraint. The receipt
207
+ records one binding per claim: `derived` (checked, the only kind that
208
+ proves), `attested` (the fact has no derivation; counts as tested) or
209
+ `rejected` with the reason. Model an enumerated claim as a set fact and a
210
+ bound as a numeric fact before writing its certificate. `kibi proof explain
211
+ REQ-...` shows each claim with its bindings.
212
+
213
+ Build the certificate with `kibi-cli/proof-certificates`
214
+ (`exhaustiveCertificate`, `typecheckCertificate`, `arithmeticCertificate`,
215
+ `smtCertificate`), fail the test when it records a failure
216
+ (`failedMembers`), and call `writeCodeCertificate`; it writes to the
217
+ directory `kibi prove` sets in `KIBI_PROOF_CERTIFICATES` and does nothing
218
+ elsewhere. A Python test writes the same `kibi.code-certificate.v1` JSON
219
+ to that directory itself. Wire the KB: the proof file symbol is
220
+ `executable_for` the test and named in `required_proofs`; the domain symbol
221
+ `implements` the requirement and is `covered_by` the test; the test
222
+ `validates` one of the requirement's scenarios. `proved` is per claim: a
223
+ multi-claim requirement is proved only when certificates derive every
224
+ applicable claim, and reads `tested` with `n/m claims proved` otherwise. A
225
+ rejected certificate leaves the receipt at `tested` with
226
+ `certificate_rejection` naming why; fix the proof, never the receipt. If a
227
+ stored certificate stops re-checking later, coverage and `kibi proof
228
+ explain` list it under `certificateRejections`. Use a
229
+ certificate kind only when the domain or claim is genuinely finite or
230
+ decidable; an e2e test that samples cases stays `tested`.
231
+
232
+ ## Evidence floors
233
+
234
+ Each current requirement accepts a weakest level, its floor: the
235
+ `required_evidence` field (`proved`, `tested`, `asserted` or `unverified`),
236
+ or, when absent, `tested` for a firm requirement and no floor otherwise.
237
+ `kb_check`'s `evidence-floor` rule fails while the level is below the floor;
238
+ coverage rows show it as `evidenceFloor` (`required`, `source`, `status`).
239
+ A requirement whose receipts are only older than the code is
240
+ `pending_reproof` and passes a plain check; `kibi check --fresh-evidence`
241
+ fails it, and is what CI runs after `kibi prove`.
242
+
243
+ Fix a finding by raising the level: add the scenario, the end-to-end
244
+ test with a proof contract and the receipts, or have a person approve the
245
+ requirement. Lower `required_evidence` only when a person decides the
246
+ requirement does not need that evidence, and say why in the requirement.
247
+
141
248
  ## Knowledge-base certificates
142
249
 
143
250
  `kb_check` (`kibi check`) proves facts about the KB itself in its
@@ -182,19 +289,22 @@ feasibility are not certified yet; their own rules still decide them.
182
289
 
183
290
  ## After code changes
184
291
 
185
- Receipts bind to the snapshot, contract hash, and execution fingerprint at
186
- run time. Any code or source change moves the snapshot and stales receipts:
187
- re-run `kibi prove` for the affected selection, then confirm `kb_status` and
188
- `kb_coverage` before handoff.
292
+ Receipts bind to the contract, the test document (its links excluded) and
293
+ the code of the symbols they cover. A change to that code stales them:
294
+ re-run `kibi prove --stale` (or the affected selection), then confirm
295
+ `kb_status` and `kb_coverage` before handoff. Type-shape symbols covered by a
296
+ unit test count only while that unit test has a current passing receipt, so
297
+ prove unit tests that cover type-shape symbols too.
189
298
 
190
299
  Full reference: `docs/proving-requirements.md`.
191
300
 
192
301
  ## Debugging proof regressions
193
302
 
194
- When a proof ratchet fails, diagnose first. Do not treat
195
- `proof/baseline.json` as the thing to edit.
303
+ When the `evidence-floor` rule fails, diagnose first. Do not lower
304
+ `required_evidence` to make it pass.
196
305
 
197
- 1. Do not refresh `proof/baseline.json` as the first fix.
306
+ 1. Read the finding: it names the requirement, its level, its floor and where
307
+ the floor comes from (`explicit` or `firmness`).
198
308
  2. Identify the exact requirement and symbol responsible for the regression.
199
309
  3. Use Kibi proof diagnostics rather than reverse-engineering
200
310
  `requirement_proof.pl`:
@@ -202,14 +312,9 @@ When a proof ratchet fails, diagnose first. Do not treat
202
312
  ```bash
203
313
  kibi proof explain REQ-<id>
204
314
  kibi proof explain SYM-<id>
205
- kibi proof impact
315
+ kibi check --rules evidence-floor
206
316
  ```
207
317
 
208
- `kibi proof impact` compares the current Proof projection to
209
- `HEAD:proof/baseline.json` (the committed ratchet snapshot, not the
210
- working-tree file). It is diagnostic: fingerprint differences are reported
211
- and the command exits 0 on successful evaluation. The strict ratchet remains
212
- `scripts/check-proof-baseline.mjs`.
213
318
  4. For `missing_production_symbol_coverage`, inspect symbol role, owning
214
319
  requirement, `covered_by`, candidate test scope, the requirement scenario
215
320
  chain, and the current proof receipt. `kibi proof explain` prints those as
@@ -231,5 +336,5 @@ When a proof ratchet fails, diagnose first. Do not treat
231
336
  `covered_by` relationship semantically correct.
232
337
  10. Prefer one meaningful E2E scenario covering multiple internal functions
233
338
  plus focused unit tests for edge cases, rather than an E2E test per helper.
234
- 11. Refresh the baseline only after a genuine intentional proof-state
235
- improvement requires the ratchet snapshot to be updated.
339
+ 11. A `pending_reproof` finding under `--fresh-evidence` needs `kibi prove`
340
+ for the tests behind the requirement, not a KB change.