kibi-cli 0.12.8 → 0.16.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 (501) hide show
  1. package/bin/kibi +3 -1
  2. package/dist/cli-command.d.ts +5 -0
  3. package/dist/cli-command.d.ts.map +1 -0
  4. package/dist/cli-command.js +9 -0
  5. package/dist/cli-errors.d.ts +13 -0
  6. package/dist/cli-errors.d.ts.map +1 -0
  7. package/dist/cli-errors.js +26 -0
  8. package/dist/cli-input.d.ts +6 -0
  9. package/dist/cli-input.d.ts.map +1 -0
  10. package/dist/cli-input.js +54 -0
  11. package/dist/cli-json-command.d.ts +14 -0
  12. package/dist/cli-json-command.d.ts.map +1 -0
  13. package/dist/cli-json-command.js +96 -0
  14. package/dist/cli-protocol.d.ts +12 -0
  15. package/dist/cli-protocol.d.ts.map +1 -0
  16. package/dist/cli-protocol.js +37 -0
  17. package/dist/cli-register-foundation.d.ts +3 -0
  18. package/dist/cli-register-foundation.d.ts.map +1 -0
  19. package/dist/cli-register-foundation.js +90 -0
  20. package/dist/cli-register-maintenance.d.ts +3 -0
  21. package/dist/cli-register-maintenance.d.ts.map +1 -0
  22. package/dist/cli-register-maintenance.js +36 -0
  23. package/dist/cli-register-reporting.d.ts +3 -0
  24. package/dist/cli-register-reporting.d.ts.map +1 -0
  25. package/dist/cli-register-reporting.js +101 -0
  26. package/dist/cli-register-skills.d.ts +3 -0
  27. package/dist/cli-register-skills.d.ts.map +1 -0
  28. package/dist/cli-register-skills.js +71 -0
  29. package/dist/cli-validate.d.ts +18 -0
  30. package/dist/cli-validate.d.ts.map +1 -0
  31. package/dist/cli-validate.js +45 -0
  32. package/dist/cli.d.ts +4 -4
  33. package/dist/cli.d.ts.map +1 -1
  34. package/dist/cli.js +48 -210
  35. package/dist/commands/aggregated-checks.d.ts +1 -1
  36. package/dist/commands/aggregated-checks.d.ts.map +1 -1
  37. package/dist/commands/aggregated-checks.js +28 -34
  38. package/dist/commands/check.d.ts +2 -1
  39. package/dist/commands/check.d.ts.map +1 -1
  40. package/dist/commands/check.js +145 -152
  41. package/dist/commands/coverage.d.ts.map +1 -1
  42. package/dist/commands/coverage.js +12 -17
  43. package/dist/commands/discovery-shared.d.ts +3 -1
  44. package/dist/commands/discovery-shared.d.ts.map +1 -1
  45. package/dist/commands/discovery-shared.js +8 -209
  46. package/dist/commands/discovery-table.d.ts +3 -0
  47. package/dist/commands/discovery-table.d.ts.map +1 -0
  48. package/dist/commands/discovery-table.js +204 -0
  49. package/dist/commands/gaps.d.ts.map +1 -1
  50. package/dist/commands/gaps.js +15 -19
  51. package/dist/commands/graph.d.ts.map +1 -1
  52. package/dist/commands/graph.js +15 -21
  53. package/dist/commands/query.d.ts +7 -7
  54. package/dist/commands/query.d.ts.map +1 -1
  55. package/dist/commands/query.js +98 -204
  56. package/dist/commands/search.d.ts +4 -4
  57. package/dist/commands/search.d.ts.map +1 -1
  58. package/dist/commands/search.js +14 -27
  59. package/dist/commands/status.d.ts +1 -1
  60. package/dist/commands/status.d.ts.map +1 -1
  61. package/dist/commands/status.js +6 -7
  62. package/dist/commands/sync/discovery.d.ts.map +1 -1
  63. package/dist/commands/sync/discovery.js +8 -1
  64. package/dist/commands/sync/extraction.d.ts +6 -1
  65. package/dist/commands/sync/extraction.d.ts.map +1 -1
  66. package/dist/commands/sync/extraction.js +7 -3
  67. package/dist/commands/sync/manifest.d.ts +1 -1
  68. package/dist/commands/sync/manifest.d.ts.map +1 -1
  69. package/dist/commands/sync/manifest.js +9 -17
  70. package/dist/commands/sync/persistence.d.ts.map +1 -1
  71. package/dist/commands/sync/persistence.js +51 -2
  72. package/dist/extractors/manifest.d.ts.map +1 -1
  73. package/dist/extractors/manifest.js +18 -0
  74. package/dist/extractors/markdown.d.ts +20 -2
  75. package/dist/extractors/markdown.d.ts.map +1 -1
  76. package/dist/extractors/markdown.js +38 -1
  77. package/dist/extractors/symbols-coordinator.d.ts +1 -1
  78. package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
  79. package/dist/extractors/symbols-ts.d.ts.map +1 -1
  80. package/dist/extractors/symbols-ts.js +73 -1
  81. package/dist/operations/autopilot/activation.d.ts +4 -0
  82. package/dist/operations/autopilot/activation.d.ts.map +1 -0
  83. package/dist/operations/autopilot/activation.js +130 -0
  84. package/dist/operations/autopilot/candidate-helpers.d.ts +13 -0
  85. package/dist/operations/autopilot/candidate-helpers.d.ts.map +1 -0
  86. package/dist/operations/autopilot/candidate-helpers.js +55 -0
  87. package/dist/operations/autopilot/candidates.d.ts +4 -0
  88. package/dist/operations/autopilot/candidates.d.ts.map +1 -0
  89. package/dist/operations/autopilot/candidates.js +114 -0
  90. package/dist/operations/autopilot/discovery-evidence.d.ts +10 -0
  91. package/dist/operations/autopilot/discovery-evidence.d.ts.map +1 -0
  92. package/dist/operations/autopilot/discovery-evidence.js +158 -0
  93. package/dist/operations/autopilot/discovery.d.ts +4 -0
  94. package/dist/operations/autopilot/discovery.d.ts.map +1 -0
  95. package/dist/operations/autopilot/discovery.js +100 -0
  96. package/dist/operations/autopilot/generate.d.ts +8 -0
  97. package/dist/operations/autopilot/generate.d.ts.map +1 -0
  98. package/dist/operations/autopilot/generate.js +112 -0
  99. package/dist/operations/autopilot/guidance-actions.d.ts +3 -0
  100. package/dist/operations/autopilot/guidance-actions.d.ts.map +1 -0
  101. package/dist/operations/autopilot/guidance-actions.js +79 -0
  102. package/dist/operations/autopilot/guidance.d.ts +14 -0
  103. package/dist/operations/autopilot/guidance.d.ts.map +1 -0
  104. package/dist/operations/autopilot/guidance.js +124 -0
  105. package/dist/operations/autopilot/markdown-candidates.d.ts +7 -0
  106. package/dist/operations/autopilot/markdown-candidates.d.ts.map +1 -0
  107. package/dist/operations/autopilot/markdown-candidates.js +134 -0
  108. package/dist/operations/autopilot/presentation.d.ts +13 -0
  109. package/dist/operations/autopilot/presentation.d.ts.map +1 -0
  110. package/dist/operations/autopilot/presentation.js +91 -0
  111. package/dist/operations/autopilot/requirement-claims.d.ts +3 -0
  112. package/dist/operations/autopilot/requirement-claims.d.ts.map +1 -0
  113. package/dist/operations/autopilot/requirement-claims.js +48 -0
  114. package/dist/operations/autopilot/types.d.ts +117 -0
  115. package/dist/operations/autopilot/types.d.ts.map +1 -0
  116. package/dist/operations/autopilot/types.js +8 -0
  117. package/dist/operations/modeling/model-requirement.d.ts +10 -0
  118. package/dist/operations/modeling/model-requirement.d.ts.map +1 -0
  119. package/dist/operations/modeling/model-requirement.js +108 -0
  120. package/dist/operations/modeling/predicate-applyplan.d.ts +6 -0
  121. package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -0
  122. package/dist/operations/modeling/predicate-applyplan.js +104 -0
  123. package/dist/operations/modeling/predicate-catalog-1.d.ts +3 -0
  124. package/dist/operations/modeling/predicate-catalog-1.d.ts.map +1 -0
  125. package/dist/operations/modeling/predicate-catalog-1.js +200 -0
  126. package/dist/operations/modeling/predicate-catalog-2.d.ts +3 -0
  127. package/dist/operations/modeling/predicate-catalog-2.d.ts.map +1 -0
  128. package/dist/operations/modeling/predicate-catalog-2.js +197 -0
  129. package/dist/operations/modeling/predicate-catalog-3.d.ts +3 -0
  130. package/dist/operations/modeling/predicate-catalog-3.d.ts.map +1 -0
  131. package/dist/operations/modeling/predicate-catalog-3.js +193 -0
  132. package/dist/operations/modeling/predicate-catalog-4.d.ts +3 -0
  133. package/dist/operations/modeling/predicate-catalog-4.d.ts.map +1 -0
  134. package/dist/operations/modeling/predicate-catalog-4.js +149 -0
  135. package/dist/operations/modeling/predicate-catalog.d.ts +5 -0
  136. package/dist/operations/modeling/predicate-catalog.d.ts.map +1 -0
  137. package/dist/operations/modeling/predicate-catalog.js +29 -0
  138. package/dist/operations/modeling/predicate-inference-1.d.ts +16 -0
  139. package/dist/operations/modeling/predicate-inference-1.d.ts.map +1 -0
  140. package/dist/operations/modeling/predicate-inference-1.js +161 -0
  141. package/dist/operations/modeling/predicate-inference-2.d.ts +19 -0
  142. package/dist/operations/modeling/predicate-inference-2.d.ts.map +1 -0
  143. package/dist/operations/modeling/predicate-inference-2.js +169 -0
  144. package/dist/operations/modeling/predicate-inference-3.d.ts +15 -0
  145. package/dist/operations/modeling/predicate-inference-3.d.ts.map +1 -0
  146. package/dist/operations/modeling/predicate-inference-3.js +163 -0
  147. package/dist/operations/modeling/predicate-inference.d.ts +5 -0
  148. package/dist/operations/modeling/predicate-inference.d.ts.map +1 -0
  149. package/dist/operations/modeling/predicate-inference.js +148 -0
  150. package/dist/operations/modeling/predicate-loader.d.ts +10 -0
  151. package/dist/operations/modeling/predicate-loader.d.ts.map +1 -0
  152. package/dist/operations/modeling/predicate-loader.js +88 -0
  153. package/dist/operations/modeling/predicate-ranker.d.ts +3 -0
  154. package/dist/operations/modeling/predicate-ranker.d.ts.map +1 -0
  155. package/dist/operations/modeling/predicate-ranker.js +24 -0
  156. package/dist/operations/modeling/predicate-score-1.d.ts +3 -0
  157. package/dist/operations/modeling/predicate-score-1.d.ts.map +1 -0
  158. package/dist/operations/modeling/predicate-score-1.js +121 -0
  159. package/dist/operations/modeling/predicate-score-2.d.ts +3 -0
  160. package/dist/operations/modeling/predicate-score-2.d.ts.map +1 -0
  161. package/dist/operations/modeling/predicate-score-2.js +122 -0
  162. package/dist/operations/modeling/predicate-score-3.d.ts +3 -0
  163. package/dist/operations/modeling/predicate-score-3.d.ts.map +1 -0
  164. package/dist/operations/modeling/predicate-score-3.js +54 -0
  165. package/dist/operations/modeling/predicate-types.d.ts +61 -0
  166. package/dist/operations/modeling/predicate-types.d.ts.map +1 -0
  167. package/dist/operations/modeling/predicate-types.js +1 -0
  168. package/dist/operations/modeling/predicate-usage-hints-1.d.ts +3 -0
  169. package/dist/operations/modeling/predicate-usage-hints-1.d.ts.map +1 -0
  170. package/dist/operations/modeling/predicate-usage-hints-1.js +211 -0
  171. package/dist/operations/modeling/predicate-usage-hints-2.d.ts +3 -0
  172. package/dist/operations/modeling/predicate-usage-hints-2.d.ts.map +1 -0
  173. package/dist/operations/modeling/predicate-usage-hints-2.js +209 -0
  174. package/dist/operations/modeling/predicate-usage-hints-3.d.ts +3 -0
  175. package/dist/operations/modeling/predicate-usage-hints-3.d.ts.map +1 -0
  176. package/dist/operations/modeling/predicate-usage-hints-3.js +45 -0
  177. package/dist/operations/modeling/predicate-utils.d.ts +23 -0
  178. package/dist/operations/modeling/predicate-utils.d.ts.map +1 -0
  179. package/dist/operations/modeling/predicate-utils.js +187 -0
  180. package/dist/operations/modeling/requirement-applyplan.d.ts +4 -0
  181. package/dist/operations/modeling/requirement-applyplan.d.ts.map +1 -0
  182. package/dist/operations/modeling/requirement-applyplan.js +44 -0
  183. package/dist/operations/modeling/requirement-heuristics.d.ts +4 -0
  184. package/dist/operations/modeling/requirement-heuristics.d.ts.map +1 -0
  185. package/dist/operations/modeling/requirement-heuristics.js +114 -0
  186. package/dist/operations/modeling/requirement-modeler.d.ts +8 -0
  187. package/dist/operations/modeling/requirement-modeler.d.ts.map +1 -0
  188. package/dist/operations/modeling/requirement-modeler.js +70 -0
  189. package/dist/operations/modeling/requirement-types.d.ts +49 -0
  190. package/dist/operations/modeling/requirement-types.d.ts.map +1 -0
  191. package/dist/operations/modeling/requirement-types.js +1 -0
  192. package/dist/operations/modeling/requirement-utils.d.ts +10 -0
  193. package/dist/operations/modeling/requirement-utils.d.ts.map +1 -0
  194. package/dist/operations/modeling/requirement-utils.js +65 -0
  195. package/dist/operations/modeling/suggest-predicates.d.ts +6 -0
  196. package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -0
  197. package/dist/operations/modeling/suggest-predicates.js +64 -0
  198. package/dist/operations/mutation/audit.d.ts +6 -0
  199. package/dist/operations/mutation/audit.d.ts.map +1 -0
  200. package/dist/operations/mutation/audit.js +22 -0
  201. package/dist/operations/mutation/contradictions.d.ts +10 -0
  202. package/dist/operations/mutation/contradictions.d.ts.map +1 -0
  203. package/dist/operations/mutation/contradictions.js +40 -0
  204. package/dist/operations/mutation/delete.d.ts +5 -0
  205. package/dist/operations/mutation/delete.d.ts.map +1 -0
  206. package/dist/operations/mutation/delete.js +67 -0
  207. package/dist/operations/mutation/relationships.d.ts +17 -0
  208. package/dist/operations/mutation/relationships.d.ts.map +1 -0
  209. package/dist/operations/mutation/relationships.js +134 -0
  210. package/dist/operations/mutation/save.d.ts +4 -0
  211. package/dist/operations/mutation/save.d.ts.map +1 -0
  212. package/dist/operations/mutation/save.js +14 -0
  213. package/dist/operations/mutation/serialization.d.ts +5 -0
  214. package/dist/operations/mutation/serialization.d.ts.map +1 -0
  215. package/dist/operations/mutation/serialization.js +85 -0
  216. package/dist/operations/mutation/strict-fact.d.ts +4 -0
  217. package/dist/operations/mutation/strict-fact.d.ts.map +1 -0
  218. package/dist/operations/mutation/strict-fact.js +67 -0
  219. package/dist/operations/mutation/symbol-granularity.d.ts +4 -0
  220. package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -0
  221. package/dist/operations/mutation/symbol-granularity.js +109 -0
  222. package/dist/operations/mutation/symbol-refresh.d.ts +10 -0
  223. package/dist/operations/mutation/symbol-refresh.d.ts.map +1 -0
  224. package/dist/operations/mutation/symbol-refresh.js +105 -0
  225. package/dist/operations/mutation/types.d.ts +43 -0
  226. package/dist/operations/mutation/types.d.ts.map +1 -0
  227. package/dist/operations/mutation/types.js +1 -0
  228. package/dist/operations/mutation/upsert.d.ts +5 -0
  229. package/dist/operations/mutation/upsert.d.ts.map +1 -0
  230. package/dist/operations/mutation/upsert.js +103 -0
  231. package/dist/operations/mutation/validate-upsert.d.ts +5 -0
  232. package/dist/operations/mutation/validate-upsert.d.ts.map +1 -0
  233. package/dist/operations/mutation/validate-upsert.js +50 -0
  234. package/dist/operations/mutation/validation.d.ts +5 -0
  235. package/dist/operations/mutation/validation.d.ts.map +1 -0
  236. package/dist/operations/mutation/validation.js +107 -0
  237. package/dist/operations/mutation/warnings.d.ts +4 -0
  238. package/dist/operations/mutation/warnings.d.ts.map +1 -0
  239. package/dist/operations/mutation/warnings.js +17 -0
  240. package/dist/operations/semantic-advisor/analysis-receipt.d.ts +5 -0
  241. package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -0
  242. package/dist/operations/semantic-advisor/analysis-receipt.js +112 -0
  243. package/dist/operations/semantic-advisor/analyze-prose.d.ts +5 -0
  244. package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -0
  245. package/dist/operations/semantic-advisor/analyze-prose.js +271 -0
  246. package/dist/operations/semantic-advisor/clauses.d.ts +10 -0
  247. package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -0
  248. package/dist/operations/semantic-advisor/clauses.js +43 -0
  249. package/dist/operations/semantic-advisor/observation-plan.d.ts +3 -0
  250. package/dist/operations/semantic-advisor/observation-plan.d.ts.map +1 -0
  251. package/dist/operations/semantic-advisor/observation-plan.js +19 -0
  252. package/dist/operations/semantic-advisor/predicate-rule.d.ts +14 -0
  253. package/dist/operations/semantic-advisor/predicate-rule.d.ts.map +1 -0
  254. package/dist/operations/semantic-advisor/predicate-rule.js +22 -0
  255. package/dist/operations/semantic-advisor/predicate-rules-core.d.ts +79 -0
  256. package/dist/operations/semantic-advisor/predicate-rules-core.d.ts.map +1 -0
  257. package/dist/operations/semantic-advisor/predicate-rules-core.js +140 -0
  258. package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts +83 -0
  259. package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts.map +1 -0
  260. package/dist/operations/semantic-advisor/predicate-rules-policy.js +150 -0
  261. package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts +48 -0
  262. package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts.map +1 -0
  263. package/dist/operations/semantic-advisor/predicate-rules-product-tail.js +102 -0
  264. package/dist/operations/semantic-advisor/predicate-rules-product.d.ts +71 -0
  265. package/dist/operations/semantic-advisor/predicate-rules-product.d.ts.map +1 -0
  266. package/dist/operations/semantic-advisor/predicate-rules-product.js +133 -0
  267. package/dist/operations/semantic-advisor/prose-coverage-evaluator.d.ts +29 -0
  268. package/dist/operations/semantic-advisor/prose-coverage-evaluator.d.ts.map +1 -0
  269. package/dist/operations/semantic-advisor/prose-coverage-evaluator.js +54 -0
  270. package/dist/operations/semantic-advisor/shared.d.ts +18 -0
  271. package/dist/operations/semantic-advisor/shared.d.ts.map +1 -0
  272. package/dist/operations/semantic-advisor/shared.js +209 -0
  273. package/dist/operations/semantic-advisor/strict-count-rules.d.ts +4 -0
  274. package/dist/operations/semantic-advisor/strict-count-rules.d.ts.map +1 -0
  275. package/dist/operations/semantic-advisor/strict-count-rules.js +62 -0
  276. package/dist/operations/semantic-advisor/strict-rules.d.ts +4 -0
  277. package/dist/operations/semantic-advisor/strict-rules.d.ts.map +1 -0
  278. package/dist/operations/semantic-advisor/strict-rules.js +106 -0
  279. package/dist/operations/semantic-advisor/types.d.ts +135 -0
  280. package/dist/operations/semantic-advisor/types.d.ts.map +1 -0
  281. package/dist/operations/semantic-advisor/types.js +1 -0
  282. package/dist/prolog/codec.d.ts.map +1 -1
  283. package/dist/prolog/codec.js +9 -2
  284. package/dist/prolog.d.ts +5 -0
  285. package/dist/prolog.d.ts.map +1 -1
  286. package/dist/prolog.js +82 -30
  287. package/dist/public/impact/analyzer.d.ts +3 -0
  288. package/dist/public/impact/analyzer.d.ts.map +1 -0
  289. package/dist/public/impact/analyzer.js +54 -0
  290. package/dist/public/impact/coverage-depth-quality.d.ts +4 -0
  291. package/dist/public/impact/coverage-depth-quality.d.ts.map +1 -0
  292. package/dist/public/impact/coverage-depth-quality.js +179 -0
  293. package/dist/public/impact/diagnostics.d.ts +7 -0
  294. package/dist/public/impact/diagnostics.d.ts.map +1 -0
  295. package/dist/public/impact/diagnostics.js +126 -0
  296. package/dist/public/impact/diff-meaning.d.ts +2 -0
  297. package/dist/public/impact/diff-meaning.d.ts.map +1 -0
  298. package/dist/public/impact/diff-meaning.js +101 -0
  299. package/dist/public/impact/full-kb-quality.d.ts +10 -0
  300. package/dist/public/impact/full-kb-quality.d.ts.map +1 -0
  301. package/dist/public/impact/full-kb-quality.js +191 -0
  302. package/dist/public/impact/manifest.d.ts +5 -0
  303. package/dist/public/impact/manifest.d.ts.map +1 -0
  304. package/dist/public/impact/manifest.js +43 -0
  305. package/dist/public/impact/requirement-quality.d.ts +4 -0
  306. package/dist/public/impact/requirement-quality.d.ts.map +1 -0
  307. package/dist/public/impact/requirement-quality.js +199 -0
  308. package/dist/public/impact/source-changes.d.ts +5 -0
  309. package/dist/public/impact/source-changes.d.ts.map +1 -0
  310. package/dist/public/impact/source-changes.js +129 -0
  311. package/dist/public/impact/summaries.d.ts +6 -0
  312. package/dist/public/impact/summaries.d.ts.map +1 -0
  313. package/dist/public/impact/summaries.js +68 -0
  314. package/dist/public/impact/symbol-quality-model.d.ts +21 -0
  315. package/dist/public/impact/symbol-quality-model.d.ts.map +1 -0
  316. package/dist/public/impact/symbol-quality-model.js +116 -0
  317. package/dist/public/impact/symbol-quality.d.ts +4 -0
  318. package/dist/public/impact/symbol-quality.d.ts.map +1 -0
  319. package/dist/public/impact/symbol-quality.js +159 -0
  320. package/dist/public/impact/types.d.ts +79 -0
  321. package/dist/public/impact/types.d.ts.map +1 -0
  322. package/dist/public/impact/types.js +1 -0
  323. package/dist/public/impact-diagnostics.d.ts +7 -0
  324. package/dist/public/impact-diagnostics.d.ts.map +1 -0
  325. package/dist/public/impact-diagnostics.js +5 -0
  326. package/dist/public/operations/catalog.d.ts +907 -0
  327. package/dist/public/operations/catalog.d.ts.map +1 -0
  328. package/dist/public/operations/catalog.js +42 -0
  329. package/dist/public/operations/check-executor.d.ts +21 -0
  330. package/dist/public/operations/check-executor.d.ts.map +1 -0
  331. package/dist/public/operations/check-executor.js +111 -0
  332. package/dist/public/operations/check-format-shared.d.ts +36 -0
  333. package/dist/public/operations/check-format-shared.d.ts.map +1 -0
  334. package/dist/public/operations/check-format-shared.js +107 -0
  335. package/dist/public/operations/check-helpers.d.ts +10 -0
  336. package/dist/public/operations/check-helpers.d.ts.map +1 -0
  337. package/dist/public/operations/check-helpers.js +107 -0
  338. package/dist/public/operations/discovery-entities.d.ts +14 -0
  339. package/dist/public/operations/discovery-entities.d.ts.map +1 -0
  340. package/dist/public/operations/discovery-entities.js +91 -0
  341. package/dist/public/operations/discovery-executors.d.ts +39 -0
  342. package/dist/public/operations/discovery-executors.d.ts.map +1 -0
  343. package/dist/public/operations/discovery-executors.js +101 -0
  344. package/dist/public/operations/index.d.ts +20 -0
  345. package/dist/public/operations/index.d.ts.map +1 -0
  346. package/dist/public/operations/index.js +18 -0
  347. package/dist/public/operations/node-ports.d.ts +15 -0
  348. package/dist/public/operations/node-ports.d.ts.map +1 -0
  349. package/dist/public/operations/node-ports.js +57 -0
  350. package/dist/public/operations/prolog-json.d.ts +5 -0
  351. package/dist/public/operations/prolog-json.d.ts.map +1 -0
  352. package/dist/public/operations/prolog-json.js +44 -0
  353. package/dist/public/operations/runtime-types.d.ts +69 -0
  354. package/dist/public/operations/runtime-types.d.ts.map +1 -0
  355. package/dist/public/operations/runtime-types.js +17 -0
  356. package/dist/public/operations/specs/autopilot.d.ts +82 -0
  357. package/dist/public/operations/specs/autopilot.d.ts.map +1 -0
  358. package/dist/public/operations/specs/autopilot.js +72 -0
  359. package/dist/public/operations/specs/check.d.ts +51 -0
  360. package/dist/public/operations/specs/check.d.ts.map +1 -0
  361. package/dist/public/operations/specs/check.js +62 -0
  362. package/dist/public/operations/specs/discovery.d.ts +94 -0
  363. package/dist/public/operations/specs/discovery.d.ts.map +1 -0
  364. package/dist/public/operations/specs/discovery.js +98 -0
  365. package/dist/public/operations/specs/modeling.d.ts +126 -0
  366. package/dist/public/operations/specs/modeling.d.ts.map +1 -0
  367. package/dist/public/operations/specs/modeling.js +117 -0
  368. package/dist/public/operations/specs/mutation-schemas.d.ts +233 -0
  369. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -0
  370. package/dist/public/operations/specs/mutation-schemas.js +267 -0
  371. package/dist/public/operations/specs/mutation.d.ts +56 -0
  372. package/dist/public/operations/specs/mutation.d.ts.map +1 -0
  373. package/dist/public/operations/specs/mutation.js +44 -0
  374. package/dist/public/operations/specs/reporting.d.ts +185 -0
  375. package/dist/public/operations/specs/reporting.d.ts.map +1 -0
  376. package/dist/public/operations/specs/reporting.js +158 -0
  377. package/dist/public/operations/specs/semantic.d.ts +53 -0
  378. package/dist/public/operations/specs/semantic.d.ts.map +1 -0
  379. package/dist/public/operations/specs/semantic.js +105 -0
  380. package/dist/public/operations/specs/skills.d.ts +70 -0
  381. package/dist/public/operations/specs/skills.d.ts.map +1 -0
  382. package/dist/public/operations/specs/skills.js +107 -0
  383. package/dist/public/operations/specs/sparql.d.ts +39 -0
  384. package/dist/public/operations/specs/sparql.d.ts.map +1 -0
  385. package/dist/public/operations/specs/sparql.js +121 -0
  386. package/dist/public/operations/specs/upsert.d.ts +256 -0
  387. package/dist/public/operations/specs/upsert.d.ts.map +1 -0
  388. package/dist/public/operations/specs/upsert.js +27 -0
  389. package/dist/public/operations/types.d.ts +24 -0
  390. package/dist/public/operations/types.d.ts.map +1 -0
  391. package/dist/public/operations/types.js +1 -0
  392. package/dist/public/schemas/entity.d.ts.map +1 -1
  393. package/dist/public/schemas/entity.js +48 -0
  394. package/dist/public/skill-system/errors.d.ts +19 -0
  395. package/dist/public/skill-system/errors.d.ts.map +1 -0
  396. package/dist/public/skill-system/errors.js +36 -0
  397. package/dist/public/skill-system/loader.d.ts +9 -0
  398. package/dist/public/skill-system/loader.d.ts.map +1 -0
  399. package/dist/public/skill-system/loader.js +76 -0
  400. package/dist/public/skill-system/paths.d.ts +6 -0
  401. package/dist/public/skill-system/paths.d.ts.map +1 -0
  402. package/dist/public/skill-system/paths.js +25 -0
  403. package/dist/public/skill-system/types.d.ts +15 -0
  404. package/dist/public/skill-system/types.d.ts.map +1 -0
  405. package/dist/public/skill-system/types.js +1 -0
  406. package/dist/public/skill-system/validation.d.ts +10 -0
  407. package/dist/public/skill-system/validation.d.ts.map +1 -0
  408. package/dist/public/skill-system/validation.js +119 -0
  409. package/dist/public/skills/init-kibi/SKILL.md +62 -0
  410. package/dist/public/skills/kibi-freshness/SKILL.md +44 -0
  411. package/dist/public/skills/kibi-traceability/SKILL.md +54 -0
  412. package/dist/public/skills/kibi-usage/SKILL.md +123 -95
  413. package/dist/public/skills/kibi-usage/resources/fact-lanes.md +107 -5
  414. package/dist/public/skills/kibi-usage/resources/operation-access.md +44 -0
  415. package/dist/public/skills/kibi-usage/resources/relationship-directions.md +30 -0
  416. package/dist/public/skills/kibi-usage/resources/workflows.md +40 -3
  417. package/dist/public/skills.d.ts +4 -41
  418. package/dist/public/skills.d.ts.map +1 -1
  419. package/dist/public/skills.js +3 -270
  420. package/dist/public/symbol-granularity.d.ts +1 -1
  421. package/dist/public/symbol-granularity.d.ts.map +1 -1
  422. package/dist/public/symbol-granularity.js +2 -0
  423. package/dist/runtime/cli-runtime.d.ts +3 -0
  424. package/dist/runtime/cli-runtime.d.ts.map +1 -0
  425. package/dist/runtime/cli-runtime.js +96 -0
  426. package/dist/schemas/entity.schema.json +23 -0
  427. package/dist/traceability/evidence-model.d.ts +1 -1
  428. package/dist/traceability/evidence-model.d.ts.map +1 -1
  429. package/dist/traceability/evidence-model.js +1 -1
  430. package/dist/traceability/staged-diagnostics.d.ts +6 -6
  431. package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
  432. package/dist/traceability/staged-diagnostics.js +12 -6
  433. package/dist/traceability/staged-impact-contract.js +1 -1
  434. package/dist/traceability/staged-symbols-manifest.d.ts +1 -0
  435. package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
  436. package/dist/traceability/staged-symbols-manifest.js +60 -27
  437. package/dist/traceability/symbol-extract.d.ts.map +1 -1
  438. package/dist/traceability/symbol-extract.js +58 -1
  439. package/dist/traceability/temp-kb.d.ts.map +1 -1
  440. package/dist/traceability/temp-kb.js +34 -1
  441. package/dist/types/entities.d.ts +8 -1
  442. package/dist/types/entities.d.ts.map +1 -1
  443. package/dist/utils/prolog-query-plan-safety.d.ts +8 -0
  444. package/dist/utils/prolog-query-plan-safety.d.ts.map +1 -0
  445. package/dist/utils/prolog-query-plan-safety.js +47 -0
  446. package/dist/utils/rule-registry.d.ts.map +1 -1
  447. package/dist/utils/rule-registry.js +18 -0
  448. package/package.json +60 -2
  449. package/schema/entities.pl +4 -0
  450. package/src/public/impact/analyzer.ts +90 -0
  451. package/src/public/impact/coverage-depth-quality.ts +268 -0
  452. package/src/public/impact/diagnostics.ts +199 -0
  453. package/src/public/impact/diff-meaning.ts +121 -0
  454. package/src/public/impact/full-kb-quality.ts +230 -0
  455. package/src/public/impact/manifest.ts +57 -0
  456. package/src/public/impact/requirement-quality.ts +262 -0
  457. package/src/public/impact/source-changes.ts +180 -0
  458. package/src/public/impact/summaries.ts +100 -0
  459. package/src/public/impact/symbol-quality-model.ts +171 -0
  460. package/src/public/impact/symbol-quality.ts +207 -0
  461. package/src/public/impact/types.ts +99 -0
  462. package/src/public/impact-diagnostics.ts +22 -0
  463. package/src/public/operations/catalog.ts +60 -0
  464. package/src/public/operations/check-executor.ts +185 -0
  465. package/src/public/operations/check-format-shared.ts +178 -0
  466. package/src/public/operations/check-helpers.ts +141 -0
  467. package/src/public/operations/discovery-entities.ts +122 -0
  468. package/src/public/operations/discovery-executors.ts +176 -0
  469. package/src/public/operations/index.ts +19 -0
  470. package/src/public/operations/node-ports.ts +78 -0
  471. package/src/public/operations/prolog-json.ts +71 -0
  472. package/src/public/operations/runtime-types.ts +106 -0
  473. package/src/public/operations/specs/autopilot.ts +98 -0
  474. package/src/public/operations/specs/check.ts +72 -0
  475. package/src/public/operations/specs/discovery.ts +126 -0
  476. package/src/public/operations/specs/modeling.ts +154 -0
  477. package/src/public/operations/specs/mutation-schemas.ts +296 -0
  478. package/src/public/operations/specs/mutation.ts +58 -0
  479. package/src/public/operations/specs/reporting.ts +249 -0
  480. package/src/public/operations/specs/semantic.ts +135 -0
  481. package/src/public/operations/specs/skills.ts +142 -0
  482. package/src/public/operations/specs/sparql.ts +149 -0
  483. package/src/public/operations/specs/upsert.ts +40 -0
  484. package/src/public/operations/types.ts +57 -0
  485. package/src/public/schemas/entity.ts +50 -0
  486. package/src/public/skill-system/errors.ts +38 -0
  487. package/src/public/skill-system/loader.ts +108 -0
  488. package/src/public/skill-system/paths.ts +27 -0
  489. package/src/public/skill-system/types.ts +14 -0
  490. package/src/public/skill-system/validation.ts +175 -0
  491. package/src/public/skills/init-kibi/SKILL.md +62 -0
  492. package/src/public/skills/kibi-freshness/SKILL.md +44 -0
  493. package/src/public/skills/kibi-traceability/SKILL.md +54 -0
  494. package/src/public/skills/kibi-usage/SKILL.md +123 -95
  495. package/src/public/skills/kibi-usage/resources/fact-lanes.md +107 -5
  496. package/src/public/skills/kibi-usage/resources/operation-access.md +44 -0
  497. package/src/public/skills/kibi-usage/resources/relationship-directions.md +30 -0
  498. package/src/public/skills/kibi-usage/resources/workflows.md +40 -3
  499. package/src/public/skills.ts +18 -427
  500. package/src/public/symbol-granularity.ts +4 -0
  501. package/src/schemas/entity.schema.json +23 -0
