kibi-cli 2.5.2 → 2.6.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 (138) hide show
  1. package/dist/cli-operation-metadata.d.ts +1 -1
  2. package/dist/cli-operation-metadata.js +1 -1
  3. package/dist/commands/check.d.ts.map +1 -1
  4. package/dist/commands/check.js +15 -0
  5. package/dist/commands/init-helpers.js +1 -1
  6. package/dist/commands/migrate.d.ts.map +1 -1
  7. package/dist/commands/migrate.js +43 -0
  8. package/dist/entity-body-context.d.ts +132 -0
  9. package/dist/entity-body-context.d.ts.map +1 -0
  10. package/dist/entity-body-context.js +382 -0
  11. package/dist/extractors/markdown.d.ts +13 -0
  12. package/dist/extractors/markdown.d.ts.map +1 -1
  13. package/dist/extractors/markdown.js +19 -2
  14. package/dist/intent-search.d.ts.map +1 -1
  15. package/dist/intent-search.js +4 -4
  16. package/dist/operations/bootstrap/candidate-helpers.d.ts +18 -0
  17. package/dist/operations/bootstrap/candidate-helpers.d.ts.map +1 -1
  18. package/dist/operations/bootstrap/candidate-helpers.js +35 -0
  19. package/dist/operations/bootstrap/candidates.d.ts.map +1 -1
  20. package/dist/operations/bootstrap/candidates.js +4 -2
  21. package/dist/operations/bootstrap/generate.d.ts.map +1 -1
  22. package/dist/operations/bootstrap/generate.js +24 -15
  23. package/dist/operations/bootstrap/intent-claims.d.ts.map +1 -1
  24. package/dist/operations/bootstrap/intent-claims.js +210 -5
  25. package/dist/operations/bootstrap/markdown-candidates.d.ts.map +1 -1
  26. package/dist/operations/bootstrap/markdown-candidates.js +7 -3
  27. package/dist/operations/bootstrap/presentation.d.ts +8 -0
  28. package/dist/operations/bootstrap/presentation.d.ts.map +1 -1
  29. package/dist/operations/bootstrap/presentation.js +66 -8
  30. package/dist/operations/bootstrap/types.d.ts +21 -0
  31. package/dist/operations/bootstrap/types.d.ts.map +1 -1
  32. package/dist/operations/bootstrap/types.js +10 -0
  33. package/dist/operations/migration/entity-body-context.d.ts +57 -0
  34. package/dist/operations/migration/entity-body-context.d.ts.map +1 -0
  35. package/dist/operations/migration/entity-body-context.js +261 -0
  36. package/dist/operations/migration/polarity-values.d.ts.map +1 -1
  37. package/dist/operations/migration/polarity-values.js +5 -2
  38. package/dist/operations/migration/schema6.d.ts +2 -0
  39. package/dist/operations/migration/schema6.d.ts.map +1 -1
  40. package/dist/operations/migration/schema6.js +69 -0
  41. package/dist/operations/modeling/logic-modeling.d.ts.map +1 -1
  42. package/dist/operations/modeling/logic-modeling.js +3 -1
  43. package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
  44. package/dist/operations/modeling/model-requirement.js +7 -9
  45. package/dist/operations/mutation/context-warning.d.ts +13 -0
  46. package/dist/operations/mutation/context-warning.d.ts.map +1 -0
  47. package/dist/operations/mutation/context-warning.js +59 -0
  48. package/dist/operations/mutation/origin.d.ts +2 -1
  49. package/dist/operations/mutation/origin.d.ts.map +1 -1
  50. package/dist/operations/mutation/origin.js +7 -18
  51. package/dist/operations/mutation/requirement-semantics.d.ts +16 -0
  52. package/dist/operations/mutation/requirement-semantics.d.ts.map +1 -0
  53. package/dist/operations/mutation/requirement-semantics.js +64 -0
  54. package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
  55. package/dist/operations/mutation/source-authoring.js +10 -0
  56. package/dist/operations/mutation/stored-entity.d.ts +20 -0
  57. package/dist/operations/mutation/stored-entity.d.ts.map +1 -0
  58. package/dist/operations/mutation/stored-entity.js +51 -0
  59. package/dist/operations/mutation/upsert.d.ts +3 -2
  60. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  61. package/dist/operations/mutation/upsert.js +19 -10
  62. package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
  63. package/dist/operations/mutation/validate-upsert.js +6 -1
  64. package/dist/operations/planning/compile-intent.d.ts +9 -0
  65. package/dist/operations/planning/compile-intent.d.ts.map +1 -1
  66. package/dist/operations/planning/compile-intent.js +49 -2
  67. package/dist/operations/semantic-advisor/analyze-prose.d.ts +3 -2
  68. package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
  69. package/dist/operations/semantic-advisor/analyze-prose.js +3 -41
  70. package/dist/operations/semantic-advisor/ingestion-boundary.d.ts.map +1 -1
  71. package/dist/operations/semantic-advisor/ingestion-boundary.js +10 -1
  72. package/dist/operations/semantic-advisor/proposition-role.d.ts +6 -0
  73. package/dist/operations/semantic-advisor/proposition-role.d.ts.map +1 -0
  74. package/dist/operations/semantic-advisor/proposition-role.js +76 -0
  75. package/dist/public/operations/catalog.d.ts +78 -9
  76. package/dist/public/operations/catalog.d.ts.map +1 -1
  77. package/dist/public/operations/check-executor.d.ts.map +1 -1
  78. package/dist/public/operations/check-executor.js +3 -0
  79. package/dist/public/operations/entity-context.d.ts +51 -0
  80. package/dist/public/operations/entity-context.d.ts.map +1 -0
  81. package/dist/public/operations/entity-context.js +235 -0
  82. package/dist/public/operations/origin-review.d.ts +1 -1
  83. package/dist/public/operations/origin-review.js +2 -2
  84. package/dist/public/operations/specs/bootstrap.d.ts +59 -5
  85. package/dist/public/operations/specs/bootstrap.d.ts.map +1 -1
  86. package/dist/public/operations/specs/bootstrap.js +48 -6
  87. package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
  88. package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
  89. package/dist/public/operations/specs/check-rules.generated.js +3 -1
  90. package/dist/public/operations/specs/check.d.ts +1 -1
  91. package/dist/public/operations/specs/mutation-schemas.d.ts +1 -1
  92. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
  93. package/dist/public/operations/specs/mutation-schemas.js +10 -2
  94. package/dist/public/operations/specs/planning.d.ts +15 -0
  95. package/dist/public/operations/specs/planning.d.ts.map +1 -1
  96. package/dist/public/operations/specs/planning.js +15 -0
  97. package/dist/public/operations/specs/upsert.d.ts +3 -3
  98. package/dist/public/operations/specs/upsert.js +2 -2
  99. package/dist/public/schemas/entity.d.ts.map +1 -1
  100. package/dist/public/schemas/entity.js +7 -1
  101. package/dist/public/skills/kibi-bootstrap/SKILL.md +13 -7
  102. package/dist/public/skills/kibi-bootstrap/resources/bootstrap.md +9 -2
  103. package/dist/public/skills/kibi-usage/SKILL.md +56 -3
  104. package/dist/public/skills/kibi-usage/resources/source-authoring.md +5 -1
  105. package/dist/schemas/entity.schema.json +14 -1
  106. package/dist/search-ranking.d.ts.map +1 -1
  107. package/dist/search-ranking.js +7 -4
  108. package/dist/traceability/staged-consistency.d.ts +25 -0
  109. package/dist/traceability/staged-consistency.d.ts.map +1 -0
  110. package/dist/traceability/staged-consistency.js +92 -0
  111. package/dist/traceability/temp-kb.d.ts.map +1 -1
  112. package/dist/traceability/temp-kb.js +5 -0
  113. package/dist/utils/kb-manifest.d.ts +5 -0
  114. package/dist/utils/kb-manifest.d.ts.map +1 -1
  115. package/dist/utils/kb-manifest.js +6 -0
  116. package/dist/utils/rule-registry.generated.d.ts +11 -0
  117. package/dist/utils/rule-registry.generated.d.ts.map +1 -1
  118. package/dist/utils/rule-registry.generated.js +13 -0
  119. package/dist/utils/schema-version.d.ts +1 -1
  120. package/dist/utils/schema-version.d.ts.map +1 -1
  121. package/dist/utils/schema-version.js +3 -2
  122. package/package.json +2 -2
  123. package/schema/manifest.json +5 -0
  124. package/schema/validation.pl +14 -2
  125. package/src/public/operations/check-executor.ts +6 -0
  126. package/src/public/operations/entity-context.ts +304 -0
  127. package/src/public/operations/origin-review.ts +2 -2
  128. package/src/public/operations/specs/bootstrap.ts +52 -5
  129. package/src/public/operations/specs/check-rules.generated.ts +3 -1
  130. package/src/public/operations/specs/mutation-schemas.ts +10 -2
  131. package/src/public/operations/specs/planning.ts +18 -0
  132. package/src/public/operations/specs/upsert.ts +2 -2
  133. package/src/public/schemas/entity.ts +7 -1
  134. package/src/public/skills/kibi-bootstrap/SKILL.md +13 -7
  135. package/src/public/skills/kibi-bootstrap/resources/bootstrap.md +9 -2
  136. package/src/public/skills/kibi-usage/SKILL.md +56 -3
  137. package/src/public/skills/kibi-usage/resources/source-authoring.md +5 -1
  138. package/src/schemas/entity.schema.json +14 -1
