kibi-cli 2.20.0 → 2.21.2

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 (126) 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/doctor.js +13 -1
  4. package/dist/commands/init.d.ts.map +1 -1
  5. package/dist/commands/init.js +15 -3
  6. package/dist/commands/legacy-storage-migration.d.ts.map +1 -1
  7. package/dist/commands/legacy-storage-migration.js +26 -1
  8. package/dist/commands/migrate.d.ts +2 -0
  9. package/dist/commands/migrate.d.ts.map +1 -1
  10. package/dist/commands/migrate.js +155 -11
  11. package/dist/commands/sync/discovery.d.ts.map +1 -1
  12. package/dist/commands/sync/discovery.js +14 -2
  13. package/dist/commands/sync/persistence.d.ts.map +1 -1
  14. package/dist/commands/sync/persistence.js +4 -0
  15. package/dist/decision-firmness.d.ts +39 -0
  16. package/dist/decision-firmness.d.ts.map +1 -0
  17. package/dist/decision-firmness.js +115 -0
  18. package/dist/extractors/markdown.d.ts +2 -0
  19. package/dist/extractors/markdown.d.ts.map +1 -1
  20. package/dist/extractors/markdown.js +16 -1
  21. package/dist/operations/migration/kb-sources.d.ts +5 -1
  22. package/dist/operations/migration/kb-sources.d.ts.map +1 -1
  23. package/dist/operations/migration/kb-sources.js +28 -1
  24. package/dist/operations/migration/schema6.d.ts +2 -0
  25. package/dist/operations/migration/schema6.d.ts.map +1 -1
  26. package/dist/operations/migration/schema6.js +44 -1
  27. package/dist/operations/migration/supersedes-reason.d.ts +26 -0
  28. package/dist/operations/migration/supersedes-reason.d.ts.map +1 -0
  29. package/dist/operations/migration/supersedes-reason.js +69 -0
  30. package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
  31. package/dist/operations/modeling/predicate-applyplan.js +10 -2
  32. package/dist/operations/modeling/predicate-loader.d.ts.map +1 -1
  33. package/dist/operations/modeling/predicate-loader.js +11 -0
  34. package/dist/operations/modeling/predicate-types.d.ts +32 -1
  35. package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
  36. package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
  37. package/dist/operations/modeling/suggest-predicates.js +175 -35
  38. package/dist/operations/mutation/delete.d.ts +5 -1
  39. package/dist/operations/mutation/delete.d.ts.map +1 -1
  40. package/dist/operations/mutation/delete.js +223 -17
  41. package/dist/operations/mutation/serialization.d.ts.map +1 -1
  42. package/dist/operations/mutation/serialization.js +1 -0
  43. package/dist/operations/mutation/source-authoring.d.ts +8 -0
  44. package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
  45. package/dist/operations/mutation/source-authoring.js +33 -0
  46. package/dist/operations/mutation/types.d.ts +37 -0
  47. package/dist/operations/mutation/types.d.ts.map +1 -1
  48. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  49. package/dist/operations/mutation/upsert.js +54 -2
  50. package/dist/operations/mutation/validation.d.ts.map +1 -1
  51. package/dist/operations/mutation/validation.js +2 -1
  52. package/dist/operations/planning/apply-plan.d.ts +6 -1
  53. package/dist/operations/planning/apply-plan.d.ts.map +1 -1
  54. package/dist/operations/planning/apply-plan.js +8 -2
  55. package/dist/operations/semantic-advisor/clauses.d.ts +9 -0
  56. package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
  57. package/dist/operations/semantic-advisor/clauses.js +24 -0
  58. package/dist/public/operations/catalog.d.ts +14 -5
  59. package/dist/public/operations/catalog.d.ts.map +1 -1
  60. package/dist/public/operations/check-executor.d.ts.map +1 -1
  61. package/dist/public/operations/check-executor.js +3 -0
  62. package/dist/public/operations/contracts.d.ts.map +1 -1
  63. package/dist/public/operations/contracts.js +29 -1
  64. package/dist/public/operations/decision-firmness.d.ts +34 -0
  65. package/dist/public/operations/decision-firmness.d.ts.map +1 -0
  66. package/dist/public/operations/decision-firmness.js +216 -0
  67. package/dist/public/operations/discovery-executors.d.ts.map +1 -1
  68. package/dist/public/operations/discovery-executors.js +16 -2
  69. package/dist/public/operations/migration-plan.d.ts.map +1 -1
  70. package/dist/public/operations/migration-plan.js +37 -7
  71. package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
  72. package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
  73. package/dist/public/operations/specs/check-rules.generated.js +5 -1
  74. package/dist/public/operations/specs/check.d.ts +1 -1
  75. package/dist/public/operations/specs/mutation-schemas.d.ts +7 -2
  76. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
  77. package/dist/public/operations/specs/mutation-schemas.js +13 -17
  78. package/dist/public/operations/specs/mutation.d.ts +6 -2
  79. package/dist/public/operations/specs/mutation.d.ts.map +1 -1
  80. package/dist/public/operations/specs/mutation.js +6 -2
  81. package/dist/public/operations/specs/upsert.d.ts +7 -2
  82. package/dist/public/operations/specs/upsert.d.ts.map +1 -1
  83. package/dist/public/schemas/entity.d.ts.map +1 -1
  84. package/dist/public/schemas/entity.js +13 -13
  85. package/dist/public/skills/kibi-traceability/SKILL.md +6 -4
  86. package/dist/public/skills/kibi-usage/SKILL.md +52 -10
  87. package/dist/public/skills/kibi-usage/resources/fact-lanes.md +1 -1
  88. package/dist/public/skills/kibi-usage/resources/source-authoring.md +4 -2
  89. package/dist/public/skills/kibi-usage/resources/ui-requirements.md +2 -2
  90. package/dist/public/skills/kibi-usage/resources/workflows.md +1 -1
  91. package/dist/relationships/shards.d.ts +10 -0
  92. package/dist/relationships/shards.d.ts.map +1 -1
  93. package/dist/relationships/shards.js +27 -11
  94. package/dist/schemas/entity.schema.json +30 -25
  95. package/dist/search-answer.d.ts +31 -2
  96. package/dist/search-answer.d.ts.map +1 -1
  97. package/dist/search-answer.js +115 -17
  98. package/dist/types/entities.d.ts +4 -0
  99. package/dist/types/entities.d.ts.map +1 -1
  100. package/dist/utils/kb-manifest.d.ts +6 -0
  101. package/dist/utils/kb-manifest.d.ts.map +1 -1
  102. package/dist/utils/kb-manifest.js +6 -0
  103. package/dist/utils/rule-registry.generated.d.ts +21 -0
  104. package/dist/utils/rule-registry.generated.d.ts.map +1 -1
  105. package/dist/utils/rule-registry.generated.js +25 -0
  106. package/dist/utils/schema-version.d.ts +1 -1
  107. package/dist/utils/schema-version.d.ts.map +1 -1
  108. package/dist/utils/schema-version.js +3 -1
  109. package/package.json +2 -2
  110. package/schema/entities.pl +6 -0
  111. package/src/public/operations/check-executor.ts +6 -0
  112. package/src/public/operations/contracts.ts +33 -1
  113. package/src/public/operations/decision-firmness.ts +280 -0
  114. package/src/public/operations/discovery-executors.ts +17 -2
  115. package/src/public/operations/migration-plan.ts +41 -9
  116. package/src/public/operations/specs/check-rules.generated.ts +5 -1
  117. package/src/public/operations/specs/mutation-schemas.ts +14 -17
  118. package/src/public/operations/specs/mutation.ts +7 -2
  119. package/src/public/schemas/entity.ts +14 -13
  120. package/src/public/skills/kibi-traceability/SKILL.md +6 -4
  121. package/src/public/skills/kibi-usage/SKILL.md +52 -10
  122. package/src/public/skills/kibi-usage/resources/fact-lanes.md +1 -1
  123. package/src/public/skills/kibi-usage/resources/source-authoring.md +4 -2
  124. package/src/public/skills/kibi-usage/resources/ui-requirements.md +2 -2
  125. package/src/public/skills/kibi-usage/resources/workflows.md +1 -1
  126. package/src/schemas/entity.schema.json +30 -25