@@ -2,7 +2,7 @@
2
2
  id: kibi-usage
3
3
  name: Kibi Usage
4
4
  description: Guides agents to use Kibi MCP, facts, relationships, and validation correctly
5
- version: 1.0.0
5
+ version: 1.2.0
6
6
  kibiCompatibility: ">=0.11.0"
7
7
  tags:
8
8
  - kibi
@@ -14,29 +14,52 @@ resources:
14
14
  - resources/relationship-directions.md
15
15
  - resources/fact-lanes.md
16
16
  - resources/workflows.md
17
+ - resources/operation-access.md
17
18
  ---
18
-
19
19
  # Kibi Usage
20
20
 
21
- Consult this skill before any Kibi knowledge base operation, on first interaction with a Kibi-enabled repo, after detecting stale or dirty KB status, and before performing mutations.
21
+ Consult this skill before any Kibi knowledge base operation, on first interaction with a Kibi-enabled repo, after stale or dirty KB status is suspected, and before mutations.
22
+
23
+ ## Interface Selection
24
+
25
+ Use this order for every Kibi operation:
26
+
27
+ 1. If Kibi MCP tools are visible and approved in the current environment, use MCP.
28
+ 2. Otherwise, in a trusted workspace, use the project-local CLI through a non-installing runner: `npx --no-install kibi ...` or `bunx --no-install kibi ...`.
29
+ 3. If the project-local CLI is unavailable or too old for the needed route, stop and tell the operator to enable or install Kibi.
30
+ 4. Never use a global fallback or an installing runner. Never probe or install packages as a side effect of interface selection.
31
+
32
+ Use exact MCP tool names, dedicated CLI routes, input modes, effects, and Prolog requirements from `resources/operation-access.md`. Do not invent a generic operation runner. Do not read or edit files inside `.kb/` directly.
33
+
34
+ CLI JSON mode accepts MCP-shaped business input at `--input <file|->`.
35
+
36
+ ```bash
37
+ echo '{"type":"req","id":"REQ-001","properties":{"title":"Test","status":"open"}}' | npx --no-install kibi upsert --input -
38
+ ```
39
+
40
+ ```bash
41
+ echo '{"query":"authentication","limit":10}' | bunx --no-install kibi search --input -
42
+ ```
43
+
44
+ ## MCP Tool Names
22
45
 
