kibi-cli 2.15.0 → 2.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/cli-register-proof.d.ts.map +1 -1
  2. package/dist/cli-register-proof.js +16 -2
  3. package/dist/commands/check.d.ts.map +1 -1
  4. package/dist/commands/check.js +5 -1
  5. package/dist/commands/doctor.d.ts.map +1 -1
  6. package/dist/commands/doctor.js +83 -4
  7. package/dist/commands/prove.js +1 -1
  8. package/dist/operations/modeling/model-requirement.d.ts +5 -0
  9. package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
  10. package/dist/operations/modeling/model-requirement.js +17 -5
  11. package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
  12. package/dist/operations/modeling/predicate-applyplan.js +16 -6
  13. package/dist/operations/planning/apply-plan.d.ts.map +1 -1
  14. package/dist/operations/planning/apply-plan.js +15 -0
  15. package/dist/proof/inspect.d.ts +18 -1
  16. package/dist/proof/inspect.d.ts.map +1 -1
  17. package/dist/proof/inspect.js +17 -8
  18. package/dist/proof/integration-plan.d.ts +57 -0
  19. package/dist/proof/integration-plan.d.ts.map +1 -0
  20. package/dist/proof/integration-plan.js +331 -0
  21. package/dist/proof/integrations.js +1 -1
  22. package/dist/public/operations/catalog.d.ts +2 -2
  23. package/dist/public/operations/check-executor.d.ts +16 -0
  24. package/dist/public/operations/check-executor.d.ts.map +1 -1
  25. package/dist/public/operations/check-executor.js +80 -0
  26. package/dist/public/operations/discovery-executors.d.ts.map +1 -1
  27. package/dist/public/operations/discovery-executors.js +13 -3
  28. package/dist/public/operations/migration-plan.d.ts.map +1 -1
  29. package/dist/public/operations/migration-plan.js +28 -0
  30. package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
  31. package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
  32. package/dist/public/operations/specs/check-rules.generated.js +2 -1
  33. package/dist/public/operations/specs/check.d.ts +1 -1
  34. package/dist/public/operations/specs/composite.d.ts +16 -3
  35. package/dist/public/operations/specs/composite.d.ts.map +1 -1
  36. package/dist/public/operations/specs/composite.js +79 -2
  37. package/dist/public/operations/specs/modeling.d.ts +1 -1
  38. package/dist/public/operations/specs/modeling.js +1 -1
  39. package/dist/public/skills/kibi-bootstrap/SKILL.md +2 -1
  40. package/dist/public/skills/kibi-usage/SKILL.md +14 -6
  41. package/dist/public/skills/kibi-usage/resources/proof.md +15 -3
  42. package/dist/utils/branch-store.d.ts +32 -0
  43. package/dist/utils/branch-store.d.ts.map +1 -1
  44. package/dist/utils/branch-store.js +122 -1
  45. package/dist/utils/rule-registry.generated.d.ts +5 -0
  46. package/dist/utils/rule-registry.generated.d.ts.map +1 -1
  47. package/dist/utils/rule-registry.generated.js +6 -0
  48. package/dist/utils/strict-modeling.d.ts +12 -0
  49. package/dist/utils/strict-modeling.d.ts.map +1 -1
  50. package/dist/utils/strict-modeling.js +12 -1
  51. package/package.json +2 -2
  52. package/src/public/operations/check-executor.ts +105 -0
  53. package/src/public/operations/discovery-executors.ts +19 -2
  54. package/src/public/operations/migration-plan.ts +35 -0
  55. package/src/public/operations/specs/check-rules.generated.ts +2 -1
  56. package/src/public/operations/specs/composite.ts +110 -11
  57. package/src/public/operations/specs/modeling.ts +1 -1
  58. package/src/public/skills/kibi-bootstrap/SKILL.md +2 -1
  59. package/src/public/skills/kibi-usage/SKILL.md +14 -6
  60. package/src/public/skills/kibi-usage/resources/proof.md +15 -3
