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,31 @@
1
+ # Branch lifecycle
2
+
3
+ Kibi attaches to the exact Git ref: `KIBI_BRANCH` when set, otherwise Git's
4
+ symbolic HEAD. Names are not normalized, and `main`, `master`, detached HEAD,
5
+ slash names, `@`, and Unicode refs remain distinct identities.
6
+
7
+ Compiled state lives under `.kb/branches/<sha256-hash>/branch.json`. The
8
+ manifest records the exact ref and hash; a mismatch is a hard attachment
9
+ failure. A missing store is compiled by `kibi sync` from the current checkout's
10
+ tracked sources. `branch ensure` may create only the empty identity fence; use
11
+ `kibi sync` before relying on compiled state. Kibi never copies another
12
+ branch's store and never chooses merge winners. Git owns merges; unresolved
13
+ conflicts in authored files block compilation.
14
+
15
+ Legacy literal-path stores are read-only compatibility attachments. Preview an
16
+ explicit migration with both identities, then apply it only with the exact
17
+ preview hash (`kibi branch migrate --from <old> --to <new> --apply
18
+ --approval-hash <preview-hash>`) while attached to the exact new ref. The
19
+ approval is mandatory and binds the source bytes and identities; do not infer a
20
+ rename from commits. For a legacy literal store on the current branch, `<old>`
21
+ and `<new>` must be the same exact identity. Every cross-identity pair is
22
+ refused, including `main` to `master`; migration changes only the storage
23
+ format from literal to hashed for the active exact branch. Deleted local branches may be quarantined for the
24
+ configured retention period; `branch restore --branch <exact-ref> --apply` is
25
+ reversible during retention and purge is explicit. Remote-only refs do not keep
26
+ a local compiled store alive.
27
+
28
+ If migration is interrupted, use the journal's exact recovery action:
29
+ `kibi branch migrate --recover-journal <id>` previews the deterministic
30
+ roll-forward or verified-backup restore, and `--apply` performs it. Do not
31
+ resolve the live branch attachment while the migration journal is ambiguous.
@@ -0,0 +1,38 @@
1
+ # Existing Product KB Improvement
2
+
3
+ Use this resource when an existing product KB already has REQ → SCEN → TEST →
4
+ symbol traceability and the task is to add typed facts so normative claims are
5
+ queryable and contradiction-checkable.
6
+
7
+ Keep the original requirement prose readable. Facts add semantics; they do not
8
+ replace the requirement body. Lane choice, field names, and predicate routing
9
+ are in `resources/fact-lanes.md` and the Predicate-First workflow in
10
+ `resources/workflows.md`.
11
+
12
+ ## Claim routing
13
+
14
+ | Claim type | Model as | Relationship |
15
+ | --- | --- | --- |
16
+ | Measurable normative property | `subject` + `property_value` | `constrains` + `requires_property` |
17
+ | Domain invariant or behavior relation | `predicate` | `requires_predicate` |
18
+ | Bug, workaround, or observed evidence | `observation` | usually `relates_to` |
19
+ | Process or governance note | `meta` | usually `relates_to` |
20
+ | Runtime or config gate | `flag` | `guards` |
21
+
22
+ Call `kb_semantic_advisor` on the complete requirement body before encoding a
23
+ clause. Apply a predicate only when a returned schema fits; otherwise leave an
24
+ ontology-gap observation.
25
+
26
+ ## Source and RDF reconciliation
27
+
28
+ After each approved write:
29
+
30
+ 1. Query the exact fact IDs.
31
+ 2. Confirm `fact_kind`, `predicate_name` or `property_key`, and `canonical_key`
32
+ appear through Kibi tools, not only in authored Markdown.
33
+ 3. Graph from the requirement with `requires_predicate` and `requires_property`.
34
+ 4. If Markdown has predicate or property fields but queries do not, report a
35
+ sync or import issue before creating duplicates.
36
+
37
+ Treat active tool query results as operational truth. Authored Markdown is
38
+ evidence of intent, not proof of active KB state.
@@ -1,44 +1,42 @@
1
1
  # Kibi Operation Access Catalog
2
2
 