@@ -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.15.2
5
+ version: 2.16.0
6
6
  kibiCompatibility: ">=1.0.0"
7
7
  tags:
8
8
  - kibi
@@ -188,8 +188,9 @@ returns `status: error`, `MIGRATION_PLAN_REFUSED` and `data.outcome:
188
188
  refused`: nothing changed, so read the action `detail` and get a new plan.
189
189
  `data.outcome: reconciliation_required` (status success) means an action
190
190
  failed mid-way: inspect its effect before retrying. `kb_delete` of an
191
- authored entity returns status success with `deleted: 0`; its `errors` say
192
- why nothing was deleted. If the status is
191
+ authored entity returns status success with `deleted: 0` and `outcome:
192
+ plan_returned` (or `supersession_required` for a requirement): nothing was
193
+ deleted yet, and `nextActions` names the call that does it. If the status is
193
194
  `committed_with_repairs`, the mutation already committed: inspect failed effects,
194
195
  execute each required repair action in order, and never retry the original
195
196
  operation. Record effect failures, followed actions, and unsafe retries in
@@ -302,12 +303,18 @@ authored. Each one is the order the write path accepts.
302
303
  between the two writes `kb_check` reports the requirement until the
303
304
  second lands.
304
305
  3. **Deleting authored entities.** `kb_delete` on an authored entity that
