kibi-cli 2.21.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.
- package/dist/cli-operation-metadata.d.ts +1 -1
- package/dist/cli-operation-metadata.js +1 -1
- package/dist/commands/doctor.js +13 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +15 -3
- package/dist/commands/legacy-storage-migration.d.ts.map +1 -1
- package/dist/commands/legacy-storage-migration.js +26 -1
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +123 -5
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +4 -0
- package/dist/decision-firmness.d.ts +39 -0
- package/dist/decision-firmness.d.ts.map +1 -0
- package/dist/decision-firmness.js +115 -0
- package/dist/extractors/markdown.d.ts +2 -0
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +14 -0
- package/dist/operations/migration/schema6.d.ts +2 -0
- package/dist/operations/migration/schema6.d.ts.map +1 -1
- package/dist/operations/migration/schema6.js +44 -1
- package/dist/operations/migration/supersedes-reason.d.ts +26 -0
- package/dist/operations/migration/supersedes-reason.d.ts.map +1 -0
- package/dist/operations/migration/supersedes-reason.js +69 -0
- package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-applyplan.js +10 -2
- package/dist/operations/modeling/predicate-loader.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-loader.js +11 -0
- package/dist/operations/modeling/predicate-types.d.ts +32 -1
- package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
- package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
- package/dist/operations/modeling/suggest-predicates.js +175 -35
- package/dist/operations/mutation/delete.d.ts +5 -1
- package/dist/operations/mutation/delete.d.ts.map +1 -1
- package/dist/operations/mutation/delete.js +223 -17
- package/dist/operations/mutation/serialization.d.ts.map +1 -1
- package/dist/operations/mutation/serialization.js +1 -0
- package/dist/operations/mutation/types.d.ts +37 -0
- package/dist/operations/mutation/types.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +54 -2
- package/dist/operations/planning/apply-plan.d.ts +6 -1
- package/dist/operations/planning/apply-plan.d.ts.map +1 -1
- package/dist/operations/planning/apply-plan.js +8 -2
- package/dist/public/operations/catalog.d.ts +12 -3
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/check-executor.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +3 -0
- package/dist/public/operations/contracts.d.ts.map +1 -1
- package/dist/public/operations/contracts.js +29 -1
- package/dist/public/operations/decision-firmness.d.ts +34 -0
- package/dist/public/operations/decision-firmness.d.ts.map +1 -0
- package/dist/public/operations/decision-firmness.js +216 -0
- package/dist/public/operations/discovery-executors.d.ts.map +1 -1
- package/dist/public/operations/discovery-executors.js +16 -2
- package/dist/public/operations/migration-plan.js +1 -1
- package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
- package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
- package/dist/public/operations/specs/check-rules.generated.js +5 -1
- package/dist/public/operations/specs/check.d.ts +1 -1
- package/dist/public/operations/specs/mutation-schemas.d.ts +5 -0
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation-schemas.js +5 -0
- package/dist/public/operations/specs/mutation.d.ts +6 -2
- package/dist/public/operations/specs/mutation.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation.js +6 -2
- package/dist/public/operations/specs/upsert.d.ts +5 -0
- package/dist/public/operations/specs/upsert.d.ts.map +1 -1
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +11 -0
- package/dist/public/skills/kibi-traceability/SKILL.md +6 -4
- package/dist/public/skills/kibi-usage/SKILL.md +50 -10
- package/dist/public/skills/kibi-usage/resources/source-authoring.md +4 -2
- package/dist/relationships/shards.d.ts +10 -0
- package/dist/relationships/shards.d.ts.map +1 -1
- package/dist/relationships/shards.js +27 -11
- package/dist/schemas/entity.schema.json +28 -0
- package/dist/search-answer.d.ts +31 -2
- package/dist/search-answer.d.ts.map +1 -1
- package/dist/search-answer.js +115 -17
- package/dist/types/entities.d.ts +4 -0
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/utils/kb-manifest.d.ts +6 -0
- package/dist/utils/kb-manifest.d.ts.map +1 -1
- package/dist/utils/kb-manifest.js +6 -0
- package/dist/utils/rule-registry.generated.d.ts +21 -0
- package/dist/utils/rule-registry.generated.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.js +25 -0
- package/dist/utils/schema-version.d.ts +1 -1
- package/dist/utils/schema-version.d.ts.map +1 -1
- package/dist/utils/schema-version.js +3 -1
- package/package.json +2 -2
- package/schema/entities.pl +6 -0
- package/src/public/operations/check-executor.ts +6 -0
- package/src/public/operations/contracts.ts +33 -1
- package/src/public/operations/decision-firmness.ts +280 -0
- package/src/public/operations/discovery-executors.ts +17 -2
- package/src/public/operations/migration-plan.ts +1 -1
- package/src/public/operations/specs/check-rules.generated.ts +5 -1
- package/src/public/operations/specs/mutation-schemas.ts +6 -0
- package/src/public/operations/specs/mutation.ts +7 -2
- package/src/public/schemas/entity.ts +12 -0
- package/src/public/skills/kibi-traceability/SKILL.md +6 -4
- package/src/public/skills/kibi-usage/SKILL.md +50 -10
- package/src/public/skills/kibi-usage/resources/source-authoring.md +4 -2
- package/src/schemas/entity.schema.json +28 -0
|
@@ -358,6 +358,12 @@ const entitySchema: Record<string, unknown> = {
|
|
|
358
358
|
text_ref: { type: "string" },
|
|
359
359
|
// Provenance of any authored entity: who wrote it and on what authority.
|
|
360
360
|
origin: ENTITY_ORIGIN_SCHEMA,
|
|
361
|
+
firmness: {
|
|
362
|
+
type: "string",
|
|
363
|
+
enum: ["firm", "default", "exploratory"],
|
|
364
|
+
description:
|
|
365
|
+
"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.",
|
|
366
|
+
},
|
|
361
367
|
expects: {
|
|
362
368
|
type: "string",
|
|
363
369
|
enum: ["success", "rejection", "error"],
|
|
@@ -713,6 +719,12 @@ const entitySchema: Record<string, unknown> = {
|
|
|
713
719
|
},
|
|
714
720
|
},
|
|
715
721
|
},
|
|
722
|
+
{
|
|
723
|
+
if: {
|
|
724
|
+
properties: { type: { enum: ["req", "adr"] } },
|
|
725
|
+
},
|
|
726
|
+
else: { not: { required: ["firmness"] } },
|
|
727
|
+
},
|
|
716
728
|
{
|
|
717
729
|
if: {
|
|
718
730
|
properties: { type: { const: "scenario" } },
|
|
@@ -43,10 +43,12 @@ sequential `kb_upsert`, then run final check and coverage. Kibi authors tracked
|
|
|
43
43
|
files transactionally but never Git-stages or commits them. Do not read or edit
|
|
44
44
|
`.kb` directly.
|
|
45
45
|
|
|
46
|
-
Use `kb_delete` only for intentional cleanup
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
Use `kb_delete` only for intentional cleanup; `dryRun: true` previews any
|
|
47
|
+
delete without writing. Authored entity deletion returns `outcome:
|
|
48
|
+
plan_returned` with a hash-bound plan whose `nextActions[0].input` is the exact
|
|
49
|
+
`kb_apply_plan` input; requirements return `supersession_required` and evolve
|
|
50
|
+
through a new requirement linked with `supersedes`. Relationship deletes patch
|
|
51
|
+
shards while preserving unrelated records.
|
|
50
52
|
|
|
51
53
|
## Typed recovery and proof
|
|
52
54
|
|
|
@@ -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.
|
|
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
|
|
192
|
-
|
|
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, …)
|
|
306
|
-
`
|
|
307
|
-
`
|
|
308
|
-
|
|
309
|
-
`
|
|
310
|
-
|
|
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`.
|
|
@@ -421,7 +451,17 @@ a second grounding link would fail, so keep the existing link or apply the
|
|
|
421
451
|
`kb_delete` of the old link, requirement link; between the last two `kb_check`
|
|
422
452
|
reports both `logic-coverage` and `strict-req-fact-pairing` for the
|
|
423
453
|
requirement, as `expected.kbCheckAfterStep` states; run `kb_check` after the
|
|
424
|
-
last step and apply `rollback` if it is not clean)
|
|
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
|
|
425
465
|
the same as for an ungrounded claim, and the gap observation is not a grounding
|
|
426
466
|
link, so write it exactly as returned (tags, `claim_text`, `document.body`, no
|
|
427
467
|
`claim_key`, no relationships). Record an ontology gap only when no returned schema fits the
|
|
@@ -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
|
|
27
|
-
|
|
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
|
|
@@ -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": {
|