kibi-cli 2.4.0 → 2.5.1

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 (354) hide show
  1. package/dist/cli-json-command.d.ts +6 -0
  2. package/dist/cli-json-command.d.ts.map +1 -1
  3. package/dist/cli-json-command.js +37 -9
  4. package/dist/cli-operation-loader.d.ts.map +1 -1
  5. package/dist/cli-operation-loader.js +7 -0
  6. package/dist/cli-operation-metadata.d.ts +12 -4
  7. package/dist/cli-operation-metadata.d.ts.map +1 -1
  8. package/dist/cli-operation-metadata.js +14 -4
  9. package/dist/cli-protocol.d.ts +14 -0
  10. package/dist/cli-protocol.d.ts.map +1 -1
  11. package/dist/cli-protocol.js +31 -2
  12. package/dist/cli-register-proof.d.ts.map +1 -1
  13. package/dist/cli-register-proof.js +13 -0
  14. package/dist/commands/check.d.ts.map +1 -1
  15. package/dist/commands/check.js +11 -2
  16. package/dist/commands/discovery-shared.d.ts.map +1 -1
  17. package/dist/commands/discovery-shared.js +8 -2
  18. package/dist/commands/engine.d.ts.map +1 -1
  19. package/dist/commands/engine.js +4 -2
  20. package/dist/commands/gc.d.ts.map +1 -1
  21. package/dist/commands/gc.js +7 -0
  22. package/dist/commands/init-helpers.d.ts.map +1 -1
  23. package/dist/commands/init-helpers.js +38 -12
  24. package/dist/commands/init.d.ts.map +1 -1
  25. package/dist/commands/init.js +10 -15
  26. package/dist/commands/migrate.d.ts.map +1 -1
  27. package/dist/commands/migrate.js +281 -14
  28. package/dist/commands/proof-compact.d.ts +9 -0
  29. package/dist/commands/proof-compact.d.ts.map +1 -0
  30. package/dist/commands/proof-compact.js +58 -0
  31. package/dist/commands/prove.d.ts +38 -0
  32. package/dist/commands/prove.d.ts.map +1 -1
  33. package/dist/commands/prove.js +222 -47
  34. package/dist/commands/sync/persistence.d.ts.map +1 -1
  35. package/dist/commands/sync/persistence.js +61 -16
  36. package/dist/commands/sync.d.ts +8 -0
  37. package/dist/commands/sync.d.ts.map +1 -1
  38. package/dist/commands/sync.js +42 -16
  39. package/dist/diagnostics.js +1 -1
  40. package/dist/engine-limits.d.ts +74 -0
  41. package/dist/engine-limits.d.ts.map +1 -0
  42. package/dist/engine-limits.js +201 -0
  43. package/dist/engine.d.ts +10 -0
  44. package/dist/engine.d.ts.map +1 -1
  45. package/dist/engine.js +57 -9
  46. package/dist/extractors/manifest.d.ts +8 -0
  47. package/dist/extractors/manifest.d.ts.map +1 -1
  48. package/dist/extractors/manifest.js +34 -5
  49. package/dist/extractors/markdown.d.ts +8 -0
  50. package/dist/extractors/markdown.d.ts.map +1 -1
  51. package/dist/extractors/markdown.js +57 -0
  52. package/dist/extractors/relationships.d.ts.map +1 -1
  53. package/dist/extractors/relationships.js +2 -0
  54. package/dist/intent-search.d.ts +4 -1
  55. package/dist/intent-search.d.ts.map +1 -1
  56. package/dist/intent-search.js +186 -33
  57. package/dist/operations/bootstrap/candidate-helpers.d.ts.map +1 -1
  58. package/dist/operations/bootstrap/candidate-helpers.js +8 -1
  59. package/dist/operations/bootstrap/candidates.d.ts.map +1 -1
  60. package/dist/operations/bootstrap/candidates.js +54 -38
  61. package/dist/operations/bootstrap/generate.d.ts +2 -0
  62. package/dist/operations/bootstrap/generate.d.ts.map +1 -1
  63. package/dist/operations/bootstrap/generate.js +87 -33
  64. package/dist/operations/bootstrap/intent-claims.d.ts.map +1 -1
  65. package/dist/operations/bootstrap/intent-claims.js +12 -4
  66. package/dist/operations/bootstrap/markdown-candidates.d.ts +2 -0
  67. package/dist/operations/bootstrap/markdown-candidates.d.ts.map +1 -1
  68. package/dist/operations/bootstrap/markdown-candidates.js +32 -10
  69. package/dist/operations/bootstrap/presentation.d.ts.map +1 -1
  70. package/dist/operations/bootstrap/presentation.js +6 -2
  71. package/dist/operations/bootstrap/requirement-claims.d.ts +1 -0
  72. package/dist/operations/bootstrap/requirement-claims.d.ts.map +1 -1
  73. package/dist/operations/bootstrap/requirement-claims.js +13 -1
  74. package/dist/operations/bootstrap/validation.d.ts +4 -0
  75. package/dist/operations/bootstrap/validation.d.ts.map +1 -0
  76. package/dist/operations/bootstrap/validation.js +20 -0
  77. package/dist/operations/migration/inventory-rederive.d.ts +81 -0
  78. package/dist/operations/migration/inventory-rederive.d.ts.map +1 -0
  79. package/dist/operations/migration/inventory-rederive.js +484 -0
  80. package/dist/operations/migration/kb-sources.d.ts +53 -0
  81. package/dist/operations/migration/kb-sources.d.ts.map +1 -0
  82. package/dist/operations/migration/kb-sources.js +233 -0
  83. package/dist/operations/migration/origin-backfill.d.ts +39 -0
  84. package/dist/operations/migration/origin-backfill.d.ts.map +1 -0
  85. package/dist/operations/migration/origin-backfill.js +164 -0
  86. package/dist/operations/migration/polarity-values.d.ts +10 -0
  87. package/dist/operations/migration/polarity-values.d.ts.map +1 -0
  88. package/dist/operations/migration/polarity-values.js +60 -0
  89. package/dist/operations/migration/schema6.d.ts +59 -0
  90. package/dist/operations/migration/schema6.d.ts.map +1 -0
  91. package/dist/operations/migration/schema6.js +379 -0
  92. package/dist/operations/migration/source-paths.d.ts +131 -0
  93. package/dist/operations/migration/source-paths.d.ts.map +1 -0
  94. package/dist/operations/migration/source-paths.js +308 -0
  95. package/dist/operations/migration/superseded-closure.d.ts +54 -0
  96. package/dist/operations/migration/superseded-closure.d.ts.map +1 -0
  97. package/dist/operations/migration/superseded-closure.js +187 -0
  98. package/dist/operations/modeling/logic-modeling.d.ts.map +1 -1
  99. package/dist/operations/modeling/logic-modeling.js +3 -5
  100. package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
  101. package/dist/operations/modeling/model-requirement.js +225 -67
  102. package/dist/operations/mutation/contradictions.d.ts +16 -0
  103. package/dist/operations/mutation/contradictions.d.ts.map +1 -1
  104. package/dist/operations/mutation/contradictions.js +32 -0
  105. package/dist/operations/mutation/delete.d.ts.map +1 -1
  106. package/dist/operations/mutation/delete.js +15 -7
  107. package/dist/operations/mutation/origin.d.ts +21 -0
  108. package/dist/operations/mutation/origin.d.ts.map +1 -0
  109. package/dist/operations/mutation/origin.js +78 -0
  110. package/dist/operations/mutation/plan-apply-journal.d.ts +182 -0
  111. package/dist/operations/mutation/plan-apply-journal.d.ts.map +1 -0
  112. package/dist/operations/mutation/plan-apply-journal.js +613 -0
  113. package/dist/operations/mutation/predicate-vocabulary-guard.d.ts +3 -1
  114. package/dist/operations/mutation/predicate-vocabulary-guard.d.ts.map +1 -1
  115. package/dist/operations/mutation/predicate-vocabulary-guard.js +13 -2
  116. package/dist/operations/mutation/relationships.d.ts +5 -5
  117. package/dist/operations/mutation/relationships.d.ts.map +1 -1
  118. package/dist/operations/mutation/relationships.js +31 -11
  119. package/dist/operations/mutation/serialization.d.ts.map +1 -1
  120. package/dist/operations/mutation/serialization.js +3 -1
  121. package/dist/operations/mutation/source-authoring.d.ts +6 -0
  122. package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
  123. package/dist/operations/mutation/source-authoring.js +7 -1
  124. package/dist/operations/mutation/types.d.ts +14 -0
  125. package/dist/operations/mutation/types.d.ts.map +1 -1
  126. package/dist/operations/mutation/upsert.d.ts +30 -3
  127. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  128. package/dist/operations/mutation/upsert.js +105 -35
  129. package/dist/operations/mutation/validate-upsert.d.ts +6 -0
  130. package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
  131. package/dist/operations/mutation/validate-upsert.js +34 -30
  132. package/dist/operations/planning/apply-plan.d.ts.map +1 -1
  133. package/dist/operations/planning/apply-plan.js +753 -145
  134. package/dist/operations/planning/compile-intent.d.ts +34 -1
  135. package/dist/operations/planning/compile-intent.d.ts.map +1 -1
  136. package/dist/operations/planning/compile-intent.js +314 -98
  137. package/dist/operations/proof/code-scope.d.ts +28 -0
  138. package/dist/operations/proof/code-scope.d.ts.map +1 -1
  139. package/dist/operations/proof/code-scope.js +72 -0
  140. package/dist/operations/proof/compact-receipts.d.ts +49 -0
  141. package/dist/operations/proof/compact-receipts.d.ts.map +1 -0
  142. package/dist/operations/proof/compact-receipts.js +160 -0
  143. package/dist/operations/proof/ingest-proof.d.ts +2 -0
  144. package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
  145. package/dist/operations/proof/ingest-proof.js +44 -23
  146. package/dist/operations/proof/prune-receipts.d.ts.map +1 -1
  147. package/dist/operations/proof/prune-receipts.js +5 -9
  148. package/dist/operations/proof/receipt-compaction.d.ts +48 -0
  149. package/dist/operations/proof/receipt-compaction.d.ts.map +1 -0
  150. package/dist/operations/proof/receipt-compaction.js +121 -0
  151. package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
  152. package/dist/operations/semantic-advisor/analysis-receipt.js +12 -1
  153. package/dist/operations/semantic-advisor/analyze-prose.d.ts +2 -1
  154. package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
  155. package/dist/operations/semantic-advisor/analyze-prose.js +51 -5
  156. package/dist/operations/semantic-advisor/clauses.d.ts +1 -0
  157. package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
  158. package/dist/operations/semantic-advisor/clauses.js +11 -1
  159. package/dist/operations/semantic-advisor/conditional-rules.d.ts +33 -0
  160. package/dist/operations/semantic-advisor/conditional-rules.d.ts.map +1 -0
  161. package/dist/operations/semantic-advisor/conditional-rules.js +262 -0
  162. package/dist/operations/semantic-advisor/ingestion-boundary.d.ts +3 -1
  163. package/dist/operations/semantic-advisor/ingestion-boundary.d.ts.map +1 -1
  164. package/dist/operations/semantic-advisor/ingestion-boundary.js +14 -6
  165. package/dist/operations/semantic-advisor/plugin-orchestration.js +1 -1
  166. package/dist/prolog/codec.d.ts.map +1 -1
  167. package/dist/prolog/codec.js +2 -1
  168. package/dist/prolog.d.ts +9 -0
  169. package/dist/prolog.d.ts.map +1 -1
  170. package/dist/prolog.js +56 -10
  171. package/dist/proof/command-test-report.d.ts +74 -0
  172. package/dist/proof/command-test-report.d.ts.map +1 -0
  173. package/dist/proof/command-test-report.js +206 -0
  174. package/dist/public/branch-resolver.d.ts +1 -0
  175. package/dist/public/branch-resolver.d.ts.map +1 -1
  176. package/dist/public/branch-resolver.js +1 -0
  177. package/dist/public/entity-origin.d.ts +69 -0
  178. package/dist/public/entity-origin.d.ts.map +1 -0
  179. package/dist/public/entity-origin.js +142 -0
  180. package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
  181. package/dist/public/impact/full-kb-quality.js +1 -0
  182. package/dist/public/impact/requirement-quality.js +1 -1
  183. package/dist/public/operations/catalog.d.ts +130 -19
  184. package/dist/public/operations/catalog.d.ts.map +1 -1
  185. package/dist/public/operations/catalog.js +3 -0
  186. package/dist/public/operations/check-executor.d.ts.map +1 -1
  187. package/dist/public/operations/check-executor.js +8 -0
  188. package/dist/public/operations/contracts.d.ts +0 -5
  189. package/dist/public/operations/contracts.d.ts.map +1 -1
  190. package/dist/public/operations/contracts.js +63 -14
  191. package/dist/public/operations/discovery-entities.d.ts +15 -0
  192. package/dist/public/operations/discovery-entities.d.ts.map +1 -1
  193. package/dist/public/operations/discovery-entities.js +59 -0
  194. package/dist/public/operations/discovery-executors.d.ts +6 -1
  195. package/dist/public/operations/discovery-executors.d.ts.map +1 -1
  196. package/dist/public/operations/discovery-executors.js +65 -6
  197. package/dist/public/operations/index.d.ts +1 -0
  198. package/dist/public/operations/index.d.ts.map +1 -1
  199. package/dist/public/operations/index.js +1 -0
  200. package/dist/public/operations/migration-plan.d.ts +5 -0
  201. package/dist/public/operations/migration-plan.d.ts.map +1 -1
  202. package/dist/public/operations/migration-plan.js +26 -1
  203. package/dist/public/operations/node-ports.d.ts.map +1 -1
  204. package/dist/public/operations/node-ports.js +24 -3
  205. package/dist/public/operations/origin-review.d.ts +51 -0
  206. package/dist/public/operations/origin-review.d.ts.map +1 -0
  207. package/dist/public/operations/origin-review.js +307 -0
  208. package/dist/public/operations/predicate-schema-conformance.js +1 -1
  209. package/dist/public/operations/repair-plan.d.ts.map +1 -1
  210. package/dist/public/operations/repair-plan.js +4 -0
  211. package/dist/public/operations/result-envelope.d.ts.map +1 -1
  212. package/dist/public/operations/result-envelope.js +17 -5
  213. package/dist/public/operations/runtime-types.d.ts +9 -0
  214. package/dist/public/operations/runtime-types.d.ts.map +1 -1
  215. package/dist/public/operations/schema6-check-actions.d.ts +127 -0
  216. package/dist/public/operations/schema6-check-actions.d.ts.map +1 -0
  217. package/dist/public/operations/schema6-check-actions.js +575 -0
  218. package/dist/public/operations/source-path-dangling.d.ts +17 -0
  219. package/dist/public/operations/source-path-dangling.d.ts.map +1 -0
  220. package/dist/public/operations/source-path-dangling.js +66 -0
  221. package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
  222. package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
  223. package/dist/public/operations/specs/check-rules.generated.js +15 -1
  224. package/dist/public/operations/specs/check.d.ts +2 -2
  225. package/dist/public/operations/specs/check.js +1 -1
  226. package/dist/public/operations/specs/composite.d.ts +351 -0
  227. package/dist/public/operations/specs/composite.d.ts.map +1 -0
  228. package/dist/public/operations/specs/composite.js +96 -0
  229. package/dist/public/operations/specs/discovery.d.ts +8 -3
  230. package/dist/public/operations/specs/discovery.d.ts.map +1 -1
  231. package/dist/public/operations/specs/discovery.js +8 -3
  232. package/dist/public/operations/specs/modeling.d.ts +2 -2
  233. package/dist/public/operations/specs/modeling.js +2 -2
  234. package/dist/public/operations/specs/mutation-schemas.d.ts +73 -8
  235. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
  236. package/dist/public/operations/specs/mutation-schemas.js +43 -7
  237. package/dist/public/operations/specs/mutation.d.ts +1 -1
  238. package/dist/public/operations/specs/mutation.js +1 -1
  239. package/dist/public/operations/specs/planning.d.ts +2 -2
  240. package/dist/public/operations/specs/planning.js +4 -4
  241. package/dist/public/operations/specs/reporting.d.ts.map +1 -1
  242. package/dist/public/operations/specs/reporting.js +13 -26
  243. package/dist/public/operations/specs/upsert.d.ts +79 -9
  244. package/dist/public/operations/specs/upsert.d.ts.map +1 -1
  245. package/dist/public/operations/specs/upsert.js +6 -1
  246. package/dist/public/operations/types.d.ts +1 -1
  247. package/dist/public/operations/types.d.ts.map +1 -1
  248. package/dist/public/proof-receipt.d.ts +1 -0
  249. package/dist/public/proof-receipt.d.ts.map +1 -1
  250. package/dist/public/schemas/entity.d.ts.map +1 -1
  251. package/dist/public/schemas/entity.js +52 -0
  252. package/dist/public/schemas/relationship.d.ts.map +1 -1
  253. package/dist/public/schemas/relationship.js +2 -0
  254. package/dist/public/skills/kibi-bootstrap/SKILL.md +35 -67
  255. package/dist/public/skills/kibi-bootstrap/resources/bootstrap.md +6 -0
  256. package/dist/public/skills/kibi-usage/SKILL.md +68 -18
  257. package/dist/public/skills/kibi-usage/resources/fact-lanes.md +5 -5
  258. package/dist/public/skills/kibi-usage/resources/kb-improvement.md +1 -1
  259. package/dist/public/skills/kibi-usage/resources/logic-ir.md +2 -2
  260. package/dist/public/skills/kibi-usage/resources/operation-access.md +25 -1
  261. package/dist/public/skills/kibi-usage/resources/ui-requirements.md +4 -4
  262. package/dist/public/skills/kibi-usage/resources/workflows.md +42 -25
  263. package/dist/public/telemetry-acceptance.d.ts +58 -2
  264. package/dist/public/telemetry-acceptance.d.ts.map +1 -1
  265. package/dist/public/telemetry-acceptance.js +136 -10
  266. package/dist/public/telemetry-remediation.d.ts.map +1 -1
  267. package/dist/public/telemetry-remediation.js +26 -10
  268. package/dist/relationships/shards.d.ts +13 -0
  269. package/dist/relationships/shards.d.ts.map +1 -1
  270. package/dist/relationships/shards.js +54 -28
  271. package/dist/runtime/cli-runtime.d.ts.map +1 -1
  272. package/dist/runtime/cli-runtime.js +44 -3
  273. package/dist/runtime/detached-snapshot.d.ts +38 -0
  274. package/dist/runtime/detached-snapshot.d.ts.map +1 -0
  275. package/dist/runtime/detached-snapshot.js +92 -0
  276. package/dist/schemas/entity.schema.json +122 -0
  277. package/dist/search-answer.d.ts +157 -0
  278. package/dist/search-answer.d.ts.map +1 -0
  279. package/dist/search-answer.js +846 -0
  280. package/dist/traceability/impact-knowledge.d.ts.map +1 -1
  281. package/dist/traceability/impact-knowledge.js +7 -0
  282. package/dist/traceability/symbol-extract.js +3 -3
  283. package/dist/traceability/temp-kb.d.ts.map +1 -1
  284. package/dist/traceability/temp-kb.js +12 -0
  285. package/dist/types/entities.d.ts +13 -0
  286. package/dist/types/entities.d.ts.map +1 -1
  287. package/dist/types/relationships.d.ts +1 -1
  288. package/dist/types/relationships.d.ts.map +1 -1
  289. package/dist/utils/branch-resolver.d.ts +37 -1
  290. package/dist/utils/branch-resolver.d.ts.map +1 -1
  291. package/dist/utils/branch-resolver.js +130 -3
  292. package/dist/utils/repo-relative-path.d.ts +18 -0
  293. package/dist/utils/repo-relative-path.d.ts.map +1 -0
  294. package/dist/utils/repo-relative-path.js +58 -0
  295. package/dist/utils/rule-registry.generated.d.ts +75 -3
  296. package/dist/utils/rule-registry.generated.d.ts.map +1 -1
  297. package/dist/utils/rule-registry.generated.js +89 -3
  298. package/dist/utils/schema-version.d.ts +1 -1
  299. package/dist/utils/schema-version.d.ts.map +1 -1
  300. package/dist/utils/schema-version.js +4 -3
  301. package/dist/utils/strict-modeling.d.ts +1 -1
  302. package/dist/utils/strict-modeling.d.ts.map +1 -1
  303. package/dist/utils/strict-modeling.js +23 -3
  304. package/package.json +3 -3
  305. package/schema/entities.pl +22 -0
  306. package/schema/relationships.pl +14 -0
  307. package/schema/validation.pl +45 -1
  308. package/src/public/branch-resolver.ts +1 -0
  309. package/src/public/entity-origin.ts +175 -0
  310. package/src/public/impact/full-kb-quality.ts +1 -0
  311. package/src/public/impact/requirement-quality.ts +1 -1
  312. package/src/public/operations/catalog.ts +3 -0
  313. package/src/public/operations/check-executor.ts +15 -0
  314. package/src/public/operations/contracts.ts +75 -15
  315. package/src/public/operations/discovery-entities.ts +74 -0
  316. package/src/public/operations/discovery-executors.ts +88 -10
  317. package/src/public/operations/index.ts +1 -0
  318. package/src/public/operations/migration-plan.ts +30 -1
  319. package/src/public/operations/node-ports.ts +24 -3
  320. package/src/public/operations/origin-review.ts +375 -0
  321. package/src/public/operations/predicate-schema-conformance.ts +1 -1
  322. package/src/public/operations/repair-plan.ts +4 -0
  323. package/src/public/operations/result-envelope.ts +18 -6
  324. package/src/public/operations/runtime-types.ts +9 -0
  325. package/src/public/operations/schema6-check-actions.ts +699 -0
  326. package/src/public/operations/source-path-dangling.ts +81 -0
  327. package/src/public/operations/specs/check-rules.generated.ts +15 -1
  328. package/src/public/operations/specs/check.ts +1 -1
  329. package/src/public/operations/specs/composite.ts +141 -0
  330. package/src/public/operations/specs/discovery.ts +9 -3
  331. package/src/public/operations/specs/modeling.ts +2 -2
  332. package/src/public/operations/specs/mutation-schemas.ts +49 -7
  333. package/src/public/operations/specs/mutation.ts +1 -1
  334. package/src/public/operations/specs/planning.ts +4 -4
  335. package/src/public/operations/specs/reporting.ts +13 -38
  336. package/src/public/operations/specs/upsert.ts +7 -1
  337. package/src/public/operations/types.ts +2 -0
  338. package/src/public/proof-receipt.ts +1 -0
  339. package/src/public/schemas/entity.ts +57 -0
  340. package/src/public/schemas/relationship.ts +2 -0
  341. package/src/public/skills/kibi-bootstrap/SKILL.md +35 -67
  342. package/src/public/skills/kibi-bootstrap/resources/bootstrap.md +6 -0
  343. package/src/public/skills/kibi-usage/SKILL.md +68 -18
  344. package/src/public/skills/kibi-usage/resources/fact-lanes.md +5 -5
  345. package/src/public/skills/kibi-usage/resources/kb-improvement.md +1 -1
  346. package/src/public/skills/kibi-usage/resources/logic-ir.md +2 -2
  347. package/src/public/skills/kibi-usage/resources/operation-access.md +25 -1
  348. package/src/public/skills/kibi-usage/resources/ui-requirements.md +4 -4
  349. package/src/public/skills/kibi-usage/resources/workflows.md +42 -25
  350. package/src/public/telemetry-acceptance-types.d.ts +4 -1
  351. package/src/public/telemetry-acceptance.ts +204 -10
  352. package/src/public/telemetry-remediation.ts +39 -10
  353. package/src/schemas/entity.schema.json +122 -0
  354. package/src/schemas/relationship.schema.json +2 -0