23
- ## MCP-Only Rules
46
+ Kibi canonical MCP names include `kb_search`, `kb_query`, `kb_upsert`, `kb_check`, `kb_status`, `kb_validate_upsert`, and related `kb_*` tools. OpenCode may expose prefixed identifiers such as `kibi_kb_search`, `kibi_kb_query`, and `kibi_kb_upsert`. Use the visible Kibi MCP tool identifiers and map them back to canonical operations before reasoning about behavior.
24
47
 
25
- Interact with the knowledge base exclusively through MCP tools. Do not read or edit files inside `.kb/` directly. Do not run any `kibi` CLI commands from the agent session. The MCP surface is the only sanctioned interface for agents.
48
+ ## Discovery First
26
49
 
27
- ### Tool Name Prefixes
50
+ Always discover before you mutate. Start exploratory work with `kb_search` across metadata and markdown body text. Split broad queries into one to three focused probes and review top hits before concluding knowledge is absent.
28
51
 
29
- Kibi's canonical MCP names are `kb_search`, `kb_query`, `kb_upsert`, `kb_check`, and related `kb_*` tools. Some hosts add a server prefix when exposing tools to agents. In OpenCode, use the visible `kibi_kb_search`, `kibi_kb_query`, `kibi_kb_upsert`, and `kibi_kb_check` names when exact tool identifiers are required; they map to the same canonical MCP names.
52
+ Use `kb_query` for exact lookups by `id`, `type`, `tags`, or `sourceFile`. Use `kb_status` when branch attachment, freshness, or stale context could affect the decision. Mutate only after discovery confirms the target state.
30
53
 
