kibi-cursor 0.6.0 → 1.0.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 (97) hide show
  1. package/.cursor-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +181 -0
  3. package/README.md +28 -10
  4. package/agent-plugin/plugin.json +1 -1
  5. package/agent-plugin/skills/kibi-bootstrap/SKILL.md +58 -0
  6. package/agent-plugin/skills/kibi-bootstrap/resources/bootstrap.md +11 -0
  7. package/agent-plugin/skills/kibi-bootstrap/resources/branch-lifecycle.md +7 -0
  8. package/agent-plugin/skills/kibi-bootstrap/resources/operation-access.md +5 -0
  9. package/agent-plugin/skills/kibi-bootstrap/resources/source-authoring.md +8 -0
  10. package/agent-plugin/skills/kibi-freshness/SKILL.md +40 -10
  11. package/agent-plugin/skills/kibi-freshness/resources/branch-lifecycle.md +7 -0
  12. package/agent-plugin/skills/kibi-freshness/resources/operation-access.md +6 -0
  13. package/agent-plugin/skills/kibi-freshness/resources/source-authoring.md +7 -0
  14. package/agent-plugin/skills/kibi-traceability/SKILL.md +47 -47
  15. package/agent-plugin/skills/kibi-traceability/resources/branch-lifecycle.md +7 -0
  16. package/agent-plugin/skills/kibi-traceability/resources/operation-access.md +5 -0
  17. package/agent-plugin/skills/kibi-traceability/resources/source-authoring.md +6 -0
  18. package/agent-plugin/skills/kibi-traceability/resources/traceability.md +8 -0
  19. package/agent-plugin/skills/kibi-usage/SKILL.md +138 -237
  20. package/agent-plugin/skills/kibi-usage/resources/branch-lifecycle.md +31 -0
  21. package/agent-plugin/skills/kibi-usage/resources/kb-improvement.md +38 -0
  22. package/agent-plugin/skills/kibi-usage/resources/operation-access.md +36 -38
  23. package/agent-plugin/skills/kibi-usage/resources/proof.md +105 -0
  24. package/agent-plugin/skills/kibi-usage/resources/relationship-directions.md +3 -3
  25. package/agent-plugin/skills/kibi-usage/resources/source-authoring.md +31 -0
  26. package/agent-plugin/skills/kibi-usage/resources/workflows.md +57 -4
  27. package/bin/launch-kibi-mcp.d.mts +18 -0
  28. package/bin/launch-kibi-mcp.mjs +378 -0
  29. package/commands/kibi-bootstrap.md +19 -0
  30. package/dist/.cursor-plugin/plugin.json +1 -1
  31. package/dist/bin/launch-kibi-mcp.d.mts +18 -0
  32. package/dist/bin/launch-kibi-mcp.mjs +378 -0
  33. package/dist/commands/kibi-bootstrap.md +19 -0
  34. package/dist/hook-input.d.ts +2 -0
  35. package/dist/hook-input.js +10 -0
  36. package/dist/hook-runner.js +34 -12
  37. package/dist/hook-state-storage.js +3 -0
  38. package/dist/hook-state.d.ts +2 -0
  39. package/dist/hook-state.js +3 -0
  40. package/dist/mcp.json +2 -2
  41. package/dist/messages.js +6 -1
  42. package/dist/path-policy.js +43 -1
  43. package/dist/rules/kibi-workflow.mdc +16 -1
  44. package/dist/skills/.canon-hash.json +22 -7
  45. package/dist/skills/kibi-bootstrap/SKILL.md +58 -0
  46. package/dist/skills/kibi-bootstrap/resources/bootstrap.md +11 -0
  47. package/dist/skills/kibi-bootstrap/resources/branch-lifecycle.md +7 -0
  48. package/dist/skills/kibi-bootstrap/resources/operation-access.md +5 -0
  49. package/dist/skills/kibi-bootstrap/resources/source-authoring.md +8 -0
  50. package/dist/skills/kibi-freshness/SKILL.md +40 -10
  51. package/dist/skills/kibi-freshness/resources/branch-lifecycle.md +7 -0
  52. package/dist/skills/kibi-freshness/resources/operation-access.md +6 -0
  53. package/dist/skills/kibi-freshness/resources/source-authoring.md +7 -0
  54. package/dist/skills/kibi-traceability/SKILL.md +47 -47
  55. package/dist/skills/kibi-traceability/resources/branch-lifecycle.md +7 -0
  56. package/dist/skills/kibi-traceability/resources/operation-access.md +5 -0
  57. package/dist/skills/kibi-traceability/resources/source-authoring.md +6 -0
  58. package/dist/skills/kibi-traceability/resources/traceability.md +8 -0
  59. package/dist/skills/kibi-usage/SKILL.md +138 -237
  60. package/dist/skills/kibi-usage/resources/branch-lifecycle.md +31 -0
  61. package/dist/skills/kibi-usage/resources/kb-improvement.md +38 -0
  62. package/dist/skills/kibi-usage/resources/operation-access.md +36 -38
  63. package/dist/skills/kibi-usage/resources/proof.md +105 -0
  64. package/dist/skills/kibi-usage/resources/relationship-directions.md +3 -3
  65. package/dist/skills/kibi-usage/resources/source-authoring.md +31 -0
  66. package/dist/skills/kibi-usage/resources/workflows.md +57 -4
  67. package/mcp.json +2 -2
  68. package/package.json +4 -3
  69. package/rules/kibi-workflow.mdc +16 -1
  70. package/skills/.canon-hash.json +22 -7
  71. package/skills/kibi-bootstrap/SKILL.md +58 -0
  72. package/skills/kibi-bootstrap/resources/bootstrap.md +11 -0
  73. package/skills/kibi-bootstrap/resources/branch-lifecycle.md +7 -0
  74. package/skills/kibi-bootstrap/resources/operation-access.md +5 -0
  75. package/skills/kibi-bootstrap/resources/source-authoring.md +8 -0
  76. package/skills/kibi-freshness/SKILL.md +40 -10
  77. package/skills/kibi-freshness/resources/branch-lifecycle.md +7 -0
  78. package/skills/kibi-freshness/resources/operation-access.md +6 -0
  79. package/skills/kibi-freshness/resources/source-authoring.md +7 -0
  80. package/skills/kibi-traceability/SKILL.md +47 -47
  81. package/skills/kibi-traceability/resources/branch-lifecycle.md +7 -0
  82. package/skills/kibi-traceability/resources/operation-access.md +5 -0
  83. package/skills/kibi-traceability/resources/source-authoring.md +6 -0
  84. package/skills/kibi-traceability/resources/traceability.md +8 -0
  85. package/skills/kibi-usage/SKILL.md +138 -237
  86. package/skills/kibi-usage/resources/branch-lifecycle.md +31 -0
  87. package/skills/kibi-usage/resources/kb-improvement.md +38 -0
  88. package/skills/kibi-usage/resources/operation-access.md +36 -38
  89. package/skills/kibi-usage/resources/proof.md +105 -0
  90. package/skills/kibi-usage/resources/relationship-directions.md +3 -3
  91. package/skills/kibi-usage/resources/source-authoring.md +31 -0
  92. package/skills/kibi-usage/resources/workflows.md +57 -4
  93. package/agent-plugin/skills/init-kibi/SKILL.md +0 -62
  94. package/commands/init-kibi.md +0 -21
  95. package/dist/commands/init-kibi.md +0 -21
  96. package/dist/skills/init-kibi/SKILL.md +0 -62
  97. package/skills/init-kibi/SKILL.md +0 -62