@@ -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.3.1
5
+ version: 2.4.0
6
6
  kibiCompatibility: ">=1.0.0"
7
7
  tags:
8
8
  - kibi
@@ -154,11 +154,43 @@ execute each required repair action in order, and never retry the original
154
154
  operation. Record effect failures, followed actions, and unsafe retries in
155
155
  diagnostic telemetry.
156
156
 
157
+ ## Entity body contract
158
+
159
+ The body is where context lives; front matter is the checked meaning.
160
+ `kb_check` rule `entity-context-missing` blocks a current `req`, `scenario`,
161
+ `test`, `adr` or observation/meta `fact` whose body carries no context: at
162
+ least 12 words that are not a restatement of the title (for a requirement, also
163
+ not of `semantic_text`). Symbols, flags, events and every other fact kind are
164
+ exempt. `kb_upsert` returns the same finding as a warning, including on dryRun.
165
+
166
+ - `req`: the statement, then `## Context` (why, who asked, constraints) and
167
+ `## Source` (blockquoted excerpt plus reference). Only text under context
168
+ headings (Context, Rationale, Why, Background, Source, Notes, Evidence)
169
+ counts for a requirement, and it never changes the checked meaning:
170
+ `semantic_text` is written explicitly and context sections are excluded.
171
+ - `scenario`: Given/When/Then prose plus the assumptions it depends on.
172
+ - `test`: what it asserts, how (fixture, entry point), what would make it a
173
+ false pass.
174
+ - `fact` (`observation`/`meta`): what was seen, where, when, how confirmed.
175
+ - Never invent a reason the requester did not give. Write "Reason not stated"
176
+ and the source instead.
177
+ - The tag `review:context-missing` is reserved for entities the schema 8
178
+ migration (`kibi migrate`) acknowledged and recorded in the manifest; it is
179
+ counted by the advisory `entity-context-acknowledged`. Never add it yourself:
180
+ on any other entity it is still a violation. Write who asked, the source and
181
+ "Reason not stated" in the Context section instead.
182
+ - `kb_plan_compile_intent` requires `context` when the plan creates a
183
+ requirement, and accepts `sourceExcerpt` and `sourceReference`. On update it
184
+ rewrites the statement and keeps the existing context sections unless you
185
+ supply new `context` or source.
186
+
157
187
  ## Source-first mutation