3
- This table is the machine-readable interface map for Kibi's shared operation catalog. Every CLI route shown is dedicated; there is no generic operation runner. `--input JSON or flags` means the route supports exact MCP-shaped JSON from a file or stdin as well as its established human flags. `--input JSON` means the dedicated parity route is JSON-only.
4
-
5
- | MCP tool name | CLI route | Input mode | Mutability | Requires Prolog | Effects | Interface |
6
- |---|---|---|---|---|---|---|
7
- | `kb_skills_list` | `skills-list` | `--input JSON` | read | no | `local-read` | peer; capability-selected |
8
- | `kb_skills_load` | `skills-load` | `--input JSON` | read | no | `local-read` | peer; capability-selected |
9
- | `kb_skills_read` | `skills-read` | `--input JSON` | read | no | `local-read` | peer; capability-selected |
10
- | `kb_query` | `query` | `--input JSON or flags` | read | yes | `kb-read` | peer; capability-selected |
11
- | `kb_search` | `search` | `--input JSON or flags` | read | yes | `kb-read` | peer; capability-selected |
12
- | `kb_status` | `status` | `--input JSON or flags` | read | yes | `kb-read, workspace-read` | peer; capability-selected |
13
- | `kb_find_gaps` | `find-gaps` | `--input JSON or flags` | read | yes | `kb-read` | peer; capability-selected |
14
- | `kb_coverage` | `coverage` | `--input JSON or flags` | read | yes | `kb-read` | peer; capability-selected |
15
- | `kb_graph` | `graph` | `--input JSON or flags` | read | yes | `kb-read` | peer; capability-selected |
16
- | `kb_semantic_advisor` | `semantic-advisor` | `--input JSON` | read | no | `local-read` | peer; capability-selected |
17
- | `kb_model_requirement` | `model-requirement` | `--input JSON` | read | yes | `kb-read` | peer; capability-selected |
18
- | `kb_suggest_predicates` | `suggest-predicates` | `--input JSON` | read | yes | `kb-read` | peer; capability-selected |
19
- | `kb_autopilot_generate` | `autopilot-generate` | `--input JSON` | read | no | `workspace-read` | peer; capability-selected |
20
- | `kb_validate_upsert` | `validate-upsert` | `--input JSON` | read | yes | `kb-read` | peer; capability-selected |
21
- | `kb_upsert` | `upsert` | `--input JSON` | write | yes | `kb-write, workspace-write` | peer; capability-selected |
22
- | `kb_delete` | `delete` | `--input JSON` | write | yes | `kb-write, workspace-write` | peer; capability-selected |
23
- | `kb_check` | `check` | `--input JSON or flags` | read | yes | `kb-read, workspace-read` | peer; capability-selected |
24
- | `kb_sparql_remote` | `sparql-remote` | `--input JSON` | read | no | `network-read` | peer; capability-selected |
25
-
26
- ## JSON execution recipes
27
-
28
- Use the project-local, non-installing runner from a trusted workspace. Stdin must contain exactly one UTF-8 JSON object.
29
-
30
- ```bash
31
- echo '{"query":"authentication","type":"req","limit":10}' | npx --no-install kibi search --input -
32
- ```
3
+ Generated from the public `OperationSpec` catalog. CLI JSON and MCP structured
4
+ content use the same `KibiResult` envelope (protocol 1); result data is versioned
5
+ per operation. Effects are authoritative for mutability and adapter annotations.
6
+
7
+ | MCP tool name | CLI route | Input mode | Mutability | Requires Prolog | Effects | Interface | Result version | Destructive | Retry safety | Open-world | Output schema |
8
+ |---|---|---|---|---|---|---|---|---|---|---|---|
9
+ | `kb_skills_list` | `skills-list` | --input JSON | read | no | local-read | peer; capability-selected | kibi.kb_skills_list.v1 | no | safe | no | yes |
10
+ | `kb_skills_load` | `skills-load` | --input JSON | read | no | local-read | peer; capability-selected | kibi.kb_skills_load.v1 | no | safe | no | yes |
11
+ | `kb_skills_read` | `skills-read` | --input JSON | read | no | local-read | peer; capability-selected | kibi.kb_skills_read.v1 | no | safe | no | yes |
12
+ | `kb_query` | `query` | --input JSON or flags | read | yes | kb-read | peer; capability-selected | kibi.kb_query.v1 | no | safe | no | yes |
13
+ | `kb_search` | `search` | --input JSON or flags | read | yes | kb-read | peer; capability-selected | kibi.kb_search.v1 | no | safe | no | yes |
14
+ | `kb_status` | `status` | --input JSON or flags | read | no | kb-read, workspace-read | peer; capability-selected | kibi.kb_status.v1 | no | safe | no | yes |
15
+ | `kb_find_gaps` | `find-gaps` | --input JSON or flags | read | yes | kb-read | peer; capability-selected | kibi.kb_find_gaps.v1 | no | safe | no | yes |
16
+ | `kb_coverage` | `coverage` | --input JSON or flags | read | yes | kb-read | peer; capability-selected | kibi.kb_coverage.v1 | no | safe | no | yes |
17
+ | `kb_graph` | `graph` | --input JSON or flags | read | yes | kb-read | peer; capability-selected | kibi.kb_graph.v1 | no | safe | no | yes |
18
+ | `kb_semantic_advisor` | `semantic-advisor` | --input JSON | read | no | local-read | peer; capability-selected | kibi.kb_semantic_advisor.v1 | no | safe | no | yes |
19
+ | `kb_model_requirement` | `model-requirement` | --input JSON | read | yes | kb-read | peer; capability-selected | kibi.kb_model_requirement.v1 | no | safe | no | yes |
20
+ | `kb_suggest_predicates` | `suggest-predicates` | --input JSON | read | yes | kb-read | peer; capability-selected | kibi.kb_suggest_predicates.v1 | no | safe | no | yes |
21
+ | `kb_plan_bootstrap` | `plan-bootstrap` | --input JSON | read | no | workspace-read | peer; capability-selected | kibi.kb_plan_bootstrap.v1 | no | safe | no | yes |
22
+ | `kb_validate_upsert` | `validate-upsert` | --input JSON | read | yes | kb-read | peer; capability-selected | kibi.kb_validate_upsert.v1 | no | safe | no | yes |
23
+ | `kb_upsert` | `upsert` | --input JSON | write | yes | kb-write, workspace-write | peer; capability-selected | kibi.kb_upsert.v1 | yes | unsafe | no | yes |
24
+ | `kb_delete` | `delete` | --input JSON | write | yes | kb-write, workspace-write | peer; capability-selected | kibi.kb_delete.v1 | yes | unsafe | no | yes |
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_sparql_remote` | `sparql-remote` | --input JSON | read | no | network-read | peer; capability-selected | kibi.kb_sparql_remote.v1 | no | safe | yes | yes |
27
+ | `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
+ | `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 |
29
+ | `kb_ingest_proof` | `ingest-proof` | --input JSON | write | yes | kb-read, kb-write, workspace-read | peer; capability-selected | kibi.kb_ingest_proof.v1 | yes | unsafe | no | yes |
30
+
31
+ ## JSON execution recipe
32
+
33
+ Use a trusted project-local, non-installing runner. Stdin contains one UTF-8 JSON
34
+ object and stdout contains the versioned result envelope:
33
35
 
34
36
  ```bash
