kibi-runtime 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine-daemon.js +136 -32
- package/dist/index.d.ts +2 -1
- package/dist/index.js +40648 -38780
- package/dist/skills/kibi-usage/SKILL.md +7 -3
- package/dist/skills/kibi-usage/resources/fact-lanes.md +4 -0
- package/dist/skills/kibi-usage/resources/relationship-directions.md +35 -17
- package/dist/skills/kibi-usage/resources/source-authoring.md +36 -0
- package/dist/skills/kibi-usage/resources/workflows.md +52 -1
- package/package.json +3 -3
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
id: kibi-usage
|
|
3
3
|
name: Kibi Usage
|
|
4
4
|
description: Use Kibi's source-first, exact-Git, migration-aware, proof-aware operations safely across MCP or the trusted local CLI, including partial completion repair.
|
|
5
|
-
version: 2.
|
|
5
|
+
version: 2.2.0
|
|
6
6
|
kibiCompatibility: ">=1.0.0"
|
|
7
7
|
tags:
|
|
8
8
|
- kibi
|
|
@@ -59,7 +59,11 @@ mutability, and Prolog requirements of each operation.
|
|
|
59
59
|
## Safe workflow
|
|
60
60
|
|
|
61
61
|
1. Always discover before you mutate: start with `kb_search`, then exact-filter with `kb_query`. Use
|
|
62
|
-
`kb_status` when branch or freshness confidence matters.
|
|
62
|
+
`kb_status` when branch or freshness confidence matters. `kb_search` ranks
|
|
63
|
+
lexically unless you pass `rankingMode: "intent-v1"`, `semanticFacets`, or
|
|
64
|
+
`sourceLocations`; use intent mode with grounded facets for conceptual
|
|
65
|
+
questions and before changing a source file, and keep lexical search for
|
|
66
|
+
literal identifiers. See `resources/workflows.md` for the mode recipe.
|
|
63
67
|
2. Resolve genuine ambiguity with the human; use semantic advisor/modeling
|
|
64
68
|
operations for deterministic interpretation and typed facts.
|
|
65
69
|
3. Create endpoints before relationships and upsert small batches sequentially.
|
|
@@ -160,7 +164,7 @@ Represent implementation ownership with a `symbol` entity that has
|
|
|
160
164
|
`sourceFile`, `implements` to the requirement, and `covered_by` to the test.
|
|
161
165
|
Prolog `symbol-coverage` also requires the test to `validates` the requirement
|
|
162
166
|
(or the requirement `verified_by` the test). `covered_by` alone is not
|
|
163
|
-
enough. Do not rely on legacy `// implements REQ
|
|
167
|
+
enough. Do not rely on legacy `// implements REQ-<area>-<behavior>` comments as the
|
|
164
168
|
traceability record.
|
|
165
169
|
|
|
166
170
|
## Complete Logical Coverage
|
|
@@ -55,6 +55,10 @@ relationship: { type: requires_predicate, from: REQ-EDITOR-DRAFT-AUTOSAVE, to: F
|
|
|
55
55
|
|
|
56
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
57
|
|
|
58
|
+
### Closed argument vocabularies
|
|
59
|
+
|
|
60
|
+
A schema can close an argument with `argument_constants` (allowed values keyed by argument name) and map older spellings with `argument_aliases`. Reuse a declared constant; `kb_upsert` rejects any other value and names the constant to use for an alias. When a genuinely new value is needed, extend `argument_constants` on the schema first. To converge existing facts, declare aliases for their spellings and let `kibi migrate` rewrite them (`predicate_schema_alignment` actions). Close only arguments with a natural shared vocabulary, such as the governed component or a severity; forcing distinct obligations into a few constants makes different requirements share one ground term.
|
|
61
|
+
|
|
58
62
|
### Deny predicate
|
|
59
63
|
|
|
60
64
|
Claim: “Suspended users must not publish articles.” When `permission_rule` fits, preserve its positive schema name and encode prohibition as polarity:
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
| `constrains` | req -> fact(subject) | Requirement constrains a strict-lane domain fact |
|
|
13
13
|
| `requires_property` | req -> fact(property_value) | Requirement requires a specific property value fact |
|
|
14
14
|
| `supersedes` | new-req -> old-req | New requirement formally replaces an old requirement |
|
|
15
|
+
| `restates` | req -> req | Requirement intentionally restates another current requirement (for example a product requirement echoed in a platform requirement); suppresses `domain-redundancy` for that pair without retiring either side |
|
|
15
16
|
| `covered_by` | symbol -> test | Production symbol has test coverage evidence |
|
|
16
17
|
|
|
17
18
|
## Valid Payload Examples
|
|
@@ -20,32 +21,32 @@
|
|
|
20
21
|
```yaml
|
|
21
22
|
relationships:
|
|
22
23
|
- type: implements
|
|
23
|
-
from: SYM-
|
|
24
|
-
to: REQ-
|
|
24
|
+
from: SYM-operation-execute-check
|
|
25
|
+
to: REQ-cli-check
|
|
25
26
|
```
|
|
26
27
|
|
|
27
28
|
### specified_by
|
|
28
29
|
```yaml
|
|
29
30
|
relationships:
|
|
30
31
|
- type: specified_by
|
|
31
|
-
from: REQ-
|
|
32
|
-
to: SCEN-
|
|
32
|
+
from: REQ-mcp-search-discovery
|
|
33
|
+
to: SCEN-mcp-search-discovery
|
|
33
34
|
```
|
|
34
35
|
|
|
35
36
|
### verified_by
|
|
36
37
|
```yaml
|
|
37
38
|
relationships:
|
|
38
39
|
- type: verified_by
|
|
39
|
-
from: REQ-
|
|
40
|
-
to: TEST-
|
|
40
|
+
from: REQ-mcp-search-discovery
|
|
41
|
+
to: TEST-mcp-search-discovery
|
|
41
42
|
```
|
|
42
43
|
|
|
43
44
|
### validates
|
|
44
45
|
```yaml
|
|
45
46
|
relationships:
|
|
46
47
|
- type: validates
|
|
47
|
-
from: TEST-
|
|
48
|
-
to: SCEN-
|
|
48
|
+
from: TEST-mcp-search-discovery
|
|
49
|
+
to: SCEN-mcp-search-discovery
|
|
49
50
|
```
|
|
50
51
|
|
|
51
52
|
### executable_for
|
|
@@ -53,39 +54,56 @@ relationships:
|
|
|
53
54
|
relationships:
|
|
54
55
|
- type: executable_for
|
|
55
56
|
from: SYM-test-login
|
|
56
|
-
to: TEST-
|
|
57
|
+
to: TEST-mcp-search-discovery
|
|
57
58
|
```
|
|
58
59
|
|
|
59
60
|
### constrains
|
|
60
61
|
```yaml
|
|
61
62
|
relationships:
|
|
62
63
|
- type: constrains
|
|
63
|
-
from: REQ-
|
|
64
|
-
to: FACT-
|
|
64
|
+
from: REQ-cli-check
|
|
65
|
+
to: FACT-SUBJECT-KIBI-CHECK
|
|
65
66
|
```
|
|
66
67
|
|
|
67
68
|
### requires_property
|
|
68
69
|
```yaml
|
|
69
70
|
relationships:
|
|
70
71
|
- type: requires_property
|
|
71
|
-
from: REQ-
|
|
72
|
-
to: FACT-
|
|
72
|
+
from: REQ-cli-check
|
|
73
|
+
to: FACT-PROP-CHECK-FAILURE-EXIT-CODE
|
|
73
74
|
```
|
|
74
75
|
|
|
75
76
|
### supersedes
|
|
76
77
|
```yaml
|
|
77
78
|
relationships:
|
|
78
79
|
- type: supersedes
|
|
79
|
-
from: REQ-
|
|
80
|
-
to: REQ-
|
|
80
|
+
from: REQ-opencode-kibi-briefing-v2
|
|
81
|
+
to: REQ-opencode-kibi-briefing-v1
|
|
81
82
|
```
|
|
82
83
|
|
|
84
|
+
A `-v2` suffix is acceptable only for a direct superseding replacement like
|
|
85
|
+
this one; otherwise name the new requirement by the behavior it governs.
|
|
86
|
+
|
|
87
|
+
### restates
|
|
88
|
+
```yaml
|
|
89
|
+
# Illustrative: a product requirement echoes a platform requirement verbatim.
|
|
90
|
+
relationships:
|
|
91
|
+
- type: restates
|
|
92
|
+
from: REQ-billing-invoice-retention
|
|
93
|
+
to: REQ-platform-record-retention
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Use `restates` only when two current requirements deliberately ground the same
|
|
97
|
+
logical term (same predicate, property tuple, or rule semantic key). It keeps
|
|
98
|
+
both requirements current and tells `domain-redundancy` the duplication is
|
|
99
|
+
intentional. If one requirement replaces the other, use `supersedes` instead.
|
|
100
|
+
|
|
83
101
|
### covered_by
|
|
84
102
|
```yaml
|
|
85
103
|
relationships:
|
|
86
104
|
- type: covered_by
|
|
87
|
-
from: SYM-
|
|
88
|
-
to: TEST-
|
|
105
|
+
from: SYM-operation-execute-check
|
|
106
|
+
to: TEST-mcp-search-discovery
|
|
89
107
|
```
|
|
90
108
|
|
|
91
109
|
## Invalid Test-Fact Shortcuts
|
|
@@ -29,3 +29,39 @@ Cancellation follows the same rule: wait for the terminal journal state. A
|
|
|
29
29
|
pre-commit rollback is retryable, a committed source with a failed derivative
|
|
30
30
|
is repairable, and an indeterminate outcome is non-retryable until its recovery
|
|
31
31
|
action resolves the journal.
|
|
32
|
+
|
|
33
|
+
## Naming entities
|
|
34
|
+
|
|
35
|
+
Name every entity by what it governs, the way you would name a source file.
|
|
36
|
+
Never choose "the next number": parallel branches pick the same next number and
|
|
37
|
+
collide even when they touch unrelated behavior.
|
|
38
|
+
|
|
39
|
+
- Use `<TYPE>-<area>-<behavior>` in kebab-case, with the type prefix kept
|
|
40
|
+
uppercase: `REQ-cli-gc`, `SCEN-mcp-search-discovery`,
|
|
41
|
+
`TEST-mcp-search-discovery`, `ADR-capability-plugins-v1`,
|
|
42
|
+
`EVT-exact-branch-store-ensure`, and a flag named after its gate such as
|
|
43
|
+
`FLAG-scip-symbol-extraction`.
|
|
44
|
+
- The filename stem equals the frontmatter `id`
|
|
45
|
+
(`.kb/requirements/REQ-cli-gc.md` has `id: REQ-cli-gc`). Always set `id`
|
|
46
|
+
explicitly; a missing `id` falls back to a path-and-title hash that changes
|
|
47
|
+
when the file is renamed.
|
|
48
|
+
- Before creating an entity, `kb_search` the area. If an existing entity already
|
|
49
|
+
covers the behavior, update it, or create a replacement and link it with
|
|
50
|
+
`supersedes`. A `-v2` suffix is acceptable only for that direct superseding
|
|
51
|
+
replacement.
|
|
52
|
+
- A name collision with another branch usually means the same work was done
|
|
53
|
+
twice. Reconcile the two entities; do not rename one of them to dodge the
|
|
54
|
+
collision.
|
|
55
|
+
- The area prefix is for humans. Whether two requirements are about the same
|
|
56
|
+
thing is decided by their facts: a shared `subject_key` and identical
|
|
57
|
+
predicate or property signatures, which `domain-redundancy` and
|
|
58
|
+
`domain-contradictions` compare deterministically. Reuse existing subject keys
|
|
59
|
+
(dotted `component.aspect[.sub]`, lowercase snake segments such as
|
|
60
|
+
`kibi.cli.check.staged`) instead of deriving a subject from the requirement
|
|
61
|
+
ID.
|
|
62
|
+
|
|
63
|
+
`entity-id-style` reports new purely numeric IDs (`REQ-123`) and IDs whose
|
|
64
|
+
filename stem differs from `id` as non-blocking quality diagnostics. Legacy
|
|
65
|
+
numbered entities created before the naming standard are grandfathered and are
|
|
66
|
+
not renamed, because code comments such as `// implements REQ-003` still
|
|
67
|
+
reference them.
|
|
@@ -33,11 +33,62 @@ surfaces are a release defect: require a new package version and label any
|
|
|
33
33
|
project override temporary. This skill never selects a package manager or
|
|
34
34
|
edits dependency configuration.
|
|
35
35
|
|
|
36
|
+
## Choosing a discovery mode
|
|
37
|
+
|
|
38
|
+
`kb_search` is not one behavior. It selects deterministic intent ranking when
|
|
39
|
+
you pass `rankingMode: "intent-v1"`, `semanticFacets`, or `sourceLocations`,
|
|
40
|
+
and legacy lexical ranking otherwise. Naming the tool is not enough; the inputs
|
|
41
|
+
decide the path.
|
|
42
|
+
|
|
43
|
+
- **Exact identity** — you already know the ID. Use `kb_query`, not search.
|
|
44
|
+
- **Literal token** — a symbol, file, or error string that appears verbatim.
|
|
45
|
+
Use lexical `kb_search` and keep the query close to the literal text.
|
|
46
|
+
- **Conceptual or behavioral** — "how does checkout handle a declined card".
|
|
47
|
+
Use intent mode and ground it in what you actually know:
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"query": "declined card during checkout",
|
|
52
|
+
"rankingMode": "intent-v1",
|
|
53
|
+
"semanticFacets": {
|
|
54
|
+
"actors": ["shopper"],
|
|
55
|
+
"actions": ["pay"],
|
|
56
|
+
"objects": ["card"],
|
|
57
|
+
"constraints": ["declined"]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
- **Before changing code** — pass the file you are about to edit as a source
|
|
63
|
+
location, so results are matched against source-linked symbols and return
|
|
64
|
+
source evidence:
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"query": "checkout total rounding",
|
|
69
|
+
"rankingMode": "intent-v1",
|
|
70
|
+
"sourceLocations": [{ "path": "src/checkout.ts", "symbol": "computeTotal" }]
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Supply facets only from the request, the code, or prior results. Inventing
|
|
75
|
+
facets fabricates evidence and biases ranking. Intent mode abstains below
|
|
76
|
+
`minScore` instead of returning weak matches; an abstention is an explicit
|
|
77
|
+
no-answer, so widen the query or drop to lexical search rather than treating it
|
|
78
|
+
as "nothing exists". There is no target percentage of intent-mode calls — a
|
|
79
|
+
literal identifier lookup is still best served lexically.
|
|
80
|
+
|
|
81
|
+
Results are summaries by default: identifying metadata, score, reasons, and a
|
|
82
|
+
snippet. Read them to pick candidates, then `kb_query` those IDs for full
|
|
83
|
+
bodies, or pass `fields: "full"` when you genuinely need every body. Extract
|
|
84
|
+
the relevant existing constraints and decisions from the response before
|
|
85
|
+
planning a behavior change; a search receipt is not comprehension.
|
|
86
|
+
|
|
36
87
|
## Discovery to Validation Sequence
|
|
37
88
|
|
|
38
89
|
The canonical workflow for any KB operation follows this pattern:
|
|
39
90
|
|
|
40
|
-
1. **Discover**: `kb_search` with focused probes
|
|
91
|
+
1. **Discover**: `kb_search` with focused probes; pick the mode above
|
|
41
92
|
2. **Confirm**: `kb_query` for exact IDs and state
|
|
42
93
|
3. **Inspect**: `kb_status` when freshness matters
|
|
43
94
|
4. **Decompose**: `kb_semantic_advisor` on the complete normative prose; verify or supply every atomic clause
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kibi-runtime",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Narrow first-party runtime contracts and adapters for Kibi operations.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"gray-matter": "^4.0.3",
|
|
21
|
-
"kibi-core": "^0.
|
|
22
|
-
"kibi-plugin-builtin": "^0.
|
|
21
|
+
"kibi-core": "^0.14.0",
|
|
22
|
+
"kibi-plugin-builtin": "^0.3.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"kibi-cli": "workspace:*"
|