kibi-runtime 2.0.2 → 2.2.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.
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  id: kibi-bootstrap
3
3
  name: kibi-bootstrap
4
- description: Bootstrap Kibi from the current Git checkout with exact Git attachment, preview approval, source-first writes, and repair-safe completion.
5
- version: 3.0.0
4
+ description: Bootstrap Kibi from the current Git checkout and the project's existing knowledge sources, with a source interview, cited intent claims, preview approval, source-first writes, and repair-safe completion.
5
+ version: 3.1.0
6
6
  kibiCompatibility: ">=1.0.0"
7
7
  tags:
8
8
  - kibi
@@ -18,20 +18,56 @@ resources:
18
18
  ## Goal
19
19
 
20
20
  Seed branch-local Kibi knowledge for an attached but thin repository without
21
- creating a parallel human-maintained ticket system. Ask at most four bounded
22
- context questions only when the planner says repository evidence is
23
- insufficient; agents own deterministic translation and humans resolve genuine
24
- ambiguity. A seeded repository hands off to the normal Kibi workflow.
21
+ creating a parallel human-maintained ticket system. Code shows what the
22
+ system does, not why; intent usually lives elsewhere (issue trackers, wikis,
23
+ specs, decision logs). Lead a short interview to find those sources, harvest
24
+ cited intent from them, and let the planner consolidate it with repository
25
+ evidence. Agents own reading and translation; humans name the sources,
26
+ judge their authority, and resolve genuine ambiguity. A seeded repository
27
+ hands off to the normal Kibi workflow.
25
28
 
26
29
  ## Interface and preview
27
30
 
28
31
  Use the visible approved MCP surface or the trusted project-local CLI as equal
29
- peer interfaces. If neither is available, stop. Run `kb_plan_bootstrap` (or
30
- `plan-bootstrap --input`) read-only. If it returns `needs_context`, ask only its
32
+ peer interfaces. If neither is available, stop. Interview first, then plan,
33
+ then preview the exact plan for approval.
34
+
35
+ ## Interview first
36
+
37
+ Before planning:
38
+
39
+ 1. Inventory what you can already read: your own MCP connectors and tools
40
+ (issue trackers such as Jira, YouTrack, Linear, or GitHub Issues; wikis such
41
+ as Confluence or Notion; drives and design tools), and in-repo docs, ADRs,
42
+ and specs.
43
+ 2. Ask the human, in one message: what the repository is for; which of those
44
+ sources hold product intent; which are authoritative, supporting, or stale;
45
+ what is missing; and which product areas matter first. If an important
46
+ source has no connector, say which one and suggest connecting it, then
47
+ continue with what is reachable. Never invent access you lack.
48
+ 3. Read the confirmed, non-stale sources through your connectors. Harvest one
49
+ normative statement per behavior, each citing its source and an exact
50
+ reference (ticket key, page URL, or section anchor). Keep the source's
51
+ meaning; do not merge, generalize, or resolve conflicts yourself.
52
+
53
+ Declare the result in `bootstrapContext`: `projectSummary`,
54
+ `knowledgeSources` (id, kind, title, locator, authority, optional connector),
55
+ and `intentClaims` (statement, sourceId, reference, optional excerpt). Kibi
56
+ never contacts those sources; it binds what you declare into the plan hash.
57
+
58
+ ## Plan and approval
59
+
60
+ Run `kb_plan_bootstrap` (or `plan-bootstrap --input`) read-only with that
61
+ context. Grounded authoritative or supporting claims become cited `req`
62
+ candidates; claims the strict modeler cannot ground come back as authoring
63
+ follow-ups; stale sources produce no candidates; undeclared sources are
64
+ reported in diagnostics. If the plan returns `needs_context`, ask only its
31
65
  bounded questions (never more than four), then rerun the planner. Show the
32
- complete returned `structuredContent.plan`, including its canonical hash, and
33
- get explicit approval before any write. Pass that plan object unchanged to
34
- `kb_apply_plan`; do not reconstruct it from preview fields.
66
+ complete returned `structuredContent.plan`, including its canonical hash and
67
+ which candidates cite which sources, and get explicit approval before any
68
+ write. Pass that plan object unchanged to `kb_apply_plan`; do not reconstruct
69
+ it from preview fields. When a claim contradicts the code or another claim,
70
+ put it to the human instead of choosing.
35
71
 
36
72
  For CLI JSON, use the trusted route with `--input` (for example
37
73
  `printf '%s\n' '{}' | kibi status --input -`); MCP and CLI are semantic peers.
@@ -1,6 +1,11 @@
1
1
  # Bootstrap resource
2
2
 
3
- `kb_plan_bootstrap` is read-only and returns `kibi.bootstrap-plan.v1`. Review
3
+ `kb_plan_bootstrap` is read-only and returns `kibi.bootstrap-plan.v1`. Declared
4
+ `knowledgeSources` and cited `intentClaims` are part of `declaredContext` and
5
+ therefore of the plan hash; a candidate built from a claim has `sourceKind:
6
+ intent_claim` and evidence rows `intent_claim:<sourceId>:<reference>`,
7
+ `knowledge_source:<kind>:<locator>`, and `source_authority:<authority>`. Its
8
+ requirement keeps the citation as `text_ref: <sourceId>:<reference>`. Review
4
9
  candidate evidence, exact actions, dependencies, expected snapshots, source