158
188
 
159
189
  Use `document.path` when a new entity has no single configured writable target.
160
- Existing entities preserve body bytes when `document.body` is omitted; new
161
- requirements default their body to `semantic_text`. Relationship mutations
190
+ Existing entities preserve body bytes when `document.body` is omitted; a new
191
+ requirement without `document.body` gets `semantic_text` as its body, and
192
+ `kb_check` then blocks it with `entity-context-missing`, so always pass a
193
+ sectioned `document.body` (see Entity body contract). Relationship mutations
162
194
  patch canonical shards while preserving unrelated records. Authored entity
163
195
  deletion returns a hash-bound approval plan; requirements normally evolve via a
164
196
  new entity linked with `supersedes`; set the replaced requirement to
@@ -220,6 +252,27 @@ grounding: run `logic-coverage` so each key binds to one ground fact.
220
252
  Relationship direction is fixed, and every `from` in a relationship batch
221
253
  must equal the upserted entity ID.
222
254
 
255
+ Worked example. `recommendedAction: "provide_argument_bindings"` means a
256
+ schema fits but `unbound_arguments` lists roles Kibi could not read from the
257
+ prose. Bind them from the claim's own words and call again with the same
258
+ `text` and `requirementId`, plus `schemaId` and `argumentBindings` keyed by
259
+ `argument_names` (reuse `argument_constants` values when the schema has them):
260
+
261
+ ```json
262
+ {"mode":"predicates","text":"Only an annotation owner may delete an annotation.","requirementId":"REQ-annotation-delete-owner","schemaId":"FACT-SCHEMA-PERMISSION-RULE","argumentBindings":{"actor":"annotation_owner","action":"delete","resource":"annotation","decision":"allow"}}
263
+ ```
264
+
265
+ When the retry returns `apply_requires_predicate`, write its `applyPlan` fact,
266
+ then the `relationshipPlan` `requires_predicate` row. Record an ontology gap
267
+ only when no returned schema fits the claim, not because bindings were missing.
268
+ A review note is an observation that quotes its claim without `claim_key`:
269
+ `{"type":"fact","id":"FACT-review-<area>-<behavior>","properties":{"title":"Review: ...","status":"active","fact_kind":"observation","text_ref":"<sourceId>:<reference>","tags":["review:invalid-write"],"claim_text":"<the claim>"}}`.
270
+
271
+ To add `specified_by` (or another relationship) to an existing requirement,
272
+ upsert it with its stored `title`, a `status` and the relationship only; Kibi
273
+ keeps the stored proposition ledger when no `semantic_*` or `logic_claims`
274
+ field is sent and `title`/`text_ref` are unchanged.
275
+
223
276
  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.