@@ -38,6 +38,12 @@ export const GENERATED_RULES = [
38
38
  enforcementClass: "canonical",
39
39
  category: "integrity",
40
40
  },
41
+ {
42
+ name: "source-path-dangling",
43
+ description: "An authored entity's source field must name an existing workspace path (a #anchor suffix is ignored), an existing entity id, or an http(s) URL; a missing source is allowed",
44
+ enforcementClass: "canonical",
45
+ category: "integrity",
46
+ },
41
47
  {
42
48
  name: "no-cycles",
43
49
  description: "No circular dependency chains in requirements",
@@ -56,6 +62,42 @@ export const GENERATED_RULES = [
56
62
  enforcementClass: "canonical",
57
63
  category: "lifecycle",
58
64
  },
65
+ {
66
+ name: "superseded-requirement-open",
67
+ description: "A requirement that another requirement supersedes must have status closed, and supersedes links between requirements must not form a cycle",
68
+ enforcementClass: "canonical",
69
+ category: "lifecycle",
70
+ },
71
+ {
72
+ name: "scenario-feasibility",
73
+ description: "A scenario that expects success must not assume property values that cannot hold, alone or together, with what current requirements require through typed property values or rules, unless an approved exception requirement waives that requirement or the listed clauses",
74
+ enforcementClass: "canonical",
75
+ category: "integrity",
76
+ },
77
+ {
78
+ name: "scenario-feasibility-unknown",
79
+ description: "Advisory: a scenario that expects success assumes nothing, assumes values that contradict each other, assumes a property value no governing requirement constrains comparably (type, unit or operator mismatch, or conflicting requirements), leaves a governing rule's conditions undecided, or conflicts only with constraints whose validity window may not cover it, so its feasibility cannot be decided",
80
+ enforcementClass: "advisory",
81
+ category: "integrity",
82
+ },
83
+ {
84
+ name: "exception-claim-keys",
85
+ description: "An exception requirement's exempts_claims must name claim keys of a requirement it exempts, and requires an exempts link",
86
+ enforcementClass: "canonical",
87
+ category: "integrity",
88
+ },
89
+ {
90
+ name: "numeric-string-value",
91
+ description: "Advisory: a property value stores a numeric-looking string where the comparison is numeric (ordering operator, or an int/number fact on the same property); the finding names the fact and the typed value, without converting it",
92
+ enforcementClass: "advisory",
93
+ category: "integrity",
94
+ },
95
+ {
96
+ name: "rule-key-arguments-missing",
97
+ description: "Advisory: an opposing rule pair stays unresolved only because a body predicate declares no key_arguments; the finding names the predicate and the key positions that would decide the pair",
98
+ enforcementClass: "advisory",
99
+ category: "integrity",
100
+ },
59
101
  {
60
102
  name: "domain-contradictions",
61
103
  description: "Detect contradictions between requirements constraining the same fact",
@@ -95,7 +137,7 @@ export const GENERATED_RULES = [
95
137
  {
96
138
  name: "strict-fact-shape",
97
139
  description: "Detect malformed strict facts (facts with fact_kind that are missing required fields)",
98
- enforcementClass: "advisory",
140
+ enforcementClass: "canonical",
99
141
  category: "integrity",
100
142
  },
101
143
  {
@@ -149,13 +191,13 @@ export const GENERATED_RULES = [
149
191
  },
150
192
  {
151
193
  name: "subject-key-identity",
152
- description: "Subject keys must name a shared component, not be derived from a requirement ID",
194
+ description: "Subject keys must name a shared component, not be derived from a requirement ID, and one subject or claim must not be minted as several active subject facts or identical property_value facts",
153
195
  enforcementClass: "advisory",
154
196
  category: "integrity",
155
197
  },
156
198
  {
157
199
  name: "subject-key-shape",
158
- description: "Subject keys follow dotted component.aspect[.sub] with lowercase snake segments",
200
+ description: "Subject keys follow dotted component.aspect[.sub] with lowercase snake segments, and property keys name a property rather than a numbered clause (clause_NN)",
159
201
  enforcementClass: "advisory",
160
202
  category: "integrity",
161
203
  },
@@ -166,6 +208,50 @@ export const GENERATED_RULES = [
166
208
  category: "integrity",
167
209
  diagnosticSeverity: "info",
168
210
  },
211
+ {
212
+ name: "exception-unapproved",
213
+ description: "Advisory: a current exception requirement exempts another requirement but has no approved_by, so it exempts nothing until a human approves it",
214
+ enforcementClass: "advisory",
215
+ category: "integrity",
216
+ },
217
+ {
218
+ name: "exception-approval-self-attested",
219
+ description: "Advisory: an agent-authored exception records approved_by but no human corroborated it (origin.approved_by or approval_ref is missing), so a human should confirm the approval",
220
+ enforcementClass: "advisory",
221
+ category: "integrity",
222
+ },
223
+ {
224
+ name: "agent-requirement-unapproved",
225
+ description: "Informational: current requirements authored by an agent (origin.kind agent) that no human has approved (origin.approved_by), listed up to 25 per check",
226
+ enforcementClass: "advisory",
227
+ category: "lifecycle",
228
+ diagnosticSeverity: "info",
229
+ },
230
+ {
231
+ name: "requirement-rationale-missing",
232
+ description: "Advisory: a current requirement authored by a human or an agent (origin.kind human or agent) states no rationale: no rationale field, no Rationale or Why section in its body, and no link to an ADR; listed up to 25 per check plus one summary finding",
233
+ enforcementClass: "advisory",
234
+ category: "lifecycle",
235
+ },
236
+ {
237
+ name: "symbol-owner-superseded",
238
+ description: "Advisory: a symbol whose every implements target is superseded or deprecated has no current owning requirement; listed up to 25 per check plus one summary finding",
239
+ enforcementClass: "advisory",
240
+ category: "traceability",
241
+ },
242
+ {
243
+ name: "adr-unlinked",
244
+ description: "Advisory: an accepted ADR that no requirement or other ADR is linked with (relates_to, supersedes or any typed edge, in either direction)",
245
+ enforcementClass: "advisory",
246
+ category: "lifecycle",
247
+ },
248
+ {
249
+ name: "adr-proposed",
250
+ description: "Informational: an ADR that is still proposed and not superseded, so nobody accepted or withdrew the decision",
251
+ enforcementClass: "advisory",
252
+ category: "lifecycle",
253
+ diagnosticSeverity: "info",
254
+ },
169
255
  {
170
256
  name: "predicate-schema-conformance",
171
257
  description: "Predicate facts match a predicate_schema (project-local, or the built-in catalog in the default namespace) and use its declared argument constants",
@@ -1,4 +1,4 @@
1
- export declare const LATEST_KB_SCHEMA_VERSION = 5;
1
+ export declare const LATEST_KB_SCHEMA_VERSION = 7;
2
2
  export interface SchemaVersionStatus {
3
3
  status: "missing" | "invalid" | "older" | "current" | "newer";
4
4
  currentVersion: number | null;
@@ -1 +1 @@
1
- {"version":3,"file":"schema-version.d.ts","sourceRoot":"","sources":["../../src/utils/schema-version.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;IAC9D,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,MAAM,mBAAmB,GAC3B;IAAE,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE,GACrD,IAAI,GACJ,SAAS,CAAC;AAGd,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAChD,MAAM,GAAG,IAAI,CAgBf;AAGD,wBAAgB,sBAAsB,CACpC,MAAM,CAAC,EAAE,mBAAmB,GAC3B,mBAAmB,CAgDrB"}
1
+ {"version":3,"file":"schema-version.d.ts","sourceRoot":"","sources":["../../src/utils/schema-version.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;IAC9D,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,MAAM,mBAAmB,GAC3B;IAAE,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE,GACrD,IAAI,GACJ,SAAS,CAAC;AAGd,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAChD,MAAM,GAAG,IAAI,CAgBf;AAGD,wBAAgB,sBAAsB,CACpC,MAAM,CAAC,EAAE,mBAAmB,GAC3B,mBAAmB,CAgDrB"}
@@ -16,7 +16,8 @@
16
16
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17
17
  */
18
18
  // implements REQ-003
19
- export const LATEST_KB_SCHEMA_VERSION = 5;
19
+ // Schema 7 requires strict fact shapes and encodes legacy polarity values.
20
+ export const LATEST_KB_SCHEMA_VERSION = 7;
20
21
  // implements REQ-003
21
22
  export function normalizeSchemaVersion(schemaVersion) {
22
23
  if (schemaVersion === undefined || schemaVersion === null) {
@@ -47,7 +48,7 @@ export function getSchemaVersionStatus(config) {
47
48
  latestVersion,
48
49
  needsMigration: true,
49
50
  warning: hasSchemaVersion
50
- ? "KB schemaVersion is invalid and should be migrated."
51
+ ? "KB schemaVersion is invalid; run 'kibi migrate' to plan the repair."
51
52
  : "KB schemaVersion is missing; the repository should be initialized or migrated.",
52
53
  };
53
54
  }
@@ -66,7 +67,7 @@ export function getSchemaVersionStatus(config) {
66
67
  currentVersion,
67
68
  latestVersion,
68
69
  needsMigration: true,
69
- warning: `KB schemaVersion ${currentVersion} is older than the latest version ${latestVersion} and should be migrated.`,
70
+ warning: `KB schemaVersion ${currentVersion} is older than the latest version ${latestVersion}; run 'kibi migrate' to plan the upgrade.`,
70
71
  };
71
72
  }
72
73
  return {
@@ -4,7 +4,7 @@ export interface SemanticClaim {
4
4
  source: string;
5
5
  subjectKey: string;
6
6
  propertyKey: string;
7
- operator: "eq" | "gte" | "lte" | "neq" | "bool" | "polarity";
7
+ operator: "eq" | "gt" | "gte" | "lt" | "lte" | "neq" | "bool" | "polarity";
8
8
  value: string | number | boolean;
9
9
  confidence: number;
10
10
  provenance?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"strict-modeling.d.ts","sourceRoot":"","sources":["../../src/utils/strict-modeling.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAKlE,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,UAAU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Title(normalizedPropertyKey, claim) {
278
278
  const label = humanizeKey(normalizedPropertyKey);
279
279
  if (claim.operator === "polarity") {
280
- return `${label} ${normalizePolarityValue(claim.value)}`;
280
+ return `${label} ${normalizePolarityValue(claim.value) === "forbid" ? "forbidden" : "required"}`;
281
281
  }
282
282
  const operatorLabel = claim.operator === "bool"
283
283
  ? "="
@@ -287,12 +287,19 @@ function buildPropertyFactTitle(normalizedPropertyKey, claim) {
287
287
  ? "!="
288
288
  : claim.operator === "gte"
289
289
  ? ">="
290
- : "<=";
290
+ : claim.operator === "gt"
291
+ ? ">"
292
+ : claim.operator === "lt"
293
+ ? "<"
294
+ : "<=";
291
295
  return `${label} ${operatorLabel} ${String(claim.value)}`;
292
296
  }
293
297
  function buildPropertyFactFields(claim) {
294
298
  if (claim.operator === "polarity") {
295
299
  return {
300
+ operator: "eq",
301
+ value_type: "bool",
302
+ value_bool: true,
296
303
  polarity: normalizePolarityValue(claim.value),
297
304
  };
298
305
  }
@@ -305,9 +312,22 @@ function buildPropertyFactFields(claim) {
305
312
  }
306
313
  return {
307
314
  operator: claim.operator,
308
- ...buildTypedValueFields(claim.value),
315
+ ...buildTypedValueFields(numericClaimValue(claim)),
309
316
  };
310
317
  }
318
+ const ORDERING_OPERATORS = new Set(["gt", "gte", "lt", "lte"]);
319
+ // implements REQ-kibi-truthful-consistency
320
+ // An ordering comparison is numeric by definition, so a numeric string value
321
+ // ("0", "2.5") is stored as int/number. Stored as a string it would be
322
+ // invisible to numeric contradiction checks.
323
+ function numericClaimValue(claim) {
324
+ if (typeof claim.value === "string" &&
325
+ ORDERING_OPERATORS.has(claim.operator) &&
326
+ /^\s*-?\d+(?:\.\d+)?\s*$/.test(claim.value)) {
327
+ return Number(claim.value);
328
+ }
329
+ return claim.value;
330
+ }
311
331
  function buildTypedValueFields(value) {
312
332
  if (typeof value === "boolean") {
313
333
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kibi-cli",
3
- "version": "2.4.0",
3
+ "version": "2.5.1",
4
4
  "type": "module",
5
5
  "description": "Kibi CLI for knowledge base management",
6
6
  "engines": {
@@ -235,8 +235,8 @@
235
235
  "fast-glob": "^3.2.12",
236
236
  "gray-matter": "^4.0.3",
237
237
  "js-yaml": "^4.1.0",
238
- "kibi-core": "^0.14.1",
239
- "kibi-plugin-builtin": "^0.4.0",
238
+ "kibi-core": "^0.15.0",
239
+ "kibi-plugin-builtin": "^0.4.1",
240
240
  "kibi-plugin-sdk": "^0.4.0",
241
241
  "kibi-swipl": "^1.0.0",
242
242
  "saxes": "^6.0.0",
@@ -30,6 +30,9 @@ entity_property(_, severity, atom).
30
30
  entity_property(_, links, list).
31
31
  entity_property(_, text_ref, uri).
32
32
  entity_property(_, sourceFile, uri).
33
+ % Provenance of any authored entity: a JSON object (kind, ref, approved_by,
34
+ % recorded_at) naming who authored it and on what authority.
35
+ entity_property(_, origin, list_or_json).
33
36
  entity_property(req, semantic_text, string).
34
37
  entity_property(req, logic_claims, list).
35
38
  entity_property(req, semantic_clauses, list).
@@ -39,6 +42,17 @@ entity_property(req, semantic_source_hash, string).
39
42
  entity_property(req, semantic_inventory, list_or_json).
40
43
  entity_property(req, proof_exempt, boolean).
41
44
  entity_property(req, proof_exempt_reason, string).
45
+ % Human approval of an exception requirement (one that `exempts` another).
46
+ % Only an approved exception makes a success scenario feasible.
47
+ entity_property(req, approved_by, string).
48
+ entity_property(req, approval_ref, string).
49
+ % Why the requirement exists, in the words of whoever stated the intent.
50
+ % Explanation only: it is never part of the checked meaning.
51
+ entity_property(req, rationale, string).
52
+ % Claim keys of the exempted requirement an exception waives (all when absent).
53
+ entity_property(req, exempts_claims, list).
54
+ % Intended outcome of a scenario: success, rejection or error.
55
+ entity_property(scenario, expects, atom).
42
56
 
43
57
  % Typed fact fields - only valid for fact entities
44
58
  entity_property(fact, fact_kind, atom).
@@ -65,6 +79,9 @@ entity_property(fact, predicate_arity, integer).
65
79
  entity_property(fact, argument_names, list).
66
80
  entity_property(fact, argument_types, list).
67
81
  entity_property(fact, argument_descriptions, list).
82
+ % Predicate-schema functional dependency: the named arguments determine the
83
+ % remaining ones, so two atoms with equal keys describe the same fact.
84
+ entity_property(fact, key_arguments, list).
68
85
  % Predicate-schema vocabularies are JSON objects serialized as strings.
69
86
  entity_property(fact, argument_constants, string).
70
87
  entity_property(fact, argument_aliases, string).
@@ -112,6 +129,7 @@ optional_property(Type, priority) :- entity_type(Type).
112
129
  optional_property(Type, severity) :- entity_type(Type).
113
130
  optional_property(Type, links) :- entity_type(Type).
114
131
  optional_property(Type, text_ref) :- entity_type(Type).
132
+ optional_property(Type, origin) :- entity_type(Type).
115
133
  optional_property(req, semantic_text).
116
134
  optional_property(req, logic_claims).
117
135
  optional_property(req, semantic_clauses).
@@ -121,6 +139,10 @@ optional_property(req, semantic_source_hash).
121
139
  optional_property(req, semantic_inventory).
122
140
  optional_property(req, proof_exempt).
123
141
  optional_property(req, proof_exempt_reason).
142
+ optional_property(req, approved_by).
143
+ optional_property(req, approval_ref).
144
+ optional_property(req, rationale).
145
+ optional_property(req, exempts_claims).
124
146
  optional_property(test, verification_scope).
125
147
  optional_property(test, verification_perspective).
126
148
  optional_property(test, proof_contract).
@@ -22,6 +22,8 @@ relationship_type(constrains).
22
22
  relationship_type(requires_property).
23
23
  relationship_type(requires_predicate).
24
24
  relationship_type(requires_rule).
25
+ relationship_type(assumes).
26
+ relationship_type(exempts).
25
27
 
26
28
  % valid_relationship(RelType, FromType, ToType).
27
29
  valid_relationship(depends_on, req, req).
@@ -45,6 +47,18 @@ valid_relationship(requires_property, req, fact).
45
47
  valid_relationship(requires_predicate, req, fact).
46
48
  valid_relationship(requires_rule, req, fact).
47
49
 
50
+ %% assumes(+ScenarioId, +FactId)
51
+ %% The scenario's outcome depends on the property_value fact holding (for
52
+ %% example "the order total is 0"). Checked against current requirements by
53
+ %% the scenario-feasibility rule.
54
+ % implements REQ-kibi-scenario-feasibility-v2
55
+ valid_relationship(assumes, scenario, fact).
56
+
57
+ %% exempts(+ExceptionReqId, +BaseReqId)
58
+ %% An approved exception requirement exempts the scenarios it specifies from
59
+ %% BaseReqId's property constraints. BaseReqId stays current and unchanged.
60
+ valid_relationship(exempts, req, req).
61
+
48
62
  %% supersedes(+NewAdrId, +OldAdrId)
49
63
  %% NewAdrId is the decision that replaces OldAdrId.
50
64
  %% OldAdrId's status should be archived or deprecated as a consequence.
@@ -8,6 +8,7 @@
8
8
 
9
9
  :- use_module('entities.pl').
10
10
  :- use_module('relationships.pl').
11
+ :- use_module(library(http/json)).
11
12
 
12
13
  % validate_entity(+Type, +Props:list)
13
14
  % Props is a list of Property=Value pairs (e.g. id=ID, title=Title)
@@ -19,7 +20,9 @@ validate_entity(Type, Props) :-
19
20
  % all properties have correct types
20
21
  forall(member(Key=Val, Props), validate_property_type(Type, Key, Val)),
21
22
  % validate entity-specific shape constraints
22
- validate_entity_shape(Type, Props).
23
+ validate_entity_shape(Type, Props),
24
+ % provenance, when present, names a known origin kind
25
+ valid_origin_in_props(Props).
23
26
 
24
27
  % validate_relationship(+RelType, +From, +To)
25
28
  % From and To are pairs Type=Id or structures type(Type) - allow Type or Type=Id
@@ -105,6 +108,7 @@ is_fact_only_field(predicate_arity).
105
108
  is_fact_only_field(argument_names).
106
109
  is_fact_only_field(argument_types).
107
110
  is_fact_only_field(argument_descriptions).
111
+ is_fact_only_field(key_arguments).
108
112
  is_fact_only_field(argument_constants).
109
113
  is_fact_only_field(argument_aliases).
110
114
  is_fact_only_field(aliases).
@@ -156,6 +160,7 @@ validate_fact_shape(predicate_schema, Props) :-
156
160
  memberchk(argument_types=ArgumentTypes, Props),
157
161
  same_length(ArgumentNames, ArgumentTypes),
158
162
  length(ArgumentNames, Arity),
163
+ valid_key_arguments(Props, ArgumentNames),
159
164
  valid_optional_fact_enums(Props),
160
165
  valid_polarity_in_props(Props), !.
161
166
  validate_fact_shape(predicate, Props) :-
@@ -185,6 +190,24 @@ validate_fact_shape(Kind, _Props) :-
185
190
  \+ memberchk(Kind, [subject, property_value, observation, meta, predicate_schema, predicate, rule_schema, rule]),
186
191
  fail.
187
192
 
193
+ % valid_key_arguments(+Props, +ArgumentNames)
194
+ % Optional key_arguments must be a non-empty list of distinct declared
195
+ % argument names.
196
+ valid_key_arguments(Props, ArgumentNames) :-
197
+ ( memberchk(key_arguments=Keys, Props)
198
+ -> is_list(Keys),
199
+ Keys \= [],
200
+ maplist(text_atom, ArgumentNames, NameAtoms),
201
+ maplist(text_atom, Keys, KeyAtoms),
202
+ sort(KeyAtoms, UniqueKeys),
203
+ same_length(KeyAtoms, UniqueKeys),
204
+ forall(member(Key, KeyAtoms), memberchk(Key, NameAtoms))
205
+ ; true
206
+ ).
207
+
208
+ text_atom(Value, Atom) :- atom(Value), !, Atom = Value.
209
+ text_atom(Value, Atom) :- string(Value), atom_string(Atom, Value).
210
+
188
211
  % valid_operator(+Op)
189
212
  valid_operator(Op) :- memberchk(Op, [eq, neq, lt, lte, gt, gte]), !.
190
213
 
@@ -256,3 +279,24 @@ value_type_matches_field(string, Props) :- memberchk(value_string=_, Props), !.
256
279
  value_type_matches_field(int, Props) :- memberchk(value_int=_, Props), !.
257
280
  value_type_matches_field(number, Props) :- memberchk(value_number=_, Props), !.
258
281
  value_type_matches_field(bool, Props) :- memberchk(value_bool=_, Props), !.
282
+
283
+ % valid_origin_in_props(+Props)
284
+ % Entity provenance travels as a JSON object string (or a dict). When present
285
+ % its kind must be human, agent, migration or import.
286
+ valid_origin_in_props(Props) :-
287
+ ( memberchk(origin=Raw, Props)
288
+ -> origin_kind(Raw, Kind),
289
+ memberchk(Kind, [human, agent, migration, import])
290
+ ; true
291
+ ).
292
+
293
+ origin_kind(Raw, Kind) :-
294
+ ( is_dict(Raw)
295
+ -> Dict = Raw
296
+ ; (atom(Raw) ; string(Raw)),
297
+ catch(atom_json_dict(Raw, Dict, []), _, fail),
298
+ is_dict(Dict)
299
+ ),
300
+ get_dict(kind, Dict, RawKind),
301
+ (atom(RawKind) ; string(RawKind)),
302
+ atom_string(Kind, RawKind).
@@ -1,2 +1,3 @@
1
1
  export * from "../utils/branch-resolver.js";
2
2
  export * from "../utils/branch-store-locator.js";
3
+ export * from "../runtime/detached-snapshot.js";
@@ -0,0 +1,175 @@
1
+ /*
2
+ Kibi — repo-local, per-branch, queryable long-term memory for software projects
3
+ Copyright (C) 2026 Piotr Franczyk
4
+
5
+ This program is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU Affero General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU Affero General Public License for more details.
14
+
15
+ You should have received a copy of the GNU Affero General Public License
16
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+ */
18
+
19
+ /**
20
+ * Entity provenance (`origin`): who authored an entity and on what authority.
21
+ *
22
+ * `origin` is one structured property shared by every authored entity type.
23
+ * It is a YAML mapping in Markdown frontmatter and symbol manifests, a JSON
24
+ * object at the public operation boundary, and a JSON string inside Prolog
25
+ * (like `proof_contract`).
26
+ */
27
+
28
+ /** How an entity entered the knowledge base. */
29
+ // implements REQ-kibi-entity-origin
30
+ export const ENTITY_ORIGIN_KINDS = [
31
+ "human",
32
+ "agent",
33
+ "migration",
34
+ "import",
35
+ ] as const;
36
+
37
+ // implements REQ-kibi-entity-origin
38
+ export type EntityOriginKind = (typeof ENTITY_ORIGIN_KINDS)[number];
39
+
40
+ // implements REQ-kibi-entity-origin
41
+ export type EntityOrigin = {
42
+ /** human | agent | migration | import */
43
+ kind: EntityOriginKind;
44
+ /** Source reference: URL, document path, ticket, commit or conversation id. */
45
+ ref?: string;
46
+ /** The person who approved the authored content. */
47
+ approved_by?: string;
48
+ /** ISO-8601 time the provenance was recorded. */
49
+ recorded_at?: string;
50
+ };
51
+
52
+ /** `ref` recorded on entities backfilled by the schema v5 -> v6 migration. */
53
+ // implements REQ-kibi-entity-origin
54
+ export const SCHEMA6_MIGRATION_ORIGIN_REF = "kibi migrate v5->v6";
55
+
56
+ const ISO_TIMESTAMP_PATTERN =
57
+ "^\\d{4}-\\d{2}-\\d{2}(?:[T ]\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d+)?)?(?:Z|[+-]\\d{2}:?\\d{2})?)?$";
58
+
59
+ /** JSON Schema shared by the entity schema and the kb_upsert input schema. */
60
+ // implements REQ-kibi-entity-origin
61
+ export const ENTITY_ORIGIN_SCHEMA = {
62
+ type: "object",
63
+ required: ["kind"],
64
+ properties: {
65
+ kind: {
66
+ type: "string",
67
+ enum: [...ENTITY_ORIGIN_KINDS],
68
+ description:
69
+ "Who authored the entity: human, agent, migration (backfilled by kibi migrate) or import.",
70
+ },
71
+ ref: {
72
+ type: "string",
73
+ minLength: 1,
74
+ pattern: "\\S",
75
+ description:
76
+ "Source reference for the authored content: URL, document path, ticket, commit or conversation id.",
77
+ },
78
+ approved_by: {
79
+ type: "string",
80
+ minLength: 1,
81
+ pattern: "\\S",
82
+ description:
83
+ "The person who reviewed and approved this entity's content. Distinct from the requirement-level approved_by of an exception.",
84
+ },
85
+ recorded_at: {
86
+ type: "string",
87
+ pattern: ISO_TIMESTAMP_PATTERN,
88
+ description: "ISO-8601 time the provenance was recorded.",
89
+ },
90
+ },
91
+ additionalProperties: false,
92
+ } as const;
93
+
94
+ function isRecord(value: unknown): value is Record<string, unknown> {
95
+ return value !== null && typeof value === "object" && !Array.isArray(value);
96
+ }
97
+
98
+ function nonEmptyText(value: unknown): string | undefined {
99
+ return typeof value === "string" && value.trim() !== ""
100
+ ? value.trim()
101
+ : undefined;
102
+ }
103
+
104
+ /**
105
+ * Normalize an authored origin mapping. YAML parsers turn an unquoted
106
+ * `recorded_at` into a Date; it is stored as its ISO-8601 string. Returns the
107
+ * reason when the mapping is not a valid origin.
108
+ */
109
+ // implements REQ-kibi-entity-origin, REQ-007
110
+ export function normalizeEntityOrigin(
111
+ value: unknown,
112
+ ): { origin: EntityOrigin } | { error: string } {
113
+ if (!isRecord(value)) {
114
+ return { error: "origin must be a mapping with at least a kind" };
115
+ }
116
+ const allowed = new Set(["kind", "ref", "approved_by", "recorded_at"]);
117
+ const unknown = Object.keys(value).filter((key) => !allowed.has(key));
118
+ if (unknown.length > 0) {
119
+ return {
120
+ error: `origin has unknown field(s) ${unknown.join(", ")}; allowed: kind, ref, approved_by, recorded_at`,
121
+ };
122
+ }
123
+ const kind = value.kind;
124
+ if (
125
+ typeof kind !== "string" ||
126
+ !(ENTITY_ORIGIN_KINDS as readonly string[]).includes(kind)
127
+ ) {
128
+ return {
129
+ error: `origin.kind must be one of ${ENTITY_ORIGIN_KINDS.join(", ")}`,
130
+ };
131
+ }
132
+ const origin: EntityOrigin = { kind: kind as EntityOriginKind };
133
+ for (const field of ["ref", "approved_by"] as const) {
134
+ if (value[field] === undefined) continue;
135
+ const text = nonEmptyText(value[field]);
136
+ if (text === undefined) {
137
+ return { error: `origin.${field} must be a non-empty string` };
138
+ }
139
+ origin[field] = text;
140
+ }
141
+ if (value.recorded_at !== undefined) {
142
+ const recordedAt =
143
+ value.recorded_at instanceof Date
144
+ ? Number.isNaN(value.recorded_at.getTime())
145
+ ? undefined
146
+ : value.recorded_at.toISOString()
147
+ : nonEmptyText(value.recorded_at);
148
+ if (
149
+ recordedAt === undefined ||
150
+ !new RegExp(ISO_TIMESTAMP_PATTERN).test(recordedAt)
151
+ ) {
152
+ return { error: "origin.recorded_at must be an ISO-8601 timestamp" };
153
+ }
154
+ origin.recorded_at = recordedAt;
155
+ }
156
+ return { origin };
157
+ }
158
+
159
+ /**
160
+ * Read an origin from a compiled entity row: an object at the public
161
+ * boundary, or the JSON string Prolog stores. Malformed values read as absent.
162
+ */
163
+ // implements REQ-kibi-entity-origin
164
+ export function readEntityOrigin(value: unknown): EntityOrigin | null {
165
+ let candidate = value;
166
+ if (typeof candidate === "string") {
167
+ try {
168
+ candidate = JSON.parse(candidate) as unknown;
169
+ } catch {
170
+ return null;
171
+ }
172
+ }
173
+ const normalized = normalizeEntityOrigin(candidate);
174
+ return "origin" in normalized ? normalized.origin : null;
175
+ }
@@ -293,6 +293,7 @@ function toExtractedEntity(entity: Record<string, unknown>): ExtractedEntity {
293
293
  "argument_names",
294
294
  "argument_types",
295
295
  "argument_descriptions",
296
+ "key_arguments",
296
297
  "aliases",
297
298
  "examples",
298
299
  "predicate_args",
@@ -242,7 +242,7 @@ function createLogicalCoverageDiagnostics(
242
242
  docs: ["docs/modeling-cheatsheet.md", "docs/error-reference.md"],
243
243
  message: `Current requirement ${result.entity.id} has no atomic logic_claims manifest, so prose and existing fact links cannot prove complete logical coverage.`,
244
244
  suggestion:
245
- "Call kb_semantic_advisor with the complete requirement prose and atomic clauses, ground each returned claim key through kb_model_requirement or kb_suggest_predicates, and persist all keys in logic_claims.",
245
+ "Call kb_model with mode analyze on the complete requirement prose and atomic clauses, ground each returned claim key through kb_model (mode requirement or predicates), and persist all keys in logic_claims.",
246
246
  evidence: {
247
247
  strictRelationshipTypes: relationshipTypes,
248
248
  },
@@ -5,6 +5,7 @@ import {
5
5
  } from "./contracts.js";
6
6
  import { planBootstrapSpec } from "./specs/bootstrap.js";
7
7
  import { checkSpec } from "./specs/check.js";
8
+ import { modelSpec, skillsSpec } from "./specs/composite.js";
8
9
  import { querySpec, searchSpec, statusSpec } from "./specs/discovery.js";
9
10
  import { prepareImpactReviewSpec } from "./specs/impact-review-preparation.js";
10
11
  import {
@@ -36,6 +37,7 @@ export const OPERATION_CATALOG = [
36
37
  skillsListSpec,
37
38
  skillsLoadSpec,
38
39
  skillsReadSpec,
40
+ skillsSpec,
39
41
  querySpec,
40
42
  searchSpec,
41
43
  statusSpec,
@@ -45,6 +47,7 @@ export const OPERATION_CATALOG = [
45
47
  semanticAdvisorSpec,
46
48
  modelRequirementSpec,
47
49
  suggestPredicatesSpec,
50
+ modelSpec,
48
51
  planBootstrapSpec,
49
52
  validateUpsertSpec,
50
53
  upsertSpec,