35
- echo '{"type":"req","id":"REQ-001","properties":{"title":"Test","status":"open"}}' | npx --no-install kibi upsert --input -
37
+ printf '%s\n' '{"query":"authentication","limit":10}' | npx --no-install kibi search --input -
36
38
  ```
37
39
 
38
- ```bash
39
- echo '{"rules":["required-fields","no-dangling-refs"]}' | bunx --no-install kibi check --input -
40
- ```
41
-
42
- ## Telemetry handling
43
-
44
- `_diagnostic_telemetry` is adapter metadata, not business input. In CLI JSON mode the adapter may validate and extract it for CLI usage logging before shared execution. In MCP diagnostic mode the adapter enforces its configured telemetry requirement and strips the field before shared execution. Never copy telemetry into entity properties or operation business input.
40
+ `_diagnostic_telemetry` is adapter metadata, not business input. Never copy it
41
+ into entity properties. On `committed_with_repairs`, follow typed required
42
+ `nextActions` and do not retry the original mutation.
@@ -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
 
@@ -1,62 +0,0 @@
1
- ---
2
- id: init-kibi
3
- name: init-kibi
4
- description: Bootstrap and model knowledge safely using approved Kibi MCP initialization and mutation workflow.
5
- version: 1.0.0
6
- kibiCompatibility: "*"
7
- tags:
8
- - kibi
9
- - mcp
10
- - bootstrap
11
- - agent-guidance
12
- ---
13
- ## Goal
14
-
15
- Set up or refresh Kibi knowledge for the current branch through approved Kibi interfaces only. Maintain source-file traceability for every repository-backed claim, and require explicit operator approval before any mutation.
16
-
17
- ## Interface Selection
18
-
19
- 1. If approved Kibi MCP tools are visible, use the MCP route.
20
- 2. Otherwise, in a trusted workspace, use the canonical project-local CLI fallback: `npx --no-install kibi ...` or `bunx --no-install kibi ...`.
21
- 3. If neither approved MCP tools nor the project-local CLI are available, stop and tell the operator to enable or install Kibi for this workspace.
22
- 4. Never use a global fallback, an installing runner, or any route outside the approved Kibi interface.
23
-
24
- Use `kibi-usage/resources/operation-access.md` for the exact operation-to-route mapping. The CLI preview route accepts the same JSON object as `kb_autopilot_generate`:
25
-
26
- ```bash
27
- echo '{"maxCandidates":25,"minConfidence":0.8}' | npx --no-install kibi autopilot-generate --input -
28
- ```
29
-
30
- ## Capability Workflow
31
-
32
- - Generate a read-only bootstrap preview with `kb_autopilot_generate`, or the dedicated CLI route `autopilot-generate --input`.
33
- - Show the generated preview and obtain explicit approval before writes.
34
- - Apply reviewed entity creation or updates with `kb_upsert`, or `upsert --input`.
35
- - If cleanup is needed, use `kb_delete`, or `delete --input`, only after checking dependencies and obtaining approval for the specific removal.
36
- - Finish with `kb_check`, or `check --input`, to validate the branch snapshot.
37
-
38
- ## Guidance
39
-
40
- - Keep mutation requests explicit, small, and sequential.
41
- - Prefer source-linked entities so future `kb_query` lookups can verify repository context against source files.
42
- - Preserve traceability by linking facts, claims, scenarios, and tests to concrete project files whenever repository evidence supports it.
43
- - Do not read or edit files inside `.kb` directly; all changes go through the selected Kibi interface.
44
- - Ask at most four bounded context questions, and only when repository evidence is insufficient.
45
- - Stop at the documented operator repair boundary if the setup appears partial, inconsistent, or unsupported by the approved interface.
46
-
47
- ## Public Training Trajectories
48
-
49
- - `init-kibi-bootstrap-analysis-train-1`: Analyze the cold-start repository and produce a read-only bootstrap preview using only the public Kibi MCP surface.
50
- - `init-kibi-bootstrap-analysis-train-2`: Analyze the cold-start repository and produce a read-only bootstrap preview using only the public Kibi MCP surface.
51
- - `init-kibi-bounded-context-questions-train-1`: Ask only the bounded context questions needed before bootstrap synthesis using only the public Kibi MCP surface.
52
- - `init-kibi-bounded-context-questions-train-2`: Ask only the bounded context questions needed before bootstrap synthesis using only the public Kibi MCP surface.
53
- - `init-kibi-approval-sequential-writes-train-1`: Apply the approved bootstrap plan sequentially and finish with validation using only the public Kibi MCP surface.
54
- - `init-kibi-approval-sequential-writes-train-2`: Apply the approved bootstrap plan sequentially and finish with validation using only the public Kibi MCP surface.
55
- - `init-kibi-repair-escalation-train-1`: Identify the partial setup and stop at the documented operator repair boundary using only the public Kibi MCP surface.
56
- - `init-kibi-repair-escalation-train-2`: Identify the partial setup and stop at the documented operator repair boundary using only the public Kibi MCP surface.
57
-
58
- ## Training Data
59
-
60
- ```json
61
- [{"taskId":"init-kibi-bootstrap-analysis-train-1","family":"bootstrap-analysis","reflection":"Analyze the cold-start repository and produce a read-only bootstrap preview. This is train case 1; use only the public Kibi MCP surface."},{"taskId":"init-kibi-bootstrap-analysis-train-2","family":"bootstrap-analysis","reflection":"Analyze the cold-start repository and produce a read-only bootstrap preview. This is train case 2; use only the public Kibi MCP surface."},{"taskId":"init-kibi-bounded-context-questions-train-1","family":"bounded-context-questions","reflection":"Ask only the bounded context questions needed before bootstrap synthesis. This is train case 1; use only the public Kibi MCP surface."},{"taskId":"init-kibi-bounded-context-questions-train-2","family":"bounded-context-questions","reflection":"Ask only the bounded context questions needed before bootstrap synthesis. This is train case 2; use only the public Kibi MCP surface."},{"taskId":"init-kibi-approval-sequential-writes-train-1","family":"approval-sequential-writes","reflection":"Apply the approved bootstrap plan sequentially and finish with validation. This is train case 1; use only the public Kibi MCP surface."},{"taskId":"init-kibi-approval-sequential-writes-train-2","family":"approval-sequential-writes","reflection":"Apply the approved bootstrap plan sequentially and finish with validation. This is train case 2; use only the public Kibi MCP surface."},{"taskId":"init-kibi-repair-escalation-train-1","family":"repair-escalation","reflection":"Identify the partial setup and stop at the documented operator repair boundary. This is train case 1; use only the public Kibi MCP surface."},{"taskId":"init-kibi-repair-escalation-train-2","family":"repair-escalation","reflection":"Identify the partial setup and stop at the documented operator repair boundary. This is train case 2; use only the public Kibi MCP surface."}]
62
- ```
@@ -1,21 +0,0 @@
1
- ---
2
- name: init-kibi
3
- description: Bootstrap Kibi knowledge for the current branch using the MCP autopilot workflow
4
- ---
5
-
6
- # Initialize Kibi
7
-
8
- Bootstrap repo-local Kibi memory without editing `.kb/` files directly.
9
-
10
- ## Workflow
11
-
12
- 1. Run `kb_autopilot_generate` for read-only synthesis.
13
- 2. Show the preview and get explicit approval before writes.
14
- 3. Apply approved entities with sequential `kb_upsert`.
15
- 4. Finish with `kb_check`.
16
-
17
- ## Guidance
18
-
19
- - Ask at most four bounded context questions when repository evidence is insufficient.
20
- - Prefer source-linked entities so future `kb_query` lookups can verify context.
21
- - Keep mutation batches small and reviewable.
@@ -1,21 +0,0 @@
1
- ---
2
- name: init-kibi
3
- description: Bootstrap Kibi knowledge for the current branch using the MCP autopilot workflow
4
- ---
5
-
6
- # Initialize Kibi
7
-
8
- Bootstrap repo-local Kibi memory without editing `.kb/` files directly.
9
-
10
- ## Workflow
11
-
12
- 1. Run `kb_autopilot_generate` for read-only synthesis.
13
- 2. Show the preview and get explicit approval before writes.
14
- 3. Apply approved entities with sequential `kb_upsert`.
15
- 4. Finish with `kb_check`.
16
-
17
- ## Guidance
18
-
19
- - Ask at most four bounded context questions when repository evidence is insufficient.
20
- - Prefer source-linked entities so future `kb_query` lookups can verify context.
21
- - Keep mutation batches small and reviewable.
@@ -1,62 +0,0 @@
1
- ---
2
- id: init-kibi
3
- name: init-kibi
4
- description: Bootstrap and model knowledge safely using approved Kibi MCP initialization and mutation workflow.
5
- version: 1.0.0
6
- kibiCompatibility: "*"
7
- tags:
8
- - kibi
9
- - mcp
10
- - bootstrap
11
- - agent-guidance
12
- ---
13
- ## Goal
14
-
15
- Set up or refresh Kibi knowledge for the current branch through approved Kibi interfaces only. Maintain source-file traceability for every repository-backed claim, and require explicit operator approval before any mutation.
16
-
17
- ## Interface Selection
18
-
19
- 1. If approved Kibi MCP tools are visible, use the MCP route.
20
- 2. Otherwise, in a trusted workspace, use the canonical project-local CLI fallback: `npx --no-install kibi ...` or `bunx --no-install kibi ...`.
21
- 3. If neither approved MCP tools nor the project-local CLI are available, stop and tell the operator to enable or install Kibi for this workspace.
22
- 4. Never use a global fallback, an installing runner, or any route outside the approved Kibi interface.
23
-
24
- Use `kibi-usage/resources/operation-access.md` for the exact operation-to-route mapping. The CLI preview route accepts the same JSON object as `kb_autopilot_generate`:
25
-
26
- ```bash
27
- echo '{"maxCandidates":25,"minConfidence":0.8}' | npx --no-install kibi autopilot-generate --input -
28
- ```
29
-
30
- ## Capability Workflow
31
-
32
- - Generate a read-only bootstrap preview with `kb_autopilot_generate`, or the dedicated CLI route `autopilot-generate --input`.
33
- - Show the generated preview and obtain explicit approval before writes.
34
- - Apply reviewed entity creation or updates with `kb_upsert`, or `upsert --input`.
35
- - If cleanup is needed, use `kb_delete`, or `delete --input`, only after checking dependencies and obtaining approval for the specific removal.
36
- - Finish with `kb_check`, or `check --input`, to validate the branch snapshot.
37
-
38
- ## Guidance
39
-
40
- - Keep mutation requests explicit, small, and sequential.
41
- - Prefer source-linked entities so future `kb_query` lookups can verify repository context against source files.
42
- - Preserve traceability by linking facts, claims, scenarios, and tests to concrete project files whenever repository evidence supports it.
43
- - Do not read or edit files inside `.kb` directly; all changes go through the selected Kibi interface.
44
- - Ask at most four bounded context questions, and only when repository evidence is insufficient.
45
- - Stop at the documented operator repair boundary if the setup appears partial, inconsistent, or unsupported by the approved interface.
46
-
47
- ## Public Training Trajectories
48
-
49
- - `init-kibi-bootstrap-analysis-train-1`: Analyze the cold-start repository and produce a read-only bootstrap preview using only the public Kibi MCP surface.
50
- - `init-kibi-bootstrap-analysis-train-2`: Analyze the cold-start repository and produce a read-only bootstrap preview using only the public Kibi MCP surface.
51
- - `init-kibi-bounded-context-questions-train-1`: Ask only the bounded context questions needed before bootstrap synthesis using only the public Kibi MCP surface.
52
- - `init-kibi-bounded-context-questions-train-2`: Ask only the bounded context questions needed before bootstrap synthesis using only the public Kibi MCP surface.
53
- - `init-kibi-approval-sequential-writes-train-1`: Apply the approved bootstrap plan sequentially and finish with validation using only the public Kibi MCP surface.
54
- - `init-kibi-approval-sequential-writes-train-2`: Apply the approved bootstrap plan sequentially and finish with validation using only the public Kibi MCP surface.
55
- - `init-kibi-repair-escalation-train-1`: Identify the partial setup and stop at the documented operator repair boundary using only the public Kibi MCP surface.
56
- - `init-kibi-repair-escalation-train-2`: Identify the partial setup and stop at the documented operator repair boundary using only the public Kibi MCP surface.
57
-
58
- ## Training Data
59
-
60
- ```json
61
- [{"taskId":"init-kibi-bootstrap-analysis-train-1","family":"bootstrap-analysis","reflection":"Analyze the cold-start repository and produce a read-only bootstrap preview. This is train case 1; use only the public Kibi MCP surface."},{"taskId":"init-kibi-bootstrap-analysis-train-2","family":"bootstrap-analysis","reflection":"Analyze the cold-start repository and produce a read-only bootstrap preview. This is train case 2; use only the public Kibi MCP surface."},{"taskId":"init-kibi-bounded-context-questions-train-1","family":"bounded-context-questions","reflection":"Ask only the bounded context questions needed before bootstrap synthesis. This is train case 1; use only the public Kibi MCP surface."},{"taskId":"init-kibi-bounded-context-questions-train-2","family":"bounded-context-questions","reflection":"Ask only the bounded context questions needed before bootstrap synthesis. This is train case 2; use only the public Kibi MCP surface."},{"taskId":"init-kibi-approval-sequential-writes-train-1","family":"approval-sequential-writes","reflection":"Apply the approved bootstrap plan sequentially and finish with validation. This is train case 1; use only the public Kibi MCP surface."},{"taskId":"init-kibi-approval-sequential-writes-train-2","family":"approval-sequential-writes","reflection":"Apply the approved bootstrap plan sequentially and finish with validation. This is train case 2; use only the public Kibi MCP surface."},{"taskId":"init-kibi-repair-escalation-train-1","family":"repair-escalation","reflection":"Identify the partial setup and stop at the documented operator repair boundary. This is train case 1; use only the public Kibi MCP surface."},{"taskId":"init-kibi-repair-escalation-train-2","family":"repair-escalation","reflection":"Identify the partial setup and stop at the documented operator repair boundary. This is train case 2; use only the public Kibi MCP surface."}]
62
- ```