kibi-cursor 0.3.1 → 0.5.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.
Files changed (53) hide show
  1. package/.cursor-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +92 -0
  3. package/README.md +21 -4
  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 +54 -0
  9. package/agent-plugin/skills/kibi-usage/SKILL.md +270 -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 +80 -0
  16. package/dist/.cursor-plugin/plugin.json +1 -1
  17. package/dist/guidance.d.ts +10 -2
  18. package/dist/guidance.js +26 -17
  19. package/dist/hook-runner.d.ts +1 -0
  20. package/dist/hook-runner.js +34 -7
  21. package/dist/hook-state-storage.d.ts +11 -0
  22. package/dist/hook-state-storage.js +187 -0
  23. package/dist/hook-state.d.ts +3 -4
  24. package/dist/hook-state.js +6 -206
  25. package/dist/kb-mcp-tools.d.ts +3 -0
  26. package/dist/kb-mcp-tools.js +6 -0
  27. package/dist/messages.d.ts +4 -2
  28. package/dist/messages.js +14 -2
  29. package/dist/rules/kibi-workflow.mdc +3 -3
  30. package/dist/skills/.canon-hash.json +12 -0
  31. package/dist/skills/init-kibi/SKILL.md +50 -11
  32. package/dist/skills/kibi-freshness/SKILL.md +32 -10
  33. package/dist/skills/kibi-traceability/SKILL.md +41 -11
  34. package/dist/skills/kibi-usage/SKILL.md +149 -97
  35. package/dist/skills/kibi-usage/resources/fact-lanes.md +235 -0
  36. package/dist/skills/kibi-usage/resources/logic-ir.md +43 -0
  37. package/dist/skills/kibi-usage/resources/operation-access.md +44 -0
  38. package/dist/skills/kibi-usage/resources/relationship-directions.md +119 -0
  39. package/dist/skills/kibi-usage/resources/ui-requirements.md +96 -0
  40. package/dist/skills/kibi-usage/resources/workflows.md +80 -0
  41. package/package.json +3 -2
  42. package/rules/kibi-workflow.mdc +3 -3
  43. package/skills/.canon-hash.json +12 -0
  44. package/skills/init-kibi/SKILL.md +50 -11
  45. package/skills/kibi-freshness/SKILL.md +32 -10
  46. package/skills/kibi-traceability/SKILL.md +41 -11
  47. package/skills/kibi-usage/SKILL.md +149 -97
  48. package/skills/kibi-usage/resources/fact-lanes.md +235 -0
  49. package/skills/kibi-usage/resources/logic-ir.md +43 -0
  50. package/skills/kibi-usage/resources/operation-access.md +44 -0
  51. package/skills/kibi-usage/resources/relationship-directions.md +119 -0
  52. package/skills/kibi-usage/resources/ui-requirements.md +96 -0
  53. package/skills/kibi-usage/resources/workflows.md +80 -0
@@ -2,7 +2,7 @@
2
2
  id: kibi-usage
3
3
  name: Kibi Usage
4
4
  description: Guides agents to use Kibi MCP, facts, relationships, and validation correctly
5
- version: 1.0.0
5
+ version: 1.3.0
6
6
  kibiCompatibility: ">=0.11.0"
7
7
  tags:
8
8
  - kibi
@@ -14,29 +14,54 @@ resources:
14
14
  - resources/relationship-directions.md
15
15
  - resources/fact-lanes.md
16
16
  - resources/workflows.md
17
+ - resources/operation-access.md
18
+ - resources/ui-requirements.md
19
+ - resources/logic-ir.md
17
20
  ---
18
-
19
21
  # Kibi Usage
20
22
 
21
- Consult this skill before any Kibi knowledge base operation, on first interaction with a Kibi-enabled repo, after detecting stale or dirty KB status, and before performing mutations.
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.
22
33
 
23
- ## MCP-Only Rules
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.
24
35
 