224
277
 
225
278
  ## Symbol-First Traceability
@@ -7,7 +7,11 @@ commits them; ordinary Git workflows remain responsible for review and merge.
7
7
 
8
8
  `kb_upsert` accepts `document.path` and `document.body`. Existing entities use
9
9
  their authored source by default and preserve body bytes when `body` is omitted.
10
- New requirements use `semantic_text` as their body. If a new entity has zero or
10
+ A new requirement without `body` uses `semantic_text` as its body, which
11
+ `entity-context-missing` blocks; pass a sectioned body (statement, `## Context`,
12
+ `## Source`) and the written `semantic_text` stays the checked meaning, since
13
+ context sections are excluded from it. Source-first requirement writes pin
14
+ `semantic_text` in front matter. If a new entity has zero or
11
15
  multiple configured writable targets, provide an explicit workspace-relative
12
16
  `document.path`; absolute, traversal, and symlink escapes are rejected.
13
17
 
@@ -1684,7 +1684,20 @@
1684
1684
  {
1685
1685
  "required": [
1686
1686
  "claim_text"
1687
- ]
1687
+ ],
1688
+ "not": {
1689
+ "properties": {
1690
+ "fact_kind": {
1691
+ "enum": [
1692
+ "observation",
1693
+ "meta"
1694
+ ]
1695
+ }
1696
+ },
1697
+ "required": [
1698
+ "fact_kind"
1699
+ ]
1700
+ }
1688
1701
  }
1689
1702
  ]
1690
1703
  },