5
10
  hashes, bounded questions, diagnostics, and the canonical `planHash` before
6
11
  approving. A preview does not authorize source edits. After approval, pass the
@@ -56,6 +56,20 @@ printf '%s\n' '{"query":"checkout","limit":10}' | npx --no-install kibi search -
56
56
  Read `resources/operation-access.md` for the route, result version, effects,
57
57
  mutability, and Prolog requirements of each operation.
58
58
 
59
+ ## Working in a git worktree or another directory
60
+
61
+ Kibi MCP servers start in one project and answer from its knowledge base.
62
+ Every Kibi MCP tool accepts `workspaceRoot`: when your working directory is not
63
+ the project the server started in (a git worktree, a sibling checkout), pass
64
+ your working directory as `workspaceRoot` on every call. Host plugins with
65
+ pre-tool hooks add it for you. The server answers from that workspace when it
66
+ is a worktree of the same repository or lies under the client's MCP roots.
67
+
68
+ If a result carries a `workspace_mismatch` diagnostic, the answer came from a
69
+ different workspace than the one you asked for; its `detail.reason` says why.
70
+ Use the CLI from your working directory instead: `npx --no-install kibi ...`
71
+ runs where you are and needs no `workspaceRoot`.
72
+
59
73
  ## Safe workflow
60
74
 
61
75
  1. Always discover before you mutate: start with `kb_search`, then exact-filter with `kb_query`. Use
@@ -23,6 +23,7 @@ per operation. Effects are authoritative for mutability and adapter annotations.
23
23
  | `kb_upsert` | `upsert` | --input JSON | write | yes | kb-write, workspace-write | peer; capability-selected | kibi.kb_upsert.v1 | yes | unsafe | no | yes |
24
24
  | `kb_delete` | `delete` | --input JSON | write | yes | kb-write, workspace-write | peer; capability-selected | kibi.kb_delete.v1 | yes | unsafe | no | yes |
25
25
  | `kb_check` | `check` | --input JSON or flags | read | yes | kb-read, workspace-read | peer; capability-selected | kibi.kb_check.v1 | no | safe | no | yes |
26
+ | `kb_prepare_impact_review` | `prepare-impact-review` | --input JSON | read | no | workspace-read, kb-read | peer; capability-selected | kibi.kb_prepare_impact_review.v1 | no | safe | no | yes |
26
27
  | `kb_sparql_remote` | `sparql-remote` | --input JSON | read | no | network-read | peer; capability-selected | kibi.kb_sparql_remote.v1 | no | safe | yes | yes |
27
28
  | `kb_compile_intent` | `compile-intent` | --input JSON | read | yes | kb-read, workspace-read | peer; capability-selected | kibi.kb_compile_intent.v1 | no | safe | no | yes |
28
29
  | `kb_apply_plan` | `apply-plan` | --input JSON | write | yes | kb-read, kb-write, workspace-read, workspace-write | peer; capability-selected | kibi.kb_apply_plan.v1 | yes | unsafe | no | yes |
@@ -40,3 +41,7 @@ printf '%s\n' '{"query":"authentication","limit":10}' | npx --no-install kibi se
40
41
  `_diagnostic_telemetry` is adapter metadata, not business input. Never copy it
41
42
  into entity properties. On `committed_with_repairs`, follow typed required
42
43
  `nextActions` and do not retry the original mutation.
44
+
45
+ `workspaceRoot` is an MCP-only routing argument naming the directory a call is
46
+ about (see the kibi-usage skill). The CLI JSON routes do not accept it; they
47
+ always run in the current directory.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kibi-runtime",
3
- "version": "2.0.2",
3
+ "version": "2.2.0",
4
4
  "description": "Narrow first-party runtime contracts and adapters for Kibi operations.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -13,13 +13,14 @@
13
13
  },
14
14
  "files": ["dist"],
15
15
  "scripts": {
16
- "build": "tsc -p tsconfig.json && bun build src/index.ts --outfile dist/index.js --target node --format esm --packages bundle --external kibi-core --external kibi-plugin-builtin && bun build ../cli/src/engine-daemon.ts --outfile dist/engine-daemon.js --target node --format esm --packages bundle --external kibi-core && rm -rf dist/skills && mkdir -p dist/skills && cp -r src/skills/. dist/skills/",
16
+ "build": "tsc -p tsconfig.json && bun build src/index.ts --outfile dist/index.js --target node --format esm --packages bundle --external kibi-core --external kibi-plugin-builtin --external kibi-swipl --external 'kibi-swipl-*' && bun build ../cli/src/engine-daemon.ts --outfile dist/engine-daemon.js --target node --format esm --packages bundle --external kibi-core --external kibi-swipl --external 'kibi-swipl-*' && rm -rf dist/skills && mkdir -p dist/skills && cp -r src/skills/. dist/skills/",
17
17
  "typecheck": "tsc -p tsconfig.json --noEmit"
18
18
  },
19
19
  "dependencies": {
20
20
  "gray-matter": "^4.0.3",
21
- "kibi-core": "^0.14.0",
22
- "kibi-plugin-builtin": "^0.3.0"
21
+ "kibi-core": "^0.14.1",
22
+ "kibi-plugin-builtin": "^0.4.0",
23
+ "kibi-swipl": "^1.0.0"
23
24
  },
24
25
  "devDependencies": {
25
26
  "kibi-cli": "workspace:*"