25
- Interact with the knowledge base exclusively through MCP tools. Do not read or edit files inside `.kb/` directly. Do not run any `kibi` CLI commands from the agent session. The MCP surface is the only sanctioned interface for agents.
36
+ CLI JSON mode accepts MCP-shaped business input at `--input <file|->`.
26
37
 
27
- ### Tool Name Prefixes
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
+ ```
28
45
 
29
- Kibi's canonical MCP names are `kb_search`, `kb_query`, `kb_upsert`, `kb_check`, and related `kb_*` tools. Some hosts add a server prefix when exposing tools to agents. In OpenCode, use the visible `kibi_kb_search`, `kibi_kb_query`, `kibi_kb_upsert`, and `kibi_kb_check` names when exact tool identifiers are required; they map to the same canonical MCP names.
46
+ ## MCP Tool Names
30
47
 
31
- ## Discovery-First Workflow
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.
32
49
 
33
- Always discover before you mutate. Start with `kb_search` for exploratory discovery across metadata and markdown body text. Split broad queries into 1-3 focused probes. Review top hits for relevance before concluding the KB lacks knowledge.
50
+ ## Discovery First
34
51
 
35
- Follow up with `kb_query` for exact lookups by `id`, `type`, `tags`, or `sourceFile`. Call `kb_status` to inspect branch attachment and freshness when stale context would affect decisions. Only after discovery and confirmation should you mutate.
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.
36
61
 
37
62
  ## Relationship Directions
38
63
 
39
- Relationship direction is fixed and semantic. Getting it wrong breaks traceability queries and validation.
64
+ Relationship direction is fixed and semantic. Reversed links break traceability queries and validation.
40
65
 
41
66
  | Relationship | Direction | Meaning |
42
67
  |-------------|-----------|---------|
@@ -47,45 +72,55 @@ Relationship direction is fixed and semantic. Getting it wrong breaks traceabili
47
72
  | `executable_for` | symbol -> test | Symbol is executable test code for a test entity |
48
73
  | `constrains` | req -> fact(subject) | Requirement constrains a domain fact |
49
74
  | `requires_property` | req -> fact(property_value) | Requirement requires a property value |
75
+ | `requires_predicate` | req -> fact(predicate) | Requirement requires a ground ontology predicate |
50
76
  | `supersedes` | old-req -> new-req | Old requirement is replaced by new requirement |
51
77
  | `covered_by` | symbol -> test | Production symbol has coverage evidence from a test |
52
78
 
53
- See `resources/relationship-directions.md` for detailed payload examples.
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" }]`
54
83
 
55
84
  ## Symbol-First Traceability
56
85
 
57
- Trace code through `symbol` entities, not inline legacy comments. Do not use legacy `// implements REQ-xxx` comments as the primary marker for new or modified code. If a symbol is new or its requirement ownership changes, create or update the `symbol` entity and add an `implements` relationship from the symbol to the requirement.
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.
58
87
 
59
- Use comments only as a temporary backward-compatibility fallback when the symbol manifest cannot be updated in the same task. Prefer durable symbol coordinates in `documentation/symbols.yaml` and `documentation/symbol-coordinates.yaml`, then link those symbols through MCP relationships.
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:
60
91
 
61
92
  ```yaml
62
- # Preferred traceability model
63
93
  symbol:
64
94
  id: SYM-admin-billing-policy
65
95
  title: Admin billing policy check
66
96
  status: active
97
+ sourceFile: src/admin/billing.ts
67
98
  relationships:
68
99
  - type: implements
69
100
  from: SYM-admin-billing-policy
70
101
  to: REQ-ADMIN-BILLING-POLICY
71
102
  ```
72
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
+
73
112
  ## Strict Fact Lane
74
113
 
75
114
  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`.
76
115
 
77
116
  ```yaml
78
- # Fact entity
79
117
  id: FACT-USER-ROLE