31
- ## Discovery-First Workflow
54
+ ## Approval Boundaries
32
55
 
33
- Always discover before you mutate. Start with `kb_search` for exploratory discovery across metadata and markdown body text. Split broad queries into 1-3 focused probes. Review top hits for relevance before concluding the KB lacks knowledge.
56
+ Do not perform Kibi mutations unless the current task calls for knowledge-base changes or the user explicitly asks for them. Discovery and validation are acceptable when needed to understand impact, freshness, traceability, or existing requirements.
34
57
 
35
- Follow up with `kb_query` for exact lookups by `id`, `type`, `tags`, or `sourceFile`. Call `kb_status` to inspect branch attachment and freshness when stale context would affect decisions. Only after discovery and confirmation should you mutate.
58
+ Kibi guidance does not define a repository's package manager, branch names, release scripts, or publishing workflow. Follow the repository's own instructions for those concerns. Never use Kibi interface selection to install packages, change dependency manifests, or bypass sandbox and approval boundaries.
36
59
 
37
60
  ## Relationship Directions
38
61
 
39
- Relationship direction is fixed and semantic. Getting it wrong breaks traceability queries and validation.
62
+ Relationship direction is fixed and semantic. Reversed links break traceability queries and validation.
40
63
 
41
64
  | Relationship | Direction | Meaning |
42
65
  |-------------|-----------|---------|
