kibi-cursor 2.1.1 → 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,7 +1,7 @@
1
1
  {
2
2
  "name": "kibi-cursor",
3
3
  "displayName": "Kibi",
4
- "version": "2.1.1",
4
+ "version": "2.2.0",
5
5
  "description": "Optional Cursor adapter for Kibi. Requires project-local kibi-cli, kibi-mcp, and kibi-core (SWI-Prolog is bundled on Linux and macOS) before the bundled MCP server can start.",
6
6
  "license": "AGPL-3.0-or-later",
7
7
  "author": {
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # kibi-cursor
2
2
 
3
+ ## 2.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f93dcdd: Bootstrap no longer learns only from the code. The agent now starts with a short interview: it asks where product intent already lives (issue trackers such as Jira or YouTrack, wikis, specs, decision logs), which sources are authoritative or stale, and reads them through its own connectors. The bootstrap plan records those sources and the intent claims harvested from them, so each requirement taken from a ticket or page cites it and the citation is part of the approved plan hash. Kibi still never contacts those sources itself.
8
+ - feat(cli): `kb_plan_bootstrap` / `plan-bootstrap` accept `bootstrapContext.knowledgeSources` (id, kind, title, locator, authority, optional connector) and `bootstrapContext.intentClaims` (statement, sourceId, reference, optional excerpt). Both are normalized into `declaredContext` and bound into `planHash`. Grounded claims from authoritative or supporting sources become `req` candidates with `sourceKind: intent_claim`, citation evidence, and `text_ref: <sourceId>:<reference>`. Ungroundable claims become authoring follow-ups, stale sources are suppressed with `stale_knowledge_source`, and claims citing undeclared sources are reported as non-blocking diagnostics. A `needs_context` plan without declared sources asks for them.
9
+ - feat(skills): `kibi-bootstrap` 3.1.0 leads with the source interview before planning; the MCP `/kibi-bootstrap` prompt and the Cursor and ZCode commands follow it.
10
+ - docs: README, landing page, quick start, and install guide lead with a copy-paste agent setup prompt; manual installation moves behind a toggle.
11
+
12
+ ### Patch Changes
13
+
14
+ - 676bac9: The Claude Code, Codex, Cursor, and ZCode plugins now tell the Kibi MCP server which workspace each call is about, so sessions working in a git worktree are answered from that worktree's branch instead of the checkout the server started in. Nothing changes for sessions that stay in one project.
15
+ - Each plugin's pre-tool hook adds `workspaceRoot`, the agent's current Kibi workspace, to every Kibi MCP call. Claude Code, Cursor, and ZCode send it without a permission decision so the host's own approval flow is unchanged; Codex requires `permissionDecision: "allow"` for input rewrites, which does not override a server's tool approval mode.
16
+ - `kibi-agent-core` exports `KIBI_WORKSPACE_ARGUMENT`, `isKibiMcpToolName`, and `stampKibiWorkspace` for the plugins.
17
+ - The Codex hook parser now reads `hook_event_name`, the field Codex actually sends; the Claude and ZCode `PreToolUse` matchers include `mcp__.*__kb_.*`.
18
+ - The ZCode launcher sets `KIBI_MCP_HOST=zcode` so its usage rows are attributed like the other hosts'.
19
+
20
+ - Updated dependencies [676bac9]
21
+ - kibi-agent-core@0.1.1
22
+
3
23
  ## 2.1.1
4
24
 
5
25
  ### Patch Changes
package/README.md CHANGED
@@ -57,7 +57,10 @@ cp -r "$(npm root)/kibi-cursor" ~/.cursor/plugins/local/kibi-cursor
57
57
  The plugin bundles `mcp.json` with a thin launcher that locates and starts the
58
58
  `kibi-mcp` package installed in the opened project. The launcher starts the
59
59
  resolved child from the consumer workspace and sets `KIBI_WORKSPACE` to that
60
- root; it never downloads, bundles, or falls back to a global Kibi runtime:
60
+ root; it never downloads, bundles, or falls back to a global Kibi runtime.
61
+ The `preToolUse` hook adds `workspaceRoot` (the agent's current workspace) to
62
+ every Kibi MCP call, so an agent working in a git worktree is answered from
63
+ that worktree's branch. Setting `KIBI_WORKSPACE` pins one workspace instead:
61
64
 
62
65
  ```json
63
66
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
3
  "name": "kibi",
4
- "version": "2.1.1",
4
+ "version": "2.2.0",
5
5
  "description": "Repo-local, per-branch, queryable knowledge base. Portable Agent Plugin packaging Kibi's Agent Skills and MCP server.",
6
6
  "author": { "name": "Kibi" },
7
7
  "homepage": "https://github.com/Looted/kibi/blob/develop/docs/install.md",
@@ -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
@@ -41,3 +41,7 @@ printf '%s\n' '{"query":"authentication","limit":10}' | npx --no-install kibi se
41
41
  `_diagnostic_telemetry` is adapter metadata, not business input. Never copy it
42
42
  into entity properties. On `committed_with_repairs`, follow typed required
43
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.
@@ -14,6 +14,9 @@ infrastructure is missing, run `kibi init` first. Then use the canonical
14
14
  planner and pass its unchanged returned `structuredContent.plan` to
15
15
  `kb_apply_plan` only after explicit approval.
16
16
 
17
- Questions come only from a `needs_context` planner result. Inspect typed apply
17
+ Start with the skill's source interview: ask which issue trackers, wikis, and
18
+ specs hold product intent and how authoritative each is, then pass the
19
+ declared sources and cited intent claims to the planner. After that, further
20
+ questions come only from a `needs_context` planner result. Inspect typed apply
18
21
  `nextActions`, finish with `kb_check` and `kb_status`, and never read or edit
19
22
  `.kb` directly.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kibi-cursor",
3
3
  "displayName": "Kibi",
4
- "version": "2.1.1",
4
+ "version": "2.2.0",
5
5
  "description": "Optional Cursor adapter for Kibi. Requires project-local kibi-cli, kibi-mcp, and kibi-core (SWI-Prolog is bundled on Linux and macOS) before the bundled MCP server can start.",
6
6
  "license": "AGPL-3.0-or-later",
7
7
  "author": {
@@ -14,6 +14,9 @@ infrastructure is missing, run `kibi init` first. Then use the canonical
14
14
  planner and pass its unchanged returned `structuredContent.plan` to
15
15
  `kb_apply_plan` only after explicit approval.
16
16
 
17
- Questions come only from a `needs_context` planner result. Inspect typed apply
17
+ Start with the skill's source interview: ask which issue trackers, wikis, and
18
+ specs hold product intent and how authoritative each is, then pass the
19
+ declared sources and cited intent claims to the planner. After that, further
20
+ questions come only from a `needs_context` planner result. Inspect typed apply
18
21
  `nextActions`, finish with `kb_check` and `kb_status`, and never read or edit
19
22
  `.kb` directly.
@@ -5,11 +5,21 @@ export type CursorHookResult = {
5
5
  user_message?: string;
6
6
  agent_message?: string;
7
7
  followup_message?: string;
8
+ /**
9
+ * preToolUse only: replacement tool input. Used without `permission`, so
10
+ * Cursor's own approval flow is unchanged.
11
+ */
12
+ updated_input?: Record<string, unknown>;
8
13
  };
9
14
  export type HookEnvironment = {
10
15
  pluginData?: string;
11
16
  workspaceTrusted?: boolean;
12
17
  };
18
+ /**
19
+ * The Kibi workspace that owns `directory`: the nearest ancestor with
20
+ * `.kb/manifest.json`, without crossing a `.git` boundary.
21
+ */
22
+ export declare function kibiWorkspaceFor(directory: string | undefined): string | undefined;
13
23
  export declare function runHook(rawInput: unknown, environment?: HookEnvironment): Promise<CursorHookResult>;
14
24
  export declare function main(): Promise<void>;
15
25
  export declare function isInvokedAsCli(argv1: string | undefined, moduleUrl: string): boolean;
@@ -3,6 +3,7 @@
3
3
  import fs from "node:fs";
4
4
  import path from "node:path";
5
5
  import { fileURLToPath, pathToFileURL } from "node:url";
6
+ import { stampKibiWorkspace } from "kibi-agent-core/kb-mcp-tools";
6
7
  import { preEditGuidance, readGuidance, writeGuidance } from "./guidance.js";
7
8
  import { parseHookInput, parseStdinJson, readStdin } from "./hook-input.js";
8
9
  import { addDirtyPaths, clearSessionHookState, hasGuidedPath, loadHookState, recordKbMcpTool, recordPlanDelivered, rememberGuidedPath, resolveStateDir, } from "./hook-state.js";
@@ -29,6 +30,26 @@ function hasKibiConfig(cwd) {
29
30
  }
30
31
  return fs.existsSync(path.join(cwd, ".kb", "manifest.json"));
31
32
  }
33
+ /**
34
+ * The Kibi workspace that owns `directory`: the nearest ancestor with
35
+ * `.kb/manifest.json`, without crossing a `.git` boundary.
36
+ */
37
+ export function kibiWorkspaceFor(directory) {
38
+ if (!directory)
39
+ return undefined;
40
+ let current = path.resolve(directory);
41
+ for (;;) {
42
+ if (fs.existsSync(path.join(current, ".kb", "manifest.json"))) {
43
+ return current;
44
+ }
45
+ if (fs.existsSync(path.join(current, ".git")))
46
+ return undefined;
47
+ const parent = path.dirname(current);
48
+ if (parent === current)
49
+ return undefined;
50
+ current = parent;
51
+ }
52
+ }
32
53
  function isEditLikeTool(toolName) {
33
54
  return toolName === undefined || editableTools.has(toolName);
34
55
  }
@@ -79,6 +100,14 @@ export async function runHook(rawInput, environment = {}) {
79
100
  return advisory ? { additional_context: advisory } : emptyResult();
80
101
  }
81
102
  case "preToolUse": {
103
+ // Name the agent's workspace on every Kibi MCP call so the launcher
104
+ // answers from it, also for agents working in a git worktree. The
105
+ // per-call cwd wins over workspace_roots, which can be the window's
106
+ // folders rather than the agent's checkout.
107
+ const stamped = stampKibiWorkspace(input.toolName, input.toolInput, kibiWorkspaceFor(input.cwd ?? input.workspaceRoots?.[0]));
108
+ if (stamped) {
109
+ return { updated_input: stamped };
110
+ }
82
111
  const explicitPaths = extractExplicitPathFields(input.toolInput);
83
112
  const hasDirectKbEdit = isEditLikeTool(input.toolName) && explicitPaths.some(isDirectKbPath);
84
113
  if (hasDirectKbEdit) {
@@ -1,6 +1,6 @@
1
1
  {
2
- "kibi-bootstrap/SKILL.md": "adf7ebe4985ee871e2f1d2d89fd90a20c596fa24460bfec4df525bdcebd3f1d6",
3
- "kibi-bootstrap/resources/bootstrap.md": "e46d5dec74204d0652d4cba7061676c76c2f066bf6d98b073efa9fa44557be80",
2
+ "kibi-bootstrap/SKILL.md": "5bb63f0e5ee5ba7e60ef3dc7758ad84ee39e83ffeb46b9f038221bc48a656676",
3
+ "kibi-bootstrap/resources/bootstrap.md": "14531116e8a0efc69b7ccb105afebeeaa2185e720bad2d5bebadc6635598a041",
4
4
  "kibi-bootstrap/resources/branch-lifecycle.md": "c854264ce888439140883a3fc636db5e522f020dd27b30a5c1ecc4105b64ed13",
5
5
  "kibi-bootstrap/resources/operation-access.md": "b5a6a59e72d800c376e7fad79132897623c32a0ce152a1e8d73f9628b444db51",
6
6
  "kibi-bootstrap/resources/source-authoring.md": "bf296e62f69474e01797d6cb9469bf624551dca834dd188abb6e705bd96fa586",
@@ -13,12 +13,12 @@
13
13
  "kibi-traceability/resources/operation-access.md": "39f7972ab7f4ae7479e78f7072bb50e8e6c4cdf4f857425f69d2522d37db437c",
14
14
  "kibi-traceability/resources/source-authoring.md": "408c6ee2bef1b84e0194c0538ef929c26a0a617e631b2234247388140dbbdd08",
15
15
  "kibi-traceability/resources/traceability.md": "38c290a0bc71bd1692e115f22694743946e2f69630e134acfd43cee5f613fb88",
16
- "kibi-usage/SKILL.md": "83567f8ead944457719e0254ad6bc1dbedda3a70d04266d2ff041a670336dcc6",
16
+ "kibi-usage/SKILL.md": "94982ae809de80467e5f2417ca64235dae0f81166407cdb8d0f66f322bd9efc8",
17
17
  "kibi-usage/resources/branch-lifecycle.md": "f1bf359e9826e83c548f3cd0287f8175a62456527b0132b06b3f9f74aa59b7d6",
18
18
  "kibi-usage/resources/fact-lanes.md": "7ac928cc6b3d189eee6a9cda282918677d5a222cd7ba9b7f324e6553cd3adce8",
19
19
  "kibi-usage/resources/kb-improvement.md": "17e8b6cf6a0dd43b443a2bfd92e7205d099647a5f1c75fe85413a6cea63d86c6",
20
20
  "kibi-usage/resources/logic-ir.md": "151675d0ffa813cb9e271084102a3af42de369b8f9a0c64866af0cdc4d924063",
21
- "kibi-usage/resources/operation-access.md": "e2b8c101c6d8b8204aa2907f48091ed97ff1037c287043586a1aa180b1d80209",
21
+ "kibi-usage/resources/operation-access.md": "df8e84258f4e4855c08a9d24f7704fd540f0ea4295f5f255a4a9500a450ccf80",
22
22
  "kibi-usage/resources/proof.md": "7391046fbdeece4858b668360c60755f184af6dfedda9dbc67e2fa4574dbce7f",
23
23
  "kibi-usage/resources/relationship-directions.md": "0fdd67032c2d15299f772845fc4f807eb9435b09507bd87a5911ab33db2f143d",
24
24
  "kibi-usage/resources/source-authoring.md": "80978cea0614484292c7a70d511a3f50458f48ef976bf0675b8bb96abe9d3d36",
@@ -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
@@ -41,3 +41,7 @@ printf '%s\n' '{"query":"authentication","limit":10}' | npx --no-install kibi se
41
41
  `_diagnostic_telemetry` is adapter metadata, not business input. Never copy it
42
42
  into entity properties. On `committed_with_repairs`, follow typed required
43
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-cursor",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "description": "Kibi Cursor plugin - thin adapter for Cursor MCP integration and editor hooks",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -54,7 +54,7 @@
54
54
  }
55
55
  },
56
56
  "dependencies": {
57
- "kibi-agent-core": "^0.1.0"
57
+ "kibi-agent-core": "^0.1.1"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/node": "latest",
@@ -1,6 +1,6 @@
1
1
  {
2
- "kibi-bootstrap/SKILL.md": "adf7ebe4985ee871e2f1d2d89fd90a20c596fa24460bfec4df525bdcebd3f1d6",
3
- "kibi-bootstrap/resources/bootstrap.md": "e46d5dec74204d0652d4cba7061676c76c2f066bf6d98b073efa9fa44557be80",
2
+ "kibi-bootstrap/SKILL.md": "5bb63f0e5ee5ba7e60ef3dc7758ad84ee39e83ffeb46b9f038221bc48a656676",
3
+ "kibi-bootstrap/resources/bootstrap.md": "14531116e8a0efc69b7ccb105afebeeaa2185e720bad2d5bebadc6635598a041",
4
4
  "kibi-bootstrap/resources/branch-lifecycle.md": "c854264ce888439140883a3fc636db5e522f020dd27b30a5c1ecc4105b64ed13",
5
5
  "kibi-bootstrap/resources/operation-access.md": "b5a6a59e72d800c376e7fad79132897623c32a0ce152a1e8d73f9628b444db51",
6
6
  "kibi-bootstrap/resources/source-authoring.md": "bf296e62f69474e01797d6cb9469bf624551dca834dd188abb6e705bd96fa586",
@@ -13,12 +13,12 @@
13
13
  "kibi-traceability/resources/operation-access.md": "39f7972ab7f4ae7479e78f7072bb50e8e6c4cdf4f857425f69d2522d37db437c",
14
14
  "kibi-traceability/resources/source-authoring.md": "408c6ee2bef1b84e0194c0538ef929c26a0a617e631b2234247388140dbbdd08",
15
15
  "kibi-traceability/resources/traceability.md": "38c290a0bc71bd1692e115f22694743946e2f69630e134acfd43cee5f613fb88",
16
- "kibi-usage/SKILL.md": "83567f8ead944457719e0254ad6bc1dbedda3a70d04266d2ff041a670336dcc6",
16
+ "kibi-usage/SKILL.md": "94982ae809de80467e5f2417ca64235dae0f81166407cdb8d0f66f322bd9efc8",
17
17
  "kibi-usage/resources/branch-lifecycle.md": "f1bf359e9826e83c548f3cd0287f8175a62456527b0132b06b3f9f74aa59b7d6",
18
18
  "kibi-usage/resources/fact-lanes.md": "7ac928cc6b3d189eee6a9cda282918677d5a222cd7ba9b7f324e6553cd3adce8",
19
19
  "kibi-usage/resources/kb-improvement.md": "17e8b6cf6a0dd43b443a2bfd92e7205d099647a5f1c75fe85413a6cea63d86c6",
20
20
  "kibi-usage/resources/logic-ir.md": "151675d0ffa813cb9e271084102a3af42de369b8f9a0c64866af0cdc4d924063",
21
- "kibi-usage/resources/operation-access.md": "e2b8c101c6d8b8204aa2907f48091ed97ff1037c287043586a1aa180b1d80209",
21
+ "kibi-usage/resources/operation-access.md": "df8e84258f4e4855c08a9d24f7704fd540f0ea4295f5f255a4a9500a450ccf80",
22
22
  "kibi-usage/resources/proof.md": "7391046fbdeece4858b668360c60755f184af6dfedda9dbc67e2fa4574dbce7f",
23
23
  "kibi-usage/resources/relationship-directions.md": "0fdd67032c2d15299f772845fc4f807eb9435b09507bd87a5911ab33db2f143d",
24
24
  "kibi-usage/resources/source-authoring.md": "80978cea0614484292c7a70d511a3f50458f48ef976bf0675b8bb96abe9d3d36",
@@ -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
@@ -41,3 +41,7 @@ printf '%s\n' '{"query":"authentication","limit":10}' | npx --no-install kibi se
41
41
  `_diagnostic_telemetry` is adapter metadata, not business input. Never copy it
42
42
  into entity properties. On `committed_with_repairs`, follow typed required
43
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.