@@ -0,0 +1,105 @@
1
+ # Proof and Verification Workflow
2
+
3
+ Use this resource when a requirement must be proven before handoff, when
4
+ wiring a proof-bearing test, or when `kb_ingest_proof` or `kibi prove`
5
+ rejected evidence.
6
+
7
+ Kibi does not support test runners. Kibi supports proof evidence. Any
8
+ producer (Playwright, pytest, JUnit, TAP, shell commands, database harnesses)
9
+ reports what happened as `kibi.proof-run.v1`; Kibi evaluates proof.
10
+
11
+ ## Golden path
12
+
13
+ 1. Query the test (`kb_query`, `type: test`) and read its
14
+ `kibi.proof-contract.v1`, `proof_bindings`, and `verification_scope`.
15
+ 2. Run the configured producer through the canonical command:
16
+
17
+ ```bash
18
+ kibi prove --test TEST-<id>
19
+ # or: kibi prove --requirement REQ-<id> | --integration <id> | --all
20
+ ```
21
+
22
+ `kibi prove` captures the workspace snapshot, runs each integration's
23
+ producer once (`shell: false`), revalidates the snapshot, evaluates the
24
+ artifact against every selected contract, and appends idempotent
25
+ `kibi.proof-receipt.v1` receipts.
26
+ 3. Confirm with `kb_status` (fresh, current snapshot) and `kb_coverage`.
27
+
28
+ Never hand-write receipts. Kibi derives them from validated
29
+ `kibi.proof-run.v1` artifacts only.
30
+
31
+ ## Proof contracts
32
+
33
+ A proof-bearing test declares explicit obligations (never a Cartesian
34
+ cases-times-projects matrix):
35
+
36
+ ```yaml
37
+ verification_scope: end_to_end
38
+ verification_perspective: consumer
39
+ proof_contract:
40
+ version: kibi.proof-contract.v1
41
+ integration: web-e2e # id from .kb/proof/integrations.json
42
+ required_proofs:
43
+ - symbol_id: SYM-PW-4F2A9C61B7D03E85
44
+ target: chromium # browser, runtime, db, device, or default
45
+ success_policy: all_required_first_attempt
46
+ proof_bindings: # optional provenance metadata
47
+ - symbol_id: SYM-PW-4F2A9C61B7D03E85
48
+ target: chromium
49
+ native_id: tests/checkout.spec.ts::accepts a card
50
+ ```
51
+
52
+ Provenance lives in `proof_bindings`; the contract stays semantic.
53
+
54
+ ## Integration configuration
55
+
56
+ `.kb/proof/integrations.json` (`kibi.proof-integration.v1`) is tracked,
57
+ Kibi-managed configuration describing evidence production only:
58
+
59
+ - `producer: command` — Kibi synthesizes the envelope from the process
60
+ outcome; obligations are bound with `aggregate_run` provenance and the
61
+ single process invocation counts as the known first attempt.
62
+ - `producer: playwright` (or custom) — the child emits `kibi.proof-run.v1`
63
+ itself (bundled reporter: `kibi-cli/playwright-reporter`).
64
+ - `producer: junit` / `tap` — Kibi converts the native report at `artifact`
65
+ using each test's `proof_bindings`; standard formats carry no retry
66
+ history, so attempts are reported as `unavailable` and fail the strict
67
+ first-attempt policy closed.
68
+
69
+ Cosmetic edits (descriptions, labels) never stale proof. Execution-relevant
70
+ edits (command, artifact, targets, options, bindings, contract) change the
71
+ effective fingerprint and do.
72
+
73
+ ## Attempt semantics (factual, never optimistic)
74
+
75
+ - `attempts: {status: "complete", entries: [...]}` — known history; the
76
+ strict policy requires a passing **first** entry.
77
+ - `attempts: {status: "unavailable"}` — unknown native history; the strict
78
+ policy fails closed, except `aggregate_run` results, which are satisfied by
79
+ the Kibi-launched process attempt when the run passed with exit code 0.
80
+ - `run.outcome` is authoritative: a failed, errored, cancelled, interrupted,
81
+ or `no_results` run proves nothing, even with passing individual results.
82
+
83
+ ## Common rejections
84
+
85
+ - `No proof integration configuration` — bootstrap has not configured proof
86
+ for this repository yet; do not hand-wave, run the bootstrap proof step.
87
+ - `captured snapshot is not the live workspace snapshot` — the tree changed
88
+ between capture and ingest; re-run `kibi prove`.
89
+ - `artifact command_argv does not match the configured command` — the
90
+ artifact came from a different command than `integrations.json` configures.
91
+ - `attempt history unavailable` — the producer could not prove first-attempt
92
+ success for a native-case obligation; use a producer with complete history
93
+ or accept aggregate provenance.
94
+ - `proof_receipts is append-only` — receipts are append-only; update tests
95
+ through the engine (which appends) or include the existing history when
96
+ authoring test files directly.
97
+
98
+ ## After code changes
99
+
100
+ Receipts bind to the snapshot, contract hash, and execution fingerprint at
101
+ run time. Any code or source change moves the snapshot and stales receipts:
102
+ re-run `kibi prove` for the affected selection, then confirm `kb_status` and
103
+ `kb_coverage` before handoff.
104
+
105
+ Full reference: `docs/proving-requirements.md`.
@@ -11,7 +11,7 @@
11
11
  | `executable_for` | symbol -> test | Test symbol (code) is executable code for a test entity |
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
- | `supersedes` | old-req -> new-req | Old requirement is formally replaced by a new requirement |
14
+ | `supersedes` | new-req -> old-req | New requirement formally replaces an old requirement |
15
15
  | `covered_by` | symbol -> test | Production symbol has test coverage evidence |