80
- title: User Role Assignment
81
- status: active
82
118
  fact_kind: subject
83
119
  subject_key: user.role_assignment
120
+ ```
84
121
 
85
- # Requirement entity
122
+ ```yaml
86
123
  id: REQ-019
87
- title: Users can have up to 3 roles
88
- status: open
89
124
  relationships:
90
125
  - type: constrains
91
126
  from: REQ-019
@@ -95,106 +130,126 @@ relationships:
95
130
  to: FACT-LIMIT-3
96
131
  ```
97
132
 
98
- See `resources/fact-lanes.md` for the full strict vs observation lane comparison.
133
+ 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.
134
+
135
+ 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.
136
+
137
+ 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.
138
+
139
+ ## UI / Visual Requirement Modeling
140
+
141
+ 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.
99
142
 
100
- ### Granular fact examples for coherence checks
143
+ 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`.
101
144
 
102
- Model one semantic claim per strict `property_value` fact. Reusing the same `subject_key` and `property_key` lets `domain-contradictions` compare requirements mechanically.
145
+ ## Complete Logical Coverage
103
146
 
104
- Incoherent role-set example: `REQ-ROLE-SET-2` says the allowed user roles are exactly `[user, admin]`, while `REQ-ROLE-SET-3` says the same property is exactly `[user, admin, superadmin]`. Both constrain `FACT-USER-ROLES` and require different values for `user.roles.allowed_set`, so they cannot both be current.
147
+ 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.
148
+
149
+ 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.
150
+ 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.
151
+ 3. Put the complete set of keys in the requirement's `logic_claims` manifest. Merge returned keys with existing values; never overwrite earlier claims while modeling a later clause.
152
+ 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.
153
+ 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.
154
+
155
+ 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.
156
+
157
+ A complete `logic_claims` manifest alone is not a complete model. Semantic-advisor readiness remains partial until the payload has at least one distinct `requires_property`, `requires_predicate`, or `requires_rule` grounding slot per assertive claim. This count prevents one token edge from suppressing the remaining plans; only `logic-coverage` readback proves that each slot reaches the fact with the matching claim key.
158
+
159
+ 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.
160
+
161
+ For a compound requirement, the manifest and linked facts form a clause-completeness contract:
105
162
 
106
163
  ```yaml
107
- subject:
108
- id: FACT-USER-ROLES
109
- fact_kind: subject
110
- subject_key: user.roles
111
-
112
- property_values:
113
- - id: FACT-USER-ROLES-ALLOWED-2
114
- fact_kind: property_value
115
- subject_key: user.roles
116
- property_key: user.roles.allowed_set
117
- operator: eq
118
- value_type: list
119
- value_json: '["user", "admin"]'
120
- - id: FACT-USER-ROLES-ALLOWED-3
121
- fact_kind: property_value
122
- subject_key: user.roles
123
- property_key: user.roles.allowed_set
124
- operator: eq
125
- value_type: list
126
- value_json: '["user", "admin", "superadmin"]'
127
-
128
- requirements:
129
- - id: REQ-ROLE-SET-2
130
- relationships:
131
- - { type: constrains, from: REQ-ROLE-SET-2, to: FACT-USER-ROLES }
132
- - { type: requires_property, from: REQ-ROLE-SET-2, to: FACT-USER-ROLES-ALLOWED-2 }
133
- - id: REQ-ROLE-SET-3
134
- relationships:
135
- - { type: constrains, from: REQ-ROLE-SET-3, to: FACT-USER-ROLES }
136
- - { type: requires_property, from: REQ-ROLE-SET-3, to: FACT-USER-ROLES-ALLOWED-3 }
164
+ requirement:
165
+ id: REQ-CHECKOUT-RETENTION
166
+ logic_claims: [CLAIM-A1B2C3D4E5F60718, CLAIM-18273645AABBCCDD]
167
+ facts:
168
+ - fact_kind: predicate
169
+ claim_key: CLAIM-A1B2C3D4E5F60718
170
+ claim_text: Checkout requires payment authorization before submission.
171
+ - fact_kind: property_value
172
+ claim_key: CLAIM-18273645AABBCCDD
173
+ claim_text: Customer data must be retained for 7 years.
137
174
  ```