@@ -47,23 +70,29 @@ Relationship direction is fixed and semantic. Getting it wrong breaks traceabili
47
70
  | `executable_for` | symbol -> test | Symbol is executable test code for a test entity |
48
71
  | `constrains` | req -> fact(subject) | Requirement constrains a domain fact |
49
72
  | `requires_property` | req -> fact(property_value) | Requirement requires a property value |
73
+ | `requires_predicate` | req -> fact(predicate) | Requirement requires a ground ontology predicate |
50
74
  | `supersedes` | old-req -> new-req | Old requirement is replaced by new requirement |
51
75
  | `covered_by` | symbol -> test | Production symbol has coverage evidence from a test |
52
76
 
53
- See `resources/relationship-directions.md` for detailed payload examples.
77
+ Before/after for reversed direction:
78
+
79
+ - Wrong: `relationships: [{ type: "implements", from: "REQ-001", to: "SYM-001" }]`
80
+ - Right: `relationships: [{ type: "implements", from: "SYM-001", to: "REQ-001" }]`
54
81
 
55
82
  ## Symbol-First Traceability
56
83
 
57
- Trace code through `symbol` entities, not inline legacy comments. Do not use legacy `// implements REQ-xxx` comments as the primary marker for new or modified code. If a symbol is new or its requirement ownership changes, create or update the `symbol` entity and add an `implements` relationship from the symbol to the requirement.
84
+ Preserve source-file traceability whenever creating or updating requirements, facts, scenarios, tests, or symbols. Prefer durable `sourceFile` references and symbol coordinates that point to tracked repository files. For code ownership, create or update a `symbol` entity and add an `implements` relationship from the symbol to the requirement; link symbols to tests with `covered_by` when coverage evidence is needed.
58
85
 
59
- Use comments only as a temporary backward-compatibility fallback when the symbol manifest cannot be updated in the same task. Prefer durable symbol coordinates in `documentation/symbols.yaml` and `documentation/symbol-coordinates.yaml`, then link those symbols through MCP relationships.
86
+ Do not use legacy `// implements REQ-xxx` comments as the primary marker for new or modified code. Use comments only as a temporary compatibility fallback when symbol metadata cannot be updated in the same task.
87
+
88
+ Preferred traceability model:
60
89
 
61
90
  ```yaml
62
- # Preferred traceability model
63
91
  symbol:
64
92
  id: SYM-admin-billing-policy
65
93
  title: Admin billing policy check
66
94
  status: active
95
+ sourceFile: src/admin/billing.ts
67
96
  relationships:
68
97
  - type: implements
69
98
  from: SYM-admin-billing-policy
@@ -75,17 +104,13 @@ relationships:
75
104
  Normative requirements that must participate in contradiction blocking use the strict fact lane. Create a `fact_kind: subject` fact and link it from the requirement via `constrains`. Create a `fact_kind: property_value` fact and link it via `requires_property`.
76
105
 
77
106
  ```yaml
78
- # Fact entity
79
107
  id: FACT-USER-ROLE
80
- title: User Role Assignment
81
- status: active
82
108
  fact_kind: subject
83
109
  subject_key: user.role_assignment
110
+ ```
84
111
 
85
- # Requirement entity
112
+ ```yaml
86
113
  id: REQ-019
87
- title: Users can have up to 3 roles
88
- status: open
89
114
  relationships:
90
115
  - type: constrains
91
116
  from: REQ-019
@@ -95,104 +120,110 @@ relationships:
95
120
  to: FACT-LIMIT-3
96
121
  ```
97
122
 
98
- See `resources/fact-lanes.md` for the full strict vs observation lane comparison.
123
+ Model one semantic claim per strict `property_value` fact. Reusing the same `subject_key` and `property_key` lets `domain-contradictions` compare requirements mechanically. If a new requirement intentionally changes a value, create a replacement requirement and link the old requirement to the new one with `supersedes` instead of leaving two current contradictory requirements.
124
+
125
+ Use `kb_model_requirement` for automated strict-fact modeling when available. It generates subject and property_value facts, links them with `constrains` and `requires_property`, and handles low-confidence downgrades to observation facts automatically.
126
+
127
+ Granular fact examples for coherence checks include `REQ-ROLE-SET-2` versus `REQ-ROLE-SET-3` on `user.roles.allowed_set` (`user,admin` versus `user,admin,superadmin`) and `REQ-ADMIN-CAN-MANAGE-BILLING` versus `REQ-ONLY-SUPERADMIN-MANAGES-BILLING` on `billing.manage.allowed_actor`. See `resources/fact-lanes.md`; `domain-contradictions` uses these canonical keys.
99
128
 
100
- ### Granular fact examples for coherence checks
129
+ ## Complete Logical Coverage
101
130
 
102
- Model one semantic claim per strict `property_value` fact. Reusing the same `subject_key` and `property_key` lets `domain-contradictions` compare requirements mechanically.
131
+ Readable prose is not evidence that a requirement is machine-checkable. Before treating a normative requirement as modeled, decompose its entire body into atomic normative clauses and ground every clause. One correct fact or relationship never proves that the other prose is covered.
103
132
 
104
- Incoherent role-set example: `REQ-ROLE-SET-2` says the allowed user roles are exactly `[user, admin]`, while `REQ-ROLE-SET-3` says the same property is exactly `[user, admin, superadmin]`. Both constrain `FACT-USER-ROLES` and require different values for `user.roles.allowed_set`, so they cannot both be current.
133
+ 1. Call `kb_semantic_advisor` with the complete requirement prose. When the automatic split is incomplete or a sentence contains multiple obligations, pass an explicit `clauses` array containing every atomic normative clause.
134
+ 2. Use the stable `claim_key` returned for each clause. Every ground `property_value` or `predicate` fact must preserve that key in `claim_key` and preserve the clause in `claim_text`. Use the advisor-returned inventory exactly; do not add punctuation or wording variants of an existing clause.
135
+ 3. Put the complete set of keys in the requirement's `logic_claims` manifest. Merge returned keys with existing values; never overwrite earlier claims while modeling a later clause.
136
+ 4. Ground each key through exactly one suitable logical lane: `requires_property` to one strict `property_value` fact, or `requires_predicate` to one ground `predicate` fact. A subject fact supports a strict claim but does not ground a key by itself. Observation, meta, ambiguity, and ontology-gap facts explicitly remain unresolved and do not count as logical coverage.
137
+ 5. Run `kb_check` with `logic-coverage`, `predicate-verifiability`, and `domain-contradictions`. `logic-coverage` enforces a one-claim/one-ground-fact mapping and rejects distinct claim keys that encode the same logical term; human or agent review still confirms that the atomic clauses exhaust the prose and that each ground term preserves its meaning.
138
+
139
+ Kibi emits a non-blocking logical-coverage debt diagnostic for every current requirement without a manifest, independent of title wording. The `logic-coverage` rule is enabled by default for requirements that do declare manifests, so an unfiltered final check catches missing or orphaned ground claims while legacy requirements remain explicit backfill work.
140
+
141
+ A complete `logic_claims` manifest alone is not a complete model. Semantic-advisor readiness remains partial until the payload has at least one distinct `requires_property` or `requires_predicate` grounding slot per normative claim. This count prevents one token edge from suppressing the remaining plans; only `logic-coverage` readback proves that each slot reaches the fact with the matching claim key.
142
+
143
+ Never invent, reuse across different clauses, or manually alter a claim key. Kibi derives it from `claim_text` and rejects mismatched mutation and Markdown inputs.
144
+
145
+ For a compound requirement, the manifest and linked facts form a clause-completeness contract:
105
146
 
106
147
  ```yaml
107
- subject:
108
- id: FACT-USER-ROLES
109
- fact_kind: subject
110
- subject_key: user.roles
111
-
112
- property_values:
113
- - id: FACT-USER-ROLES-ALLOWED-2
114
- fact_kind: property_value
115
- subject_key: user.roles
116
- property_key: user.roles.allowed_set
117
- operator: eq
118
- value_type: list
119
- value_json: '["user", "admin"]'
120
- - id: FACT-USER-ROLES-ALLOWED-3
121
- fact_kind: property_value
122
- subject_key: user.roles
123
- property_key: user.roles.allowed_set
124
- operator: eq
125
- value_type: list
126
- value_json: '["user", "admin", "superadmin"]'
127
-
128
- requirements:
129
- - id: REQ-ROLE-SET-2
130
- relationships:
131
- - { type: constrains, from: REQ-ROLE-SET-2, to: FACT-USER-ROLES }
132
- - { type: requires_property, from: REQ-ROLE-SET-2, to: FACT-USER-ROLES-ALLOWED-2 }
133
- - id: REQ-ROLE-SET-3
134
- relationships:
135
- - { type: constrains, from: REQ-ROLE-SET-3, to: FACT-USER-ROLES }
136
- - { type: requires_property, from: REQ-ROLE-SET-3, to: FACT-USER-ROLES-ALLOWED-3 }
148
+ requirement:
149
+ id: REQ-CHECKOUT-RETENTION
150
+ logic_claims: [CLAIM-A1B2C3D4E5F60718, CLAIM-18273645AABBCCDD]
151
+ facts:
152
+ - fact_kind: predicate
153
+ claim_key: CLAIM-A1B2C3D4E5F60718
154
+ claim_text: Checkout requires payment authorization before submission.
155
+ - fact_kind: property_value
156
+ claim_key: CLAIM-18273645AABBCCDD
157
+ claim_text: Customer data must be retained for 7 years.
137
158
  ```
138
159
 
139
- Incoherent permission example: `REQ-ADMIN-CAN-MANAGE-BILLING` says `admin` can manage billing, while `REQ-ONLY-SUPERADMIN-MANAGES-BILLING` says the only allowed actor is `superadmin`. Model both against `billing.manage.allowed_actor` with `operator: eq` so the conflict is explicit.
160
+ The example keys are illustrative; use only keys returned for the exact clause text.
161
+
162
+ ## Predicate Ontology Decision Tree
163
+
164
+ Preserve the readable requirement prose. Facts add a machine-queryable model; they do not replace prose, and stored predicate facts are data queried by Kibi's Prolog layer rather than executable Prolog supplied by the agent.
165
+
166
+ 1. Call `kb_semantic_advisor` on the complete prose, verify its atomic clause inventory, and choose one lane per clause.
167
+ 2. For each relational clause, call `kb_suggest_predicates` with that clause and the current `existingLogicClaims`. Read each candidate as a Prolog-shaped ground term `predicate_name(arg1,...,argN)`: the schema fixes the predicate name, arity, argument roles, and argument order.
168
+ 3. Accept a candidate only when its meaning and every ordered argument fit the prose. Use the returned `applyPlan`, including its exact `predicate_name`, `predicate_args`, `canonical_key`, and `polarity`; never invent a predicate name, reorder arguments, add variables, or write a raw Prolog clause.
169
+ 4. Create or confirm the requirement and `fact_kind: predicate` endpoints, preserve `claim_key` and `claim_text`, merge the returned `logicClaims` into the requirement, then link requirement -> predicate fact with `requires_predicate`. Treat the requirement's logical representation as the conjunction of every linked ground term. Encode a prohibition with `polarity: deny` on the fitting positive schema, not a made-up negative predicate. An `assert` and `deny` requirement over the same namespace, name, and ordered arguments are a blocking `domain-contradictions` conflict, so requirements must reuse the same canonical schema and argument vocabulary for equivalent domain claims.
170
+ 5. Use an existing built-in or project-local `fact_kind: predicate_schema`. Create a new schema only when the task explicitly authorizes ontology extension and supplies a stable name, arity, `argument_names`, and `argument_types`; otherwise record `fact_kind: observation` with `review:ontology-gap`.
171
+ 6. For each scalar, threshold, duration, boolean, enum-set, or cardinality clause, use `kb_model_requirement` with the current `existingLogicClaims` and the strict subject/property lane instead. For ambiguity or a lexical false positive, preserve the prose as a review observation and report the requirement as logically incomplete.
172
+ 7. Validate every payload, create endpoints first, apply `kb_upsert` calls sequentially, read back all affected IDs, and run targeted `logic-coverage`, `predicate-verifiability`, and `domain-contradictions` checks before the final unfiltered `kb_check`. Exact query output can return an array when one relationship type has multiple targets; verify every target rather than reading only one edge.
173
+
174
+ Example: “Checkout requires payment authorization before order submission” fits `dependency_rule(subject, prerequisite, dependent)`. The ground model is `dependency_rule(checkout,payment_authorization,order_submission)`, stored as:
140
175
 
141
176
  ```yaml