16
16
 
17
17
  ## Valid Payload Examples
@@ -76,8 +76,8 @@ relationships:
76
76
  ```yaml
77
77
  relationships:
78
78
  - type: supersedes
79
- from: REQ-001
80
- to: REQ-001-v2
79
+ from: REQ-001-v2
80
+ to: REQ-001
81
81
  ```
82
82
 
83
83
  ### covered_by
@@ -0,0 +1,31 @@
1
+ # Source-first authoring
2
+
3
+ Tracked Markdown, YAML, symbol manifests, and relationship shards are the
4
+ authoritative project memory. Prolog/RDF state is a rebuildable compiled
5
+ artifact. Kibi may transactionally write tracked files, but it never stages or
6
+ commits them; ordinary Git workflows remain responsible for review and merge.
7
+
8
+ `kb_upsert` accepts `document.path` and `document.body`. Existing entities use
9
+ their authored source by default and preserve body bytes when `body` is omitted.
10
+ New requirements use `semantic_text` as their body. If a new entity has zero or
11
+ multiple configured writable targets, provide an explicit workspace-relative
12
+ `document.path`; absolute, traversal, and symlink escapes are rejected.
13
+
14
+ New files are compiled only while their exact bytes are covered by a pending-
15
+ source receipt. Sync compiles Git-tracked files plus those hash-bound pending
16
+ files; arbitrary untracked files are ignored. Stage the file in Git to absorb
17
+ and remove its receipt. A changed or missing pending file is a blocking hash
18
+ drift diagnostic. Unresolved Git index conflicts are likewise blocking; Kibi
19
+ never chooses a merge winner.
20
+
21
+ Relationship upserts and relationship deletes patch only the canonical shard,
22
+ preserving unrelated records. Authored entity deletion returns a hash-bound
23
+ plan; approve that plan through `kb_apply_plan`. Evolve requirements with a new
24
+ requirement and `supersedes`, rather than deleting the old semantic claim.
25
+
26
+ On `committed_with_repairs`, inspect `effects` and execute the typed required
27
+ `nextActions`. Never retry the original mutation after its authoritative commit.
28
+ Cancellation follows the same rule: wait for the terminal journal state. A
29
+ pre-commit rollback is retryable, a committed source with a failed derivative
30
+ is repairable, and an indeterminate outcome is non-retryable until its recovery
31
+ action resolves the journal.
@@ -1,5 +1,38 @@
1
1
  # Workflows
2
2
 
