kibi-cursor 0.5.0 → 0.6.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 (35) hide show
  1. package/.cursor-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +85 -0
  3. package/README.md +16 -1
  4. package/agent-plugin/mcp.json +10 -0
  5. package/agent-plugin/plugin.json +11 -0
  6. package/agent-plugin/skills/init-kibi/SKILL.md +62 -0
  7. package/agent-plugin/skills/kibi-freshness/SKILL.md +44 -0
  8. package/agent-plugin/skills/kibi-traceability/SKILL.md +60 -0
  9. package/agent-plugin/skills/kibi-usage/SKILL.md +276 -0
  10. package/agent-plugin/skills/kibi-usage/resources/fact-lanes.md +235 -0
  11. package/agent-plugin/skills/kibi-usage/resources/logic-ir.md +43 -0
  12. package/agent-plugin/skills/kibi-usage/resources/operation-access.md +44 -0
  13. package/agent-plugin/skills/kibi-usage/resources/relationship-directions.md +119 -0
  14. package/agent-plugin/skills/kibi-usage/resources/ui-requirements.md +96 -0
  15. package/agent-plugin/skills/kibi-usage/resources/workflows.md +97 -0
  16. package/dist/.cursor-plugin/plugin.json +1 -1
  17. package/dist/messages.d.ts +2 -2
  18. package/dist/messages.js +2 -2
  19. package/dist/skills/.canon-hash.json +7 -5
  20. package/dist/skills/kibi-traceability/SKILL.md +7 -1
  21. package/dist/skills/kibi-usage/SKILL.md +44 -12
  22. package/dist/skills/kibi-usage/resources/fact-lanes.md +12 -2
  23. package/dist/skills/kibi-usage/resources/logic-ir.md +43 -0
  24. package/dist/skills/kibi-usage/resources/operation-access.md +19 -19
  25. package/dist/skills/kibi-usage/resources/ui-requirements.md +96 -0
  26. package/dist/skills/kibi-usage/resources/workflows.md +40 -8
  27. package/package.json +3 -2
  28. package/skills/.canon-hash.json +7 -5
  29. package/skills/kibi-traceability/SKILL.md +7 -1
  30. package/skills/kibi-usage/SKILL.md +44 -12
  31. package/skills/kibi-usage/resources/fact-lanes.md +12 -2
  32. package/skills/kibi-usage/resources/logic-ir.md +43 -0
  33. package/skills/kibi-usage/resources/operation-access.md +19 -19
  34. package/skills/kibi-usage/resources/ui-requirements.md +96 -0
  35. package/skills/kibi-usage/resources/workflows.md +40 -8