142
- property_values:
143
- - id: FACT-BILLING-MANAGE-ACTOR-ADMIN
144
- fact_kind: property_value
145
- subject_key: billing.manage
146
- property_key: billing.manage.allowed_actor
147
- operator: eq
148
- value_type: string
149
- value_string: admin
150
- - id: FACT-BILLING-MANAGE-ACTOR-SUPERADMIN
151
- fact_kind: property_value
152
- subject_key: billing.manage
153
- property_key: billing.manage.allowed_actor
154
- operator: eq
155
- value_type: string
156
- value_string: superadmin
177
+ fact_kind: predicate
178
+ predicate_name: dependency_rule
179
+ predicate_args: [checkout, payment_authorization, order_submission]
180
+ canonical_key: dependency_rule(checkout,payment_authorization,order_submission)
181
+ polarity: assert
182
+ claim_key: <claim key returned by kb_semantic_advisor>
183
+ claim_text: Checkout requires payment authorization before order submission.
157
184
  ```
158
185
 
159
- If a new requirement intentionally changes a value, create a replacement requirement and link the old requirement to the new one with `supersedes` instead of leaving two current contradictory requirements.
186
+ Link the requirement to that predicate fact with `requires_predicate`. Do not use `verified_by`, `requires_predicate`, or another relationship type as the `predicate_name`; graph relationships and ontology predicates are different layers.
187
+
188
+ Detailed built-in, project-local, deny, strict-scalar, ambiguous, false-positive, and ontology-gap examples are immutable reference material in `resources/fact-lanes.md` and `resources/workflows.md`.
160
189
 
161
190
  ## Fact vs Flag
162
191
 
163
- Use `flag` for runtime or config gates only. Feature flags, kill-switches, and deferred capabilities are valid `flag` entities.
192
+ Use `flag` for runtime or config gates only, such as feature flags, kill-switches, and deferred capabilities.
164
193
 
165
- Bugs, incidents, and workarounds belong in `fact` entities with `fact_kind: observation` or `meta`. These fact kinds are excluded from contradiction inference, making them appropriate for non-blocking evidence.
194
+ Bugs, incidents, and workarounds belong in `fact` entities with `fact_kind: observation` or `meta`. These fact kinds are excluded from contradiction inference, making them appropriate for non-blocking evidence. Do not create a `flag` named like a bug to track a defect.
166
195
 
167
- Anti-example: do not create a `flag` named `BUG-123` to track a defect. Create a `fact` with `fact_kind: observation` instead.
196
+ ## Create Before Link
168
197
 
169
- ## Create-Before-Link
198
+ Always confirm or create endpoint entities before linking them. Query target IDs with `kb_query` first. If an endpoint does not exist, create it with `kb_upsert` before creating the relationship. Relationships to missing entities produce dangling references that `kb_check` will flag.
170
199
 
171
- Always confirm or create endpoint entities before linking them. Query target IDs with `kb_query` first. If an endpoint does not exist, create it with `kb_upsert` before creating the relationship. Creating relationships to non-existent entities produces dangling references that `kb_check` will flag.
200
+ For `kb_upsert`, keep relationship rows anchored to the entity being upserted: each row's `from` must equal the upserted entity ID. If you need a `SYM -> REQ` link, upsert the symbol endpoint first, then link that symbol to the requirement.
172
201
 
173
- For `kb_upsert`, keep relationship rows anchored to the entity you are upserting: each row's `from` must equal the upserted entity ID. If you need a `SYM -> REQ` link, upsert the symbol endpoint first, then link that symbol to the requirement.
202
+ Keep symbol payloads minimal: include only fields needed to identify the symbol, status, and source traceability. Put extra prose, examples, or audit notes in documentation or evidence artifacts instead of custom `kb_upsert.properties`; strict `kb_upsert.properties` rejects unknown fields.
174
203
 
175
- Keep symbol payloads minimal: include only the fields needed to identify the symbol, its status, and its source traceability. Put extra prose, examples, or audit notes in docs or evidence files instead of custom `kb_upsert.properties`; strict `kb_upsert.properties` rejects unknown fields.
204
+ When a generic `Query failed` appears, do not keep retrying the same payload. First call `kb_validate_upsert`, query or create missing endpoints, reduce the payload to required fields, and retry once. If it still fails, report the blocker.
176
205
 
177
- When a generic `Query failed` appears, do not keep retrying the same payload. First call `kb_validate_upsert`, query or create the missing endpoints, reduce the payload to the minimum required fields, and retry once. If it still fails, report the blocker instead of looping.
206
+ ## Small Behavior Fix Impact Evidence
178
207
 
179
- ## Sequential Upserts
208
+ For a behavior-changing source edit, first query for an existing requirement. If no requirement exists, create one for the corrected behavior. Model strict facts from that requirement when the invariant is contradiction-sensitive.
180
209
 
181
- Never fire `kb_upsert` calls in parallel. Execute them sequentially to avoid lock contention and ensure deterministic ordering. This is especially important when creating chains of related entities.
210
+ Do not link facts directly to tests. Facts describe invariants; requirements or scenarios are verified by executable tests. Use `REQ -> TEST` with `verified_by` or `TEST -> REQ` with `validates`, then link the requirement to facts with `constrains` and `requires_property`. Link touched production symbols to requirements with `implements` and to tests with `covered_by` when coverage evidence is needed.
182
211
 
183
- ## Targeted and Final Checks
212
+ Kibi operation writes do not automatically stage markdown evidence. When a staged hook requires impact evidence, ensure tracked documentation artifacts for requirements, facts, tests, symbol metadata, or coordinate refreshes are authored and staged alongside source changes.
184
213
 
185
- Run `kb_check` with specific rules during iteration for fast feedback. For example, use `rules: ["required-fields", "no-dangling-refs"]` after small changes. Run a full `kb_check` without rule filters before declaring work complete.
214
+ ## Sequential Upserts
186
215
 
187
- ## Domain Contradictions and Evolution
216
+ Never fire `kb_upsert` calls in parallel. Execute them sequentially to avoid lock contention and ensure deterministic ordering, especially when creating chains of related entities.
188
217
 
189
- The `domain-contradictions` rule detects conflicts between strict-lane facts linked to requirements. When a contradiction is found, the supported escape hatch is `supersedes`: create a new requirement that supersedes the old one, then link the new requirement to updated facts.
218
+ ## Checks
190
219
 
191
- Use `kb_model_requirement` for automated strict-fact modeling. It generates the subject and property_value facts, links them via `constrains` and `requires_property`, and handles low-confidence downgrades to `observation` facts automatically.
220
+ Run `kb_check` with specific rules during iteration for fast feedback. For normative requirement modeling, include `rules: ["logic-coverage", "predicate-verifiability", "domain-contradictions"]`; add `required-fields` and `no-dangling-refs` after writes. Run a full `kb_check` without rule filters before declaring Kibi work complete.
221
+
222
+ The `domain-contradictions` rule detects conflicts between strict-lane facts linked to requirements. When a contradiction is found, the supported escape hatch is `supersedes`: create a new requirement that supersedes the old one, then link the new requirement to updated facts.
192
223
 
193
224
  ## Stale or Dirty KB Handling
194
225
 
195
- Call `kb_status` when you suspect the branch KB is stale or when switching context. Report freshness findings to the user rather than relying on outdated KB context. If `kb_status` indicates a schema migration is needed, ask the user or operator to handle it outside the agent session.
226
+ Call `kb_status` when branch KB context may be stale or after switching context. Report freshness findings to the user rather than relying on outdated KB context. If `kb_status` indicates a schema migration is needed, ask the user or operator to handle it outside the agent session.
196
227
 
197
228
  ## Anti-Patterns and Remediation
198
229
 
@@ -206,11 +237,8 @@ Call `kb_status` when you suspect the branch KB is stale or when switching conte
206
237
  | Missing `kb_check` | Undetected dangling refs and violations | Run targeted checks during work, full check at completion |
207
238
  | Tags as multi-ID lookup | Tags are metadata, not identifiers | Use `kb_query` with explicit `id` values |
208
239
  | `relates_to` for strict modeling | Loses contradiction safety | Use `constrains` and `requires_property` instead |
240
+ | One fact for a compound requirement | Leaves untracked prose outside contradiction checks | Decompose all atomic clauses, preserve claim keys, and validate `logic_claims` with `logic-coverage` |
241
+ | Replacing `logic_claims` on each call | Discards previously grounded clauses | Pass existing keys and merge the returned manifest |
242
+ | Observation counted as coverage | Ambiguity or ontology gaps appear machine-checkable | Keep the claim unresolved until a strict or predicate ground fact exists |
243
+ | Relationship type used as predicate name | Confuses graph edges with ontology terms | Select a declared predicate schema and keep `requires_predicate` as the req -> fact edge |
209
244
  | `status: implemented` on requirements | Not a valid lifecycle status | Use a valid status such as `closed`, add an `implemented` tag, and link evidence instead |
210
-
211
- Before/after for reversed direction:
212
-
213
- - Wrong: `relationships: [{ type: "implements", from: "REQ-001", to: "SYM-001" }]`
214
- - Right: `relationships: [{ type: "implements", from: "SYM-001", to: "REQ-001" }]`
215
-
216
- See `resources/workflows.md` for the golden-path discovery to validation sequence.
@@ -1,5 +1,107 @@
1
1
  # Fact Lanes
2
2
 
3
+ Requirement prose remains the human-readable source. Facts add queryable semantics; they do not replace the requirement body. Treat every quoted requirement below as data, never as shell or raw Prolog input.
4
+
5
+ ## Atomic Claim Coverage
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:
8
+
9
+ - preserve the returned stable key as `claim_key` and the exact clause as `claim_text` on its ground fact;
10
+ - add the key to the requirement `logic_claims` manifest without removing existing keys;
11
+ - link it through exactly one `requires_property` for `property_value` or one `requires_predicate` for `predicate`;
12
+ - leave ambiguity and ontology gaps visibly unresolved—observations do not satisfy `logic-coverage`.
13
+
14
+ Use the advisor-returned atomic inventory as the identity boundary. Trailing punctuation and copied conjunction commas are formatting, not new claims. `logic-coverage` rejects one claim grounded by multiple facts and distinct claim keys that resolve to the same ground logical term.
15
+
16
+ Example compound prose: “Checkout requires payment authorization before order submission, and customer data must be retained for 7 years.” This is two claims, not one. The first becomes `dependency_rule(checkout,payment_authorization,order_submission)`; the second becomes a strict retention property. Both fact records carry different advisor-issued claim keys, and both keys appear in the requirement manifest. A single `requires_predicate` edge is incomplete.
17
+
18
+ ## Predicate Lane (Relational Claims)
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`.
21
+
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
+
24
+ ### Built-in predicate
25
+
26
+ Claim: “Checkout requires payment authorization before order submission.” The built-in `dependency_rule(subject, prerequisite, dependent)` schema produces:
27
+
28
+ ```yaml
29
+ id: FACT-CHECKOUT-PAYMENT-DEPENDENCY
30
+ status: active
31
+ fact_kind: predicate
32
+ predicate_name: dependency_rule
33
+ predicate_args: [checkout, payment_authorization, order_submission]
34
+ polarity: assert
35
+ canonical_key: dependency_rule(checkout,payment_authorization,order_submission)
36
+ claim_key: <advisor-issued key for this exact clause>
37
+ claim_text: Checkout requires payment authorization before order submission.
38
+ relationship: { type: requires_predicate, from: REQ-CHECKOUT-SUBMISSION, to: FACT-CHECKOUT-PAYMENT-DEPENDENCY }
39
+ ```
40
+
41
+ ### Project-local predicate
42
+
43
+ If the project has an approved `commit_action(subject, trigger, object)` predicate schema, “Editor annotation drafts autosave on navigation” may use:
44
+
45
+ ```yaml
46
+ id: FACT-EDITOR-DRAFT-AUTOSAVE
47
+ status: active
48
+ fact_kind: predicate
49
+ predicate_name: commit_action
50
+ predicate_args: [editor.annotation, navigation, draft]
51
+ polarity: assert
52
+ canonical_key: commit_action(editor.annotation,navigation,draft)
53
+ relationship: { type: requires_predicate, from: REQ-EDITOR-DRAFT-AUTOSAVE, to: FACT-EDITOR-DRAFT-AUTOSAVE }
54
+ ```
55
+
56
+ The project-local schema endpoint must exist before this fact is linked. When ontology extension is explicitly authorized, define it first with `fact_kind: predicate_schema`, `predicate_name`, `predicate_arity`, and equally sized `argument_names` and `argument_types`. Without an authorized stable signature, record `review:ontology-gap` instead of inventing a schema.
57
+
58
+ ### Deny predicate
59
+
60
+ Claim: “Suspended users must not publish articles.” When `permission_rule` fits, preserve its positive schema name and encode prohibition as polarity:
61
+
62
+ ```yaml
63
+ id: FACT-SUSPENDED-PUBLISH-DENIED
64
+ status: active
65
+ fact_kind: predicate
66
+ predicate_name: permission_rule
67
+ predicate_args: [suspended_user, publish, article]
68
+ polarity: deny
69
+ canonical_key: permission_rule(suspended_user,publish,article)
70
+ claim_key: <advisor-issued key for this exact clause>
71
+ claim_text: Suspended users must not publish articles.
72
+ relationship: { type: requires_predicate, from: REQ-SUSPENDED-PUBLISH-DENIED, to: FACT-SUSPENDED-PUBLISH-DENIED }
73
+ ```
74
+
75
+ If another current requirement links an `assert` fact with the same predicate namespace, name, and ordered arguments, `domain-contradictions` reports the pair. More complex semantic conflicts require a shared canonical schema and arguments; do not assume Kibi can prove arbitrary equivalence between differently shaped predicates.
76
+
77
+ The full logical representation of a requirement is the conjunction of all of its linked ground property and predicate terms. Conditions, exceptions, permissions, and ordering constraints remain explicit arguments of their declared schemas. Contradiction detection therefore depends on equivalent prose reusing the same predicate name, argument roles, ordered canonical values, and opposing polarity rather than inventing synonymous terms.
78
+
79
+ ### Strict scalar
80
+
81
+ 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`.
82
+
83
+ ### Ambiguous claim
84
+
85
+ Claim: “Premium accounts get better support.” “Better” does not identify a stable relation or scalar. Keep readable prose and create a `fact_kind: observation` tagged `review:ambiguity`; request clarification before adding strict or predicate facts.
86
+
87
+ ### False-positive trap
88
+
89
+ Claim: “Suspended users must not publish articles.” A lexical match such as `publishes_event` is semantically wrong because an article is not a domain event. Reject that candidate and use the suitable permission schema if one is returned; otherwise use a review observation. Candidate rank alone is never proof of suitability.
90
+
91
+ ### Ontology gap
92
+
93
+ Claim: “Annotations remain anchored to selected text after edits.” If no returned built-in or approved project-local schema expresses anchoring preservation, do not invent one:
94
+
95
+ ```yaml
96
+ id: FACT-ONTOLOGY-GAP-ANNOTATION-ANCHOR
97
+ status: active
98
+ fact_kind: observation
99
+ tags: [review:ontology-gap]
100
+ text_ref: docs/requirements/annotation-anchor.md
101
+ ```
102
+
103
+ An ontology-gap observation records review work; it does not make the requirement machine-checkable.
104
+
3
105
  ## Strict Lane (Contradiction-Safe)
4
106
 
5
107
  ### fact_kind: subject
@@ -30,7 +132,7 @@ Granular strict facts work best when each `property_value` represents one semant
30
132
 
31
133
  ### Role set conflict
32
134
 
33
- `REQ-ROLE-SET-2` and `REQ-ROLE-SET-3` are incoherent if both are current: they each define the exact allowed role set, but one allows two roles and the other allows three.
135
+ `REQ-ROLE-SET-2` and `REQ-ROLE-SET-3` are incoherent if both are current: they each define the exact allowed role set, but one allows two roles and the other allows three. Encode compact set values as canonical strings because the strict property schema supports string, int, number, and bool values.
34
136
 
35
137
  ```yaml