3
+ ## Closeout contract
4
+
5
+ End every task with these five independent fields (not a single inferred
6
+ success flag):
7
+
8
+ ```text
9
+ taskOutcome: complete | interim | blocked
10
+ kbState: clean_fresh | stale | dirty | legacy_compat | not_evaluated
11
+ verificationState: fresh | dirty | unavailable | not_evaluated
12
+ proofState: proven | mixed | unresolved | not_evaluated
13
+ limitationDisposition: none | accepted | unaccepted | not_applicable
14
+ ```
15
+
16
+ `taskOutcome` describes whether the requested objective was completed. The
17
+ other fields describe observed system state. A clean check can coexist with a
18
+ stale or dirty KB; unresolved proof can coexist with a complete maintenance
19
+ task. An accepted limitation is an auditable operator decision, never logical
20
+ grounding, receipt editing, or proof. For every quality diagnostic, record its
21
+ ID, one of `fixed`, `accepted`, or `deferred`, and a rationale. Keep accepted
22
+ ontology gaps and historical telemetry limitations explicit.
23
+
24
+ Receipt reuse is safe only when the live verification snapshot, contract hash,
25
+ freshness window, and every required case result still match. Otherwise rerun
26
+ the contracted command. If the contract changed, retain every older receipt
27
+ unchanged, append evidence for the current contract, and keep proof unresolved
28
+ with `proof_contract_mismatch` until that current receipt exists.
29
+ Obsolete symbols require current extraction or Git evidence before
30
+ remap/deletion; transfer coverage only when existing test evidence supports it,
31
+ then sync and read back status. Same-version packages with different export
32
+ surfaces are a release defect: require a new package version and label any
33
+ project override temporary. This skill never selects a package manager or
34
+ edits dependency configuration.
35
+
3
36
  ## Discovery to Validation Sequence
4
37
 
5
38
  The canonical workflow for any KB operation follows this pattern:
@@ -13,7 +46,7 @@ The canonical workflow for any KB operation follows this pattern:
13
46
  7. **Create endpoints**: validated `kb_upsert` for new entities, sequentially
14
47
  8. **Link**: validated `kb_upsert` with `requires_rule`, `requires_predicate`, `constrains`, or `requires_property`, sequentially
15
48
  9. **Validate coverage and consistency**: targeted `rule-safety`, `rule-verifiability`, `semantic-completeness`, `logic-coverage`, `predicate-verifiability`, and `domain-contradictions`, then final full `kb_check`
16
- 10. **Prove execution**: read `kb_status.verificationSnapshot`, run each scenario-backed E2E command, append its `kibi.verification-receipt.v1`, and re-run `kb_coverage`; never promote durable test status into fresh evidence
49
+ 10. **Prove execution**: read `kb_status.proofSnapshot`, run `kibi prove` so each configured integration executes once and its `kibi.proof-run.v1` artifact is evaluated against every selected test's `kibi.proof-contract.v1` obligations, appending idempotent `kibi.proof-receipt.v1` receipts; then re-run `kb_coverage`. Never promote durable test status into fresh evidence.
17
50
  11. **Repair incrementally**: require `kb_coverage.repairPlan.scope.complete`, apply only one `ready` dependency batch per requirement, validate before every sequential write, and rerun coverage before selecting the next batch
18
51
  12. **Gate workflow evidence**: when `.kb/usage.log` exists, run `kibi usage-metrics --format json --require-acceptance`; repair ranked telemetry diagnostics and never treat stale or insufficient evidence as a pass
19
52
 
@@ -23,6 +56,26 @@ Every current requirement without `logic_claims` remains visible as non-blocking
23
56
 
24
57
  `kibi.telemetry-acceptance.v1` evaluates the latest 200 usage events and keeps process health separate from graph correctness. It requires at least 95% complete diagnostic telemetry and, when applicable, exact recent validation before every upsert and a same-requirement/current-hash advisor pass before requirement writes. It also evaluates source lookup misses, comparable complete-scope proof-gap recovery, receipt-specific coverage gaps, and mutation targets retried three or more times. Failed metrics become ranked `category: telemetry` quality diagnostics; missing current coverage fields or evidence older than seven days stays `insufficient_evidence`.
25
58
 
59
+ ## Agent-guided migration
60
+
61
+ `kb_status`, unfiltered `kb_check`, and complete-scope `kb_coverage` may return
62
+ the shared `kibi.migration-plan.v2`. Treat it as a typed action graph: inspect
63
+ the canonical `planHash`, scope completeness, dependencies, safety class,
64
+ preconditions, postconditions, and evidence. Apply only ready automatic actions
65
+ with `autoApplicable: true` through an explicitly approved `kb_apply_plan` or
66
+ `kibi migrate --apply-safe` request containing the exact hash and action IDs.
67
+ Never infer an operation from a prose suggestion, and never apply a partial
68
+ plan's destructive symbol or relationship action.
69
+
70
+ The migration engine may normalize schema/config metadata, cut over validated
71
+ legacy storage with backups, migrate the exact historical branch attachment,
72
+ refresh coordinates, and perform provenance-proven stale cleanup. It does not
73
+ choose package managers, ground semantic claims, resolve contradictions, rerun
74
+ E2E tests, rewrite receipt history, remap authored symbols, or accept
75
+ limitations. Those actions remain explicit review/operator/execution steps.
76
+
77
+ For `e2e_receipt_freshness_low`, query each listed requirement/test gap and run `kibi prove --requirement <id>` (or the covering integration); this appends proof receipts idempotently and preserves history. If `coverage_depth_review` conflicts with a coverage row whose `proofStages.passingE2e.status` is `passed`, report the diagnostic as a stale heuristic and keep any independent proof gaps unresolved.
78
+
26
79
  ## Creating a New Feature
