kibi-cli 2.3.0 → 2.5.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 (380) 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 +39 -11
  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 +13 -5
  7. package/dist/cli-operation-metadata.d.ts.map +1 -1
  8. package/dist/cli-operation-metadata.js +15 -5
  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-maintenance.d.ts.map +1 -1
  13. package/dist/cli-register-maintenance.js +7 -0
  14. package/dist/cli-register-proof.d.ts.map +1 -1
  15. package/dist/cli-register-proof.js +13 -0
  16. package/dist/commands/check.d.ts.map +1 -1
  17. package/dist/commands/check.js +11 -2
  18. package/dist/commands/discovery-shared.d.ts.map +1 -1
  19. package/dist/commands/discovery-shared.js +8 -2
  20. package/dist/commands/engine.d.ts.map +1 -1
  21. package/dist/commands/engine.js +4 -2
  22. package/dist/commands/gc.d.ts.map +1 -1
  23. package/dist/commands/gc.js +7 -0
  24. package/dist/commands/init-helpers.d.ts.map +1 -1
  25. package/dist/commands/init-helpers.js +0 -1
  26. package/dist/commands/merge-driver.d.ts +31 -0
  27. package/dist/commands/merge-driver.d.ts.map +1 -0
  28. package/dist/commands/merge-driver.js +268 -0
  29. package/dist/commands/migrate.d.ts.map +1 -1
  30. package/dist/commands/migrate.js +281 -14
  31. package/dist/commands/proof-compact.d.ts +9 -0
  32. package/dist/commands/proof-compact.d.ts.map +1 -0
  33. package/dist/commands/proof-compact.js +58 -0
  34. package/dist/commands/prove.d.ts +38 -0
  35. package/dist/commands/prove.d.ts.map +1 -1
  36. package/dist/commands/prove.js +222 -47
  37. package/dist/commands/sync/persistence.d.ts.map +1 -1
  38. package/dist/commands/sync/persistence.js +61 -16
  39. package/dist/commands/sync.d.ts +8 -0
  40. package/dist/commands/sync.d.ts.map +1 -1
  41. package/dist/commands/sync.js +42 -16
  42. package/dist/diagnostics.js +1 -1
  43. package/dist/engine-limits.d.ts +74 -0
  44. package/dist/engine-limits.d.ts.map +1 -0
  45. package/dist/engine-limits.js +201 -0
  46. package/dist/engine.d.ts +10 -0
  47. package/dist/engine.d.ts.map +1 -1
  48. package/dist/engine.js +57 -9
  49. package/dist/extractors/manifest.d.ts +8 -0
  50. package/dist/extractors/manifest.d.ts.map +1 -1
  51. package/dist/extractors/manifest.js +34 -5
  52. package/dist/extractors/markdown.d.ts +8 -0
  53. package/dist/extractors/markdown.d.ts.map +1 -1
  54. package/dist/extractors/markdown.js +57 -0
  55. package/dist/extractors/relationships.d.ts.map +1 -1
  56. package/dist/extractors/relationships.js +2 -0
  57. package/dist/intent-search.d.ts +4 -1
  58. package/dist/intent-search.d.ts.map +1 -1
  59. package/dist/intent-search.js +186 -33
  60. package/dist/operations/bootstrap/candidate-helpers.d.ts.map +1 -1
  61. package/dist/operations/bootstrap/candidate-helpers.js +8 -1
  62. package/dist/operations/bootstrap/candidates.d.ts.map +1 -1
  63. package/dist/operations/bootstrap/candidates.js +55 -39
  64. package/dist/operations/bootstrap/discovery.js +1 -1
  65. package/dist/operations/bootstrap/generate.d.ts +2 -0
  66. package/dist/operations/bootstrap/generate.d.ts.map +1 -1
  67. package/dist/operations/bootstrap/generate.js +107 -37
  68. package/dist/operations/bootstrap/guidance-actions.d.ts.map +1 -1
  69. package/dist/operations/bootstrap/guidance-actions.js +3 -0
  70. package/dist/operations/bootstrap/guidance.d.ts.map +1 -1
  71. package/dist/operations/bootstrap/guidance.js +7 -1
  72. package/dist/operations/bootstrap/intent-claims.d.ts +17 -0
  73. package/dist/operations/bootstrap/intent-claims.d.ts.map +1 -0
  74. package/dist/operations/bootstrap/intent-claims.js +103 -0
  75. package/dist/operations/bootstrap/markdown-candidates.d.ts +2 -0
  76. package/dist/operations/bootstrap/markdown-candidates.d.ts.map +1 -1
  77. package/dist/operations/bootstrap/markdown-candidates.js +32 -10
  78. package/dist/operations/bootstrap/presentation.d.ts +2 -0
  79. package/dist/operations/bootstrap/presentation.d.ts.map +1 -1
  80. package/dist/operations/bootstrap/presentation.js +66 -3
  81. package/dist/operations/bootstrap/requirement-claims.d.ts +1 -0
  82. package/dist/operations/bootstrap/requirement-claims.d.ts.map +1 -1
  83. package/dist/operations/bootstrap/requirement-claims.js +13 -1
  84. package/dist/operations/bootstrap/types.d.ts +28 -0
  85. package/dist/operations/bootstrap/types.d.ts.map +1 -1
  86. package/dist/operations/bootstrap/types.js +16 -0
  87. package/dist/operations/bootstrap/validation.d.ts +4 -0
  88. package/dist/operations/bootstrap/validation.d.ts.map +1 -0
  89. package/dist/operations/bootstrap/validation.js +20 -0
  90. package/dist/operations/migration/inventory-rederive.d.ts +81 -0
  91. package/dist/operations/migration/inventory-rederive.d.ts.map +1 -0
  92. package/dist/operations/migration/inventory-rederive.js +484 -0
  93. package/dist/operations/migration/kb-sources.d.ts +53 -0
  94. package/dist/operations/migration/kb-sources.d.ts.map +1 -0
  95. package/dist/operations/migration/kb-sources.js +233 -0
  96. package/dist/operations/migration/origin-backfill.d.ts +39 -0
  97. package/dist/operations/migration/origin-backfill.d.ts.map +1 -0
  98. package/dist/operations/migration/origin-backfill.js +164 -0
  99. package/dist/operations/migration/polarity-values.d.ts +10 -0
  100. package/dist/operations/migration/polarity-values.d.ts.map +1 -0
  101. package/dist/operations/migration/polarity-values.js +60 -0
  102. package/dist/operations/migration/schema6.d.ts +59 -0
  103. package/dist/operations/migration/schema6.d.ts.map +1 -0
  104. package/dist/operations/migration/schema6.js +379 -0
  105. package/dist/operations/migration/source-paths.d.ts +131 -0
  106. package/dist/operations/migration/source-paths.d.ts.map +1 -0
  107. package/dist/operations/migration/source-paths.js +308 -0
  108. package/dist/operations/migration/superseded-closure.d.ts +54 -0
  109. package/dist/operations/migration/superseded-closure.d.ts.map +1 -0
  110. package/dist/operations/migration/superseded-closure.js +187 -0
  111. package/dist/operations/modeling/logic-modeling.d.ts.map +1 -1
  112. package/dist/operations/modeling/logic-modeling.js +3 -5
  113. package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
  114. package/dist/operations/modeling/model-requirement.js +225 -67
  115. package/dist/operations/mutation/contradictions.d.ts +16 -0
  116. package/dist/operations/mutation/contradictions.d.ts.map +1 -1
  117. package/dist/operations/mutation/contradictions.js +32 -0
  118. package/dist/operations/mutation/delete.d.ts.map +1 -1
  119. package/dist/operations/mutation/delete.js +15 -7
  120. package/dist/operations/mutation/origin.d.ts +21 -0
  121. package/dist/operations/mutation/origin.d.ts.map +1 -0
  122. package/dist/operations/mutation/origin.js +78 -0
  123. package/dist/operations/mutation/plan-apply-journal.d.ts +182 -0
  124. package/dist/operations/mutation/plan-apply-journal.d.ts.map +1 -0
  125. package/dist/operations/mutation/plan-apply-journal.js +613 -0
  126. package/dist/operations/mutation/predicate-vocabulary-guard.d.ts +3 -1
  127. package/dist/operations/mutation/predicate-vocabulary-guard.d.ts.map +1 -1
  128. package/dist/operations/mutation/predicate-vocabulary-guard.js +13 -2
  129. package/dist/operations/mutation/relationships.d.ts +5 -5
  130. package/dist/operations/mutation/relationships.d.ts.map +1 -1
  131. package/dist/operations/mutation/relationships.js +31 -11
  132. package/dist/operations/mutation/serialization.d.ts.map +1 -1
  133. package/dist/operations/mutation/serialization.js +3 -1
  134. package/dist/operations/mutation/source-authoring.d.ts +6 -0
  135. package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
  136. package/dist/operations/mutation/source-authoring.js +7 -1
  137. package/dist/operations/mutation/symbol-refresh.d.ts.map +1 -1
  138. package/dist/operations/mutation/symbol-refresh.js +4 -1
  139. package/dist/operations/mutation/types.d.ts +14 -0
  140. package/dist/operations/mutation/types.d.ts.map +1 -1
  141. package/dist/operations/mutation/upsert.d.ts +30 -3
  142. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  143. package/dist/operations/mutation/upsert.js +105 -35
  144. package/dist/operations/mutation/validate-upsert.d.ts +6 -0
  145. package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
  146. package/dist/operations/mutation/validate-upsert.js +34 -30
  147. package/dist/operations/planning/apply-plan.d.ts.map +1 -1
  148. package/dist/operations/planning/apply-plan.js +751 -144
  149. package/dist/operations/planning/compile-intent.d.ts +34 -1
  150. package/dist/operations/planning/compile-intent.d.ts.map +1 -1
  151. package/dist/operations/planning/compile-intent.js +314 -98
  152. package/dist/operations/proof/code-scope.d.ts +28 -0
  153. package/dist/operations/proof/code-scope.d.ts.map +1 -1
  154. package/dist/operations/proof/code-scope.js +72 -0
  155. package/dist/operations/proof/compact-receipts.d.ts +49 -0
  156. package/dist/operations/proof/compact-receipts.d.ts.map +1 -0
  157. package/dist/operations/proof/compact-receipts.js +160 -0
  158. package/dist/operations/proof/ingest-proof.d.ts +2 -0
  159. package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
  160. package/dist/operations/proof/ingest-proof.js +44 -23
  161. package/dist/operations/proof/prune-receipts.d.ts.map +1 -1
  162. package/dist/operations/proof/prune-receipts.js +5 -9
  163. package/dist/operations/proof/receipt-compaction.d.ts +48 -0
  164. package/dist/operations/proof/receipt-compaction.d.ts.map +1 -0
  165. package/dist/operations/proof/receipt-compaction.js +121 -0
  166. package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
  167. package/dist/operations/semantic-advisor/analysis-receipt.js +12 -1
  168. package/dist/operations/semantic-advisor/analyze-prose.d.ts +2 -1
  169. package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
  170. package/dist/operations/semantic-advisor/analyze-prose.js +51 -5
  171. package/dist/operations/semantic-advisor/clauses.d.ts +1 -0
  172. package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
  173. package/dist/operations/semantic-advisor/clauses.js +11 -1
  174. package/dist/operations/semantic-advisor/conditional-rules.d.ts +33 -0
  175. package/dist/operations/semantic-advisor/conditional-rules.d.ts.map +1 -0
  176. package/dist/operations/semantic-advisor/conditional-rules.js +262 -0
  177. package/dist/operations/semantic-advisor/ingestion-boundary.d.ts +3 -1
  178. package/dist/operations/semantic-advisor/ingestion-boundary.d.ts.map +1 -1
  179. package/dist/operations/semantic-advisor/ingestion-boundary.js +14 -6
  180. package/dist/operations/semantic-advisor/plugin-orchestration.js +1 -1
  181. package/dist/prolog/codec.d.ts.map +1 -1
  182. package/dist/prolog/codec.js +2 -1
  183. package/dist/prolog.d.ts +9 -0
  184. package/dist/prolog.d.ts.map +1 -1
  185. package/dist/prolog.js +56 -10
  186. package/dist/proof/command-test-report.d.ts +74 -0
  187. package/dist/proof/command-test-report.d.ts.map +1 -0
  188. package/dist/proof/command-test-report.js +206 -0
  189. package/dist/public/branch-resolver.d.ts +1 -0
  190. package/dist/public/branch-resolver.d.ts.map +1 -1
  191. package/dist/public/branch-resolver.js +1 -0
  192. package/dist/public/diagnostic-usage.d.ts +14 -0
  193. package/dist/public/diagnostic-usage.d.ts.map +1 -1
  194. package/dist/public/diagnostic-usage.js +55 -1
  195. package/dist/public/entity-origin.d.ts +69 -0
  196. package/dist/public/entity-origin.d.ts.map +1 -0
  197. package/dist/public/entity-origin.js +142 -0
  198. package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
  199. package/dist/public/impact/full-kb-quality.js +1 -0
  200. package/dist/public/impact/requirement-quality.js +1 -1
  201. package/dist/public/operations/catalog.d.ts +203 -20
  202. package/dist/public/operations/catalog.d.ts.map +1 -1
  203. package/dist/public/operations/catalog.js +3 -0
  204. package/dist/public/operations/check-executor.d.ts.map +1 -1
  205. package/dist/public/operations/check-executor.js +8 -0
  206. package/dist/public/operations/contracts.d.ts +0 -5
  207. package/dist/public/operations/contracts.d.ts.map +1 -1
  208. package/dist/public/operations/contracts.js +63 -14
  209. package/dist/public/operations/discovery-entities.d.ts +15 -0
  210. package/dist/public/operations/discovery-entities.d.ts.map +1 -1
  211. package/dist/public/operations/discovery-entities.js +59 -0
  212. package/dist/public/operations/discovery-executors.d.ts +6 -1
  213. package/dist/public/operations/discovery-executors.d.ts.map +1 -1
  214. package/dist/public/operations/discovery-executors.js +65 -6
  215. package/dist/public/operations/index.d.ts +1 -0
  216. package/dist/public/operations/index.d.ts.map +1 -1
  217. package/dist/public/operations/index.js +1 -0
  218. package/dist/public/operations/migration-plan.d.ts +5 -0
  219. package/dist/public/operations/migration-plan.d.ts.map +1 -1
  220. package/dist/public/operations/migration-plan.js +26 -1
  221. package/dist/public/operations/node-ports.d.ts.map +1 -1
  222. package/dist/public/operations/node-ports.js +24 -3
  223. package/dist/public/operations/origin-review.d.ts +51 -0
  224. package/dist/public/operations/origin-review.d.ts.map +1 -0
  225. package/dist/public/operations/origin-review.js +307 -0
  226. package/dist/public/operations/predicate-schema-conformance.js +1 -1
  227. package/dist/public/operations/repair-plan.d.ts.map +1 -1
  228. package/dist/public/operations/repair-plan.js +4 -0
  229. package/dist/public/operations/result-envelope.d.ts.map +1 -1
  230. package/dist/public/operations/result-envelope.js +17 -5
  231. package/dist/public/operations/runtime-types.d.ts +9 -0
  232. package/dist/public/operations/runtime-types.d.ts.map +1 -1
  233. package/dist/public/operations/schema6-check-actions.d.ts +127 -0
  234. package/dist/public/operations/schema6-check-actions.d.ts.map +1 -0
  235. package/dist/public/operations/schema6-check-actions.js +575 -0
  236. package/dist/public/operations/source-path-dangling.d.ts +17 -0
  237. package/dist/public/operations/source-path-dangling.d.ts.map +1 -0
  238. package/dist/public/operations/source-path-dangling.js +66 -0
  239. package/dist/public/operations/specs/bootstrap.d.ts +73 -1
  240. package/dist/public/operations/specs/bootstrap.d.ts.map +1 -1
  241. package/dist/public/operations/specs/bootstrap.js +66 -1
  242. package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
  243. package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
  244. package/dist/public/operations/specs/check-rules.generated.js +15 -1
  245. package/dist/public/operations/specs/check.d.ts +2 -2
  246. package/dist/public/operations/specs/check.js +1 -1
  247. package/dist/public/operations/specs/composite.d.ts +351 -0
  248. package/dist/public/operations/specs/composite.d.ts.map +1 -0
  249. package/dist/public/operations/specs/composite.js +96 -0
  250. package/dist/public/operations/specs/discovery.d.ts +8 -3
  251. package/dist/public/operations/specs/discovery.d.ts.map +1 -1
  252. package/dist/public/operations/specs/discovery.js +8 -3
  253. package/dist/public/operations/specs/modeling.d.ts +2 -2
  254. package/dist/public/operations/specs/modeling.js +2 -2
  255. package/dist/public/operations/specs/mutation-schemas.d.ts +73 -8
  256. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
  257. package/dist/public/operations/specs/mutation-schemas.js +43 -7
  258. package/dist/public/operations/specs/mutation.d.ts +1 -1
  259. package/dist/public/operations/specs/mutation.js +1 -1
  260. package/dist/public/operations/specs/planning.d.ts +2 -2
  261. package/dist/public/operations/specs/planning.js +4 -4
  262. package/dist/public/operations/specs/reporting.d.ts.map +1 -1
  263. package/dist/public/operations/specs/reporting.js +13 -26
  264. package/dist/public/operations/specs/upsert.d.ts +79 -9
  265. package/dist/public/operations/specs/upsert.d.ts.map +1 -1
  266. package/dist/public/operations/specs/upsert.js +6 -1
  267. package/dist/public/operations/symbol-repair-plan.d.ts.map +1 -1
  268. package/dist/public/operations/symbol-repair-plan.js +3 -1
  269. package/dist/public/operations/types.d.ts +1 -1
  270. package/dist/public/operations/types.d.ts.map +1 -1
  271. package/dist/public/proof-receipt.d.ts +1 -0
  272. package/dist/public/proof-receipt.d.ts.map +1 -1
  273. package/dist/public/schemas/entity.d.ts.map +1 -1
  274. package/dist/public/schemas/entity.js +52 -0
  275. package/dist/public/schemas/relationship.d.ts.map +1 -1
  276. package/dist/public/schemas/relationship.js +2 -0
  277. package/dist/public/skills/kibi-bootstrap/SKILL.md +52 -11
  278. package/dist/public/skills/kibi-bootstrap/resources/bootstrap.md +12 -1
  279. package/dist/public/skills/kibi-usage/SKILL.md +82 -18
  280. package/dist/public/skills/kibi-usage/resources/fact-lanes.md +5 -5
  281. package/dist/public/skills/kibi-usage/resources/kb-improvement.md +1 -1
  282. package/dist/public/skills/kibi-usage/resources/logic-ir.md +2 -2
  283. package/dist/public/skills/kibi-usage/resources/operation-access.md +29 -1
  284. package/dist/public/skills/kibi-usage/resources/ui-requirements.md +4 -4
  285. package/dist/public/skills/kibi-usage/resources/workflows.md +42 -25
  286. package/dist/public/telemetry-acceptance.d.ts +64 -0
  287. package/dist/public/telemetry-acceptance.d.ts.map +1 -1
  288. package/dist/public/telemetry-acceptance.js +143 -7
  289. package/dist/public/telemetry-remediation.d.ts.map +1 -1
  290. package/dist/public/telemetry-remediation.js +26 -10
  291. package/dist/relationships/shards.d.ts +13 -0
  292. package/dist/relationships/shards.d.ts.map +1 -1
  293. package/dist/relationships/shards.js +54 -28
  294. package/dist/runtime/cli-runtime.d.ts.map +1 -1
  295. package/dist/runtime/cli-runtime.js +44 -3
  296. package/dist/runtime/detached-snapshot.d.ts +38 -0
  297. package/dist/runtime/detached-snapshot.d.ts.map +1 -0
  298. package/dist/runtime/detached-snapshot.js +92 -0
  299. package/dist/schemas/entity.schema.json +122 -0
  300. package/dist/search-answer.d.ts +157 -0
  301. package/dist/search-answer.d.ts.map +1 -0
  302. package/dist/search-answer.js +846 -0
  303. package/dist/traceability/impact-knowledge.d.ts.map +1 -1
  304. package/dist/traceability/impact-knowledge.js +7 -0
  305. package/dist/traceability/symbol-extract.js +3 -3
  306. package/dist/traceability/temp-kb.d.ts.map +1 -1
  307. package/dist/traceability/temp-kb.js +12 -0
  308. package/dist/types/entities.d.ts +13 -0
  309. package/dist/types/entities.d.ts.map +1 -1
  310. package/dist/types/relationships.d.ts +1 -1
  311. package/dist/types/relationships.d.ts.map +1 -1
  312. package/dist/utils/branch-resolver.d.ts +37 -1
  313. package/dist/utils/branch-resolver.d.ts.map +1 -1
  314. package/dist/utils/branch-resolver.js +130 -3
  315. package/dist/utils/repo-relative-path.d.ts +18 -0
  316. package/dist/utils/repo-relative-path.d.ts.map +1 -0
  317. package/dist/utils/repo-relative-path.js +58 -0
  318. package/dist/utils/rule-registry.generated.d.ts +75 -3
  319. package/dist/utils/rule-registry.generated.d.ts.map +1 -1
  320. package/dist/utils/rule-registry.generated.js +89 -3
  321. package/dist/utils/schema-version.d.ts +1 -1
  322. package/dist/utils/schema-version.d.ts.map +1 -1
  323. package/dist/utils/schema-version.js +4 -3
  324. package/dist/utils/strict-modeling.d.ts +1 -1
  325. package/dist/utils/strict-modeling.d.ts.map +1 -1
  326. package/dist/utils/strict-modeling.js +23 -3
  327. package/package.json +3 -3
  328. package/schema/entities.pl +22 -0
  329. package/schema/relationships.pl +14 -0
  330. package/schema/validation.pl +45 -1
  331. package/src/public/branch-resolver.ts +1 -0
  332. package/src/public/diagnostic-usage.ts +59 -1
  333. package/src/public/entity-origin.ts +175 -0
  334. package/src/public/impact/full-kb-quality.ts +1 -0
  335. package/src/public/impact/requirement-quality.ts +1 -1
  336. package/src/public/operations/catalog.ts +3 -0
  337. package/src/public/operations/check-executor.ts +15 -0
  338. package/src/public/operations/contracts.ts +75 -15
  339. package/src/public/operations/discovery-entities.ts +74 -0
  340. package/src/public/operations/discovery-executors.ts +88 -10
  341. package/src/public/operations/index.ts +1 -0
  342. package/src/public/operations/migration-plan.ts +30 -1
  343. package/src/public/operations/node-ports.ts +24 -3
  344. package/src/public/operations/origin-review.ts +375 -0
  345. package/src/public/operations/predicate-schema-conformance.ts +1 -1
  346. package/src/public/operations/repair-plan.ts +4 -0
  347. package/src/public/operations/result-envelope.ts +18 -6
  348. package/src/public/operations/runtime-types.ts +9 -0
  349. package/src/public/operations/schema6-check-actions.ts +699 -0
  350. package/src/public/operations/source-path-dangling.ts +81 -0
  351. package/src/public/operations/specs/bootstrap.ts +78 -4
  352. package/src/public/operations/specs/check-rules.generated.ts +15 -1
  353. package/src/public/operations/specs/check.ts +1 -1
  354. package/src/public/operations/specs/composite.ts +141 -0
  355. package/src/public/operations/specs/discovery.ts +9 -3
  356. package/src/public/operations/specs/modeling.ts +2 -2
  357. package/src/public/operations/specs/mutation-schemas.ts +49 -7
  358. package/src/public/operations/specs/mutation.ts +1 -1
  359. package/src/public/operations/specs/planning.ts +4 -4
  360. package/src/public/operations/specs/reporting.ts +13 -38
  361. package/src/public/operations/specs/upsert.ts +7 -1
  362. package/src/public/operations/symbol-repair-plan.ts +3 -1
  363. package/src/public/operations/types.ts +2 -0
  364. package/src/public/proof-receipt.ts +1 -0
  365. package/src/public/schemas/entity.ts +57 -0
  366. package/src/public/schemas/relationship.ts +2 -0
  367. package/src/public/skills/kibi-bootstrap/SKILL.md +52 -11
  368. package/src/public/skills/kibi-bootstrap/resources/bootstrap.md +12 -1
  369. package/src/public/skills/kibi-usage/SKILL.md +82 -18
  370. package/src/public/skills/kibi-usage/resources/fact-lanes.md +5 -5
  371. package/src/public/skills/kibi-usage/resources/kb-improvement.md +1 -1
  372. package/src/public/skills/kibi-usage/resources/logic-ir.md +2 -2
  373. package/src/public/skills/kibi-usage/resources/operation-access.md +29 -1
  374. package/src/public/skills/kibi-usage/resources/ui-requirements.md +4 -4
  375. package/src/public/skills/kibi-usage/resources/workflows.md +42 -25
  376. package/src/public/telemetry-acceptance-types.d.ts +4 -1
  377. package/src/public/telemetry-acceptance.ts +210 -7
  378. package/src/public/telemetry-remediation.ts +39 -10
  379. package/src/schemas/entity.schema.json +122 -0
  380. package/src/schemas/relationship.schema.json +2 -0