305
- is not a requirement (scenario, test, fact, ADR, …) returns a hash-bound
306
- `kibi.entity-deletion-plan.v1` in `deletionPlan`; apply it unchanged with
307
- `kb_apply_plan` (`plan` plus `approvedPlanHash: plan.planHash`). For an
308
- authored requirement the plan carries `supersessionRequired: true` and
309
- `kb_apply_plan` refuses it (`REQUIREMENT_SUPERSESSION_REQUIRED`): Kibi
310
- never deletes an authored requirement. Evolve it instead with a new
306
+ is not a requirement (scenario, test, fact, ADR, …) writes nothing and
307
+ returns `outcome: plan_returned` with a hash-bound
308
+ `kibi.entity-deletion-plan.v1` in `deletionPlan`. After review, run
309
+ `nextActions[0]` unchanged: `kb_apply_plan` with its `input` (`plan` plus
310
+ `approvedPlanHash: plan.planHash`), or repeat the `kb_delete` call with
311
+ `approvedPlanHash` to apply the freshly computed plan in one step (a
312
+ changed source fails with `DELETE_PLAN_HASH_MISMATCH`). `dryRun: true`
313
+ previews relationship and direct deletes without writing. For an
314
+ authored requirement the result is `outcome: supersession_required`, the
315
+ plan carries `supersessionRequired: true` and both routes refuse it
316
+ (`REQUIREMENT_SUPERSESSION_REQUIRED`): Kibi never deletes an authored
317
+ requirement. Evolve it instead with a new
311
318
  requirement linked by `supersedes` and close the old one, or, for an
312
319
  agent-origin requirement nobody approved and nothing links to, upsert it
313
320
  with `status: closed` (keep its `title`); it stays on disk as history. A
@@ -342,6 +349,29 @@ human sets `approved_by`; `kb_check` flags approvals an agent recorded without
342
349
  corroboration. Never fill in an approval yourself. Record why a requirement
343
350
  exists in `rationale`, or link the ADR that explains it.
344
351
 
352
+ ## Decision firmness
353
+
354
+ Requirements and ADRs carry `firmness`, which says what you may do with them.
355
+ Search answers, `kb_query` rows and hook snippets show it (snippets label only
356
+ `[firm]` and `[exploratory]`; an unlabeled decision is `default`).
357
+
358
+ - `firm`: a human stated it as a rule. Follow it; to change it, ask first.
359
+ `kb_check` blocks a firm decision without `origin.ref` to their words, and
360
+ a replacement of a firm decision that is not itself firm.
361
+ - `default` (when absent): a delegated or agent choice. Follow it unless the
362
+ task gives evidence against it; then supersede it in the same change and
363
+ list it under "Decisions I changed" for review, without asking first.
364
+ - `exploratory`: a flagged guess; revisit it when you touch the area.
365
+
366
+ Set `firmness` from what a human actually said: only their stated rule is
367
+ `firm` (with `origin.ref`); "do whatever" or your own pick is `default`; a
368
+ guess is `exploratory`. A supersede needs `## Why this changed` in the new
369
+ entity's body (at least 12 words): name the evidence (a failing test, a
370
+ measured cost, a constraint the old decision missed, a new requirement) and
371
+ answer the old decision's reasoning; `kb_check` blocks it otherwise. A
372
+ preference is not evidence: propose it instead of superseding. Kibi checks
373
+ only that a firm decision has a reference; never cite words nobody said.
374
+
345
375
  Conditional clauses ("only when", "only if", "must not ... unless") compile
346
376
  into typed `forbid` rules linked by `requires_rule`, not property facts; one
347
377
  `kb_model` or `kb_compile_intent` cannot translate stays an `ontology_gap`.