138
175
 
139
- Incoherent permission example: `REQ-ADMIN-CAN-MANAGE-BILLING` says `admin` can manage billing, while `REQ-ONLY-SUPERADMIN-MANAGES-BILLING` says the only allowed actor is `superadmin`. Model both against `billing.manage.allowed_actor` with `operator: eq` so the conflict is explicit.
176
+ The example keys are illustrative; use only keys returned for the exact clause text.
177
+
178
+ ## Predicate Ontology Decision Tree
179
+
180
+ 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.
181
+
182
+ 1. Call `kb_semantic_advisor` on the complete prose, verify its atomic clause inventory, and choose one lane per clause.
183
+ 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.
184
+ 3. Accept a candidate only when its meaning and every ordered argument fit the prose. 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.
185
+ 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.
186
+ 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`.
187
+ 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.
188
+ 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.
189
+
190
+ ### Schema-aware proposition boundary
191
+
192
+ 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.
193
+
194
+ ### Hard lane gates for unresolved prose and supplied schemas
195
+
196
+ 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.
197
+
198
+ 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.
199
+
200
+ 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:
140
201
 
141
202
  ```yaml
142
- property_values:
143
- - id: FACT-BILLING-MANAGE-ACTOR-ADMIN
144
- fact_kind: property_value
145
- subject_key: billing.manage
146
- property_key: billing.manage.allowed_actor
147
- operator: eq
148
- value_type: string
149
- value_string: admin
150
- - id: FACT-BILLING-MANAGE-ACTOR-SUPERADMIN
151
- fact_kind: property_value
152
- subject_key: billing.manage
153
- property_key: billing.manage.allowed_actor
154
- operator: eq
155
- value_type: string
156
- value_string: superadmin
203
+ fact_kind: predicate
204
+ predicate_name: dependency_rule
205
+ predicate_args: [checkout, payment_authorization, order_submission]
206
+ canonical_key: dependency_rule(checkout,payment_authorization,order_submission)
207
+ polarity: assert
208
+ claim_key: <claim key returned by kb_semantic_advisor>
209
+ claim_text: Checkout requires payment authorization before order submission.
157
210
  ```
158
211
 
159
- 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.
212
+ 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.
213
+
214
+ 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`.
160
215
 
161
216
  ## Fact vs Flag
162
217
 
163
- Use `flag` for runtime or config gates only. Feature flags, kill-switches, and deferred capabilities are valid `flag` entities.
218
+ Use `flag` for runtime or config gates only, such as feature flags, kill-switches, and deferred capabilities.
164
219
 
165
- 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.
220
+ 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.
166
221
 
167
- Anti-example: do not create a `flag` named `BUG-123` to track a defect. Create a `fact` with `fact_kind: observation` instead.
222
+ ## Create Before Link
168
223
 
169
- ## Create-Before-Link
224
+ 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.
170
225
 
171
- 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. Creating relationships to non-existent entities produces dangling references that `kb_check` will flag.
226
+ 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.
172
227
 
173
- For `kb_upsert`, keep relationship rows anchored to the entity you are upserting: 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.
228
+ 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.
174
229
 
175
- Keep symbol payloads minimal: include only the fields needed to identify the symbol, its status, and its source traceability. Put extra prose, examples, or audit notes in docs or evidence files instead of custom `kb_upsert.properties`; strict `kb_upsert.properties` rejects unknown fields.
230
+ 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.
176
231
 
177
- When a generic `Query failed` appears, do not keep retrying the same payload. First call `kb_validate_upsert`, query or create the missing endpoints, reduce the payload to the minimum required fields, and retry once. If it still fails, report the blocker instead of looping.
232
+ ## Small Behavior Fix Impact Evidence
178
233
 