36
138
  subject:
@@ -48,8 +150,8 @@ property_values:
48
150
  subject_key: user.roles
49
151
  property_key: user.roles.allowed_set
50
152
  operator: eq
51
- value_type: list
52
- value_json: '["user", "admin"]'
153
+ value_type: string
154
+ value_string: user,admin
53
155
  - id: FACT-USER-ROLES-ALLOWED-3
54
156
  title: User, admin, and superadmin roles
55
157
  status: active
@@ -57,8 +159,8 @@ property_values:
57
159
  subject_key: user.roles
58
160
  property_key: user.roles.allowed_set
59
161
  operator: eq
60
- value_type: list
61
- value_json: '["user", "admin", "superadmin"]'
162
+ value_type: string
163
+ value_string: user,admin,superadmin
62
164
 
63
165
  relationships:
64
166
  - { type: constrains, from: REQ-ROLE-SET-2, to: FACT-USER-ROLES }
@@ -0,0 +1,44 @@
1
+ # Kibi Operation Access Catalog
2
+
3
+ This table is the machine-readable interface map for Kibi's shared operation catalog. Every CLI route shown is dedicated; there is no generic operation runner. `--input JSON or flags` means the route supports exact MCP-shaped JSON from a file or stdin as well as its established human flags. `--input JSON` means the dedicated parity route is JSON-only.
4
+
5
+ | MCP tool name | CLI route | Input mode | Mutability | Requires Prolog | Effects | Capability preference |
6
+ |---|---|---|---|---|---|---|
7
+ | `kb_skills_list` | `skills-list` | `--input JSON` | read | no | `local-read` | MCP-first; CLI-fallback |
8
+ | `kb_skills_load` | `skills-load` | `--input JSON` | read | no | `local-read` | MCP-first; CLI-fallback |
9
+ | `kb_skills_read` | `skills-read` | `--input JSON` | read | no | `local-read` | MCP-first; CLI-fallback |
10
+ | `kb_query` | `query` | `--input JSON or flags` | read | yes | `kb-read` | MCP-first; CLI-fallback |
11
+ | `kb_search` | `search` | `--input JSON or flags` | read | yes | `kb-read` | MCP-first; CLI-fallback |
12
+ | `kb_status` | `status` | `--input JSON or flags` | read | yes | `kb-read, workspace-read` | MCP-first; CLI-fallback |
13
+ | `kb_find_gaps` | `find-gaps` | `--input JSON or flags` | read | yes | `kb-read` | MCP-first; CLI-fallback |
14
+ | `kb_coverage` | `coverage` | `--input JSON or flags` | read | yes | `kb-read` | MCP-first; CLI-fallback |
15
+ | `kb_graph` | `graph` | `--input JSON or flags` | read | yes | `kb-read` | MCP-first; CLI-fallback |
16
+ | `kb_semantic_advisor` | `semantic-advisor` | `--input JSON` | read | no | `local-read` | MCP-first; CLI-fallback |
17
+ | `kb_model_requirement` | `model-requirement` | `--input JSON` | read | yes | `kb-read` | MCP-first; CLI-fallback |
18
+ | `kb_suggest_predicates` | `suggest-predicates` | `--input JSON` | read | yes | `kb-read` | MCP-first; CLI-fallback |
19
+ | `kb_autopilot_generate` | `autopilot-generate` | `--input JSON` | read | no | `workspace-read` | MCP-first; CLI-fallback |
20
+ | `kb_validate_upsert` | `validate-upsert` | `--input JSON` | read | yes | `kb-read` | MCP-first; CLI-fallback |
21
+ | `kb_upsert` | `upsert` | `--input JSON` | write | yes | `kb-write, workspace-write` | MCP-first; CLI-fallback |
22
+ | `kb_delete` | `delete` | `--input JSON` | write | yes | `kb-write, workspace-write` | MCP-first; CLI-fallback |
23
+ | `kb_check` | `check` | `--input JSON or flags` | read | yes | `kb-read, workspace-read` | MCP-first; CLI-fallback |
24
+ | `kb_sparql_remote` | `sparql-remote` | `--input JSON` | read | no | `network-read` | MCP-first; CLI-fallback |
25
+
26
+ ## JSON execution recipes
27
+
28
+ Use the project-local, non-installing runner from a trusted workspace. Stdin must contain exactly one UTF-8 JSON object.
29
+
30
+ ```bash
31
+ echo '{"query":"authentication","type":"req","limit":10}' | npx --no-install kibi search --input -
32
+ ```
33
+
34
+ ```bash
35
+ echo '{"type":"req","id":"REQ-001","properties":{"title":"Test","status":"open"}}' | npx --no-install kibi upsert --input -
36
+ ```
37
+
38
+ ```bash
39
+ echo '{"rules":["required-fields","no-dangling-refs"]}' | bunx --no-install kibi check --input -
40
+ ```
41
+
42
+ ## Telemetry handling
43
+
44
+ `_diagnostic_telemetry` is adapter metadata, not business input. In CLI JSON mode the adapter may validate and extract it for CLI usage logging before shared execution. In MCP diagnostic mode the adapter enforces its configured telemetry requirement and strips the field before shared execution. Never copy telemetry into entity properties or operation business input.
@@ -87,3 +87,33 @@ relationships:
87
87
  from: SYM-handler