@@ -369,6 +399,8 @@ For each relational clause, call `kb_model` with `mode: "predicates"`, that clau
369
399
  reviewed `schemaId`. If `binding_status` is `incomplete`, supply
370
400
  `argumentBindings` and retry. Persist `fact_kind: predicate` with the same
371
401
  `claim_key` / `claim_text`, then link `REQ -> fact` with `requires_predicate`.
402
+ `claim_key` is derived from `claim_text`, so a ground fact may send the exact
403
+ clause alone and Kibi fills the key in; a sent key must equal the derived one.
372
404
  Use `kb_model` with `mode: "requirement"` for strict scalar clauses. Use
373
405
  `fact_kind: observation` only for a true ontology gap. The manifest is not
374
406
  grounding: run `logic-coverage` so each key binds to one ground fact.
@@ -419,7 +451,17 @@ a second grounding link would fail, so keep the existing link or apply the
419
451
  `kb_delete` of the old link, requirement link; between the last two `kb_check`
420
452
  reports both `logic-coverage` and `strict-req-fact-pairing` for the
421
453
  requirement, as `expected.kbCheckAfterStep` states; run `kb_check` after the
422
- last step and apply `rollback` if it is not clean); `provide_argument_bindings` and `record_ontology_gap` mean
454
+ last step and apply `rollback` if it is not clean). `keep_existing_grounding`
455
+ means the requirement already links a predicate fact with the candidate's
456
+ `canonical_key` (`existingGrounding[].matchedBy` is `canonical_key` when the
457
+ claim was worded differently), so write nothing. `extend_requirement` means
458
+ the requirement's proposition ledger has no entry for this text, so a link
459
+ cannot be made and no fact is planned: add the clause to the requirement's
460
+ prose (`mode: "requirement"`, or `kb_upsert` with the extended `semantic_text`
461
+ and the ledger `mode: "analyze"` returns) and call `mode: "predicates"` again.
462
+ Read `decisionConflicts` and its warnings whenever `plan` is null: they name
463
+ the stored decision facts the candidate would contradict and the requirements
464
+ that own them. `provide_argument_bindings` and `record_ontology_gap` mean
423
465
  the same as for an ungrounded claim, and the gap observation is not a grounding
424
466
  link, so write it exactly as returned (tags, `claim_text`, `document.body`, no
425
467
  `claim_key`, no relationships). Record an ontology gap only when no returned schema fits the
@@ -6,7 +6,7 @@ Requirement prose remains the human-readable source. Facts add queryable semanti
6
6
 
7
7
  Logical coverage is clause-based, not entity-based. Give `kb_model` (`mode: "analyze"`) the complete requirement body and verify that its `clauses` list contains every atomic obligation. Supply the `clauses` input yourself when automatic splitting would combine or omit obligations. For every normative clause:
8
8
 
9
- - preserve the returned stable key as `claim_key` and the exact clause as `claim_text` on its ground fact;
9
+ - put the exact clause as `claim_text` on its ground fact, with the returned stable key as `claim_key` or none (Kibi derives a missing key; a sent key must match);
10
10
  - add the key to the exact current `logic_claims` set, removing only stale keys whose propositions no longer exist in the source;
11
11
  - link it through exactly one `requires_property` for `property_value`, one `requires_predicate` for `predicate`, or one `requires_rule` for a safe `rule` fact;
12
12
  - leave ambiguity and ontology gaps visibly unresolved—observations do not satisfy `logic-coverage`.
@@ -23,8 +23,10 @@ drift diagnostic. Unresolved Git index conflicts are likewise blocking; Kibi
23
23
  never chooses a merge winner.
24
24
 
25
25
  Relationship upserts and relationship deletes patch only the canonical shard,
26
- preserving unrelated records. Authored entity deletion returns a hash-bound
27
- plan; approve that plan through `kb_apply_plan`. Evolve requirements with a new
26
+ preserving unrelated records. Authored entity deletion writes nothing and
27
+ returns a hash-bound plan (`outcome: plan_returned`); approve it by running the
28
+ returned `nextActions[0]` (`kb_apply_plan` with `{plan, approvedPlanHash}`)
29
+ unchanged, or by repeating `kb_delete` with `approvedPlanHash`. Evolve requirements with a new
28
30
  requirement and `supersedes`, rather than deleting the old semantic claim.
29
31
 
30
32
  On `committed_with_repairs`, inspect `effects` and execute the typed required
@@ -126,8 +126,8 @@ diagnostics (`symbol_semantic_review_needed`).
126
126
  `requires_predicate`.