179
- ## Sequential Upserts
234
+ 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.
180
235
 
181
- Never fire `kb_upsert` calls in parallel. Execute them sequentially to avoid lock contention and ensure deterministic ordering. This is especially important when creating chains of related entities.
236
+ 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.
182
237
 
183
- ## Targeted and Final Checks
238
+ 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.
184
239
 
185
- Run `kb_check` with specific rules during iteration for fast feedback. For example, use `rules: ["required-fields", "no-dangling-refs"]` after small changes. Supplying `rules` preserves that scoped validation and skips the full-KB advisory scan. Run a full `kb_check` without rule filters before declaring work complete so `qualityDiagnostics[]` includes the full-KB audit-quality review.
240
+ ## Sequential Upserts
186
241
 
187
- For meaningful source edits, run impact diagnostics while the edit context is fresh: `kb_check({sourceFiles:["src/changed-file.ts"], includeImpactDiagnostics:true, includeWorkingTreeDiff:true})`. Review `symbol_granularity_violation` as a hard ownership-shape problem and `symbol_semantic_review_needed` as an advisory prompt to inspect whether linked requirements, scenarios, and tests still match the changed behavior or UI copy.
242
+ 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.
188
243
 
189
- ## Domain Contradictions and Evolution
244
+ ## Checks
190
245
 
191
- 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.
246
+ 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.
192
247
 
193
- Use `kb_model_requirement` for automated strict-fact modeling. It generates the subject and property_value facts, links them via `constrains` and `requires_property`, and handles low-confidence downgrades to `observation` facts automatically.
248
+ 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.
194
249
 
195
250
  ## Stale or Dirty KB Handling
196
251
 
197
- Call `kb_status` when you suspect the branch KB is stale or when 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.
252
+ 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.
198
253
 
199
254
  ## Anti-Patterns and Remediation
200
255
 
@@ -205,14 +260,11 @@ Call `kb_status` when you suspect the branch KB is stale or when switching conte
205
260
  | Bug-as-flag | `flag` misused for defect tracking | Use `fact` with `fact_kind: observation` or `meta` |
206
261
  | Parallel upserts | Lock contention and nondeterminism | Execute `kb_upsert` calls sequentially |
207
262
  | Embedded scenarios in reqs | Violates canonical traceability chain | Create separate `req`, `scen`, and `test` entities |
208
- | Missing `kb_check` | Undetected dangling refs, violations, and full-KB quality diagnostics | Run targeted checks during work, full unfiltered check at completion |
263
+ | Missing `kb_check` | Undetected dangling refs and violations | Run targeted checks during work, full check at completion |
209
264
  | Tags as multi-ID lookup | Tags are metadata, not identifiers | Use `kb_query` with explicit `id` values |
210
265
  | `relates_to` for strict modeling | Loses contradiction safety | Use `constrains` and `requires_property` instead |
266
+ | 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` |
267
+ | Replacing `logic_claims` on each call | Discards previously grounded clauses | Pass existing keys and merge the returned manifest |
268
+ | Observation counted as coverage | Ambiguity or ontology gaps appear machine-checkable | Keep the claim unresolved until a strict or predicate ground fact exists |
269
+ | 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 |
211
270
  | `status: implemented` on requirements | Not a valid lifecycle status | Use a valid status such as `closed`, add an `implemented` tag, and link evidence instead |
212
-
213
- Before/after for reversed direction:
214
-
215
- - Wrong: `relationships: [{ type: "implements", from: "REQ-001", to: "SYM-001" }]`
216
- - Right: `relationships: [{ type: "implements", from: "SYM-001", to: "REQ-001" }]`
217
-
218
- See `resources/workflows.md` for the golden-path discovery to validation sequence.
@@ -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 requirement `logic_claims` manifest without removing existing keys;
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
+ ```