kibi-cursor 1.0.1 → 2.0.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.
@@ -1,3 +1,14 @@
1
+ export function isFreshnessLane(lane) {
2
+ return (lane === "requirements" ||
3
+ lane === "scenarios" ||
4
+ lane === "tests" ||
5
+ lane === "facts" ||
6
+ lane === "adr" ||
7
+ lane === "flags" ||
8
+ lane === "events" ||
9
+ lane === "symbols.yaml" ||
10
+ lane === "symbol-coordinates.yaml");
11
+ }
1
12
  // implements REQ-cursor-kibi-plugin-v1
2
13
  const explicitPathKeys = new Set([
3
14
  "absolute_path",
@@ -59,6 +70,9 @@ function isCanonicalKbKnowledgePath(segments) {
59
70
  return false;
60
71
  }
61
72
  const lane = segments[1];
73
+ // rationale: the undefined check narrows the type for Set<string>.has;
74
+ // at runtime Set.has(undefined) is false, so the result is the same.
75
+ // Stryker disable next-line ConditionalExpression, BlockStatement
62
76
  if (lane === undefined) {
63
77
  return false;
64
78
  }
@@ -123,10 +137,15 @@ export function isMeaningfulTrackedPath(candidate) {
123
137
  if (segments.includes(".kb")) {
124
138
  return isCanonicalKbKnowledgePath(segments);
125
139
  }
140
+ // rationale: an empty basename and the placeholder basename both yield a
141
+ // non-matching extension, and split().at(-1) of a non-empty string is
142
+ // never undefined, so these fallback literals are observationally inert.
143
+ // Stryker disable StringLiteral
126
144
  const basename = segments.at(-1) ?? "";
127
145
  const extension = basename.includes(".")
128
146
  ? `.${basename.split(".").at(-1) ?? ""}`
129
147
  : "";
148
+ // Stryker restore
130
149
  if (segments.includes("docs") || segments.includes("documentation")) {
131
150
  return documentationExtensions.has(extension);
132
151
  }
@@ -145,17 +164,8 @@ export function isKbFreshnessRelevantPath(candidate) {
145
164
  const segments = pathSegments(normalizePath(candidate));
146
165
  if (segments[0] === ".kb") {
147
166
  const lane = segments[1];
148
- if (lane === "requirements" ||
149
- lane === "scenarios" ||
150
- lane === "tests" ||
151
- lane === "facts" ||
152
- lane === "adr" ||
153
- lane === "flags" ||
154
- lane === "events" ||
155
- lane === "symbols.yaml" ||
156
- lane === "symbol-coordinates.yaml") {
167
+ if (isFreshnessLane(lane))
157
168
  return true;
158
- }
159
169
  }
160
170
  // Legacy layout during migration
161
171
  if (segments.includes("documentation")) {
@@ -185,10 +195,13 @@ export function isSourceImpactRelevantPath(candidate) {
185
195
  export function isDocumentationTrackedPath(candidate) {
186
196
  const normalized = normalizePath(candidate);
187
197
  const segments = pathSegments(normalized);
198
+ // rationale: same inert fallbacks as in isMeaningfulTrackedPath.
199
+ // Stryker disable StringLiteral
188
200
  const basename = segments.at(-1) ?? "";
189
201
  const extension = basename.includes(".")
190
202
  ? `.${basename.split(".").at(-1) ?? ""}`
191
203
  : "";
204
+ // Stryker restore
192
205
  return (segments.includes("docs") ||
193
206
  segments.includes("documentation") ||
194
207
  documentationExtensions.has(extension));
@@ -13,13 +13,13 @@
13
13
  "kibi-traceability/resources/operation-access.md": "39f7972ab7f4ae7479e78f7072bb50e8e6c4cdf4f857425f69d2522d37db437c",
14
14
  "kibi-traceability/resources/source-authoring.md": "408c6ee2bef1b84e0194c0538ef929c26a0a617e631b2234247388140dbbdd08",
15
15
  "kibi-traceability/resources/traceability.md": "38c290a0bc71bd1692e115f22694743946e2f69630e134acfd43cee5f613fb88",
16
- "kibi-usage/SKILL.md": "ed42d8f6caf8048b81c05f670018c5f341e0667e3fa4aff2bf11277e9deb3c2f",
16
+ "kibi-usage/SKILL.md": "c59558c8b5349ef380a5543373f35a7f68fae9ae04aee589e1a8bf0104a5d7e2",
17
17
  "kibi-usage/resources/branch-lifecycle.md": "f1bf359e9826e83c548f3cd0287f8175a62456527b0132b06b3f9f74aa59b7d6",
18
18
  "kibi-usage/resources/fact-lanes.md": "41b28023a57593009867ea0ebc8e9f3f05c3bd837144772d12844423f922e763",
19
19
  "kibi-usage/resources/kb-improvement.md": "17e8b6cf6a0dd43b443a2bfd92e7205d099647a5f1c75fe85413a6cea63d86c6",
20
20
  "kibi-usage/resources/logic-ir.md": "151675d0ffa813cb9e271084102a3af42de369b8f9a0c64866af0cdc4d924063",
21
21
  "kibi-usage/resources/operation-access.md": "e8b4a3676892d2f7e2cfd708ec4ad1f41b6f296e1eb3a5ecc047f43322b4a92a",
22
- "kibi-usage/resources/proof.md": "e1a44ea4bf342afebb0aaa7800221067a511f6607c687ac38db6392b7e3d9f9a",
22
+ "kibi-usage/resources/proof.md": "7391046fbdeece4858b668360c60755f184af6dfedda9dbc67e2fa4574dbce7f",
23
23
  "kibi-usage/resources/relationship-directions.md": "a357072d3370db9b7d80e505795f952909a68778cc18b1d089970de91e4fda46",
24
24
  "kibi-usage/resources/source-authoring.md": "ac4f1a9b5785462f8c3530bdcdb82ad9a0ee1f4049454ae28bf4df09ff267ebd",
25
25
  "kibi-usage/resources/ui-requirements.md": "b7c31ab1affa3ab25ae5242d8fd8c4d546532d1cafc65d84088375317c1682cc",
@@ -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.1.1
5
+ version: 2.1.3
6
6
  kibiCompatibility: ">=1.0.0"
7
7
  tags:
8
8
  - kibi
@@ -75,6 +75,8 @@ check. Never fire `kb_upsert` calls in parallel; create or confirm endpoint
75
75
  entities before linking them. The canonical MCP names are `kb_search`,
76
76
  `kb_query`, `kb_upsert`, and `kb_check`.
77
77
 
78
+ For a task that explicitly supplies a malformed concrete mutation payload, locate and read that public request artifact before choosing an entity, preserving its exact entity ID, type, requested changes, and every intended relationship and endpoint. Do not substitute a seeded or convenient entity for the requested target. Start with kb_search, then exact-filter those targets with kb_query, and run kb_validate_upsert on that same payload; validation is not completion. Correct only diagnosed pre-commit errors and revalidate the corrected payload. Once authorized, apply the identical corrected and authorized payload with kb_upsert. If it returns committed_with_repairs, treat the mutation as committed, follow only the required repair actions, and neither retry it nor trigger unrelated semantic backfill for a schema-only repair. Exact-read every changed entity and relationship endpoint with kb_query, then finish with an unfiltered kb_check followed by a final kb_status.
79
+
78
80
  ## Closeout fields
79
81
 
80
82
  End every task with these five independent fields:
@@ -131,6 +133,9 @@ safe normative claims; use `observation` or `meta` for bug/workaround notes and
131
133
  tests, symbol ownership, and fresh proof-bearing receipts before claiming proof.
132
134
  For an existing product KB that needs semantic backfill, read
133
135
  `resources/kb-improvement.md`, and `resources/proof.md` for the proof workflow.
136
+ When a proof ratchet fails, follow Debugging proof regressions in
137
+ `resources/proof.md`: use `kibi proof explain` and compare current proof state
138
+ to committed `proof/baseline.json` with `kibi proof impact`.
134
139
 
135
140
  ## Predicate Ontology Decision Tree
136
141
 
@@ -147,6 +152,8 @@ grounding: run `logic-coverage` so each key binds to one ground fact.
147
152
  Relationship direction is fixed, and every `from` in a relationship batch
148
153
  must equal the upserted entity ID.
149
154
 
155
+ For conditional relational claims, after the initial `kb_suggest_predicates` and before any `kb_upsert`—including one needed for a missing schema—call read-only `kb_model_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.
156
+
150
157
  ## Symbol-First Traceability
151
158
 
152
159
  Represent implementation ownership with a `symbol` entity that has
@@ -103,3 +103,48 @@ re-run `kibi prove` for the affected selection, then confirm `kb_status` and
103
103
  `kb_coverage` before handoff.
104
104
 
105
105
  Full reference: `docs/proving-requirements.md`.
106
+
107
+ ## Debugging proof regressions
108
+
109
+ When a proof ratchet fails, diagnose first. Do not treat
110
+ `proof/baseline.json` as the thing to edit.
111
+
112
+ 1. Do not refresh `proof/baseline.json` as the first fix.
113
+ 2. Identify the exact requirement and symbol responsible for the regression.
114
+ 3. Use Kibi proof diagnostics rather than reverse-engineering
115
+ `requirement_proof.pl`:
116
+
117
+ ```bash
118
+ kibi proof explain REQ-<id>
119
+ kibi proof explain SYM-<id>
120
+ kibi proof impact
121
+ ```
122
+
123
+ `kibi proof impact` compares the current Proof projection to
124
+ `HEAD:proof/baseline.json` (the committed ratchet snapshot, not the
125
+ working-tree file). It is diagnostic: fingerprint differences are reported
126
+ and the command exits 0 on successful evaluation. The strict ratchet remains
127
+ `scripts/check-proof-baseline.mjs`.
128
+ 4. For `missing_production_symbol_coverage`, inspect symbol role, owning
129
+ requirement, `covered_by`, candidate test scope, the requirement scenario
130
+ chain, and the current proof receipt. `kibi proof explain` prints those as
131
+ three labeled blocks so they cannot be confused:
132
+ `required_proofs` (TEST contract obligations), `executable_for` (test-code
133
+ identity), and `covered_by` (production coverage candidates with primary
134
+ plus optional secondary reasons).
135
+ 5. A behavioral production symbol requires qualifying behavioral/E2E evidence
136
+ under the current proof model.
137
+ 6. Unit coverage can satisfy structural/type-shape requirements only when the
138
+ symbol genuinely represents structural shape and the proof model allows it.
139
+ 7. `executable_for` identifies executable test code. Never use it on
140
+ production helpers merely to remove production coverage obligations.
141
+ 8. Do not trust TEST names. Resolve
142
+ `TEST -> proof_contract.required_proofs -> SYM -> source` and inspect what
143
+ the executable test actually exercises. Kibi does not infer “this TEST name
144
+ does not match that source file.”
145
+ 9. A passing proof producer does not automatically make every authored
146
+ `covered_by` relationship semantically correct.
147
+ 10. Prefer one meaningful E2E scenario covering multiple internal functions
148
+ plus focused unit tests for edge cases, rather than an E2E test per helper.
149
+ 11. Refresh the baseline only after a genuine intentional proof-state
150
+ improvement requires the ratchet snapshot to be updated.
package/mcp.json CHANGED
@@ -2,7 +2,10 @@
2
2
  "mcpServers": {
3
3
  "kibi": {
4
4
  "command": "node",
5
- "args": ["bin/launch-kibi-mcp.mjs", "${workspaceFolder}"]
5
+ "args": [
6
+ "${CURSOR_PLUGIN_ROOT}/bin/launch-kibi-mcp.mjs",
7
+ "${workspaceFolder}"
8
+ ]
6
9
  }
7
10
  }
8
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kibi-cursor",
3
- "version": "1.0.1",
3
+ "version": "2.0.1",
4
4
  "description": "Kibi Cursor plugin - thin adapter for Cursor MCP integration and editor hooks",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -13,13 +13,13 @@
13
13
  "kibi-traceability/resources/operation-access.md": "39f7972ab7f4ae7479e78f7072bb50e8e6c4cdf4f857425f69d2522d37db437c",
14
14
  "kibi-traceability/resources/source-authoring.md": "408c6ee2bef1b84e0194c0538ef929c26a0a617e631b2234247388140dbbdd08",
15
15
  "kibi-traceability/resources/traceability.md": "38c290a0bc71bd1692e115f22694743946e2f69630e134acfd43cee5f613fb88",
16
- "kibi-usage/SKILL.md": "ed42d8f6caf8048b81c05f670018c5f341e0667e3fa4aff2bf11277e9deb3c2f",
16
+ "kibi-usage/SKILL.md": "c59558c8b5349ef380a5543373f35a7f68fae9ae04aee589e1a8bf0104a5d7e2",
17
17
  "kibi-usage/resources/branch-lifecycle.md": "f1bf359e9826e83c548f3cd0287f8175a62456527b0132b06b3f9f74aa59b7d6",
18
18
  "kibi-usage/resources/fact-lanes.md": "41b28023a57593009867ea0ebc8e9f3f05c3bd837144772d12844423f922e763",
19
19
  "kibi-usage/resources/kb-improvement.md": "17e8b6cf6a0dd43b443a2bfd92e7205d099647a5f1c75fe85413a6cea63d86c6",
20
20
  "kibi-usage/resources/logic-ir.md": "151675d0ffa813cb9e271084102a3af42de369b8f9a0c64866af0cdc4d924063",
21
21
  "kibi-usage/resources/operation-access.md": "e8b4a3676892d2f7e2cfd708ec4ad1f41b6f296e1eb3a5ecc047f43322b4a92a",
22
- "kibi-usage/resources/proof.md": "e1a44ea4bf342afebb0aaa7800221067a511f6607c687ac38db6392b7e3d9f9a",
22
+ "kibi-usage/resources/proof.md": "7391046fbdeece4858b668360c60755f184af6dfedda9dbc67e2fa4574dbce7f",
23
23
  "kibi-usage/resources/relationship-directions.md": "a357072d3370db9b7d80e505795f952909a68778cc18b1d089970de91e4fda46",
24
24
  "kibi-usage/resources/source-authoring.md": "ac4f1a9b5785462f8c3530bdcdb82ad9a0ee1f4049454ae28bf4df09ff267ebd",
25
25
  "kibi-usage/resources/ui-requirements.md": "b7c31ab1affa3ab25ae5242d8fd8c4d546532d1cafc65d84088375317c1682cc",
@@ -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.1.1
5
+ version: 2.1.3
6
6
  kibiCompatibility: ">=1.0.0"
7
7
  tags:
8
8
  - kibi
@@ -75,6 +75,8 @@ check. Never fire `kb_upsert` calls in parallel; create or confirm endpoint
75
75
  entities before linking them. The canonical MCP names are `kb_search`,
76
76
  `kb_query`, `kb_upsert`, and `kb_check`.
77
77
 
78
+ For a task that explicitly supplies a malformed concrete mutation payload, locate and read that public request artifact before choosing an entity, preserving its exact entity ID, type, requested changes, and every intended relationship and endpoint. Do not substitute a seeded or convenient entity for the requested target. Start with kb_search, then exact-filter those targets with kb_query, and run kb_validate_upsert on that same payload; validation is not completion. Correct only diagnosed pre-commit errors and revalidate the corrected payload. Once authorized, apply the identical corrected and authorized payload with kb_upsert. If it returns committed_with_repairs, treat the mutation as committed, follow only the required repair actions, and neither retry it nor trigger unrelated semantic backfill for a schema-only repair. Exact-read every changed entity and relationship endpoint with kb_query, then finish with an unfiltered kb_check followed by a final kb_status.
79
+
78
80
  ## Closeout fields
79
81
 
80
82
  End every task with these five independent fields:
@@ -131,6 +133,9 @@ safe normative claims; use `observation` or `meta` for bug/workaround notes and
131
133
  tests, symbol ownership, and fresh proof-bearing receipts before claiming proof.
132
134
  For an existing product KB that needs semantic backfill, read
133
135
  `resources/kb-improvement.md`, and `resources/proof.md` for the proof workflow.
136
+ When a proof ratchet fails, follow Debugging proof regressions in
137
+ `resources/proof.md`: use `kibi proof explain` and compare current proof state
138
+ to committed `proof/baseline.json` with `kibi proof impact`.
134
139
 
135
140
  ## Predicate Ontology Decision Tree
136
141
 
@@ -147,6 +152,8 @@ grounding: run `logic-coverage` so each key binds to one ground fact.
147
152
  Relationship direction is fixed, and every `from` in a relationship batch
148
153
  must equal the upserted entity ID.
149
154
 
155
+ For conditional relational claims, after the initial `kb_suggest_predicates` and before any `kb_upsert`—including one needed for a missing schema—call read-only `kb_model_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.
156
+
150
157
  ## Symbol-First Traceability
151
158
 
152
159
  Represent implementation ownership with a `symbol` entity that has
@@ -103,3 +103,48 @@ re-run `kibi prove` for the affected selection, then confirm `kb_status` and
103
103
  `kb_coverage` before handoff.
104
104
 
105
105
  Full reference: `docs/proving-requirements.md`.
106
+
107
+ ## Debugging proof regressions
108
+
109
+ When a proof ratchet fails, diagnose first. Do not treat
110
+ `proof/baseline.json` as the thing to edit.
111
+
112
+ 1. Do not refresh `proof/baseline.json` as the first fix.
113
+ 2. Identify the exact requirement and symbol responsible for the regression.
114
+ 3. Use Kibi proof diagnostics rather than reverse-engineering
115
+ `requirement_proof.pl`:
116
+
117
+ ```bash
118
+ kibi proof explain REQ-<id>
119
+ kibi proof explain SYM-<id>
120
+ kibi proof impact
121
+ ```
122
+
123
+ `kibi proof impact` compares the current Proof projection to
124
+ `HEAD:proof/baseline.json` (the committed ratchet snapshot, not the
125
+ working-tree file). It is diagnostic: fingerprint differences are reported
126
+ and the command exits 0 on successful evaluation. The strict ratchet remains
127
+ `scripts/check-proof-baseline.mjs`.
128
+ 4. For `missing_production_symbol_coverage`, inspect symbol role, owning
129
+ requirement, `covered_by`, candidate test scope, the requirement scenario
130
+ chain, and the current proof receipt. `kibi proof explain` prints those as
131
+ three labeled blocks so they cannot be confused:
132
+ `required_proofs` (TEST contract obligations), `executable_for` (test-code
133
+ identity), and `covered_by` (production coverage candidates with primary
134
+ plus optional secondary reasons).
135
+ 5. A behavioral production symbol requires qualifying behavioral/E2E evidence
136
+ under the current proof model.
137
+ 6. Unit coverage can satisfy structural/type-shape requirements only when the
138
+ symbol genuinely represents structural shape and the proof model allows it.
139
+ 7. `executable_for` identifies executable test code. Never use it on
140
+ production helpers merely to remove production coverage obligations.
141
+ 8. Do not trust TEST names. Resolve
142
+ `TEST -> proof_contract.required_proofs -> SYM -> source` and inspect what
143
+ the executable test actually exercises. Kibi does not infer “this TEST name
144
+ does not match that source file.”
145
+ 9. A passing proof producer does not automatically make every authored
146
+ `covered_by` relationship semantically correct.
147
+ 10. Prefer one meaningful E2E scenario covering multiple internal functions
148
+ plus focused unit tests for edge cases, rather than an E2E test per helper.
149
+ 11. Refresh the baseline only after a genuine intentional proof-state
150
+ improvement requires the ratchet snapshot to be updated.