127
127
  3. Scalar placement/alignment/order clauses: `kb_model` (`mode: "requirement"`), apply the strict
128
128
  subject/property plan and `constrains` / `requires_property`.
129
- 4. Preserve `claim_key` / `claim_text`; merge every key into the requirement
130
- `logic_claims` manifest.
129
+ 4. Preserve `claim_key` / `claim_text` (a missing key is derived from the
130
+ text); merge every key into the requirement `logic_claims` manifest.
131
131
  5. `kb_upsert` with `dryRun: true`, create endpoints first, then sequential `kb_upsert`.
132
132
  6. `kb_check` with `logic-coverage`, `predicate-verifiability`, `domain-contradictions`,
133
133
  then a final unfiltered `kb_check`.
@@ -203,7 +203,7 @@ Optional per-project workflow for recording what the screen should look like. No
203
203
  2. Run `kb_model` with `mode: "analyze"` on the description; audit or supply `clauses`.
204
204
  3. For relational layout clauses ("X must remain visually aligned with Y"), call `kb_model` with `mode: "predicates"`, apply the returned `fact_kind: predicate` plan with `predicate_name: visual_layout_rule` and `requires_predicate`.
205
205
  4. For scalar placement, alignment, and ordering clauses, call `kb_model` with `mode: "requirement"` and apply strict `fact_kind: subject` / `fact_kind: property_value` facts linked with `constrains` / `requires_property`. Model header order as indexed property keys (`nav_order_1`, `nav_order_2`, ...) against one subject region.
206
- 5. Preserve `claim_key` / `claim_text` on every ground fact and merge every key into the requirement `logic_claims` manifest.
206
+ 5. Preserve `claim_key` / `claim_text` on every ground fact (a missing `claim_key` is derived from `claim_text`) and merge every key into the requirement `logic_claims` manifest.
207
207
  6. Model UI components as `symbol` entities with `sourceFile` and `symbol_role: behavioral`, linked `implements` to the requirement.
208
208
  7. `kb_upsert` with `dryRun: true`, create endpoints first, then sequential `kb_upsert`. Run `kb_check` with `logic-coverage`, `predicate-verifiability`, and `domain-contradictions`, then a final unfiltered `kb_check`.
209
209
 
@@ -514,6 +514,15 @@
514
514
  },
515
515
  "additionalProperties": false
516
516
  },
517
+ "firmness": {
518
+ "type": "string",
519
+ "enum": [
520
+ "firm",
521
+ "default",
522
+ "exploratory"
523
+ ],
524
+ "description": "Requirement and ADR only. How firmly the decision was made. firm: a human stated it as a rule; it needs a ref (origin.ref, or approval_ref on a requirement) to their words, and only a human may change it. default (assumed when absent): a delegated or agent choice; a later agent may supersede it with evidence. exploratory: a flagged guess, expected to be revisited."
525
+ },
517
526
  "expects": {
518
527
  "type": "string",
519
528
  "enum": [
@@ -1657,6 +1666,25 @@
1657
1666
  }
1658
1667
  }
1659
1668
  },
1669
+ {
1670
+ "if": {
1671
+ "properties": {
1672
+ "type": {
1673
+ "enum": [
1674
+ "req",
1675
+ "adr"
1676
+ ]
1677
+ }
1678
+ }
1679
+ },
1680
+ "else": {
1681
+ "not": {
1682
+ "required": [
1683
+ "firmness"
1684
+ ]
1685
+ }
1686
+ }
1687
+ },
1660
1688
  {
1661
1689
  "if": {
1662
1690
  "properties": {
@@ -1675,35 +1703,12 @@
1675
1703
  },
1676
1704
  {
1677
1705
  "if": {
1678
- "anyOf": [
1679
- {
1680
- "required": [
1681
- "claim_key"
1682
- ]
1683
- },
1684
- {
1685
- "required": [
1686
- "claim_text"
1687
- ],
1688
- "not": {
1689
- "properties": {
1690
- "fact_kind": {
1691
- "enum": [
1692
- "observation",
1693
- "meta"
1694
- ]
1695
- }
1696
- },
1697
- "required": [
1698
- "fact_kind"
1699
- ]
1700
- }
1701
- }
1706
+ "required": [
1707
+ "claim_key"
1702
1708
  ]
1703
1709
  },
1704
1710
  "then": {
1705
1711
  "required": [
1706
- "claim_key",
1707
1712
  "claim_text"
1708
1713
  ]
1709
1714
  }