@@ -1,6 +1,3 @@
1
- import { join } from "node:path";
2
-
3
- import { resolveBoundSymbolScope } from "../../../extractors/manifest.js";
4
1
  import { PROOF_RECEIPT_MAX_AGE_SECONDS } from "../../proof-receipt.js";
5
2
  import { executeStatus } from "../discovery-executors.js";
6
3
  import {
@@ -200,16 +197,13 @@ export function currentProofBindingMode(): "per_contract" | "strict_snapshot" {
200
197
  : "per_contract";
201
198
  }
202
199
 
200
+ // implements REQ-kibi-verification-evidence-contract
203
201
  export async function perContractTestBindings(
204
202
  context: OperationContext,
205
203
  ): Promise<string | null> {
206
204
  if (currentProofBindingMode() !== "per_contract") return null;
207
205
  const { loadEntities } = await import("../discovery-entities.js");
208
- const { receiptBindingHash } = await import("../../proof-fingerprint.js");
209
- const { removeFrontmatterBlock } = await import(
210
- "../../../operations/proof/receipt-document.js"
211
- );
212
- const { loadCoveredBySymbolsByTest, receiptCodeScopeSymbolIds } =
206
+ const { currentReceiptBindingHash, loadCoveredBySymbolsByTest } =
213
207
  await import("../../../operations/proof/code-scope.js");
214
208
  // Only the contract, scoped code, and authored source feed the binding
215
209
  // hash. The paged projection never materializes receipt histories, which
@@ -230,39 +224,20 @@ export async function perContractTestBindings(
230
224
  ? await loadCoveredBySymbolsByTest(requireProlog(context))
231
225
  : new Map<string, readonly string[]>();
232
226
  const entries: string[] = [];
233
- const manifestPath = join(context.workspaceRoot, ".kb", "symbols.yaml");
227
+ const fs = context.fs;
234
228
  for (const test of tests) {
235
229
  const testId = typeof test.id === "string" ? test.id : "";
236
- const contract =
237
- test.proof_contract !== undefined &&
238
- test.proof_contract !== null &&
239
- typeof test.proof_contract === "object"
240
- ? (test.proof_contract as Record<string, unknown>)
241
- : undefined;
242
- const source = typeof test.source === "string" ? test.source : "";
243
- if (testId === "" || contract === undefined || source === "") continue;
244
- if (!/\.(md|mdx)$/i.test(source)) continue;
245
- if (!context.fs) continue;
246
- try {
247
- const absolute = join(context.workspaceRoot, source);
248
- const authored = await context.fs.readFile(absolute);
249
- const stripped = removeFrontmatterBlock(authored, "proof_receipts");
250
- const codeScope = resolveBoundSymbolScope(
251
- manifestPath,
252
- receiptCodeScopeSymbolIds(
253
- contract,
254
- test.proof_bindings,
255
- coveredBy.get(testId) ?? [],
256
- ),
257
- );
258
- const binding = receiptBindingHash(
259
- contract as never,
260
- stripped ?? authored,
261
- codeScope,
262
- );
230
+ if (testId === "" || fs === undefined) continue;
231
+ // The same computation ingest uses to write binding_hash. Unreadable or
232
+ // non-markdown documents keep strict snapshot semantics for that test.
233
+ const binding = await currentReceiptBindingHash({
234
+ workspaceRoot: context.workspaceRoot,
235
+ readFile: (absolute) => fs.readFile(absolute),
236
+ test,
237
+ coveredBySymbols: coveredBy.get(testId) ?? [],
238
+ });
239
+ if (binding !== undefined) {
263
240
  entries.push(`${toPrologAtom(testId)}: ${toPrologAtom(binding)}`);
264
- } catch {
265
- // Unreadable documents keep strict semantics for that test.
266
241
  }
267
242
  }
268
243
  if (entries.length === 0) return null;
@@ -14,7 +14,7 @@ export const upsertSpec = {
14
14
  name: "kb_upsert",
15
15
  cliName: "upsert",
16
16
  description:
17
- "Create or update one entity and optional relationships. Use for KB mutations after validating intent; prefer kb_validate_upsert first because it returns semantic advisor receipts for prose-heavy requirements. Use kb_model_requirement before hand-writing strict property facts from prose, and kb_suggest_predicates before hand-writing ontology predicate facts. Use the `relationships` array for batch creation of multiple links in a single call (e.g., linking a requirement to multiple tests or facts). Prefer modeling requirements as reusable fact links (`constrains`, `requires_property`, or `requires_predicate`) so consistency and contradiction checks remain queryable. Relationship endpoints must already exist in KB. For requirements, the write will be rejected if it contradicts existing current requirements that constrain the same subject with incompatible properties. To replace a conflicting requirement, include a `supersedes` relationship from the new requirement to the old one in the same request. Successful writes may return non-blocking semantic advisor warnings; inspect and repair those warnings before treating prose as contradiction-checkable. Do not use for read-only inspection. Side effects: writes KB, may refresh symbol coordinates.",
17
+ "Create or update one entity and optional relationships. Use for KB mutations after validating intent; prefer a dryRun:true call first because it validates without writing and returns semantic advisor receipts for prose-heavy requirements. Use kb_model (mode requirement) before hand-writing strict property facts from prose, and kb_model (mode predicates) before hand-writing ontology predicate facts. Use the `relationships` array for batch creation of multiple links in a single call (e.g., linking a requirement to multiple tests or facts). Prefer modeling requirements as reusable fact links (`constrains`, `requires_property`, or `requires_predicate`) so consistency and contradiction checks remain queryable. Relationship endpoints must already exist in KB. For requirements, the write will be rejected if it contradicts existing current requirements that constrain the same subject with incompatible properties. To replace a conflicting requirement, include a `supersedes` relationship from the new requirement to the old one in the same request, then upsert the old requirement with status closed (kb_check blocks a superseded requirement that is not closed). Successful writes may return non-blocking semantic advisor warnings; inspect and repair those warnings before treating prose as contradiction-checkable. Do not use for read-only inspection. Side effects: writes KB, may refresh symbol coordinates; dryRun:true writes nothing.",
18
18
  businessInputSchema: {
19
19
  type: "object",
20
20
  required: ["type", "id", "properties"],
@@ -32,6 +32,12 @@ export const upsertSpec = {
32
32
  },
33
33
  properties: ENTITY_PROPERTIES_SCHEMA,
34
34
  relationships: RELATIONSHIPS_SCHEMA,
35
+ dryRun: {
36
+ type: "boolean",
37
+ default: false,
38
+ description:
39
+ "Validate the payload and return schema/modeling errors, a normalized preview and the semantic advisor receipt without writing the KB or workspace. Use it as the preflight before the real write.",
40
+ },
35
41
  document: {
36
42
  type: "object",
37
43
  additionalProperties: false,
@@ -71,7 +71,9 @@ export async function inspectCoordinateRepairs(
71
71
  : {}),
72
72
  };
73
73
  });
74
- const enriched = await enrichSymbolCoordinates(entries, workspaceRoot);
74
+ const enriched = await enrichSymbolCoordinates(entries, workspaceRoot, {
75
+ allowPythonDecoratorCoordinates: true,
76
+ });
75
77
  return new Map(
76
78
  entries.map((entry, index) => {
77
79
  const sourceFile = entry.sourceFile ?? null;
@@ -7,6 +7,7 @@ export type OperationName =
7
7
  | "kb_skills_list"
8
8
  | "kb_skills_load"
9
9
  | "kb_skills_read"
10
+ | "kb_skills"
10
11
  | "kb_find_gaps"
11
12
  | "kb_coverage"
12
13
  | "kb_graph"
@@ -19,6 +20,7 @@ export type OperationName =
19
20
  | "kb_prepare_impact_review"
20
21
  | "kb_model_requirement"
21
22
  | "kb_suggest_predicates"
23
+ | "kb_model"
22
24
  | "kb_plan_bootstrap"
23
25
  | "kb_compile_intent"
24
26
  | "kb_apply_plan"
@@ -173,6 +173,7 @@ export type ProofReceipt = Readonly<{
173
173
  finished_at: string;
174
174
  artifact_digest: string;
175
175
  contract_hash: string;
176
+ binding_hash?: string;
176
177
  fingerprint: string;
177
178
  fingerprint_components: ProofFingerprintComponents;
178
179
  integration_id: string;
@@ -16,6 +16,7 @@
16
16
  along with this program. If not, see <https://www.gnu.org/licenses/>.
17
17
  */
18
18
 
19
+ import { ENTITY_ORIGIN_SCHEMA } from "../entity-origin.js";
19
20
  import {
20
21
  PROOF_BINDINGS_SCHEMA,
21
22
  PROOF_CONTRACT_SCHEMA,
@@ -360,6 +361,14 @@ const entitySchema: Record<string, unknown> = {
360
361
  severity: { type: "string" },
361
362
  links: { type: "array", items: { type: "string" } },
362
363
  text_ref: { type: "string" },
364
+ // Provenance of any authored entity: who wrote it and on what authority.
365
+ origin: ENTITY_ORIGIN_SCHEMA,
366
+ expects: {
367
+ type: "string",
368
+ enum: ["success", "rejection", "error"],
369
+ description:
370
+ "Scenario-only. The scenario's intended outcome. A scenario that expects success and assumes (via `assumes` facts) a value a current requirement forbids fails the scenario-feasibility check.",
371
+ },
363
372
  proof_exempt: {
364
373
  type: "boolean",
365
374
  description:
@@ -371,6 +380,34 @@ const entitySchema: Record<string, unknown> = {
371
380
  description:
372
381
  "Requirement-only. Required when proof_exempt is true; surfaces as the applicability reason in coverage rows.",
373
382
  },
383
+ approved_by: {
384
+ type: "string",
385
+ minLength: 1,
386
+ pattern: "\\S",
387
+ description:
388
+ "Requirement-only. The human who approved this exception requirement. An exception (a requirement that exempts another and is specified_by a scenario) makes that success scenario feasible only when approved_by is set.",
389
+ },
390
+ approval_ref: {
391
+ type: "string",
392
+ minLength: 1,
393
+ description:
394
+ "Requirement-only. Optional reference to the approval decision record (ticket, ADR or review link) for an exception requirement.",
395
+ },
396
+ rationale: {
397
+ type: "string",
398
+ minLength: 1,
399
+ pattern: "\\S",
400
+ description:
401
+ "Requirement-only. Why the requirement exists, in one or two sentences from whoever stated the intent. Explanation only: it is not part of the checked meaning.",
402
+ },
403
+ exempts_claims: {
404
+ type: "array",
405
+ minItems: 1,
406
+ uniqueItems: true,
407
+ items: { type: "string", pattern: "^CLAIM-[A-F0-9]{16}$" },
408
+ description:
409
+ "Requirement-only. Narrows an exception requirement to individual clauses: the claim keys (from logic_claims) of the requirement it exempts whose constraints it waives. Without it the exception waives the whole exempted requirement.",
410
+ },
374
411
  semantic_text: {
375
412
  type: "string",
376
413
  description:
@@ -528,6 +565,15 @@ const entitySchema: Record<string, unknown> = {
528
565
  argument_names: { type: "array", items: { type: "string" } },
529
566
  argument_types: { type: "array", items: { type: "string" } },
530
567
  argument_descriptions: { type: "array", items: { type: "string" } },
568
+ // predicate_schema only: the argument names that determine the remaining
569
+ // arguments. Rule comparison identifies two atoms of the predicate only
570
+ // when their key arguments are identical.
571
+ key_arguments: {
572
+ type: "array",
573
+ minItems: 1,
574
+ uniqueItems: true,
575
+ items: { type: "string", minLength: 1 },
576
+ },
531
577
  aliases: { type: "array", items: { type: "string" } },
532
578
  examples: { type: "array", items: { type: "string" } },
533
579
  predicate_args: { type: "array", items: { type: "string" } },
@@ -611,6 +657,7 @@ const entitySchema: Record<string, unknown> = {
611
657
  { required: ["argument_names"] },
612
658
  { required: ["argument_types"] },
613
659
  { required: ["argument_descriptions"] },
660
+ { required: ["key_arguments"] },
614
661
  { required: ["aliases"] },
615
662
  { required: ["examples"] },
616
663
  { required: ["predicate_args"] },
@@ -663,10 +710,20 @@ const entitySchema: Record<string, unknown> = {
663
710
  { required: ["semantic_source_hash"] },
664
711
  { required: ["proof_exempt"] },
665
712
  { required: ["proof_exempt_reason"] },
713
+ { required: ["approved_by"] },
714
+ { required: ["approval_ref"] },
715
+ { required: ["rationale"] },
716
+ { required: ["exempts_claims"] },
666
717
  ],
667
718
  },
668
719
  },
669
720
  },
721
+ {
722
+ if: {
723
+ properties: { type: { const: "scenario" } },
724
+ },
725
+ else: { not: { required: ["expects"] } },
726
+ },
670
727
  ...factConditionals,
671
728
  ],
672
729
  additionalProperties: false,
@@ -41,6 +41,8 @@ const relationshipSchema = {
41
41
  "consumes",
42
42
  "supersedes",
43
43
  "restates",
44
+ "assumes",
45
+ "exempts",
44
46
  "relates_to",
45
47
  ],
46
48
  },
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  id: kibi-bootstrap
3
3
  name: kibi-bootstrap
4
- description: Bootstrap Kibi from the current Git checkout with exact Git attachment, preview approval, source-first writes, and repair-safe completion.
5
- version: 3.0.0
4
+ description: Bootstrap Kibi from the current Git checkout and the project's existing knowledge sources, with a source interview, cited intent claims, preview approval, source-first writes, and repair-safe completion.
5
+ version: 3.1.1
6
6
  kibiCompatibility: ">=1.0.0"
7
7
  tags:
8
8
  - kibi
@@ -18,20 +18,56 @@ resources:
18
18
  ## Goal
19
19
 
20
20
  Seed branch-local Kibi knowledge for an attached but thin repository without
21
- creating a parallel human-maintained ticket system. Ask at most four bounded
22
- context questions only when the planner says repository evidence is
23
- insufficient; agents own deterministic translation and humans resolve genuine
24
- ambiguity. A seeded repository hands off to the normal Kibi workflow.
21
+ creating a parallel human-maintained ticket system. Code shows what the
22
+ system does, not why; intent usually lives elsewhere (issue trackers, wikis,
23
+ specs, decision logs). Lead a short interview to find those sources, harvest
24
+ cited intent from them, and let the planner consolidate it with repository
25
+ evidence. Agents own reading and translation; humans name the sources,
26
+ judge their authority, and resolve genuine ambiguity. A seeded repository
27
+ hands off to the normal Kibi workflow.
25
28
 
26
29
  ## Interface and preview
27
30
 
28
31
  Use the visible approved MCP surface or the trusted project-local CLI as equal
29
- peer interfaces. If neither is available, stop. Run `kb_plan_bootstrap` (or
30
- `plan-bootstrap --input`) read-only. If it returns `needs_context`, ask only its
32
+ peer interfaces. If neither is available, stop. Interview first, then plan,
33
+ then preview the exact plan for approval.
34
+
35
+ ## Interview first
36
+
37
+ Before planning:
38
+
39
+ 1. Inventory what you can already read: your own MCP connectors and tools
40
+ (issue trackers such as Jira, YouTrack, Linear, or GitHub Issues; wikis such
41
+ as Confluence or Notion; drives and design tools), and in-repo docs, ADRs,
42
+ and specs.
43
+ 2. Ask the human, in one message: what the repository is for; which of those
44
+ sources hold product intent; which are authoritative, supporting, or stale;
45
+ what is missing; and which product areas matter first. If an important
46
+ source has no connector, say which one and suggest connecting it, then
47
+ continue with what is reachable. Never invent access you lack.
48
+ 3. Read the confirmed, non-stale sources through your connectors. Harvest one
49
+ normative statement per behavior, each citing its source and an exact
50
+ reference (ticket key, page URL, or section anchor). Keep the source's
51
+ meaning; do not merge, generalize, or resolve conflicts yourself.
52
+
53
+ Declare the result in `bootstrapContext`: `projectSummary`,
54
+ `knowledgeSources` (id, kind, title, locator, authority, optional connector),
55
+ and `intentClaims` (statement, sourceId, reference, optional excerpt). Kibi
56
+ never contacts those sources; it binds what you declare into the plan hash.
57
+
58
+ ## Plan and approval
59
+
60
+ Run `kb_plan_bootstrap` (or `plan-bootstrap --input`) read-only with that
61
+ context. Grounded authoritative or supporting claims become cited `req`
62
+ candidates; claims the strict modeler cannot ground come back as authoring
63
+ follow-ups; stale sources produce no candidates; undeclared sources are
64
+ reported in diagnostics. If the plan returns `needs_context`, ask only its
31
65
  bounded questions (never more than four), then rerun the planner. Show the
32
- complete returned `structuredContent.plan`, including its canonical hash, and
33
- get explicit approval before any write. Pass that plan object unchanged to
34
- `kb_apply_plan`; do not reconstruct it from preview fields.
66
+ complete returned `structuredContent.plan`, including its canonical hash and
67
+ which candidates cite which sources, and get explicit approval before any
68
+ write. Pass that plan object unchanged to `kb_apply_plan`; do not reconstruct
69
+ it from preview fields. When a claim contradicts the code or another claim,
70
+ put it to the human instead of choosing.
35
71
 
36
72
  For CLI JSON, use the trusted route with `--input` (for example
37
73
  `printf '%s\n' '{}' | kibi status --input -`); MCP and CLI are semantic peers.
@@ -51,6 +87,11 @@ Finish with `kb_check` and `kb_status`.
51
87
  Consume the versioned `kibiProtocol: 1` result envelope: inspect `status`, `effects`,
52
88
  `diagnostics`, and `nextActions`. On `committed_with_repairs`, execute required
53
89
  repair actions and never retry the original mutation.
90
+ On `BOOTSTRAP_PLAN_INVALID`, obtain a corrected preview and approval before
91
+ applying. On `BOOTSTRAP_PLAN_REJECTED`, inspect committed `data.actionResults`
92
+ and re-plan from the current state; the journal is terminal and cannot recover.
93
+ Review `suppressedCandidates`, `sourceOnlySignals`, and diagnostics for invalid,
94
+ ungroundable, unreadable, or over-limit candidates before approving a plan.
54
95
 
55
96
  Kibi may author tracked Markdown/YAML/manifests and relationship shards
56
97
  transactionally, but never Git-stages or commits them. Never read or edit
@@ -1,6 +1,11 @@
1
1
  # Bootstrap resource
2
2
 
3
- `kb_plan_bootstrap` is read-only and returns `kibi.bootstrap-plan.v1`. Review
3
+ `kb_plan_bootstrap` is read-only and returns `kibi.bootstrap-plan.v1`. Declared
4
+ `knowledgeSources` and cited `intentClaims` are part of `declaredContext` and
5
+ therefore of the plan hash; a candidate built from a claim has `sourceKind:
6
+ intent_claim` and evidence rows `intent_claim:<sourceId>:<reference>`,
7
+ `knowledge_source:<kind>:<locator>`, and `source_authority:<authority>`. Its
8
+ requirement keeps the citation as `text_ref: <sourceId>:<reference>`. Review
4
9
  candidate evidence, exact actions, dependencies, expected snapshots, source
5
10
  hashes, bounded questions, diagnostics, and the canonical `planHash` before
6
11
  approving. A preview does not authorize source edits. After approval, pass the
@@ -9,3 +14,9 @@ approved hash; inspect its typed result
9
14
  and follow `nextActions` if it returns `committed_with_repairs`. Direct
10
15
  `kb_upsert` is forbidden for every bootstrap task; never manually replay the
11
16
  plan through it.
17
+
18
+ `BOOTSTRAP_PLAN_INVALID` fails before bootstrap writes or a new journal; request
19
+ a corrected plan. `BOOTSTRAP_PLAN_REJECTED` reports a deterministic failure and
20
+ may include earlier committed `data.actionResults`. Re-plan from the current
21
+ state; its terminal journal cannot recover. Review candidate suppressions and
22
+ cited authoring follow-ups, including any `over_limit` entries, before approval.
@@ -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.2.0
5
+ version: 2.3.1
6
6
  kibiCompatibility: ">=1.0.0"
7
7
  tags:
8
8
  - kibi
@@ -47,6 +47,18 @@ Use whichever capability is visible and approved. The surfaces are equal peers:
47
47
  Hosts may expose prefixed identifiers such as `kibi_kb_search`,
48
48
  `kibi_kb_query`, and `kibi_kb_upsert`; map them to the canonical MCP names.
49
49
 
50
+ The MCP server keeps its tool list short. Load skills with `kb_skills`
51
+ (`action: "list" | "load" | "read"`; CLI `kibi skill` or `kibi skills
52
+ list|load|read`). Model prose with `kb_model` (`mode: "analyze"` for the
53
+ semantic advisor, `"requirement"` for strict claims, `"predicates"` for
54
+ ontology predicates; CLI `kibi model` or `semantic-advisor`,
55
+ `model-requirement`, `suggest-predicates`). Preflight a write with
56
+ `kb_upsert` plus `dryRun: true` (CLI `upsert` with `"dryRun": true` or
57
+ `validate-upsert`); it validates and writes nothing. Result payloads still name
58
+ catalog operations such as `kb_model_requirement` or `kb_validate_upsert` in
59
+ `recommended_tools` and repair steps; translate them with the list in
60
+ `resources/operation-access.md`.
61
+
50
62
  The CLI JSON route accepts the same business object as MCP:
51
63
 
52
64
  ```bash
@@ -56,16 +68,36 @@ printf '%s\n' '{"query":"checkout","limit":10}' | npx --no-install kibi search -
56
68
  Read `resources/operation-access.md` for the route, result version, effects,
57
69
  mutability, and Prolog requirements of each operation.
58
70
 
71
+ ## Working in a git worktree or another directory
72
+
73
+ Kibi MCP servers start in one project and answer from its knowledge base.
74
+ Every Kibi MCP tool accepts `workspaceRoot`: when your working directory is not
75
+ the project the server started in (a git worktree, a sibling checkout), pass
76
+ your working directory as `workspaceRoot` on every call. Host plugins with
77
+ pre-tool hooks add it for you. The server answers from that workspace when it
78
+ is a worktree of the same repository or lies under the client's MCP roots.
79
+
80
+ If a result carries a `workspace_mismatch` diagnostic, the answer came from a
81
+ different workspace than the one you asked for; its `detail.reason` says why.
82
+ Use the CLI from your working directory instead: `npx --no-install kibi ...`
83
+ runs where you are and needs no `workspaceRoot`.
84
+
59
85
  ## Safe workflow
60
86
 
61
87
  1. Always discover before you mutate: start with `kb_search`, then exact-filter with `kb_query`. Use
62
- `kb_status` when branch or freshness confidence matters. `kb_search` ranks
63
- lexically unless you pass `rankingMode: "intent-v1"`, `semanticFacets`, or
64
- `sourceLocations`; use intent mode with grounded facets for conceptual
65
- questions and before changing a source file, and keep lexical search for
66
- literal identifiers. See `resources/workflows.md` for the mode recipe.
67
- 2. Resolve genuine ambiguity with the human; use semantic advisor/modeling
68
- operations for deterministic interpretation and typed facts.
88
+ `kb_status` when branch or freshness confidence matters. `kb_search`
89
+ defaults to intent ranking, so you can ask it a question ("what governs
90
+ checkout rounding?"); its `data.answer` layer lists the current governing
91
+ requirements with linked facts, scenarios, tests, and ADRs, separates
92
+ superseded requirements, and labels observations as notes. Each governing
93
+ requirement also carries a `verdict` (`contradiction`, `infeasible`,
94
+ `unknown`, or `none`, which is not proof), the `exceptions` that exempt it,
95
+ and the `unknowns` the checks could not decide. Those links and verdicts are
96
+ discovery, not proof. Pass `sourceLocations` before changing a source file,
97
+ and `rankingMode: "legacy"` for literal identifier lookups. See
98
+ `resources/workflows.md` for the mode recipe.
99
+ 2. Resolve genuine ambiguity with the human; use `kb_model` for deterministic
100
+ interpretation and typed facts.
69
101
  3. Create endpoints before relationships and upsert small batches sequentially.
70
102
  Keep the canonical `REQ-* -> SCEN-* -> TEST-*` chain.
71
103
  4. Author tracked Markdown/YAML/manifests and relationship shards through Kibi;
@@ -77,9 +109,9 @@ mutability, and Prolog requirements of each operation.
77
109
  Run `kb_check` with specific rules during iteration and the unfiltered final
78
110
  check. Never fire `kb_upsert` calls in parallel; create or confirm endpoint
79
111
  entities before linking them. The canonical MCP names are `kb_search`,
80
- `kb_query`, `kb_upsert`, and `kb_check`.
112
+ `kb_query`, `kb_model`, `kb_upsert`, and `kb_check`.
81
113
 
82
- For a task that explicitly supplies a malformed concrete mutation payload, locate and read that public request artifact before choosing an entity, preserving its exact entity ID, type, requested changes, and every intended relationship and endpoint. Do not substitute a seeded or convenient entity for the requested target. Start with kb_search, then exact-filter those targets with kb_query, and run kb_validate_upsert on that same payload; validation is not completion. Correct only diagnosed pre-commit errors and revalidate the corrected payload. Once authorized, apply the identical corrected and authorized payload with kb_upsert. If it returns committed_with_repairs, treat the mutation as committed, follow only the required repair actions, and neither retry it nor trigger unrelated semantic backfill for a schema-only repair. Exact-read every changed entity and relationship endpoint with kb_query, then finish with an unfiltered kb_check followed by a final kb_status.
114
+ For a task that explicitly supplies a malformed concrete mutation payload, locate and read that public request artifact before choosing an entity, preserving its exact entity ID, type, requested changes, and every intended relationship and endpoint. Do not substitute a seeded or convenient entity for the requested target. Start with kb_search, then exact-filter those targets with kb_query, and run kb_upsert with dryRun: true on that same payload (CLI: validate-upsert); validation is not completion. Correct only diagnosed pre-commit errors and revalidate the corrected payload. Once authorized, apply the identical corrected and authorized payload with kb_upsert. If it returns committed_with_repairs, treat the mutation as committed, follow only the required repair actions, and neither retry it nor trigger unrelated semantic backfill for a schema-only repair. Exact-read every changed entity and relationship endpoint with kb_query, then finish with an unfiltered kb_check followed by a final kb_status.
83
115
 
84
116
  ## Closeout fields
85
117
 
@@ -110,8 +142,13 @@ migration, worktrees, quarantine, restore, and purge.
110
142
  ## Typed results and recovery
111
143
 
112
144
  Every CLI JSON/MCP result has `kibiProtocol`, `operation`, `resultVersion`,
113
- `status`, `data`, `effects`, `diagnostics`, and typed `nextActions`. Treat
114
- `status: error` as a failed pre-commit operation. If the status is
145
+ `status`, `data`, `effects`, `diagnostics`, and typed `nextActions`.
146
+ `status: error` normally means a failed pre-commit operation. The bootstrap
147
+ error `BOOTSTRAP_PLAN_REJECTED` can follow earlier committed actions: inspect
148
+ `data.actionResults` and `data.applied`, then re-plan from the current state.
149
+ Its journal is terminal; never recover or replay it. `BOOTSTRAP_PLAN_INVALID`
150
+ fails preflight before bootstrap writes or a new journal; obtain a corrected
151
+ plan. If the status is
115
152
  `committed_with_repairs`, the mutation already committed: inspect failed effects,
116
153
  execute each required repair action in order, and never retry the original
117
154
  operation. Record effect failures, followed actions, and unsafe retries in
@@ -124,8 +161,35 @@ Existing entities preserve body bytes when `document.body` is omitted; new
124
161
  requirements default their body to `semantic_text`. Relationship mutations
125
162
  patch canonical shards while preserving unrelated records. Authored entity
126
163
  deletion returns a hash-bound approval plan; requirements normally evolve via a
127
- new entity linked with `supersedes`. Read `resources/source-authoring.md` before
128
- source writes, deletion approval, or recovery.
164
+ new entity linked with `supersedes`; set the replaced requirement to
165
+ `status: closed` in the same change, because `kb_check` blocks an open
166
+ superseded requirement and supersession cycles. Kibi compiles `source` from
167
+ the entity's own file and never writes an authored `source` field, so
168
+ `kb_upsert` cannot change one. When `kb_check` blocks a leftover value
169
+ (`source-path-dangling`), run `kibi migrate`: its automatic
170
+ `source_path_rewrite` action removes the value, or rewrites it when the file
171
+ moved. Never hand-edit `.kb/` for it. Read `resources/source-authoring.md`
172
+ before source writes, deletion approval, or recovery.
173
+
174
+ `kb_apply_plan` applies a whole plan atomically: a failure changes nothing.
175
+ An interrupted plan is settled by the next `kb_apply_plan`, `kb_upsert`, or
176
+ `kb_delete` call, or by `kb_apply_plan` with its `recoveryJournalId`; never
177
+ re-apply the original plan. On a detached HEAD, reads answer from a read-only
178
+ snapshot and writes are refused; check out a branch before mutating.
179
+
180
+ ## Origin and approvals
181
+
182
+ Entities record `origin` (`kind`: `human`, `agent`, `migration`, or `import`,
183
+ plus optional `ref` and `approved_by`). `kb_upsert` records `kind: agent` on
184
+ entities you create; leave `origin.approved_by` to the person who reviews them.
185
+ An exception (a requirement that `exempts` another) exempts nothing until a
186
+ human sets `approved_by`; `kb_check` flags approvals an agent recorded without
187
+ corroboration. Never fill in an approval yourself. Record why a requirement
188
+ exists in `rationale`, or link the ADR that explains it.
189
+
190
+ Conditional clauses ("only when", "only if", "must not ... unless") compile
191
+ into typed `forbid` rules linked by `requires_rule`, not property facts; one
192
+ `kb_model` or `kb_compile_intent` cannot translate stays an `ontology_gap`.
129
193
 
130
194
  ## Semantic and proof guardrails
131
195
 
@@ -143,20 +207,20 @@ to committed `proof/baseline.json` with `kibi proof impact`.
143
207
 
144
208
  ## Predicate Ontology Decision Tree
145
209
 
146
- Call `kb_semantic_advisor` on the complete prose before encoding a clause.
210
+ Call `kb_model` with `mode: "analyze"` on the complete prose before encoding a clause.
147
211
  Set requirement `logic_claims` to exactly the assertive `claim_key` values.
148
- For each relational clause, call `kb_suggest_predicates` with that clause and
212
+ For each relational clause, call `kb_model` with `mode: "predicates"`, that clause, and
149
213
  `existingLogicClaims`. If lexical rank is a false positive, retry with the
150
214
  reviewed `schemaId`. If `binding_status` is `incomplete`, supply
151
215
  `argumentBindings` and retry. Persist `fact_kind: predicate` with the same
152
216
  `claim_key` / `claim_text`, then link `REQ -> fact` with `requires_predicate`.
153
- Use `kb_model_requirement` for strict scalar clauses. Use
217
+ Use `kb_model` with `mode: "requirement"` for strict scalar clauses. Use
154
218
  `fact_kind: observation` only for a true ontology gap. The manifest is not
155
219
  grounding: run `logic-coverage` so each key binds to one ground fact.
156
220
  Relationship direction is fixed, and every `from` in a relationship batch
157
221
  must equal the upserted entity ID.
158
222
 
159
- For conditional relational claims, after the initial `kb_suggest_predicates` and before any `kb_upsert`—including one needed for a missing schema—call read-only `kb_model_requirement` to preview suitable scalar or typed-rule modeling. Treat the preview as advisory: do not apply an irrelevant result or create unrequested facts, and retain an approved ground-predicate plan when it captures the whole claim. Preserve supplied arity, ordered argument roles, polarity, bound values, and one claim key per actual assertion; never split arguments across clauses or schemas or alter values to force uniqueness.
223
+ For conditional relational claims, after the initial `kb_model` predicates call and before any `kb_upsert`—including one needed for a missing schema—call read-only `kb_model` with `mode: "requirement"` to preview suitable scalar or typed-rule modeling. Treat the preview as advisory: do not apply an irrelevant result or create unrequested facts, and retain an approved ground-predicate plan when it captures the whole claim. Preserve supplied arity, ordered argument roles, polarity, bound values, and one claim key per actual assertion; never split arguments across clauses or schemas or alter values to force uniqueness.
160
224
 
161
225
  ## Symbol-First Traceability
162
226
 
@@ -4,7 +4,7 @@ Requirement prose remains the human-readable source. Facts add queryable semanti
4
4
 
5
5
  ## Atomic Claim Coverage
6
6
 
7
- Logical coverage is clause-based, not entity-based. Give `kb_semantic_advisor` the complete requirement body and verify that its `clauses` list contains every atomic obligation. Supply the `clauses` input yourself when automatic splitting would combine or omit obligations. For every normative clause:
7
+ Logical coverage is clause-based, not entity-based. Give `kb_model` (`mode: "analyze"`) the complete requirement body and verify that its `clauses` list contains every atomic obligation. Supply the `clauses` input yourself when automatic splitting would combine or omit obligations. For every normative clause:
8
8
 
9
9
  - preserve the returned stable key as `claim_key` and the exact clause as `claim_text` on its ground fact;
10
10
  - add the key to the exact current `logic_claims` set, removing only stale keys whose propositions no longer exist in the source;
@@ -17,7 +17,7 @@ Example compound prose: “Checkout requires payment authorization before order
17
17
 
18
18
  ## Predicate Lane (Relational Claims)
19
19
 
20
- Call `kb_semantic_advisor`, then `kb_suggest_predicates`. Apply a candidate only when its schema meaning and ordered arguments fit the claim. Use the returned `applyPlan` rather than hand-writing unsupported predicate names, and link the requirement to the predicate fact with `requires_predicate`.
20
+ Call `kb_model` with `mode: "analyze"`, then with `mode: "predicates"`. Apply a candidate only when its schema meaning and ordered arguments fit the claim. Use the returned `applyPlan` rather than hand-writing unsupported predicate names, and link the requirement to the predicate fact with `requires_predicate`.
21
21
 
22
22
  Treat the result as a Prolog-shaped ground term, not executable source: `predicate_name(arg1,...,argN)`. The selected `predicate_schema` fixes the name, arity, argument roles, and order. Store that model through `predicate_name`, `predicate_args`, `canonical_key`, and `polarity`; never interpolate prose into raw Prolog, introduce variables, or use a graph relationship such as `verified_by` as the predicate name.
23
23
 
@@ -84,15 +84,15 @@ The full logical representation of a requirement is the conjunction of all of it
84
84
 
85
85
  Treat the advisor's proposition status as a hard routing decision. `nonlogical`/`subjective` prose is not a logical claim: keep it as one observation when needed and do not add its key to `logic_claims`. `ambiguous` prose stays an ambiguity observation. `ontology_gap` prose stays unresolved unless an approved schema or validated Logic IR is available. Never split a subjective or commentary sentence into synthetic clauses just because it contains conditional words or domain vocabulary.
86
86
 
87
- If authorized input supplies `projectLocalSchemas`, use those signatures as the authority. Create the minimal `predicate_schema` endpoint before lookup, then rerun `kb_suggest_predicates` on the complete relation if the first lookup had no candidate. Apply exactly one ground predicate and one claim key for that relation. For `must not`, `never`, `cannot`, or `forbidden` wording, preserve the positive schema and set `polarity: deny`; do not turn the result into an asserted predicate or invent a negative name. An empty lookup before the declared schema exists is a retry condition, not proof of an ontology gap.
87
+ If authorized input supplies `projectLocalSchemas`, use those signatures as the authority. Create the minimal `predicate_schema` endpoint before lookup, then rerun `kb_model` with `mode: "predicates"` on the complete relation if the first lookup had no candidate. Apply exactly one ground predicate and one claim key for that relation. For `must not`, `never`, `cannot`, or `forbidden` wording, preserve the positive schema and set `polarity: deny`; do not turn the result into an asserted predicate or invent a negative name. An empty lookup before the declared schema exists is a retry condition, not proof of an ontology gap.
88
88
 
89
89
  ## Typed rule lane
90
90
 
91
- Use a validated `kibi.logic.v1` object for a proposition whose meaning includes a condition, exception, obligation, prohibition, permission, quantifier, cardinality bound, or bounded temporal relation. `kb_model_requirement` returns the `rule_schema` and `rule` facts plus a `requires_rule` edge. The rule stores canonical JSON and a deterministic hash; any rendered Prolog is an audit view and is never executed. Reject raw goals, function symbols, cuts, meta-calls, dynamic predicates, I/O, unsafe variables, unstratified negation, and unbounded aggregation. Keep the exact proposition in `claim_text`, its advisor key in `claim_key`, and its byte span in the semantic ledger. Run `rule-safety` and `rule-verifiability` before treating the rule as modeled.
91
+ Use a validated `kibi.logic.v1` object for a proposition whose meaning includes a condition, exception, obligation, prohibition, permission, quantifier, cardinality bound, or bounded temporal relation. `kb_model` with `mode: "requirement"` returns the `rule_schema` and `rule` facts plus a `requires_rule` edge. The rule stores canonical JSON and a deterministic hash; any rendered Prolog is an audit view and is never executed. Reject raw goals, function symbols, cuts, meta-calls, dynamic predicates, I/O, unsafe variables, unstratified negation, and unbounded aggregation. Keep the exact proposition in `claim_text`, its advisor key in `claim_key`, and its byte span in the semantic ledger. Run `rule-safety` and `rule-verifiability` before treating the rule as modeled.
92
92
 
93
93
  ### Strict scalar
94
94
 
95
- Claim: “Sessions expire after at most 30 minutes.” This is a scalar limit, not a predicate. Route it through `kb_model_requirement` to a subject plus `property_value` with `operator: lte`, `value_type: int`, and `value_int: 30`, linked by `constrains` and `requires_property`.
95
+ Claim: “Sessions expire after at most 30 minutes.” This is a scalar limit, not a predicate. Route it through `kb_model` with `mode: "requirement"` to a subject plus `property_value` with `operator: lte`, `value_type: int`, and `value_int: 30`, linked by `constrains` and `requires_property`.
96
96
 
97
97
  ### Ambiguous claim
98
98
 
@@ -19,7 +19,7 @@ are in `resources/fact-lanes.md` and the Predicate-First workflow in
19
19
  | Process or governance note | `meta` | usually `relates_to` |
20
20
  | Runtime or config gate | `flag` | `guards` |
21
21
 
22
- Call `kb_semantic_advisor` on the complete requirement body before encoding a
22
+ Call `kb_model` with `mode: "analyze"` on the complete requirement body before encoding a
23
23
  clause. Apply a predicate only when a returned schema fits; otherwise leave an
24
24
  ontology-gap observation.
25
25
 
@@ -4,12 +4,12 @@ Kibi stores human prose as readable requirement text, but verifiable meaning bel
4
4
 
5
5
  ## Two-pass extraction
6
6
 
7
- 1. Run `kb_semantic_advisor` over the complete text. Supply explicit `clauses` when sentence splitting could hide a condition, exception, definition, descriptive assertion, threshold, quantity, or temporal qualifier.
7
+ 1. Run `kb_model` with `mode: "analyze"` over the complete text. Supply explicit `clauses` when sentence splitting could hide a condition, exception, definition, descriptive assertion, threshold, quantity, or temporal qualifier.
8
8
  2. Audit the returned `propositions` against the original UTF-8 text. Every assertive span must be `modeled`, `ambiguous`, `ontology_gap`, or `missing`; rationale, examples, and subjective commentary are `nonlogical` and remain readable prose.
9
9
  3. For each assertive proposition, submit up to three typed `interpretations` when alternatives are plausible. Kibi compares canonical semantic keys; materially different valid interpretations remain unresolved regardless of confidence.
10
10
  4. Apply only a validated plan, then read back the requirement, rule schema, rule fact, and all relationship targets. Run `rule-safety`, `rule-verifiability`, `semantic-completeness`, `logic-coverage`, and `domain-contradictions` before the final unfiltered check.
11
11
 
12
- When a project-local schema names several ordered arguments, those arguments are facets of one relation, not separate propositions. Preserve the advisor claim key for the complete relation and do not manufacture clauses for each argument. Supporting `predicate_schema` facts carry the declared signature only; the ground predicate fact carries the claim provenance. Apply the exact `kb_suggest_predicates`/`kb_model_requirement` plan, reducing a rejected schema payload through `kb_validate_upsert` rather than silently downgrading a fitting declared relation to an observation.
12
+ When a project-local schema names several ordered arguments, those arguments are facets of one relation, not separate propositions. Preserve the advisor claim key for the complete relation and do not manufacture clauses for each argument. Supporting `predicate_schema` facts carry the declared signature only; the ground predicate fact carries the claim provenance. Apply the exact `kb_model` predicates/requirement plan, reducing a rejected schema payload through `kb_upsert` with `dryRun: true` rather than silently downgrading a fitting declared relation to an observation.
13
13
 
14
14
  ## Logic IR shape
15
15