@@ -14,6 +14,7 @@ export const SELECTABLE_RULE_NAMES = [
14
14
  "symbol-traceability",
15
15
  "no-dangling-refs",
16
16
  "source-relationship-parity",
17
+ "branch-store-not-compiled",
17
18
  "source-path-dangling",
18
19
  "no-cycles",
19
20
  "required-fields",
@@ -58,4 +59,4 @@ export const SELECTABLE_RULE_NAMES = [
58
59
  ];
59
60
  // implements REQ-006
60
61
  /** Comma-separated "Allowed:" fragment for the kb_check rules description. */
61
- export const SELECTABLE_RULES_ALLOWED = "must-priority-coverage, symbol-coverage, symbol-traceability, no-dangling-refs, source-relationship-parity, source-path-dangling, no-cycles, required-fields, deprecated-adr-no-successor, superseded-requirement-open, scenario-feasibility, scenario-feasibility-unknown, exception-claim-keys, numeric-string-value, rule-key-arguments-missing, domain-contradictions, logic-coverage, rule-safety, rule-verifiability, query-plan-safety, req-status-vocabulary, strict-fact-shape, strict-req-fact-pairing, predicate-verifiability, strict-readiness, semantic-completeness, related-requirement-unmodeled, proof-contract-symbols, entity-id-style, domain-redundancy, domain-implication, subject-key-identity, subject-key-shape, ontology-quality, exception-unapproved, exception-approval-self-attested, agent-requirement-unapproved, requirement-rationale-missing, symbol-owner-superseded, adr-unlinked, adr-proposed, predicate-schema-conformance, entity-context-missing, entity-context-acknowledged, policy-ownership, policy-markers";
62
+ export const SELECTABLE_RULES_ALLOWED = "must-priority-coverage, symbol-coverage, symbol-traceability, no-dangling-refs, source-relationship-parity, branch-store-not-compiled, source-path-dangling, no-cycles, required-fields, deprecated-adr-no-successor, superseded-requirement-open, scenario-feasibility, scenario-feasibility-unknown, exception-claim-keys, numeric-string-value, rule-key-arguments-missing, domain-contradictions, logic-coverage, rule-safety, rule-verifiability, query-plan-safety, req-status-vocabulary, strict-fact-shape, strict-req-fact-pairing, predicate-verifiability, strict-readiness, semantic-completeness, related-requirement-unmodeled, proof-contract-symbols, entity-id-style, domain-redundancy, domain-implication, subject-key-identity, subject-key-shape, ontology-quality, exception-unapproved, exception-approval-self-attested, agent-requirement-unapproved, requirement-rationale-missing, symbol-owner-superseded, adr-unlinked, adr-proposed, predicate-schema-conformance, entity-context-missing, entity-context-acknowledged, policy-ownership, policy-markers";
@@ -12,7 +12,7 @@ export declare const checkSpec: {
12
12
  readonly type: "string";
13
13
  readonly enum: readonly string[];
14
14
  };
15
- readonly description: "Optional rule subset. Allowed: must-priority-coverage, symbol-coverage, symbol-traceability, no-dangling-refs, source-relationship-parity, source-path-dangling, no-cycles, required-fields, deprecated-adr-no-successor, superseded-requirement-open, scenario-feasibility, scenario-feasibility-unknown, exception-claim-keys, numeric-string-value, rule-key-arguments-missing, domain-contradictions, logic-coverage, rule-safety, rule-verifiability, query-plan-safety, req-status-vocabulary, strict-fact-shape, strict-req-fact-pairing, predicate-verifiability, strict-readiness, semantic-completeness, related-requirement-unmodeled, proof-contract-symbols, entity-id-style, domain-redundancy, domain-implication, subject-key-identity, subject-key-shape, ontology-quality, exception-unapproved, exception-approval-self-attested, agent-requirement-unapproved, requirement-rationale-missing, symbol-owner-superseded, adr-unlinked, adr-proposed, predicate-schema-conformance, entity-context-missing, entity-context-acknowledged, policy-ownership, policy-markers. If omitted, server runs canonical and advisory rules plus the full-KB qualityDiagnostics audit scan, including usage telemetry acceptance when evidence exists; migration rules run only when explicitly selected. Advisory and migration findings are non-blocking qualityDiagnostics. If supplied, server preserves scoped validation and skips the full-KB advisory scan.";
15
+ readonly description: "Optional rule subset. Allowed: must-priority-coverage, symbol-coverage, symbol-traceability, no-dangling-refs, source-relationship-parity, branch-store-not-compiled, source-path-dangling, no-cycles, required-fields, deprecated-adr-no-successor, superseded-requirement-open, scenario-feasibility, scenario-feasibility-unknown, exception-claim-keys, numeric-string-value, rule-key-arguments-missing, domain-contradictions, logic-coverage, rule-safety, rule-verifiability, query-plan-safety, req-status-vocabulary, strict-fact-shape, strict-req-fact-pairing, predicate-verifiability, strict-readiness, semantic-completeness, related-requirement-unmodeled, proof-contract-symbols, entity-id-style, domain-redundancy, domain-implication, subject-key-identity, subject-key-shape, ontology-quality, exception-unapproved, exception-approval-self-attested, agent-requirement-unapproved, requirement-rationale-missing, symbol-owner-superseded, adr-unlinked, adr-proposed, predicate-schema-conformance, entity-context-missing, entity-context-acknowledged, policy-ownership, policy-markers. If omitted, server runs canonical and advisory rules plus the full-KB qualityDiagnostics audit scan, including usage telemetry acceptance when evidence exists; migration rules run only when explicitly selected. Advisory and migration findings are non-blocking qualityDiagnostics. If supplied, server preserves scoped validation and skips the full-KB advisory scan.";
16
16
  };