@@ -0,0 +1,276 @@
1
+ ---
2
+ id: kibi-usage
3
+ name: Kibi Usage
4
+ description: Guides agents to use Kibi MCP, facts, relationships, and validation correctly
5
+ version: 1.3.0
6
+ kibiCompatibility: ">=0.11.0"
7
+ tags:
8
+ - kibi
9
+ - mcp
10
+ - knowledge-base
11
+ - traceability
12
+ - agent-guidance
13
+ resources:
14
+ - resources/relationship-directions.md
15
+ - resources/fact-lanes.md
16
+ - resources/workflows.md
17
+ - resources/operation-access.md
18
+ - resources/ui-requirements.md
19
+ - resources/logic-ir.md
20
+ ---
21
+ # Kibi Usage
22
+
23
+ Consult this skill before any Kibi knowledge base operation, on first interaction with a Kibi-enabled repo, after stale or dirty KB status is suspected, and before mutations.
24
+
25
+ ## Interface Selection
26
+
27
+ Kibi exposes two peer surfaces over the same 18 operations: visible MCP tools and the trusted project-local CLI. Both accept the same business input and effects (see `resources/operation-access.md`). Choose by what is visible and approved in the current environment — MCP and the CLI are equal choices, not a preference order:
28
+
29
+ 1. If Kibi MCP tools are visible and approved in the current environment, use MCP.
30
+ 2. Otherwise, in a trusted workspace, use the project-local CLI through a non-installing runner: `npx --no-install kibi ...` or `bunx --no-install kibi ...`. The CLI is a peer interface, not a fallback.
31
+ 3. If the project-local CLI is unavailable or too old for the needed route, stop and tell the operator to enable or install Kibi.
32
+ 4. Never use a global fallback or an installing runner. Never probe or install packages as a side effect of interface selection.
33
+
34
+ Use exact MCP tool names, dedicated CLI routes, input modes, effects, and Prolog requirements from `resources/operation-access.md`. Do not invent a generic operation runner. Do not read or edit files inside `.kb/` directly.
35
+
36
+ CLI JSON mode accepts MCP-shaped business input at `--input <file|->`.
37
+
38
+ ```bash
39
+ echo '{"type":"req","id":"REQ-001","properties":{"title":"Test","status":"open"}}' | npx --no-install kibi upsert --input -
40
+ ```
41
+
42
+ ```bash
43
+ echo '{"query":"authentication","limit":10}' | bunx --no-install kibi search --input -
44
+ ```
45
+
46
+ ## MCP Tool Names
47
+
48
+ Kibi canonical MCP names include `kb_search`, `kb_query`, `kb_upsert`, `kb_check`, `kb_status`, `kb_validate_upsert`, and related `kb_*` tools. OpenCode may expose prefixed identifiers such as `kibi_kb_search`, `kibi_kb_query`, and `kibi_kb_upsert`. Use the visible Kibi MCP tool identifiers and map them back to canonical operations before reasoning about behavior.
49
+
50
+ ## Discovery First
51
+
52
+ Always discover before you mutate. Start exploratory work with `kb_search` across metadata and markdown body text. Split broad queries into one to three focused probes and review top hits before concluding knowledge is absent.
53
+
54
+ Use `kb_query` for exact lookups by `id`, `type`, `tags`, or `sourceFile`. Use `kb_status` when branch attachment, freshness, or stale context could affect the decision. Mutate only after discovery confirms the target state.
55
+
56
+ ## Approval Boundaries
57
+
58
+ Do not perform Kibi mutations unless the current task calls for knowledge-base changes or the user explicitly asks for them. Discovery and validation are acceptable when needed to understand impact, freshness, traceability, or existing requirements.
59
+
60
+ Kibi guidance does not define a repository's package manager, branch names, release scripts, or publishing workflow. Follow the repository's own instructions for those concerns. Never use Kibi interface selection to install packages, change dependency manifests, or bypass sandbox and approval boundaries.
61
+
62
+ ## Relationship Directions
63
+
64
+ Relationship direction is fixed and semantic. Reversed links break traceability queries and validation.
65
+
66
+ | Relationship | Direction | Meaning |
67
+ |-------------|-----------|---------|
68
+ | `implements` | symbol -> req | Symbol owns or implements requirement behavior |
69
+ | `specified_by` | req -> scenario | Requirement is specified by a scenario |
70
+ | `verified_by` | req/scenario -> test | Requirement or scenario is verified by a test |
71
+ | `validates` | test -> req/scenario | Test validates a requirement or scenario |
72
+ | `executable_for` | symbol -> test | Symbol is executable test code for a test entity |
73
+ | `constrains` | req -> fact(subject) | Requirement constrains a domain fact |
74
+ | `requires_property` | req -> fact(property_value) | Requirement requires a property value |
75
+ | `requires_predicate` | req -> fact(predicate) | Requirement requires a ground ontology predicate |
76
+ | `supersedes` | old-req -> new-req | Old requirement is replaced by new requirement |
77
+ | `covered_by` | symbol -> test | Production symbol has coverage evidence from a test |
78
+
79
+ Before/after for reversed direction:
80
+
81
+ - Wrong: `relationships: [{ type: "implements", from: "REQ-001", to: "SYM-001" }]`
82
+ - Right: `relationships: [{ type: "implements", from: "SYM-001", to: "REQ-001" }]`
83
+
84
+ ## Symbol-First Traceability
85
+
86
+ Preserve source-file traceability whenever creating or updating requirements, facts, scenarios, tests, or symbols. Prefer durable `sourceFile` references and symbol coordinates that point to tracked repository files. For code ownership, create or update a `symbol` entity and add an `implements` relationship from the symbol to the requirement; link symbols to tests with `covered_by` when coverage evidence is needed.
87
+
88
+ Do not use legacy `// implements REQ-xxx` comments as the primary marker for new or modified code. Use comments only as a temporary compatibility fallback when symbol metadata cannot be updated in the same task.
89
+
90
+ Preferred traceability model:
91
+
92
+ ```yaml
93
+ symbol:
94
+ id: SYM-admin-billing-policy
95
+ title: Admin billing policy check
96
+ status: active
97
+ sourceFile: src/admin/billing.ts
98
+ relationships:
99
+ - type: implements
100
+ from: SYM-admin-billing-policy
101
+ to: REQ-ADMIN-BILLING-POLICY
102
+ ```
103
+
104
+ ## Typed Logic IR Lane
105
+
106
+ Readable prose is retained for people, while every assertive proposition is inventoried and either grounded in a strict fact, a predicate fact, or a safe typed rule. Use the required extraction pass followed by an adversarial coverage audit; do not let a high-confidence single suggestion stand in for the rest of a compound requirement. Load `resources/logic-ir.md` for the IR grammar, proposition ledger, safety boundary, and proof semantics.
107
+
108
+ Use `kb_semantic_advisor` with up to three typed `interpretations` for ambiguous clauses. Kibi canonicalizes alternatives and keeps materially different meanings unresolved. Create `fact_kind: rule_schema` and `fact_kind: rule` endpoints from `kb_model_requirement`'s validated plan, then link `req -> rule` with `requires_rule`. Run `rule-safety`, `rule-verifiability`, `semantic-completeness`, `logic-coverage`, and `domain-contradictions`; unresolved, incomplete, or timed-out reasoning is not evidence of consistency.
109
+
110
+ The portable skill body must carry the core contract even when its detailed resources are unavailable: `kb_semantic_advisor` returns a `propositions[]` ledger and `semantic_inventory`; submit typed `interpretations` when wording has more than one plausible logical reading; validate modeled conditions through `kibi.logic.v1`; and preserve unresolved propositions as explicit gaps. Do not read or edit files inside `.kb` directly.
111
+
112
+ Requirement proof also requires fresh execution evidence. Read the available `verificationSnapshot` from `kb_status`, run the scenario-backed E2E command, and append a `kibi.verification-receipt.v1` carrying test ID, typed scope, runner, command, snapshot, environment hash, timestamps, outcome, and artifact digest. Never rewrite receipt history or treat durable `status: passing` as execution proof; re-run coverage and repair every receipt-specific gap.
113
+
114
+ Requirement-mode `kb_coverage` also returns `kibi.repair-plan.v1`. Use it only when `scope.complete` is true; a partial plan means pagination hid actionable requirements. Apply only the earliest `ready` batch for each requirement, query before mutation, create endpoints before relationships, validate every payload, and keep `kb_upsert` calls sequential. Batches are deliberately `autoApplicable: false`: semantic resolution, contradiction supersession, E2E execution, and source ownership always require review. Re-run coverage after every batch instead of continuing from a stale plan.
115
+
116
+ When `.kb/usage.log` exists, treat `kibi.telemetry-acceptance.v1` as the process-evidence lane. Run `kibi usage-metrics --format json --require-acceptance` before completion and inspect unfiltered `kb_check.qualityDiagnostics[]` for ranked `category: telemetry` repairs. The rolling report requires fresh evidence for advisor-before-requirement-write, exact validation-before-upsert, source-linked lookup results, proof-gap recovery, receipt freshness, and mutation retry discipline. `insufficient_evidence` is not a pass: capture current complete coverage and diagnostic events rather than waiving stale, partial, or pre-upgrade logs. A missing usage log means diagnostic logging is not active; do not invent telemetry evidence.
117
+
118
+ ## Strict Fact Lane
119
+
120
+ Normative requirements that must participate in contradiction blocking use the strict fact lane. Create a `fact_kind: subject` fact and link it from the requirement via `constrains`. Create a `fact_kind: property_value` fact and link it via `requires_property`.
121
+
122
+ ```yaml
123
+ id: FACT-USER-ROLE
124
+ fact_kind: subject
125
+ subject_key: user.role_assignment
126
+ ```
127
+
128
+ ```yaml
129
+ id: REQ-019
130
+ relationships:
131
+ - type: constrains
132
+ from: REQ-019
133
+ to: FACT-USER-ROLE
134
+ - type: requires_property
135
+ from: REQ-019
136
+ to: FACT-LIMIT-3
137
+ ```
138
+
139
+ Model one semantic claim per strict `property_value` fact. Reusing the same `subject_key` and `property_key` lets `domain-contradictions` compare requirements mechanically. If a new requirement intentionally changes a value, create a replacement requirement and link the old requirement to the new one with `supersedes` instead of leaving two current contradictory requirements.
140
+
141
+ Use `kb_model_requirement` for automated strict-fact modeling when available. It generates subject and property_value facts, links them with `constrains` and `requires_property`, and handles low-confidence downgrades to observation facts automatically.
142
+
143
+ Granular fact examples for coherence checks include `REQ-ROLE-SET-2` versus `REQ-ROLE-SET-3` on `user.roles.allowed_set` (`user,admin` versus `user,admin,superadmin`) and `REQ-ADMIN-CAN-MANAGE-BILLING` versus `REQ-ONLY-SUPERADMIN-MANAGES-BILLING` on `billing.manage.allowed_actor`. See `resources/fact-lanes.md`; `domain-contradictions` uses these canonical keys.
144
+
145
+ ## UI / Visual Requirement Modeling
146
+
147
+ Optional, per-project lane for recording what the screen should look like so UI edits cannot silently drift from the spec. Non-UI projects skip it; no check rule requires it.
148
+
149
+ Use three layers: a prose `req` as the searchable anchor, strict `property_value` facts for checkable positions/alignment/order (linked `constrains` / `requires_property`, so incompatible values on the same subject/property are rejected on write unless `supersedes`), and relational predicates linked with `requires_predicate` (built-in `visual_layout_rule(subject, relation, target)` for "X must remain visually aligned with Y"). Model UI components as `symbol` entities with `sourceFile` and `symbol_role: behavioral`, linked `implements` to the requirement, so component edits surface the visual spec in impact diagnostics. Full payloads and workflow: `resources/ui-requirements.md`.
150
+
151
+ ## Complete Logical Coverage
152
+
153
+ Readable prose is not evidence that a requirement is machine-checkable. Before treating a normative requirement as modeled, decompose its entire body into atomic normative clauses and ground every clause. One correct fact or relationship never proves that the other prose is covered.
154
+
155
+ 1. Call `kb_semantic_advisor` with the complete requirement prose. When the automatic split is incomplete or a sentence contains multiple obligations, pass an explicit `clauses` array containing every atomic normative clause.
156
+ 2. Use the stable `claim_key` returned for each clause. Every ground `property_value` or `predicate` fact must preserve that key in `claim_key` and preserve the clause in `claim_text`. Use the advisor-returned inventory exactly; do not add punctuation or wording variants of an existing clause.
157
+ 3. Put exactly the current assertive proposition keys in the requirement's `logic_claims` manifest. Preserve unrelated metadata, but remove stale claim keys when the source meaning changes; never silently omit an earlier proposition that remains in the current prose.
158
+ 4. Ground each key through exactly one suitable logical lane: `requires_property` to one strict `property_value` fact, `requires_predicate` to one ground `predicate` fact, or `requires_rule` to one safe `rule` fact. A subject fact supports a strict claim but does not ground a key by itself. Observation, meta, ambiguity, and ontology-gap facts explicitly remain unresolved and do not count as logical coverage.
159
+ 5. Run `kb_check` with `logic-coverage`, `rule-safety`, `rule-verifiability`, `semantic-completeness`, `predicate-verifiability`, and `domain-contradictions`. `logic-coverage` enforces a one-claim/one-ground-fact mapping and rejects distinct claim keys that encode the same logical term; human or agent review still confirms that the atomic clauses exhaust the prose and that each ground term preserves its meaning.
160
+
161
+ Kibi emits a non-blocking logical-coverage debt diagnostic for every current requirement without a manifest, independent of title wording. The `logic-coverage` rule is enabled by default for requirements that do declare manifests, so an unfiltered final check catches missing or orphaned ground claims while legacy requirements remain explicit backfill work.
162
+
163
+ A complete `logic_claims` manifest alone is not a complete model. Preserve the advisor's `inventory_contract` as `semantic_inventory_version`, `semantic_source_field`, and `semantic_source_hash`; every ledger span must select its exact claim text from that field. For new or migrated requirements, use requirement-only `semantic_text` for normalized authored prose and keep `text_ref` available for independent code or document evidence. Legacy direct payloads may still declare `text_ref` or `title`; an explicitly declared but empty semantic source fails closed instead of falling through. Mutation rejects duplicate or omitted propositions and requires every `modeled` entry to resolve through exactly one logical edge to a fact with the same claim key. Explicit unresolved entries remain ingestible but cannot prove the requirement.
164
+
165
+ Never invent, reuse across different clauses, or manually alter a claim key. Kibi derives it from `claim_text` and rejects mismatched mutation and Markdown inputs.
166
+
167
+ For a compound requirement, the manifest and linked facts form a clause-completeness contract:
168
+
169
+ ```yaml
170
+ requirement:
171
+ id: REQ-CHECKOUT-RETENTION
172
+ logic_claims: [CLAIM-A1B2C3D4E5F60718, CLAIM-18273645AABBCCDD]
173
+ facts:
174
+ - fact_kind: predicate
175
+ claim_key: CLAIM-A1B2C3D4E5F60718
176
+ claim_text: Checkout requires payment authorization before submission.
177
+ - fact_kind: property_value
178
+ claim_key: CLAIM-18273645AABBCCDD
179
+ claim_text: Customer data must be retained for 7 years.
180
+ ```
181
+
182
+ The example keys are illustrative; use only keys returned for the exact clause text.
183
+
184
+ ## Predicate Ontology Decision Tree
185
+
186
+ Preserve the readable requirement prose. Facts add a machine-queryable model; they do not replace prose, and stored predicate facts are data queried by Kibi's Prolog layer rather than executable Prolog supplied by the agent.
187
+
188
+ 1. Call `kb_semantic_advisor` on the complete prose, verify its atomic clause inventory, and choose one lane per clause.
189
+ 2. For each relational clause, call `kb_suggest_predicates` with that clause and the current `existingLogicClaims`. Read each candidate as a Prolog-shaped ground term `predicate_name(arg1,...,argN)`: the schema fixes the predicate name, arity, argument roles, and argument order.
190
+ 3. Accept a candidate only when its meaning and every ordered argument fit the prose. If lexical rank order prefers a false positive, retry with the reviewed candidate's exact `schema.id` as `schemaId`; do not mutate the candidate or treat a missing schema reference as an ontology gap. If it returns `binding_status: incomplete`, retry with exact `argumentBindings` for every `unbound_arguments` name; its empty `applyPlan` is a safety gate, and the literal `unknown` must never be persisted. Use `polarityHint` only when review of the complete claim proves that surface negation does not deny the selected predicate. Once complete, use the returned `applyPlan`, including its exact `predicate_name`, `predicate_args`, `canonical_key`, and `polarity`; never invent a predicate name, reorder arguments, add variables, or write a raw Prolog clause.
191
+ 4. Create or confirm the requirement and `fact_kind: predicate` endpoints, preserve `claim_key` and `claim_text`, merge the returned `logicClaims` into the requirement, then link requirement -> predicate fact with `requires_predicate`. Treat the requirement's logical representation as the conjunction of every linked ground term. Encode a prohibition with `polarity: deny` on the fitting positive schema, not a made-up negative predicate. An `assert` and `deny` requirement over the same namespace, name, and ordered arguments are a blocking `domain-contradictions` conflict, so requirements must reuse the same canonical schema and argument vocabulary for equivalent domain claims.
192
+ 5. Use an existing built-in or project-local `fact_kind: predicate_schema`. Create a new schema only when the task explicitly authorizes ontology extension and supplies a stable name, arity, `argument_names`, and `argument_types`; otherwise record `fact_kind: observation` with `review:ontology-gap`.
193
+ 6. For each scalar, threshold, duration, boolean, enum-set, or cardinality clause, use `kb_model_requirement` with the current `existingLogicClaims` and the strict subject/property lane instead. For ambiguity or a lexical false positive, preserve the prose as a review observation, apply its returned `relates_to` review anchor when present, and report the requirement as logically incomplete. Use `review:ambiguity` for unresolved scope or interpretation and `review:keyword-false-positive` when a vocabulary match is not a domain assertion.
194
+ 7. Validate every payload, create endpoints first, apply `kb_upsert` calls sequentially, read back all affected IDs, and run targeted `rule-safety`, `rule-verifiability`, `semantic-completeness`, `logic-coverage`, `predicate-verifiability`, and `domain-contradictions` checks before the final unfiltered `kb_check`. Exact query output can return an array when one relationship type has multiple targets; verify every target rather than reading only one edge.
195
+
196
+ ### Schema-aware proposition boundary
197
+
198
+ A declared project-local predicate schema can encode one complete relation whose ordered arguments name several facets of the same claim. Do not split those arguments into separate propositions, invent one predicate per noun, or pass an explicit `clauses` array merely to enumerate the schema arguments. First ask `kb_semantic_advisor` about the complete sentence; add clauses only for independently asserted propositions that are not represented by the selected relation. For a schema-backed relation, preserve the one claim key for the complete relation, create the supporting `predicate_schema` with its minimal declared signature (supporting schemas do not carry `claim_key` or `logic_claims`), call `kb_suggest_predicates` on the complete claim, and apply its exact plan to create one ground predicate fact with the ordered schema arguments and that claim key. If `kb_model_requirement` returns an apply plan, execute that plan sequentially; do not fall back to observation facts when an explicitly declared schema fits. If a schema write is rejected, use `kb_validate_upsert` to reduce it to the supported signature, then retry once before considering an ontology gap.
199
+
200
+ ### Hard lane gates for unresolved prose and supplied schemas
201
+
202
+ The advisor's proposition `status` is a safety gate, not a confidence hint. A `nonlogical` proposition (including `subjective`, rationale, example, heading, or commentary) never receives a `logic_claims` entry and never goes through `kb_suggest_predicates` or `kb_model_requirement`; preserve the complete prose as one `fact_kind: observation` only when an auditable record is useful. Do not manufacture atomic clauses from a subjective sentence merely because it contains `when`, a domain noun, or the word `predicate`. An `ambiguous` proposition remains an ambiguity observation until the operator supplies a typed interpretation. An `ontology_gap` remains unresolved unless an approved schema or validated IR is actually available.
203
+
204
+ When authorized task input contains `projectLocalSchemas`, those declarations are the schema authority even if the first advisor or predicate lookup calls them an ontology gap. Do not treat an empty candidate list as final: create the minimal declared `predicate_schema` endpoint first, then call `kb_suggest_predicates` again on the one complete claim (with the current `existingLogicClaims`) and apply the resulting ground predicate plan. Preserve the single claim key for that relation; do not add keys for schema arguments. If the lookup still cannot return a plan after the declared schema exists, validate the exact schema-backed predicate payload once and report the remaining blocker rather than inventing a different predicate. For prohibition cues (`must not`, `never`, `cannot`, `forbidden`), use the positive schema with `polarity: deny`; never silently change it to `assert` or encode the negation in a new predicate name.
205
+
206
+ Example: “Checkout requires payment authorization before order submission” fits `dependency_rule(subject, prerequisite, dependent)`. The ground model is `dependency_rule(checkout,payment_authorization,order_submission)`, stored as:
207
+
208
+ ```yaml
209
+ fact_kind: predicate
210
+ predicate_name: dependency_rule
211
+ predicate_args: [checkout, payment_authorization, order_submission]
212
+ canonical_key: dependency_rule(checkout,payment_authorization,order_submission)
213
+ polarity: assert
214
+ claim_key: <claim key returned by kb_semantic_advisor>
215
+ claim_text: Checkout requires payment authorization before order submission.
216
+ ```
217
+
218
+ Link the requirement to that predicate fact with `requires_predicate`. Do not use `verified_by`, `requires_predicate`, or another relationship type as the `predicate_name`; graph relationships and ontology predicates are different layers.
219
+
220
+ Detailed built-in, project-local, deny, strict-scalar, ambiguous, false-positive, and ontology-gap examples are immutable reference material in `resources/fact-lanes.md` and `resources/workflows.md`.
221
+
222
+ ## Fact vs Flag
223
+
224
+ Use `flag` for runtime or config gates only, such as feature flags, kill-switches, and deferred capabilities.
225
+
226
+ Bugs, incidents, and workarounds belong in `fact` entities with `fact_kind: observation` or `meta`. These fact kinds are excluded from contradiction inference, making them appropriate for non-blocking evidence. Do not create a `flag` named like a bug to track a defect.
227
+
228
+ ## Create Before Link
229
+
230
+ Always confirm or create endpoint entities before linking them. Query target IDs with `kb_query` first. If an endpoint does not exist, create it with `kb_upsert` before creating the relationship. Relationships to missing entities produce dangling references that `kb_check` will flag.
231
+
232
+ For `kb_upsert`, keep relationship rows anchored to the entity being upserted: each row's `from` must equal the upserted entity ID. If you need a `SYM -> REQ` link, upsert the symbol endpoint first, then link that symbol to the requirement.
233
+
234
+ Keep symbol payloads minimal: include only fields needed to identify the symbol, status, and source traceability. Put extra prose, examples, or audit notes in documentation or evidence artifacts instead of custom `kb_upsert.properties`; strict `kb_upsert.properties` rejects unknown fields.
235
+
236
+ When a generic `Query failed` appears, do not keep retrying the same payload. First call `kb_validate_upsert`, query or create missing endpoints, reduce the payload to required fields, and retry once. If it still fails, report the blocker.
237
+
238
+ ## Small Behavior Fix Impact Evidence
239
+
240
+ For a behavior-changing source edit, first query for an existing requirement. If no requirement exists, create one for the corrected behavior. Model strict facts from that requirement when the invariant is contradiction-sensitive.
241
+
242
+ Do not link facts directly to tests. Facts describe invariants; requirements or scenarios are verified by executable tests. Use `REQ -> TEST` with `verified_by` or `TEST -> REQ` with `validates`, then link the requirement to facts with `constrains` and `requires_property`. Link touched production symbols to requirements with `implements` and to tests with `covered_by` when coverage evidence is needed.
243
+
244
+ Kibi operation writes do not automatically stage markdown evidence. When a staged hook requires impact evidence, ensure tracked documentation artifacts for requirements, facts, tests, symbol metadata, or coordinate refreshes are authored and staged alongside source changes.
245
+
246
+ ## Sequential Upserts
247
+
248
+ Never fire `kb_upsert` calls in parallel. Execute them sequentially to avoid lock contention and ensure deterministic ordering, especially when creating chains of related entities.
249
+
250
+ ## Checks
251
+
252
+ Run `kb_check` with specific rules during iteration for fast feedback. For normative requirement modeling, include `rules: ["rule-safety", "rule-verifiability", "semantic-completeness", "logic-coverage", "predicate-verifiability", "domain-contradictions"]`; add `required-fields` and `no-dangling-refs` after writes. Run a full `kb_check` without rule filters before declaring Kibi work complete.
253
+
254
+ The `domain-contradictions` rule detects conflicts between strict-lane facts linked to requirements. When a contradiction is found, the supported escape hatch is `supersedes`: create a new requirement that supersedes the old one, then link the new requirement to updated facts.
255
+
256
+ ## Stale or Dirty KB Handling
257
+
258
+ Call `kb_status` when branch KB context may be stale or after switching context. Report freshness findings to the user rather than relying on outdated KB context. If `kb_status` indicates a schema migration is needed, ask the user or operator to handle it outside the agent session.
259
+
260
+ ## Anti-Patterns and Remediation
261
+
262
+ | Anti-Pattern | Problem | Remediation |
263
+ |-------------|---------|-------------|
264
+ | Reversed relationship direction | Traceability queries break | Verify direction against the relationship table above |
265
+ | Legacy implements comments | Comments are not durable queryable symbols | Create or update a `symbol` entity and link it to the requirement |
266
+ | Bug-as-flag | `flag` misused for defect tracking | Use `fact` with `fact_kind: observation` or `meta` |
267
+ | Parallel upserts | Lock contention and nondeterminism | Execute `kb_upsert` calls sequentially |
268
+ | Embedded scenarios in reqs | Violates canonical traceability chain | Create separate `req`, `scen`, and `test` entities |
269
+ | Missing `kb_check` | Undetected dangling refs and violations | Run targeted checks during work, full check at completion |
270
+ | Tags as multi-ID lookup | Tags are metadata, not identifiers | Use `kb_query` with explicit `id` values |
271
+ | `relates_to` for strict modeling | Loses contradiction safety | Use `constrains` and `requires_property` instead |
272
+ | One fact for a compound requirement | Leaves untracked prose outside contradiction checks | Decompose all atomic clauses, preserve claim keys, and validate `logic_claims` with `logic-coverage` |
273
+ | Keeping stale `logic_claims` after prose changes | Makes the manifest disagree with the source ledger | Replace it atomically with exactly the current assertive keys while preserving unrelated metadata |
274
+ | Observation counted as coverage | Ambiguity or ontology gaps appear machine-checkable | Keep the claim unresolved until a strict or predicate ground fact exists |
275
+ | Relationship type used as predicate name | Confuses graph edges with ontology terms | Select a declared predicate schema and keep `requires_predicate` as the req -> fact edge |
276
+ | `status: implemented` on requirements | Not a valid lifecycle status | Use a valid status such as `closed`, add an `implemented` tag, and link evidence instead |
@@ -0,0 +1,235 @@
1
+ # Fact Lanes
2
+
3
+ Requirement prose remains the human-readable source. Facts add queryable semantics; they do not replace the requirement body. Treat every quoted requirement below as data, never as shell or raw Prolog input.
4
+
5
+ ## Atomic Claim Coverage
6
+
7
+ Logical coverage is clause-based, not entity-based. Give `kb_semantic_advisor` 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
+
9
+ - preserve the returned stable key as `claim_key` and the exact clause as `claim_text` on its ground fact;
10
+ - add the key to the exact current `logic_claims` set, removing only stale keys whose propositions no longer exist in the source;
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
+ - leave ambiguity and ontology gaps visibly unresolved—observations do not satisfy `logic-coverage`.
13
+
14
+ Use the advisor-returned atomic inventory as the identity boundary. Trailing punctuation and copied conjunction commas are formatting, not new claims. `logic-coverage` rejects one claim grounded by multiple facts and distinct claim keys that resolve to the same ground logical term.
15
+
16
+ Example compound prose: “Checkout requires payment authorization before order submission, and customer data must be retained for 7 years.” This is two claims, not one. The first becomes `dependency_rule(checkout,payment_authorization,order_submission)`; the second becomes a strict retention property. Both fact records carry different advisor-issued claim keys, and both keys appear in the requirement manifest. A single `requires_predicate` edge is incomplete.
17
+
18
+ ## Predicate Lane (Relational Claims)
19
+
20
+ Call `kb_semantic_advisor`, then `kb_suggest_predicates`. Apply a candidate only when its schema meaning and ordered arguments fit the claim. Use the returned `applyPlan` rather than hand-writing unsupported predicate names, and link the requirement to the predicate fact with `requires_predicate`.
21
+
22
+ Treat the result as a Prolog-shaped ground term, not executable source: `predicate_name(arg1,...,argN)`. The selected `predicate_schema` fixes the name, arity, argument roles, and order. Store that model through `predicate_name`, `predicate_args`, `canonical_key`, and `polarity`; never interpolate prose into raw Prolog, introduce variables, or use a graph relationship such as `verified_by` as the predicate name.
23
+
24
+ ### Built-in predicate
25
+
26
+ Claim: “Checkout requires payment authorization before order submission.” The built-in `dependency_rule(subject, prerequisite, dependent)` schema produces:
27
+
28
+ ```yaml
29
+ id: FACT-CHECKOUT-PAYMENT-DEPENDENCY
30
+ status: active
31
+ fact_kind: predicate
32
+ predicate_name: dependency_rule
33
+ predicate_args: [checkout, payment_authorization, order_submission]
34
+ polarity: assert
35
+ canonical_key: dependency_rule(checkout,payment_authorization,order_submission)
36
+ claim_key: <advisor-issued key for this exact clause>
37
+ claim_text: Checkout requires payment authorization before order submission.
38
+ relationship: { type: requires_predicate, from: REQ-CHECKOUT-SUBMISSION, to: FACT-CHECKOUT-PAYMENT-DEPENDENCY }
39
+ ```
40
+
41
+ ### Project-local predicate
42
+
43
+ If the project has an approved `commit_action(subject, trigger, object)` predicate schema, “Editor annotation drafts autosave on navigation” may use:
44
+
45
+ ```yaml
46
+ id: FACT-EDITOR-DRAFT-AUTOSAVE
47
+ status: active
48
+ fact_kind: predicate
49
+ predicate_name: commit_action
50
+ predicate_args: [editor.annotation, navigation, draft]
51
+ polarity: assert
52
+ canonical_key: commit_action(editor.annotation,navigation,draft)
53
+ relationship: { type: requires_predicate, from: REQ-EDITOR-DRAFT-AUTOSAVE, to: FACT-EDITOR-DRAFT-AUTOSAVE }
54
+ ```
55
+
56
+ The project-local schema endpoint must exist before this fact is linked. When ontology extension is explicitly authorized, define it first with `fact_kind: predicate_schema`, `predicate_name`, `predicate_arity`, and equally sized `argument_names` and `argument_types`. Without an authorized stable signature, record `review:ontology-gap` instead of inventing a schema.
57
+
58
+ ### Deny predicate
59
+
60
+ Claim: “Suspended users must not publish articles.” When `permission_rule` fits, preserve its positive schema name and encode prohibition as polarity:
61
+
62
+ ```yaml
63
+ id: FACT-SUSPENDED-PUBLISH-DENIED
64
+ status: active
65
+ fact_kind: predicate
66
+ predicate_name: permission_rule
67
+ predicate_args: [suspended_user, publish, article]
68
+ polarity: deny
69
+ canonical_key: permission_rule(suspended_user,publish,article)
70
+ claim_key: <advisor-issued key for this exact clause>
71
+ claim_text: Suspended users must not publish articles.
72
+ relationship: { type: requires_predicate, from: REQ-SUSPENDED-PUBLISH-DENIED, to: FACT-SUSPENDED-PUBLISH-DENIED }
73
+ ```
74
+
75
+ If another current requirement links an `assert` fact with the same predicate namespace, name, and ordered arguments, `domain-contradictions` reports the pair. More complex semantic conflicts require a shared canonical schema and arguments; do not assume Kibi can prove arbitrary equivalence between differently shaped predicates.
76
+
77
+ The full logical representation of a requirement is the conjunction of all of its linked ground property and predicate terms. Conditions, exceptions, permissions, and ordering constraints remain explicit arguments of their declared schemas. Contradiction detection therefore depends on equivalent prose reusing the same predicate name, argument roles, ordered canonical values, and opposing polarity rather than inventing synonymous terms.
78
+
79
+ ### Lane gates before a predicate lookup
80
+
81
+ Treat the advisor's proposition status as a hard routing decision. `nonlogical`/`subjective` prose is not a logical claim: keep it as one observation when needed and do not add its key to `logic_claims`. `ambiguous` prose stays an ambiguity observation. `ontology_gap` prose stays unresolved unless an approved schema or validated Logic IR is available. Never split a subjective or commentary sentence into synthetic clauses just because it contains conditional words or domain vocabulary.
82
+
83
+ If authorized input supplies `projectLocalSchemas`, use those signatures as the authority. Create the minimal `predicate_schema` endpoint before lookup, then rerun `kb_suggest_predicates` on the complete relation if the first lookup had no candidate. Apply exactly one ground predicate and one claim key for that relation. For `must not`, `never`, `cannot`, or `forbidden` wording, preserve the positive schema and set `polarity: deny`; do not turn the result into an asserted predicate or invent a negative name. An empty lookup before the declared schema exists is a retry condition, not proof of an ontology gap.
84
+
85
+ ## Typed rule lane
86
+
87
+ Use a validated `kibi.logic.v1` object for a proposition whose meaning includes a condition, exception, obligation, prohibition, permission, quantifier, cardinality bound, or bounded temporal relation. `kb_model_requirement` returns the `rule_schema` and `rule` facts plus a `requires_rule` edge. The rule stores canonical JSON and a deterministic hash; any rendered Prolog is an audit view and is never executed. Reject raw goals, function symbols, cuts, meta-calls, dynamic predicates, I/O, unsafe variables, unstratified negation, and unbounded aggregation. Keep the exact proposition in `claim_text`, its advisor key in `claim_key`, and its byte span in the semantic ledger. Run `rule-safety` and `rule-verifiability` before treating the rule as modeled.
88
+
89
+ ### Strict scalar
90
+
91
+ Claim: “Sessions expire after at most 30 minutes.” This is a scalar limit, not a predicate. Route it through `kb_model_requirement` to a subject plus `property_value` with `operator: lte`, `value_type: int`, and `value_int: 30`, linked by `constrains` and `requires_property`.
92
+
93
+ ### Ambiguous claim
94
+
95
+ Claim: “Premium accounts get better support.” “Better” does not identify a stable relation or scalar. Keep readable prose and create a `fact_kind: observation` tagged `review:ambiguity`; request clarification before adding strict or predicate facts.
96
+
97
+ ### False-positive trap
98
+
99
+ Claim: “Suspended users must not publish articles.” A lexical match such as `publishes_event` is semantically wrong because an article is not a domain event. Reject that candidate and use the suitable permission schema if one is returned; otherwise use a review observation. Candidate rank alone is never proof of suitability.
100
+
101
+ ### Ontology gap
102
+
103
+ Claim: “Annotations remain anchored to selected text after edits.” If no returned built-in or approved project-local schema expresses anchoring preservation, do not invent one:
104
+
105
+ ```yaml
106
+ id: FACT-ONTOLOGY-GAP-ANNOTATION-ANCHOR
107
+ status: active
108
+ fact_kind: observation
109
+ tags: [review:ontology-gap]
110
+ text_ref: docs/requirements/annotation-anchor.md
111
+ ```
112
+
113
+ An ontology-gap observation records review work; it does not make the requirement machine-checkable.
114
+
115
+ ## Strict Lane (Contradiction-Safe)
116
+
117
+ ### fact_kind: subject
118
+ ```yaml
119
+ id: FACT-USER-ROLE
120
+ title: User Role Assignment
121
+ status: active
122
+ fact_kind: subject
123
+ subject_key: user.role_assignment
124
+ ```
125
+
126
+ ### fact_kind: property_value
127
+ ```yaml
128
+ id: FACT-LIMIT-3
129
+ title: Maximum of Three Roles
130
+ status: active
131
+ fact_kind: property_value
132
+ subject_key: user.role_assignment
133
+ property_key: max_roles
134
+ operator: lte
135
+ value_type: int
136
+ value_int: 3
137
+ ```
138
+
139
+ ## Granular Facts for Coherence Checks
140
+
141
+ Granular strict facts work best when each `property_value` represents one semantic claim about one `subject_key` and one `property_key`. This lets `domain-contradictions` compare current requirements that constrain the same subject and require incompatible values.
142
+
143
+ ### Role set conflict
144
+
145
+ `REQ-ROLE-SET-2` and `REQ-ROLE-SET-3` are incoherent if both are current: they each define the exact allowed role set, but one allows two roles and the other allows three. Encode compact set values as canonical strings because the strict property schema supports string, int, number, and bool values.
146
+
147
+ ```yaml
148
+ subject:
149
+ id: FACT-USER-ROLES
150
+ title: User roles
151
+ status: active
152
+ fact_kind: subject
153
+ subject_key: user.roles
154
+
155
+ property_values:
156
+ - id: FACT-USER-ROLES-ALLOWED-2
157
+ title: User and admin roles only
158
+ status: active
159
+ fact_kind: property_value
160
+ subject_key: user.roles
161
+ property_key: user.roles.allowed_set
162
+ operator: eq
163
+ value_type: string
164
+ value_string: user,admin
165
+ - id: FACT-USER-ROLES-ALLOWED-3
166
+ title: User, admin, and superadmin roles
167
+ status: active
168
+ fact_kind: property_value
169
+ subject_key: user.roles
170
+ property_key: user.roles.allowed_set
171
+ operator: eq
172
+ value_type: string
173
+ value_string: user,admin,superadmin
174
+
175
+ relationships:
176
+ - { type: constrains, from: REQ-ROLE-SET-2, to: FACT-USER-ROLES }
177
+ - { type: requires_property, from: REQ-ROLE-SET-2, to: FACT-USER-ROLES-ALLOWED-2 }
178
+ - { type: constrains, from: REQ-ROLE-SET-3, to: FACT-USER-ROLES }
179
+ - { type: requires_property, from: REQ-ROLE-SET-3, to: FACT-USER-ROLES-ALLOWED-3 }
180
+ ```
181
+
182
+ ### Permission actor conflict
183
+
184
+ `REQ-ADMIN-CAN-MANAGE-BILLING` and `REQ-ONLY-SUPERADMIN-MANAGES-BILLING` conflict when both define the exact allowed actor for the same permission.
185
+
186
+ ```yaml
187
+ subject:
188
+ id: FACT-BILLING-MANAGE
189
+ title: Billing management permission
190
+ status: active
191
+ fact_kind: subject
192
+ subject_key: billing.manage
193
+
194
+ property_values:
195
+ - id: FACT-BILLING-MANAGE-ACTOR-ADMIN
196
+ title: Admin can manage billing
197
+ status: active
198
+ fact_kind: property_value
199
+ subject_key: billing.manage
200
+ property_key: billing.manage.allowed_actor
201
+ operator: eq
202
+ value_type: string
203
+ value_string: admin
204
+ - id: FACT-BILLING-MANAGE-ACTOR-SUPERADMIN
205
+ title: Only superadmin can manage billing
206
+ status: active
207
+ fact_kind: property_value
208
+ subject_key: billing.manage
209
+ property_key: billing.manage.allowed_actor
210
+ operator: eq
211
+ value_type: string
212
+ value_string: superadmin
213
+ ```
214
+
215
+ When a contradiction is intentional evolution rather than a real conflict, link the replaced requirement to the replacement requirement with `supersedes`.
216
+
217
+ ## Context Lane (Non-Blocking)
218
+
219
+ ### fact_kind: observation
220
+ For bug records, incident notes, and observed behavior.
221
+ ```yaml
222
+ id: FACT-BUG-123
223
+ title: Login fails on Safari 17
224
+ status: active
225
+ fact_kind: observation
226
+ ```
227
+
228
+ ### fact_kind: meta
229
+ For governance notes, process commentary, and workaround documentation.
230
+ ```yaml
231
+ id: FACT-WORKAROUND-456
232
+ title: Temporary cache bypass for v2 migration
233
+ status: active
234
+ fact_kind: meta
235
+ ```
@@ -0,0 +1,43 @@
1
+ # Typed Logic IR and Proposition Coverage
2
+
3
+ Kibi stores human prose as readable requirement text, but verifiable meaning belongs in typed facts and `kibi.logic.v1` rule facts. The host agent may propose an interpretation; Kibi validates, canonicalizes, hashes, persists, and reasons over it. Never submit a Prolog source string, goal, module, or function symbol. Rendered Prolog is an inspection preview only.
4
+
5
+ ## Two-pass extraction
6
+
7
+ 1. Run `kb_semantic_advisor` over the complete text. Supply explicit `clauses` when sentence splitting could hide a condition, exception, definition, descriptive assertion, threshold, quantity, or temporal qualifier.
8
+ 2. Audit the returned `propositions` against the original UTF-8 text. Every assertive span must be `modeled`, `ambiguous`, `ontology_gap`, or `missing`; rationale, examples, and subjective commentary are `nonlogical` and remain readable prose.
9
+ 3. For each assertive proposition, submit up to three typed `interpretations` when alternatives are plausible. Kibi compares canonical semantic keys; materially different valid interpretations remain unresolved regardless of confidence.
10
+ 4. Apply only a validated plan, then read back the requirement, rule schema, rule fact, and all relationship targets. Run `rule-safety`, `rule-verifiability`, `semantic-completeness`, `logic-coverage`, and `domain-contradictions` before the final unfiltered check.
11
+
12
+ When a project-local schema names several ordered arguments, those arguments are facets of one relation, not separate propositions. Preserve the advisor claim key for the complete relation and do not manufacture clauses for each argument. Supporting `predicate_schema` facts carry the declared signature only; the ground predicate fact carries the claim provenance. Apply the exact `kb_suggest_predicates`/`kb_model_requirement` plan, reducing a rejected schema payload through `kb_validate_upsert` rather than silently downgrading a fitting declared relation to an observation.
13
+
14
+ ## Logic IR shape
15
+
16
+ The supported v1 forms are:
17
+
18
+ - `kind: atom` with a ground `head`;
19
+ - `kind: rule` with a range-restricted `head` and `body`;
20
+ - `kind: constraint` with a body and no head.
21
+
22
+ Terms are typed `const`, `var`, `number`, `duration`, or ISO `timestamp`. Variables are explicitly declared as `forall` (the default) or body-local `exists`; an existential variable may not occur in a rule head. Bodies use `all`, `any`, closed-world `not`, comparisons, bounded `count`, and bounded temporal expressions. Modalities are `assert`, `deny`, `oblige`, `permit`, and `forbid`.
23
+
24
+ Every head and body variable must be bound by a positive atom. Negation is allowed only on an atom with `closedWorld: true`, and only when its variables are also positively bound. Function symbols, raw goals, cuts, meta-calls, dynamic predicates, I/O, unbounded aggregation, unsafe variables, and unstratified negation are rejected before persistence.
25
+
26
+ Example (inspection data, not executable input):
27
+
28
+ ```json
29
+ {
30
+ "version": "kibi.logic.v1",
31
+ "kind": "rule",
32
+ "modality": "oblige",
33
+ "variables": [{"name": "U", "type": "user", "quantifier": "forall"}],
34
+ "head": {"kind": "atom", "name": "audit", "args": [{"kind": "var", "name": "U", "type": "user"}]},
35
+ "body": {"kind": "atom", "name": "admin_action", "args": [{"kind": "var", "name": "U", "type": "user"}]}
36
+ }
37
+ ```
38
+
39
+ Use `rule_schema` facts for stable predicate signatures and link a requirement to a `rule` fact with `requires_rule`. Keep `logic_claims` as the exact current assertive key set; `semantic_inventory` is the complete proposition ledger, anchored by `semantic_inventory_version`, `semantic_source_field`, and `semantic_source_hash`. Prefer requirement-only `semantic_text` as the semantic source for normalized authored prose so `text_ref` can remain independent code or document evidence; retain `text_ref` and `title` only as legacy semantic-source choices. A manifest is not proof until each modeled key is linked to exactly one same-key fact and the rule checks pass.
40
+
41
+ ## Contradictions and uncertainty
42
+
43
+ Kibi compares opposing modalities over matching heads and overlapping authority, scope, and validity intervals. `assert`/`deny`, `oblige`/`forbid`, and overlapping `permit`/`forbid` pairs can be contradictory. Different conditions, unresolved interpretations, unsupported ontology terms, analysis limits, and incomplete closure produce `unresolved`, never a false consistency proof. Preserve superseding requirements rather than deleting historical claims.
@@ -0,0 +1,44 @@
1
+ # Kibi Operation Access Catalog
2
+
3
+ This table is the machine-readable interface map for Kibi's shared operation catalog. Every CLI route shown is dedicated; there is no generic operation runner. `--input JSON or flags` means the route supports exact MCP-shaped JSON from a file or stdin as well as its established human flags. `--input JSON` means the dedicated parity route is JSON-only.
4
+
5
+ | MCP tool name | CLI route | Input mode | Mutability | Requires Prolog | Effects | Interface |
6
+ |---|---|---|---|---|---|---|
7
+ | `kb_skills_list` | `skills-list` | `--input JSON` | read | no | `local-read` | peer; capability-selected |
8
+ | `kb_skills_load` | `skills-load` | `--input JSON` | read | no | `local-read` | peer; capability-selected |
9
+ | `kb_skills_read` | `skills-read` | `--input JSON` | read | no | `local-read` | peer; capability-selected |
10
+ | `kb_query` | `query` | `--input JSON or flags` | read | yes | `kb-read` | peer; capability-selected |
11
+ | `kb_search` | `search` | `--input JSON or flags` | read | yes | `kb-read` | peer; capability-selected |
12
+ | `kb_status` | `status` | `--input JSON or flags` | read | yes | `kb-read, workspace-read` | peer; capability-selected |
13
+ | `kb_find_gaps` | `find-gaps` | `--input JSON or flags` | read | yes | `kb-read` | peer; capability-selected |
14
+ | `kb_coverage` | `coverage` | `--input JSON or flags` | read | yes | `kb-read` | peer; capability-selected |
15
+ | `kb_graph` | `graph` | `--input JSON or flags` | read | yes | `kb-read` | peer; capability-selected |
16
+ | `kb_semantic_advisor` | `semantic-advisor` | `--input JSON` | read | no | `local-read` | peer; capability-selected |
17
+ | `kb_model_requirement` | `model-requirement` | `--input JSON` | read | yes | `kb-read` | peer; capability-selected |
18
+ | `kb_suggest_predicates` | `suggest-predicates` | `--input JSON` | read | yes | `kb-read` | peer; capability-selected |
19
+ | `kb_autopilot_generate` | `autopilot-generate` | `--input JSON` | read | no | `workspace-read` | peer; capability-selected |
20
+ | `kb_validate_upsert` | `validate-upsert` | `--input JSON` | read | yes | `kb-read` | peer; capability-selected |
21
+ | `kb_upsert` | `upsert` | `--input JSON` | write | yes | `kb-write, workspace-write` | peer; capability-selected |
22
+ | `kb_delete` | `delete` | `--input JSON` | write | yes | `kb-write, workspace-write` | peer; capability-selected |
23
+ | `kb_check` | `check` | `--input JSON or flags` | read | yes | `kb-read, workspace-read` | peer; capability-selected |
24
+ | `kb_sparql_remote` | `sparql-remote` | `--input JSON` | read | no | `network-read` | peer; capability-selected |
25
+
26
+ ## JSON execution recipes
27
+
28
+ Use the project-local, non-installing runner from a trusted workspace. Stdin must contain exactly one UTF-8 JSON object.
29
+
30
+ ```bash
31
+ echo '{"query":"authentication","type":"req","limit":10}' | npx --no-install kibi search --input -
32
+ ```
33
+
34
+ ```bash
35
+ echo '{"type":"req","id":"REQ-001","properties":{"title":"Test","status":"open"}}' | npx --no-install kibi upsert --input -
36
+ ```
37
+
38
+ ```bash
39
+ echo '{"rules":["required-fields","no-dangling-refs"]}' | bunx --no-install kibi check --input -
40
+ ```
41
+
42
+ ## Telemetry handling
43
+
44
+ `_diagnostic_telemetry` is adapter metadata, not business input. In CLI JSON mode the adapter may validate and extract it for CLI usage logging before shared execution. In MCP diagnostic mode the adapter enforces its configured telemetry requirement and strips the field before shared execution. Never copy telemetry into entity properties or operation business input.