88
88
  to: TEST-005
89
89
  ```
90
+
91
+ ## Invalid Test-Fact Shortcuts
92
+
93
+ Do not model small behavior fixes as direct test-fact pairs. Facts describe invariants; requirements or scenarios are verified by tests.
94
+
95
+ ```yaml
96
+ # WRONG: fact -> test is not a valid verified_by shape
97
+ relationships:
98
+ - type: verified_by
99
+ from: FACT-HEADER-AVATAR-INITIAL-UPPERCASE
100
+ to: TEST-AVATAR-HEADER-FALLBACK
101
+
102
+ # WRONG: test -> fact is not a valid validates shape
103
+ relationships:
104
+ - type: validates
105
+ from: TEST-AVATAR-HEADER-FALLBACK
106
+ to: FACT-HEADER-AVATAR-INITIAL-UPPERCASE
107
+ ```
108
+
109
+ Use a requirement as the verification target/source, then link that requirement to strict facts:
110
+
111
+ ```yaml
112
+ relationships:
113
+ - type: verified_by
114
+ from: REQ-HEADER-AVATAR-INITIAL-UPPERCASE
115
+ to: TEST-AVATAR-HEADER-FALLBACK
116
+ - type: requires_property
117
+ from: REQ-HEADER-AVATAR-INITIAL-UPPERCASE
118
+ to: FACT-HEADER-AVATAR-INITIAL-UPPERCASE
119
+ ```
@@ -7,9 +7,14 @@ The canonical workflow for any KB operation follows this pattern:
7
7
  1. **Discover**: `kb_search` with focused probes
8
8
  2. **Confirm**: `kb_query` for exact IDs and state
9
9
  3. **Inspect**: `kb_status` when freshness matters
10
- 4. **Create endpoints**: `kb_upsert` for new entities (sequential)
11
- 5. **Link**: `kb_upsert` with relationship rows (sequential)
12
- 6. **Validate**: `kb_check` with targeted rules during work, full check at completion
10
+ 4. **Decompose**: `kb_semantic_advisor` on the complete normative prose; verify or supply every atomic clause
11
+ 5. **Choose per-clause lanes**: `kb_suggest_predicates` for relational clauses; `kb_model_requirement` for strict scalar clauses; observation review for ambiguity, false positives, and ontology gaps
12
+ 6. **Preflight**: `kb_validate_upsert` for every intended entity or relationship payload
13
+ 7. **Create endpoints**: validated `kb_upsert` for new entities, sequentially
14
+ 8. **Link**: validated `kb_upsert` with `requires_predicate`, `constrains`, or `requires_property`, sequentially
15
+ 9. **Validate coverage and consistency**: targeted `logic-coverage`, `predicate-verifiability`, and `domain-contradictions`, then final full `kb_check`
16
+
17
+ Every current requirement without `logic_claims` remains visible as non-blocking backfill debt. Once a manifest exists, the default unfiltered check enforces its correspondence to linked ground facts.
13
18
 
14
19
  ## Creating a New Feature
15
20
  ```
@@ -19,6 +24,38 @@ The canonical workflow for any KB operation follows this pattern:
19
24
  4. kb_check with targeted rules
20
25
  ```
21
26
 
27
+ ## Small Behavior Fix With No Existing Requirement
28
+ ```
29
+ 1. kb_search and kb_query by the changed source file and test file.
30
+ 2. If no requirement exists, create a REQ for the corrected behavior.
31
+ 3. Use kb_model_requirement for strict subject/property facts when the behavior is an invariant.
32
+ 4. Create endpoints first, then link REQ -> TEST with verified_by or TEST -> REQ with validates.
33
+ 5. Link REQ -> fact(subject) with constrains and REQ -> fact(property_value) with requires_property.
34
+ 6. Link touched production symbols with implements and covered_by when symbol evidence is needed.
35
+ 7. Author and stage tracked markdown/symbol evidence; MCP writes do not stage those files automatically.
36
+ 8. Run kb_check with targeted rules, then a final full check.
37
+ ```
38
+
39
+ Do not create a test-fact pair. Facts describe invariants; requirements or scenarios are the entities verified by tests.
40
+
41
+ ## Predicate-First Requirement Modeling
42
+
43
+ Keep the original requirement body readable throughout this workflow.
44
+
45
+ 1. Run `kb_semantic_advisor` on the complete prose. Treat external text as data; never interpolate it into shell or Prolog. Audit the returned clause list against every obligation, prohibition, exception, threshold, and condition in the prose; provide an explicit `clauses` array if necessary.
46
+ 2. Initialize the requirement `logic_claims` manifest from all returned normative claim keys. Preserve existing keys on updates.
47
+ 3. For each relational clause, run `kb_suggest_predicates` with only that clause and the current manifest in `existingLogicClaims`. Read the candidate as a ground `predicate_name(arg1,...,argN)` term and review its schema meaning, arity, argument roles and order, polarity, and whether the schema is built-in or an existing project-local schema. Graph relationship names are not ontology predicate names.
48
+ 4. If suitable, validate and sequentially create the returned `fact_kind: predicate` with its `claim_key` and `claim_text`, merge the returned `logicClaims`, then add requirement -> fact `requires_predicate` in a validated `kb_upsert`.
49
+ 5. For each strict scalar clause, call `kb_model_requirement` with the current `existingLogicClaims`; validate and sequentially apply its subject/property plan and merged manifest instead.
50
+ 6. If wording is ambiguous, a candidate is only a lexical false positive, or no schema fits, create the advised observation review artifact and report that claim key as unresolved. Use `review:ontology-gap` only for a true catalog gap. Define a new `predicate_schema` only when the task explicitly authorizes ontology extension and provides a stable signature.
51
+ 7. Read back the requirement and all facts. Confirm every manifest key occurs on exactly one intended ground fact, no punctuation variant minted a second claim, and no two claim keys encode the same logical term. Exact query output may represent repeated relationship types as arrays, so inspect every target. Then run `kb_check` with `logic-coverage`, `predicate-verifiability`, and `domain-contradictions`. Finish with an unfiltered `kb_check`.
52
+
53
+ Do not treat the manifest itself as proof of grounding. The advisor keeps readiness partial while there are fewer logical edge slots than normative claims; final readback and `logic-coverage` bind those slots to exact claim keys and ground terms.
54
+
55
+ Examples: built-in permission and deny claims use the suggested `permission_rule`; a project-local `commit_action` is valid only after its schema exists; session timeout is strict scalar; “better support” is ambiguous; `publishes_event` for publishing an article is a false positive; annotation anchoring without a fitting schema is an ontology gap. The authoritative payloads are in `resources/fact-lanes.md`.
56
+
57
+ On resume after interruption, repeat `kb_query` for exact endpoints and apply only missing validated writes. Keep `kb_upsert` concurrency at one.
58
+
22
59
  ## Fixing a Traceability Gap
23
60
  ```
24
61
  1. kb_query --sourceFile <code-file> to find linked entities