17
17
  readonly sourceFiles: {
18
18
  readonly type: "array";
@@ -7,10 +7,23 @@ import type { OperationResult } from "../types.js";
7
7
  * and the composite tool always agree.
8
8
  */
9
9
  type Executor = (input: never, context: OperationContext) => Promise<unknown>;
10
- export declare function dispatchComposite(selector: "action" | "mode", routes: Readonly<Record<string, {
10
+ type CompositeRoute = {
11
+ readonly name?: string;
11
12
  readonly execute: Executor;
12
13
  readonly businessInputSchema: Readonly<Record<string, unknown>>;
13
- }>>, input: Readonly<Record<string, unknown>>, context: OperationContext): Promise<OperationResult<Record<string, unknown>>>;
14
+ };
15
+ /**
16
+ * A composite accepts every route's parameters, so a parameter of another
17
+ * route passes schema validation and the chosen route silently ignores it.
18
+ * Name each one instead, with the parameter this route uses for the same
19
+ * thing when there is one.
20
+ */
21
+ export declare function foreignParameterWarnings(selector: "action" | "mode", choice: string, routes: Readonly<Record<string, CompositeRoute>>, rest: Readonly<Record<string, unknown>>): Array<{
22
+ parameter: string;
23
+ message: string;
24
+ nextAction: string;
25
+ }>;
26
+ export declare function dispatchComposite(selector: "action" | "mode", routes: Readonly<Record<string, CompositeRoute>>, input: Readonly<Record<string, unknown>>, context: OperationContext): Promise<OperationResult<Record<string, unknown>>>;
14
27
  export declare const SKILL_ROUTES: {
15
28
  readonly list: {
16
29
  readonly name: "kb_skills_list";
@@ -212,7 +225,7 @@ export declare const MODEL_ROUTES: {
212
225
  };
213
226
  readonly requirementId: {
214
227
  readonly type: "string";
215
- readonly description: "Optional existing requirement ID to receive the requires_rule relationship.";
228
+ readonly description: "Optional requirement ID. The strict write set updates this requirement instead of minting a REQ-AUTO id, and a typed logic rule attaches its requires_rule relationship to it.";
216
229
  };
217
230
  readonly claimKey: {
218
231
  readonly type: "string";
@@ -1 +1 @@
1
- {"version":3,"file":"composite.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/composite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,eA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIf,CAAC;AAGX,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIf,CAAC;AAGX,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;CAqBW,CAAC;AAGnC,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;CAwBY,CAAC"}
@@ -11,6 +11,51 @@ function requiredFields(spec) {
11
11
  const required = spec.businessInputSchema.required;
12
12
  return Array.isArray(required) ? required : [];
13
13
  }
14
+ /**
15
+ * Per route, the parameters another route of the same composite owns that
16
+ * mean the same thing here under another name. kb_model mode requirement
17
+ * takes the claim's subject as subjectKey; mode predicates takes it as
18
+ * subjectHint.
19
+ */
20
+ const EQUIVALENT_PARAMETERS = {
21
+ kb_suggest_predicates: { subjectKey: "subjectHint" },
22
+ kb_model_requirement: { subjectHint: "subjectKey" },
23
+ };
24
+ /** Routed operations whose `warnings` are `{ kind, message, nextAction }`. */
25
+ const RECORD_WARNING_OPERATIONS = new Set(["kb_model_requirement"]);
26
+ // implements REQ-kibi-mcp-tool-consolidation
27
+ /**
28
+ * A composite accepts every route's parameters, so a parameter of another
29
+ * route passes schema validation and the chosen route silently ignores it.
30
+ * Name each one instead, with the parameter this route uses for the same
31
+ * thing when there is one.
32
+ */
33
+ export function foreignParameterWarnings(selector, choice, routes, rest) {
34
+ const route = routes[choice];
35
+ if (route === undefined)
36
+ return [];
37
+ const own = new Set(Object.keys(properties(route)));
38
+ const equivalents = route.name === undefined ? {} : (EQUIVALENT_PARAMETERS[route.name] ?? {});
39
+ const warnings = [];
40
+ for (const parameter of Object.keys(rest)) {
41
+ if (own.has(parameter) || rest[parameter] === undefined)
42
+ continue;
43
+ const owners = Object.entries(routes)
44
+ .filter(([other, otherRoute]) => other !== choice && parameter in properties(otherRoute))
45
+ .map(([other]) => `${selector}: ${other}`);
46
+ if (owners.length === 0)
47
+ continue;
48
+ const equivalent = equivalents[parameter];
49
+ warnings.push({
50
+ parameter,
51
+ message: `${parameter} is a ${owners.join(" / ")} argument; ${selector}: ${choice} ignored it.`,
52
+ nextAction: equivalent !== undefined
53
+ ? `Use ${equivalent} in ${selector}: ${choice}.`
54
+ : `Drop ${parameter}, or switch to ${owners.join(" / ")} if that is what you meant.`,
55
+ });
56
+ }
57
+ return warnings;
58
+ }
14
59
  export async function dispatchComposite(selector, routes, input, context) {
15
60
  const choice = input[selector];
16
61
  const route = typeof choice === "string" ? routes[choice] : undefined;
@@ -33,9 +78,41 @@ export async function dispatchComposite(selector, routes, input, context) {
33
78
  const content = wrapped && Array.isArray(result.content)
34
79
  ? result.content
35
80
  : [{ type: "text", text: `${selector} ${String(choice)} completed` }];
81
+ const ignored = foreignParameterWarnings(selector, String(choice), routes, rest);
82
+ if (ignored.length === 0) {
83
+ return {
84
+ content,
85
+ structuredContent: { [selector]: choice, ...payload },
86
+ };
87
+ }
88
+ // The routed payload's own warnings list carries them, in its own shape;
89
+ // a payload without one gets them in the text content only.
90
+ const asRecords = route.name !== undefined && RECORD_WARNING_OPERATIONS.has(route.name);
91
+ const routedWarnings = Array.isArray(payload.warnings)
92
+ ? {
93
+ warnings: [
94
+ ...payload.warnings,
95
+ ...ignored.map((warning) => asRecords
96
+ ? {
97
+ kind: "parameter_ignored",
98
+ message: warning.message,
99
+ nextAction: warning.nextAction,
100
+ }
101
+ : `${warning.message} ${warning.nextAction}`),
102
+ ],
103
+ }
104
+ : {};
36
105
  return {
37
- content,
38
- structuredContent: { [selector]: choice, ...payload },
106
+ content: [
107
+ ...content,
108
+ {
109
+ type: "text",
110
+ text: ignored
111
+ .map((warning) => `${warning.message} ${warning.nextAction}`)
112
+ .join("\n"),
113
+ },
114
+ ],
115
+ structuredContent: { [selector]: choice, ...payload, ...routedWarnings },
39
116
  };
40
117
  }
41
118
  // implements REQ-kibi-mcp-tool-consolidation
@@ -61,7 +61,7 @@ export declare const modelRequirementSpec: {
61
61
  };
62
62
  readonly requirementId: {
63
63
  readonly type: "string";
64
- readonly description: "Optional existing requirement ID to receive the requires_rule relationship.";
64
+ readonly description: "Optional requirement ID. The strict write set updates this requirement instead of minting a REQ-AUTO id, and a typed logic rule attaches its requires_rule relationship to it.";
65
65
  };
66
66
  readonly claimKey: {
67
67
  readonly type: "string";
@@ -56,7 +56,7 @@ export const modelRequirementSpec = {
56
56
  },
57
57
  requirementId: {
58
58
  type: "string",
59
- description: "Optional existing requirement ID to receive the requires_rule relationship.",
59
+ description: "Optional requirement ID. The strict write set updates this requirement instead of minting a REQ-AUTO id, and a typed logic rule attaches its requires_rule relationship to it.",
60
60
  },
61
61
  claimKey: {
62
62
  type: "string",
@@ -2,7 +2,7 @@
2
2
  id: kibi-bootstrap
3
3
  name: kibi-bootstrap
4
4
  description: "Use for any Kibi bootstrap or onboarding task: seeding a new or thin knowledge base; reviewing a bootstrap or onboarding plan, preview, or evidence; judging approval readiness or coverage; diagnosing a blocked, partial, or failed bootstrap or its repair; applying an approved bootstrap plan; or asking the human which knowledge sources hold intent. Covers kb_status first, source interview, cited intent claims, read-only kb_plan_bootstrap preview, explicit approval, exact-plan kb_apply_plan, and repair-safe close-out."
5
- version: 3.10.0
5
+ version: 3.11.0
6
6
  kibiCompatibility: ">=1.0.0"
7
7
  tags:
8
8
  - kibi
@@ -46,6 +46,7 @@ Seed branch-local Kibi knowledge from cited product intent, without creating a p
46
46
  - **Scenarios.** Write scenarios from the cited ticket's acceptance criteria, one scenario per criterion, not bulk drafts from the requirement title; ask the human when the source states none. Give each a plain title, the scenario prose in `document.body` (never in `properties`), and `assumes` links to the `property_value` facts whose values the scenario relies on. Set `expects` only when the scenario links `assumes` facts (or its criterion names concrete values that become them); `expects` without `assumes` only yields a feasibility-unknown warning, so a draft tagged `needs-human-review` omits `expects`. Then link the requirement with `specified_by` (upsert the `req` with its stored `title`, a `status` and that relationship only). Example: criterion "Given an annotation in draft state, when the user deletes it, the draft is cleared" becomes `{"type":"scenario","id":"SCEN-annotation-delete-clears-draft","properties":{"title":"Deleting a draft annotation clears the draft","status":"active","expects":"success"},"document":{"body":"Given an annotation in draft state, when the user deletes it, then the draft is cleared and nothing is published.\n\nThe acceptance criterion comes from the cited ticket; reviewers asked for it so a deleted draft never reappears after reload.\n"},"relationships":[{"type":"assumes","from":"SCEN-annotation-delete-clears-draft","to":"FACT-annotation-state-draft"}]}`, where the assumed fact is a `property_value` (`annotation.state` `eq` `draft`). Link existing tests that exercise it; never invent test evidence.
47
47
  - **Predicates.** Run `kb_model` with `mode: "predicates"` and `requirementId` on each persisted requirement and apply a returned plan with `requires_predicate` to its `relationshipTarget` (the planned `FACT-PRED-…` id, never a `SUGGEST-…` candidate id), or record the `review:ontology-gap` observation it returns, with its prose in `document.body`. A non-empty `existingGrounding` means the bootstrap already grounded that claim: on `replace_grounding` leave it unless the human wants the `replacementPlan` swap; on `provide_argument_bindings` retry with the listed arguments bound; on `record_ontology_gap` still write the returned gap observation, which is not a grounding link. Count what `kb_query` shows afterwards, not the calls you made.
48
48
  - **Unrecorded ambiguity.** Record any conflict or open question you found but did not declare in step 3 as a cited `fact_kind: observation` tagged `review:conflict` or `review:open-question`.
49
+ - **Proof integration.** Run `kibi proof inspect --json`. When it returns an `integrationPlan` (a `command` integration for the detected test runner), show the human the proposed command and `contractDefaults`, and on approval apply that exact plan with `kb_apply_plan` (`plan`, `approvedPlanHash` = its `planHash`, `approvedActionIds`); it writes `.kb/proof/integrations.json`, which you never hand-write. With no runner detected, report that proof stays deferred. Proof-bearing tests then name the integration in `proof_contract.integration`, and `kibi prove` records their evidence.
49
50
  Finish with `kb_check` and `kb_status`.
50
51
  12. **Report** calls made, result statuses, applied scope, what step 11 authored, gaps, and follow-ups. Classify as complete, partial, awaiting approval, or blocked.
51
52
 
@@ -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.11.0
5
+ version: 2.12.0
6
6
  kibiCompatibility: ">=1.0.0"
7
7
  tags:
8
8
  - kibi
@@ -219,11 +219,19 @@ authored. Each one is the order the write path accepts.
219
219
  `semantic_inventory_version`, `semantic_source_field` and
220
220
  `semantic_source_hash`, the prose into `semantic_text`, `propositions`
221
221
  into `semantic_inventory` and the assertive `claim_key`s into
222
- `logic_claims`. `kb_model` mode `predicates` per clause; `kb_upsert` the
223
- returned `applyPlan` fact first (it carries the clause's `claim_key`).
224
- Then write the requirement in one `kb_upsert` with the ledger (that
225
- clause `status: modeled`), a sectioned `document.body`, `constrains` to
226
- the subject fact and `requires_predicate` to `relationshipTarget`. A
222
+ `logic_claims`. Reuse (or `kb_upsert`) the subject fact, then call
223
+ `kb_model` mode `predicates` per clause with `subjectHint` set to that
224
+ subject fact's `subject_key`: the requirement constrains nothing yet, so
225
+ the hint is the planned subject and the planned fact gets its
226
+ `subject_key` (`subjectKey` is a mode `requirement` parameter; mode
227
+ `predicates` ignores it and warns). `kb_upsert` the returned `applyPlan`
228
+ fact first (it carries the clause's `claim_key`). Then write the
229
+ requirement in one `kb_upsert` with the ledger (that clause `status:
230
+ modeled`), a sectioned `document.body`, `constrains` to the subject
231
+ fact, `requires_predicate` to `relationshipTarget` and `specified_by` to
232
+ its scenario: `specified_by` (req → scenario) is sent in the
233
+ requirement's write, never in the scenario's, so create the scenario
234
+ first. A
227
235
  `modeled` entry and its grounding link must arrive in the same write
228
236
  (`modeled semantic_inventory entries (n) must equal logical grounding
229
237
  relationships (m)`); a clause not grounded yet stays `status: missing`
@@ -54,7 +54,16 @@ Provenance lives in `proof_bindings`; the contract stays semantic.
54
54
  ## Integration configuration
55
55
 
56
56
  `.kb/proof/integrations.json` (`kibi.proof-integration.v1`) is tracked,
57
- Kibi-managed configuration describing evidence production only:
57
+ Kibi-managed configuration describing evidence production only. Never
58
+ hand-write it: `kibi proof inspect --json` proposes a `command` integration
59
+ for the detected test runner (the `package.json` `test` script first) and
60
+ returns `integrationPlan`, a hash-bound `kibi.migration-plan.v2`, plus the
61
+ `contractDefaults` a proof-bearing test's `proof_contract` uses. Show the
62
+ proposal to the human, then apply the plan with `kb_apply_plan` (or
63
+ `kibi apply-plan --input -`) passing `plan`, `approvedPlanHash` (the plan's
64
+ `planHash`) and `approvedActionIds`. Once the file exists, a create plan is
65
+ refused; `kibi proof inspect --update <id> --json` plans adding or replacing
66
+ one named integration.
58
67
 
59
68
  - `producer: command` — Kibi synthesizes the envelope from the process
60
69
  outcome; obligations are bound with `aggregate_run` provenance and the
@@ -82,8 +91,11 @@ effective fingerprint and do.
82
91
 
83
92
  ## Common rejections
84
93
 
85
- - `No proof integration configuration` — bootstrap has not configured proof
86
- for this repository yet; do not hand-wave, run the bootstrap proof step.
94
+ - `No proof integration configuration` — proof is not configured for this
95
+ repository yet; run `kibi proof inspect --json`, review its
96
+ `integrationPlan` and apply it with `kb_apply_plan`.
97
+ - `integration '<id>' ... is not configured` — the test names an integration
98
+ the file lacks; plan it with `kibi proof inspect --update <id> --json`.
87
99
  - `captured snapshot is not the live workspace snapshot` — the tree changed
88
100
  between capture and ingest; re-run `kibi prove`.
89
101
  - `artifact command_argv does not match the configured command` — the
@@ -1,3 +1,7 @@
1
+ /** Stale-reason code of a branch store that was never compiled. */
2
+ export declare const BRANCH_STORE_NOT_COMPILED = "branch_store_not_compiled";
3
+ /** The kb_check rule that reports it. */
4
+ export declare const BRANCH_STORE_NOT_COMPILED_RULE = "branch-store-not-compiled";
1
5
  export type BranchStoreState = "healthy" | "missing" | "incomplete" | "unreadable";
2
6
  export type BranchStoreInspection = Readonly<{
3
7
  state: BranchStoreState;
@@ -18,4 +22,32 @@ export declare function inspectBranchStore(workspaceRoot: string, branch: string
18
22
  */
19
23
  export declare function storeLockJournalReason(storePath: string): Record<string, unknown> | null;
20
24
  export declare function branchStoreReason(inspection: BranchStoreInspection): Record<string, unknown> | null;
25
+ /**
26
+ * The number of authored source files under `.kb/`: entity Markdown in the
27
+ * entity lanes plus relationship shards. Filesystem only, like
28
+ * inspectBranchStore, so a status read never compiles anything.
29
+ */
30
+ export declare function countAuthoredKbSources(workspaceRoot: string): number;
31
+ export type BranchStoreCompilation = Readonly<{
32
+ /** True once a sync (or any write) has committed into the store. */
33
+ compiled: boolean;
34
+ /** The journal CURRENT pointer (`generation-<id>:<sequence>`), if any. */
35
+ generation: string | null;
36
+ }>;
37
+ /**
38
+ * Whether the branch store holds a compilation. A missing store holds none;
39
+ * a journaled store whose CURRENT sequence is still 0 and whose journal holds
40
+ * no graph data was created (by `kibi branch ensure` or by an engine
41
+ * attaching to a new branch) but nothing was ever committed into it, so it is
42
+ * empty. A legacy kb.rdf store counts as compiled.
43
+ */
44
+ export declare function branchStoreCompilation(inspection: BranchStoreInspection): BranchStoreCompilation;
45
+ /**
46
+ * The single blocking reason for a branch whose store was never compiled
47
+ * while `.kb/` holds authored sources: Kibi stores are per branch and never
48
+ * copied, so a fresh branch (no post-checkout hook) starts empty. Every
49
+ * check against that store would report each authored relationship as
50
+ * missing; the one fix is `kibi sync`.
51
+ */
52
+ export declare function uncompiledBranchStoreReason(workspaceRoot: string, inspection: BranchStoreInspection, branch: string): Record<string, unknown> | null;
21
53
  //# sourceMappingURL=branch-store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"branch-store.d.ts","sourceRoot":"","sources":["../../src/utils/branch-store.ts"],"names":[],"mappings":"AAiBA,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,SAAS,GACT,YAAY,GACZ,YAAY,CAAC;AAEjB,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC;IAC3C,KAAK,EAAE,gB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AiBhC;AAED,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,qBAAqB,GAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAWhC;AA6BD;;;;GAIG;AAEH,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAOpE;AAED,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAC5C,oEAAoE;IACpE,QAAQ,EAAE,OAAO,CAAC;IAClB,0EAA0E;IAC1E,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC,CAAC;AAEH;;;;;;GAMG;AAEH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,qBAAqB,GAChC,sBAAsB,CAwBxB;AAkBD;;;;;;GAMG;AAEH,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,qBAAqB,EACjC,MAAM,EAAE,MAAM,GACb,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAwBhC"}
@@ -2,10 +2,15 @@
2
2
  Kibi — repo-local, per-branch, queryable long-term memory for software projects
3
3
  Copyright (C) 2026 Piotr Franczyk
4
4
  */
5
- import { existsSync, readFileSync, statSync } from "node:fs";
5
+ import { existsSync, readFileSync, readdirSync, statSync, } from "node:fs";
6
6
  import * as path from "node:path";
7
7
  import { classifyStoreLockHolder, readStoreLockOwner, } from "../prolog/store-lock.js";
8
8
  import { branchStoreManifestMatches, branchStorePath, legacyBranchStorePath, } from "./branch-store-locator.js";
9
+ import { ENTITY_LANES, KB_ROOT } from "./kb-paths.js";
10
+ /** Stale-reason code of a branch store that was never compiled. */
11
+ export const BRANCH_STORE_NOT_COMPILED = "branch_store_not_compiled";
12
+ /** The kb_check rule that reports it. */
13
+ export const BRANCH_STORE_NOT_COMPILED_RULE = "branch-store-not-compiled";
9
14
  /**
10
15
  * Performs only filesystem checks. It deliberately never starts the engine or
11
16
  * attaches Prolog, so callers can still explain a broken branch store.
@@ -155,3 +160,119 @@ export function branchStoreReason(inspection) {
155
160
  : { command_argv: ["kibi", "branch", "ensure"], applyRequired: false },
156
161
  };
157
162
  }
163
+ /** Directories under .kb/ that hold authored, Git-tracked entity sources. */
164
+ const AUTHORED_SOURCE_DIRECTORIES = [
165
+ ...ENTITY_LANES.map((lane) => [lane, ".md"]),
166
+ ["adrs", ".md"],
167
+ ["relationships", ".yaml"],
168
+ ];
169
+ function countFiles(directory, extension) {
170
+ let count = 0;
171
+ let entries;
172
+ try {
173
+ entries = readdirSync(directory, { withFileTypes: true });
174
+ }
175
+ catch {
176
+ return 0;
177
+ }
178
+ for (const entry of entries) {
179
+ if (entry.isDirectory()) {
180
+ count += countFiles(path.join(directory, entry.name), extension);
181
+ }
182
+ else if (entry.isFile() && entry.name.endsWith(extension)) {
183
+ count += 1;
184
+ }
185
+ }
186
+ return count;
187
+ }
188
+ /**
189
+ * The number of authored source files under `.kb/`: entity Markdown in the
190
+ * entity lanes plus relationship shards. Filesystem only, like
191
+ * inspectBranchStore, so a status read never compiles anything.
192
+ */
193
+ // implements REQ-cli-status-pre-first-sync
194
+ export function countAuthoredKbSources(workspaceRoot) {
195
+ const kbRoot = path.join(workspaceRoot, KB_ROOT);
196
+ return AUTHORED_SOURCE_DIRECTORIES.reduce((total, [directory, extension]) => total + countFiles(path.join(kbRoot, directory), extension), 0);
197
+ }
198
+ /**
199
+ * Whether the branch store holds a compilation. A missing store holds none;
200
+ * a journaled store whose CURRENT sequence is still 0 and whose journal holds
201
+ * no graph data was created (by `kibi branch ensure` or by an engine
202
+ * attaching to a new branch) but nothing was ever committed into it, so it is
203
+ * empty. A legacy kb.rdf store counts as compiled.
204
+ */
205
+ // implements REQ-cli-status-pre-first-sync
206
+ export function branchStoreCompilation(inspection) {
207
+ if (inspection.state === "missing") {
208
+ return { compiled: false, generation: null };
209
+ }
210
+ const currentPath = path.join(inspection.path, "CURRENT");
211
+ let current = "";
212
+ try {
213
+ current = existsSync(currentPath)
214
+ ? readFileSync(currentPath, "utf8").trim()
215
+ : "";
216
+ }
217
+ catch {
218
+ current = "";
219
+ }
220
+ if (current === "") {
221
+ // A healthy store without CURRENT is a legacy kb.rdf store.
222
+ return { compiled: inspection.state === "healthy", generation: null };
223
+ }
224
+ const sequence = Number(current.split(":").at(-1));
225
+ return {
226
+ compiled: (Number.isFinite(sequence) && sequence > 0) ||
227
+ journalHoldsGraphData(inspection.path),
228
+ generation: current,
229
+ };
230
+ }
231
+ /**
232
+ * Whether the journal directory holds persisted graph data. An empty store
233
+ * has only `rdf/lock`; a store migrated from a legacy kb.rdf holds the
234
+ * imported graph under a fresh `generation-…:0` pointer, so it is compiled
235
+ * although its sequence is still 0.
236
+ */
237
+ function journalHoldsGraphData(storePath) {
238
+ try {
239
+ return readdirSync(path.join(storePath, "rdf")).some((entry) => entry !== "lock" && !entry.startsWith("."));
240
+ }
241
+ catch {
242
+ return false;
243
+ }
244
+ }
245
+ /**
246
+ * The single blocking reason for a branch whose store was never compiled
247
+ * while `.kb/` holds authored sources: Kibi stores are per branch and never
248
+ * copied, so a fresh branch (no post-checkout hook) starts empty. Every
249
+ * check against that store would report each authored relationship as
250
+ * missing; the one fix is `kibi sync`.
251
+ */
252
+ // implements REQ-cli-status-pre-first-sync
253
+ export function uncompiledBranchStoreReason(workspaceRoot, inspection, branch) {
254
+ if (inspection.state !== "healthy" && inspection.state !== "missing") {
255
+ return null;
256
+ }
257
+ const compilation = branchStoreCompilation(inspection);
258
+ if (compilation.compiled)
259
+ return null;
260
+ const authoredSources = countAuthoredKbSources(workspaceRoot);
261
+ if (authoredSources === 0)
262
+ return null;
263
+ const storeState = inspection.state === "missing"
264
+ ? "does not exist yet"
265
+ : `is empty (${compilation.generation ?? "no generation"}: nothing compiled)`;
266
+ return {
267
+ code: BRANCH_STORE_NOT_COMPILED,
268
+ path: inspection.path,
269
+ entityIds: [],
270
+ detail: `The KB store for branch ${branch} ${storeState}, while .kb/ holds ${authoredSources} authored source file(s). Kibi compiles one store per branch and never copies another branch's, so every query and check reads an empty KB until this branch is compiled.`,
271
+ remediation: { command_argv: ["kibi", "sync"], applyRequired: false },
272
+ blocking: true,
273
+ authoredSources,
274
+ ...(compilation.generation !== null
275
+ ? { generation: compilation.generation }
276
+ : {}),
277
+ };
278
+ }
@@ -23,6 +23,11 @@ export declare const GENERATED_RULES: readonly [{
23
23
  readonly description: "Authored Markdown and relationship-shard edges must exactly match the compiled KB";
24
24
  readonly enforcementClass: "canonical";
25
25
  readonly category: "integrity";
26
+ }, {
27
+ readonly name: "branch-store-not-compiled";
28
+ readonly description: "The current branch's KB store must be compiled from the authored .kb/ sources; a missing or empty store is reported once, naming kibi sync, instead of every store-backed rule reading an empty KB";
29
+ readonly enforcementClass: "canonical";
30
+ readonly category: "integrity";
26
31
  }, {
27
32
  readonly name: "source-path-dangling";
28
33
  readonly description: "An authored entity's source field must name an existing workspace path (a #anchor suffix is ignored), an existing entity id, or an http(s) URL; a missing source is allowed";
@@ -1 +1 @@
1
- {"version":3,"file":"rule-registry.generated.d.ts","sourceRoot":"","sources":["../../src/utils/rule-registry.generated.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqUlB,CAAC"}
1
+ {"version":3,"file":"rule-registry.generated.d.ts","sourceRoot":"","sources":["../../src/utils/rule-registry.generated.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4UlB,CAAC"}
@@ -38,6 +38,12 @@ export const GENERATED_RULES = [
38
38
  enforcementClass: "canonical",
39
39
  category: "integrity",
40
40
  },
41
+ {
42
+ name: "branch-store-not-compiled",
43
+ description: "The current branch's KB store must be compiled from the authored .kb/ sources; a missing or empty store is reported once, naming kibi sync, instead of every store-backed rule reading an empty KB",
44
+ enforcementClass: "canonical",
45
+ category: "integrity",
46
+ },
41
47
  {
42
48
  name: "source-path-dangling",
43
49
  description: "An authored entity's source field must name an existing workspace path (a #anchor suffix is ignored), an existing entity id, or an http(s) URL; a missing source is allowed",
@@ -12,6 +12,12 @@ export interface SemanticClaim {
12
12
  export interface StrictModelInput {
13
13
  claim: SemanticClaim;
14
14
  statement: string;
15
+ /**
16
+ * The requirement the write set updates. When set it replaces the minted
17
+ * REQ-AUTO-<hash> id; fact ids, subject_key and the claim stay derived from
18
+ * the claim.
19
+ */
20
+ requirementId?: string;
15
21
  }
16
22
  type EntityProperties = Partial<Omit<BaseEntity, "created_at" | "updated_at"> & FactFields> & {
17
23
  id: string;
@@ -65,5 +71,11 @@ export declare function buildStrictWriteSet(input: StrictModelInput): StrictWrit
65
71
  export declare function modelRequirementClaims(inputs: ReadonlyArray<StrictModelInput>): StrictWriteSet[];
66
72
  export declare function normalizeSourceKey(value: string): string;
67
73
  export declare function normalizeTextRef(provenance: string | undefined, source: string): string;
74
+ /**
75
+ * The file an authored fact lives in: `.kb/facts/<id>.md`. Kibi writes every
76
+ * fact there (the filename stem equals the id), so a plan that points at an
77
+ * existing fact names this path.
78
+ */
79
+ export declare function factSourcePath(factId: string): string;
68
80
  export {};
69
81
  //# sourceMappingURL=strict-modeling.d.ts.map
@@ -1 +1 @@
1
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AM,sBAAsB,QACoC,CAAC;AAGxE,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAe1D;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,aAAa,GACnB,oBAAoB,CAwBtB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,gBAAgB,GAAG,cAAc,CAwH3E;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,aAAa,CAAC,gBAAgB,CAAC,GACtC,cAAc,EAAE,CAkBlB;AAQD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAexD;AA0BD,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,MAAM,EAAE,MAAM,GACb,MAAM,CAMR;AAsND;;;;GAIG;AAEH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD"}
@@ -83,7 +83,9 @@ export function buildStableRequirementIds(claim) {
83
83
  export function buildStrictWriteSet(input) {
84
84
  const statement = normalizeStatement(input.statement);
85
85
  const confidence = normalizeConfidence(input.claim.confidence);
86
- const ids = buildStableRequirementIds(input.claim);
86
+ const minted = buildStableRequirementIds(input.claim);
87
+ const requirementId = input.requirementId?.trim();
88
+ const ids = requirementId ? { ...minted, reqId: requirementId } : minted;
87
89
  const textRef = normalizeTextRef(input.claim.provenance, input.claim.source);
88
90
  const metadataTags = buildMetadataTags({
89
91
  confidence,
@@ -409,3 +411,12 @@ function normalizeEntityDirectory(directory) {
409
411
  function buildEntitySourcePath(directory, entityId) {
410
412
  return `${directory}/${entityId}.md`;
411
413
  }
414
+ /**
415
+ * The file an authored fact lives in: `.kb/facts/<id>.md`. Kibi writes every
416
+ * fact there (the filename stem equals the id), so a plan that points at an
417
+ * existing fact names this path.
418
+ */
419
+ // implements REQ-kibi-subject-vocabulary
420
+ export function factSourcePath(factId) {
421
+ return buildEntitySourcePath(resolveEntitySourcePaths().facts, factId);
422
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kibi-cli",
3
- "version": "2.15.0",
3
+ "version": "2.16.0",
4
4
  "type": "module",
5
5
  "description": "Kibi CLI for knowledge base management",
6
6
  "engines": {
@@ -235,7 +235,7 @@
235
235
  "fast-glob": "^3.2.12",
236
236
  "gray-matter": "^4.0.3",
237
237
  "js-yaml": "^4.1.0",
238
- "kibi-core": "^0.18.0",
238
+ "kibi-core": "^0.18.1",
239
239
  "kibi-plugin-builtin": "^0.5.0",
240
240
  "kibi-plugin-sdk": "^0.5.0",
241
241
  "kibi-swipl": "^1.0.1",