27
80
  ```
28
81
  1. kb_search to discover existing requirements and related knowledge
@@ -48,12 +101,12 @@ Do not create a test-fact pair. Facts describe invariants; requirements or scena
48
101
  ## Fresh E2E Receipt Workflow
49
102
 
50
103
  1. Confirm the exact `REQ -> SCEN -> TEST` path and require typed `verification_scope: end_to_end`; direct requirement-to-test links do not satisfy the conservative scenario stage.
51
- 2. Read `kb_status` and retain its available `verificationSnapshot`. Stop if the runtime reports `unknown`; proof must fail closed when the code identity cannot be computed.
104
+ 2. Read `kb_status` and retain its available `proofSnapshot`. Stop if the runtime reports `unknown`; proof must fail closed when the code identity cannot be computed.
52
105
  3. Run the exact E2E command against that snapshot. Record runner, command, start/finish timestamps, outcome, an environment SHA-256, and an artifact/output SHA-256. Do not mint a passed receipt from an authored test status or from an unexecuted assertion.
53
- 4. Preserve every existing receipt byte-for-byte and append a unique `kibi.verification-receipt.v1` object with strictly later `finished_at`. Mutation and incremental sync reject history removal, rewriting, and reordering.
106
+ 4. Preserve every existing receipt byte-for-byte and append the derived `kibi.proof-receipt.v1` object with strictly later `finished_at`. Earlier receipts may bind older contracts or fingerprints; they remain audit history but cannot prove the current contract. Mutation and incremental sync reject history removal, rewriting, and reordering.
54
107
  5. Re-read `kb_status`; if the snapshot changed during the run, discard the candidate as proof and rerun against the new snapshot. Then run `kb_coverage` and inspect `proofStages.passingE2e.receiptEvidence` plus gap codes.
55
108
 
56
- Only the newest receipt for the live snapshot qualifies, and it must be passed, no more than seven days old, and no more than five minutes in the future. Wrong-snapshot history is retained but stale for current proof. `missing_verification_receipt`, `stale_verification_receipt`, `failed_verification_receipt`, `invalid_verification_receipt`, and `verification_snapshot_unavailable` are repair states, not warnings to waive.
109
+ Only the newest receipt matching the live snapshot, current contract hash, and current execution fingerprint qualifies, and it must be passed, no more than seven days old, and no more than five minutes in the future. Wrong-snapshot and older-contract history is retained but cannot prove the current test. `missing_proof_receipt`, `stale_proof_receipt`, `failed_proof_receipt`, `invalid_proof_receipt`, `proof_contract_mismatch`, and `proof_snapshot_unavailable` are repair states, not warnings to waive.
57
110
 
58
111
  ## Predicate-First Requirement Modeling
59
112
 
package/mcp.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "mcpServers": {
3
3
  "kibi": {
4
- "command": "npx",
5
- "args": ["--no-install", "kibi-mcp"]
4
+ "command": "node",
5
+ "args": ["bin/launch-kibi-mcp.mjs", "${workspaceFolder}"]
6
6
  }
7
7
  }
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kibi-cursor",
3
- "version": "0.6.0",
3
+ "version": "1.0.1",
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",
@@ -15,6 +15,7 @@
15
15
  "files": [
16
16
  ".cursor-plugin",
17
17
  "mcp.json",
18
+ "bin",
18
19
  "hooks",
19
20
  "skills",
20
21
  "rules",
@@ -41,8 +42,8 @@
41
42
  "prepack": "npm run build"
42
43
  },
43
44
  "peerDependencies": {
44
- "kibi-cli": ">=0.12.0 <1",
45
- "kibi-mcp": ">=0.12.0 <1"
45
+ "kibi-cli": ">=1.0.0",
46
+ "kibi-mcp": ">=1.0.0"
46
47
  },
47
48
  "peerDependenciesMeta": {
48
49
  "kibi-cli": {
@@ -3,7 +3,22 @@ description: Kibi capability-based discovery-first workflow and KB mutation disc
3
3
  alwaysApply: true
4
4
  ---
5
5
 
6
- Use Kibi via MCP tools when available, or via CLI JSON routes when MCP is unavailable. If MCP tools are visible, use MCP. If MCP availability is unknown and a trusted project-local CLI is available, use `kibi <route> --input <file|->`. If neither interface is available, stop and tell the operator. Do not infer MCP availability from config file existence. Do not read or edit `.kb/` files directly.
6
+ Use Kibi via MCP tools when available, or via CLI JSON routes when MCP is unavailable.
7
+
8
+ Interface selection:
9
+ 1. If any `kb_*` or `kibi_kb_*` tool is in the tool list, use MCP only. Do not use the CLI path.
10
+ 2. Else if Shell (or equivalent) is available and the project-local CLI is trusted, run the non-installing JSON recipe below. Missing MCP tools does not mean Kibi is unavailable.
11
+ 3. Else stop and tell the operator. Do not probe the CLI, do not install packages, and do not infer MCP availability from config file existence.
12
+ 4. Shell is in-policy only for the trusted project-local `npx --no-install kibi ...` (or `bunx --no-install kibi ...`) command when step 2 applies.
13
+ 5. Never use a global fallback, an installing runner, or an unapproved route. Do not read or edit `.kb/` files directly.
14
+
15
+ CLI JSON recipe (stdin is one UTF-8 JSON object):
16
+
17
+ ```bash
18
+ printf '%s\n' '{"query":"checkout","limit":10}' | npx --no-install kibi search --input -
19
+ ```
20
+
21
+ Map canonical MCP names to CLI routes by dropping the `kb_` prefix and replacing `_` with `-` (`kb_search` → `search`, `kb_find_gaps` → `find-gaps`, `kb_query` → `query`, `kb_status` → `status`, `kb_check` → `check`, `kb_upsert` → `upsert`).
7
22
 
8
23
  Discovery workflow:
9
24
  - Start with `kb_search` for broad discovery.
@@ -1,12 +1,27 @@
1
1
  {
2
- "init-kibi/SKILL.md": "4e936774cd31cf366e9e17452e9030fdaeabab345bce5ee163656e0fe5dc73d7",
3
- "kibi-freshness/SKILL.md": "68345a514233503f8f78d53e7d602d8a5fc566e1ec118388c7393716c9f7490d",
4
- "kibi-traceability/SKILL.md": "3aee5cb0d3d8e41d29cb6804ac9303083e8477fc9cb90f76248a7dc8e907a4b3",
5
- "kibi-usage/SKILL.md": "e31077634b0d53700eb4ff15c82e04239340b08cd327e6d99c831f89c3e10904",
2
+ "kibi-bootstrap/SKILL.md": "adf7ebe4985ee871e2f1d2d89fd90a20c596fa24460bfec4df525bdcebd3f1d6",
3
+ "kibi-bootstrap/resources/bootstrap.md": "e46d5dec74204d0652d4cba7061676c76c2f066bf6d98b073efa9fa44557be80",
4
+ "kibi-bootstrap/resources/branch-lifecycle.md": "c854264ce888439140883a3fc636db5e522f020dd27b30a5c1ecc4105b64ed13",
5
+ "kibi-bootstrap/resources/operation-access.md": "b5a6a59e72d800c376e7fad79132897623c32a0ce152a1e8d73f9628b444db51",
6
+ "kibi-bootstrap/resources/source-authoring.md": "bf296e62f69474e01797d6cb9469bf624551dca834dd188abb6e705bd96fa586",
7
+ "kibi-freshness/SKILL.md": "fa90d34663ddd6f03468008fb26e4417211f7b7d46ffde082291747743464c54",
8
+ "kibi-freshness/resources/branch-lifecycle.md": "ebc01b19fe3dca8df5fc0175978963f6f1204f71f7c805cb2a5fb1b277ac78e4",
9
+ "kibi-freshness/resources/operation-access.md": "4e1db9294ee540cd29b8b3a2532a81e7894d5b4228b39e99ba48b37212f489f3",
10
+ "kibi-freshness/resources/source-authoring.md": "41a0547ce4d2a112a0f3671d36720f07c447864db3b473e94eb88a8ce2d371ff",
11
+ "kibi-traceability/SKILL.md": "e3d559e149f11792a44fe9ae9d68f88933df9992df460abac33c8bfc468ddadb",
12
+ "kibi-traceability/resources/branch-lifecycle.md": "50f1a6355aa9185d412b2474db1a64e112944625d2465be0adbf93ada3273c1f",
13
+ "kibi-traceability/resources/operation-access.md": "39f7972ab7f4ae7479e78f7072bb50e8e6c4cdf4f857425f69d2522d37db437c",
14
+ "kibi-traceability/resources/source-authoring.md": "408c6ee2bef1b84e0194c0538ef929c26a0a617e631b2234247388140dbbdd08",
15
+ "kibi-traceability/resources/traceability.md": "38c290a0bc71bd1692e115f22694743946e2f69630e134acfd43cee5f613fb88",
16
+ "kibi-usage/SKILL.md": "ed42d8f6caf8048b81c05f670018c5f341e0667e3fa4aff2bf11277e9deb3c2f",
17
+ "kibi-usage/resources/branch-lifecycle.md": "f1bf359e9826e83c548f3cd0287f8175a62456527b0132b06b3f9f74aa59b7d6",
6
18
  "kibi-usage/resources/fact-lanes.md": "41b28023a57593009867ea0ebc8e9f3f05c3bd837144772d12844423f922e763",
19
+ "kibi-usage/resources/kb-improvement.md": "17e8b6cf6a0dd43b443a2bfd92e7205d099647a5f1c75fe85413a6cea63d86c6",
7
20
  "kibi-usage/resources/logic-ir.md": "151675d0ffa813cb9e271084102a3af42de369b8f9a0c64866af0cdc4d924063",
8
- "kibi-usage/resources/operation-access.md": "a5ec895aa9b2f30140b2b72baf444843d32dd99e92d6e10be4279d84f5ea799b",
9
- "kibi-usage/resources/relationship-directions.md": "aecbde048bb84e210318e4aca98e07f8370168c640c3a9d65696d2195c8598ec",
21
+ "kibi-usage/resources/operation-access.md": "e8b4a3676892d2f7e2cfd708ec4ad1f41b6f296e1eb3a5ecc047f43322b4a92a",
22
+ "kibi-usage/resources/proof.md": "e1a44ea4bf342afebb0aaa7800221067a511f6607c687ac38db6392b7e3d9f9a",
23
+ "kibi-usage/resources/relationship-directions.md": "a357072d3370db9b7d80e505795f952909a68778cc18b1d089970de91e4fda46",
24
+ "kibi-usage/resources/source-authoring.md": "ac4f1a9b5785462f8c3530bdcdb82ad9a0ee1f4049454ae28bf4df09ff267ebd",
10
25
  "kibi-usage/resources/ui-requirements.md": "b7c31ab1affa3ab25ae5242d8fd8c4d546532d1cafc65d84088375317c1682cc",
11
- "kibi-usage/resources/workflows.md": "06cf3da42b0cc96a3f38c0c37b28ee435fa93f45a93dc665fc5d756094ee1eab"
26
+ "kibi-usage/resources/workflows.md": "776b97a794325e7012a230d2b9fc32fc89b2a51df45dfd8498cad49170bdc43d"
12
27
  }
@@ -0,0 +1,58 @@
1
+ ---
2
+ id: kibi-bootstrap
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
6
+ kibiCompatibility: ">=1.0.0"
7
+ tags:
8
+ - kibi
9
+ - bootstrap
10
+ - source-first
11
+ - agent-guidance
12
+ resources:
13
+ - resources/bootstrap.md
14
+ - resources/branch-lifecycle.md
15
+ - resources/source-authoring.md
16
+ - resources/operation-access.md
17
+ ---
18
+ ## Goal
19
+
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.
25
+
26
+ ## Interface and preview
27
+
28
+ 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
31
+ 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.
35
+
36
+ For CLI JSON, use the trusted route with `--input` (for example
37
+ `printf '%s\n' '{}' | kibi status --input -`); MCP and CLI are semantic peers.
38
+ Read the branch-lifecycle and source-authoring resources before migration,
39
+ source writes, or repair actions.
40
+
41
+ ## Apply and verify
42
+
43
+ Apply the approved `kibi.bootstrap-plan.v1` by calling `kb_apply_plan` with the
44
+ exact plan and approved hash. The operation owns dependency ordering,
45
+ source-first writes, sequential mutation, and recovery journaling. Direct
46
+ `kb_upsert` is forbidden for every kibi-bootstrap task, including after
47
+ approval; never replay plan actions manually. Use `kb_delete` only for an
48
+ approved hash-bound deletion plan; evolve requirements with `supersedes`.
49
+ Finish with `kb_check` and `kb_status`.
50
+
51
+ Consume the versioned `kibiProtocol: 1` result envelope: inspect `status`, `effects`,
52
+ `diagnostics`, and `nextActions`. On `committed_with_repairs`, execute required
53
+ repair actions and never retry the original mutation.
54
+
55
+ Kibi may author tracked Markdown/YAML/manifests and relationship shards
56
+ transactionally, but never Git-stages or commits them. Never read or edit
57
+ `.kb` directly. Missing exact branch stores are compiled from this checkout's
58
+ tracked sources by `kibi sync`; Kibi does not copy another branch's store.
@@ -0,0 +1,11 @@
1
+ # Bootstrap resource
2
+
3
+ `kb_plan_bootstrap` is read-only and returns `kibi.bootstrap-plan.v1`. Review
4
+ candidate evidence, exact actions, dependencies, expected snapshots, source
5
+ hashes, bounded questions, diagnostics, and the canonical `planHash` before
6
+ approving. A preview does not authorize source edits. After approval, pass the
7
+ unchanged returned `structuredContent.plan` to `kb_apply_plan` once with its
8
+ approved hash; inspect its typed result
9
+ and follow `nextActions` if it returns `committed_with_repairs`. Direct
10
+ `kb_upsert` is forbidden for every bootstrap task; never manually replay the
11
+ plan through it.
@@ -0,0 +1,7 @@
1
+ # Branch lifecycle
2
+
3
+ Use the exact `KIBI_BRANCH` value or Git symbolic HEAD. Hashed stores carry a
4
+ matching `branch.json`; missing stores are compiled from tracked sources by
5
+ `kibi sync`. Legacy literal stores require explicit migration. Kibi never
6
+ copies stores between branches or resolves Git conflicts. Read the preview,
7
+ approval hash, quarantine, restore, and purge details before lifecycle work.
@@ -0,0 +1,5 @@
1
+ # Operation access
2
+
3
+ MCP tools and the trusted project-local CLI are peer surfaces for the same
4
+ operation contracts. Use the dedicated JSON route; parse the shared
5
+ `KibiResult` envelope and follow required `nextActions` after partial commits.
@@ -0,0 +1,8 @@
1
+ # Source authoring
2
+
3
+ Tracked documents, manifests, and relationship shards are authoritative.
4
+ Kibi may write them transactionally but does not stage or commit them. Use
5
+ `document.path` for ambiguous new targets, preserve existing bodies when the
6
+ body is omitted, and use hash-bound deletion plans. On
7
+ `committed_with_repairs`, follow typed `nextActions` and never retry the
8
+ original mutation.
@@ -1,14 +1,18 @@
1
1
  ---
2
2
  id: kibi-freshness
3
3
  name: kibi-freshness
4
- description: Check branch freshness and source linkage quality before decisions or risky writes.
5
- version: 1.0.0
6
- kibiCompatibility: "*"
4
+ description: Check exact Git attachment, branch migration/quarantine, compiled-store freshness, source linkage, and repair state before decisions or writes.
5
+ version: 2.0.0
6
+ kibiCompatibility: ">=1.0.0"
7
7
  tags:
8
8
  - kibi
9
9
  - mcp
10
10
  - freshness
11
11
  - agent-guidance
12
+ resources:
13
+ - resources/branch-lifecycle.md
14
+ - resources/source-authoring.md
15
+ - resources/operation-access.md
12
16
  ---
13
17
  ## Goal
14
18
 
@@ -16,10 +20,10 @@ Help agents decide whether Kibi knowledge is current enough to support safe chan
16
20
 
17
21
  ## Interface Selection
18
22
 
19
- 1. If Kibi MCP tools are visible and approved for the workspace, use the MCP surface only.
20
- 2. Otherwise, in a trusted workspace, use the canonical project-local CLI fallback through `npx --no-install kibi ...` or `bunx --no-install kibi ...`.
21
- 3. If the project-local CLI is unavailable or too old, stop and tell the operator to enable or install Kibi.
22
- 4. Never use a global fallback or an installing runner.
23
+ 1. Use whichever approved peer is visible: MCP or the trusted project-local CLI.
24
+ 2. They have the same operation semantics and machine envelope; neither is preferred.
25
+ 3. If neither surface is available, stop and tell the operator which capability must be enabled.
26
+ 4. Never install packages, choose a package manager, or use a global fallback as part of freshness inspection.
23
27
 
24
28
  Use `kibi-usage/resources/operation-access.md` for exact dedicated routes. A project-local CLI freshness check is executable as:
25
29
 
@@ -30,15 +34,41 @@ echo '{}' | npx --no-install kibi status --input -
30
34
  ## Capability Workflow
31
35
 
32
36
  - Use `kb_status`, or `status --input`, first to confirm branch attachment, freshness state, dirty-worktree evidence, and whether the knowledge snapshot is safe to rely on.
37
+ - Treat `branchAttachment.gitBranch`, `branchAttachment.kbBranch`, and
38
+ `branchAttachment.storePath` as exact identities. Hashed stores require a
39
+ matching `branch.json`; a `legacy_compat` attachment is read-only until an
40
+ explicit old/new migration is approved.
41
+ - Inspect bounded `staleReasons` (indexed source missing/newer or documentation
42
+ source newer) and `proofSnapshotChanges`. Kibi deliberately reports
43
+ editor/config paths such as editor dot-directories; do not silently ignore them.
33
44
  - Use `kb_query`, or `query --input`, with `sourceFile` and text references for source-linked discovery.
34
45
  - Re-run `kb_search`, or `search --input`, after sync gaps or stale context are detected.
35
46
  - If knowledge must change, use the selected interface's `kb_upsert`/`upsert` or `kb_delete`/`delete` operation sequentially, then finish with `kb_check`/`check`.
47
+ - If status returns `migrationPlan.version: kibi.migration-plan.v2`, inspect its
48
+ hash, scope, dependencies, and safety classes. Apply only ready automatic
49
+ actions with explicit hash/action approval through `kb_apply_plan` or
50
+ `kibi migrate --apply-safe`; escalate operator actions and never infer a
51
+ migration from prose suggestions.
52
+ - Parse the outer `kibiProtocol`/`resultVersion` envelope. If a mutation returns
53
+ `committed_with_repairs`, follow required typed `nextActions`; never retry the
54
+ original operation.
36
55
 
37
56
  ## Guidance
38
57
 
39
- - Prefer the public Kibi MCP surface whenever it is available and approved.
40
- - Never proceed with broad changes when freshness is stale and unresolved.
58
+ - Treat MCP and the trusted project-local CLI as equal peer surfaces.
59
+ - Report task outcome separately from KB, verification, proof, and limitation
60
+ state. A maintenance task can be complete with stale KB state or unresolved
61
+ proof only when its scoped objective is complete and the status is named
62
+ accurately; never call the KB clean/fresh in that case.
63
+ - A legacy attachment blocks mutation, and a dirty verification snapshot blocks
64
+ evidence-dependent closeout. Name the exact paths/symbol IDs and whether the
65
+ result is fixed, accepted, or deferred.
41
66
  - If entities look stale, refresh context through an approved Kibi capability and then re-query.
42
67
  - Preserve source-file traceability by carrying `sourceFile`, text references, and validation evidence through discovery, mutation, and completion.
43
68
  - Do not read or edit files inside `.kb` directly; use the selected Kibi interface instead.
44
- - Completion must state one freshness outcome: KB updated, no KB impact with rationale, or deferred/failed.
69
+ - Kibi authors tracked files but never Git-stages or commits them; ordinary Git workflows remain responsible for review and commit.
70
+ - Completion must state one freshness outcome: KB updated, no KB impact with rationale, or deferred/failed.
71
+
72
+ For exact branch lifecycle, quarantine, restore, and source-first writes, read
73
+ the shared `kibi-usage/resources/branch-lifecycle.md` and
74
+ `source-authoring.md` resources.
@@ -0,0 +1,7 @@
1
+ # Branch lifecycle
2
+
3
+ Use the exact `KIBI_BRANCH` value or Git symbolic HEAD. Hashed stores carry a
4
+ matching `branch.json`; missing stores are rebuilt from tracked sources by
5
+ `kibi sync`. Legacy literal stores require explicit migration. Kibi never copies
6
+ stores between branches or resolves Git conflicts.
7
+
@@ -0,0 +1,6 @@
1
+ # Operation access
2
+
3
+ Use visible approved MCP or the trusted project-local CLI. `kb_status`/`status`
4
+ is read-only and returns the shared versioned result envelope with exact branch,
5
+ store, freshness, effects, diagnostics, and typed next actions.
6
+
@@ -0,0 +1,7 @@
1
+ # Source authoring
2
+
3
+ Tracked documents and relationship shards are authoritative. Kibi may write
4
+ them transactionally but does not stage or commit them. Inspect `effects` and
5
+ typed `nextActions`; after `committed_with_repairs`, repair without retrying the
6
+ original mutation.
7
+