kibi-cursor 1.0.0 → 2.0.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.
Files changed (35) hide show
  1. package/.cursor-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +50 -0
  3. package/README.md +25 -4
  4. package/agent-plugin/plugin.json +1 -1
  5. package/agent-plugin/skills/kibi-freshness/SKILL.md +1 -1
  6. package/agent-plugin/skills/kibi-usage/SKILL.md +41 -12
  7. package/agent-plugin/skills/kibi-usage/resources/operation-access.md +1 -1
  8. package/agent-plugin/skills/kibi-usage/resources/proof.md +105 -0
  9. package/agent-plugin/skills/kibi-usage/resources/workflows.md +6 -6
  10. package/bin/launch-kibi-mcp.d.mts +38 -0
  11. package/bin/launch-kibi-mcp.mjs +66 -33
  12. package/dist/.cursor-plugin/plugin.json +1 -1
  13. package/dist/bin/launch-kibi-mcp.d.mts +38 -0
  14. package/dist/bin/launch-kibi-mcp.mjs +66 -33
  15. package/dist/hook-runner.d.ts +4 -0
  16. package/dist/hook-runner.js +19 -7
  17. package/dist/mcp.json +4 -1
  18. package/dist/path-policy.d.ts +1 -0
  19. package/dist/path-policy.js +12 -10
  20. package/dist/rules/kibi-workflow.mdc +16 -1
  21. package/dist/skills/.canon-hash.json +5 -4
  22. package/dist/skills/kibi-freshness/SKILL.md +1 -1
  23. package/dist/skills/kibi-usage/SKILL.md +41 -12
  24. package/dist/skills/kibi-usage/resources/operation-access.md +1 -1
  25. package/dist/skills/kibi-usage/resources/proof.md +105 -0
  26. package/dist/skills/kibi-usage/resources/workflows.md +6 -6
  27. package/mcp.json +4 -1
  28. package/package.json +1 -1
  29. package/rules/kibi-workflow.mdc +16 -1
  30. package/skills/.canon-hash.json +5 -4
  31. package/skills/kibi-freshness/SKILL.md +1 -1
  32. package/skills/kibi-usage/SKILL.md +41 -12
  33. package/skills/kibi-usage/resources/operation-access.md +1 -1
  34. package/skills/kibi-usage/resources/proof.md +105 -0
  35. package/skills/kibi-usage/resources/workflows.md +6 -6
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kibi-cursor",
3
3
  "displayName": "Kibi",
4
- "version": "1.0.0",
4
+ "version": "2.0.0",
5
5
  "description": "Optional Cursor adapter for Kibi. Requires SWI-Prolog 9+ and project-local kibi-cli, kibi-mcp, and kibi-core 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,55 @@
1
1
  # kibi-cursor
2
2
 
3
+ ## 2.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 812c201: Kibi's proof layer is now runner-neutral: any test runner, script, or harness can prove requirements, and Playwright is no longer built into the proof model.
8
+
9
+ - `kibi prove` replaces `kibi verify` as the single command to run configured proof producers and record evidence. Proof contracts (`kibi.proof-contract.v1`) declare explicit obligations (`symbol_id` + `target`) executed by a configured integration in `.kb/proof/integrations.json`; `kibi proof inspect` discovers test infrastructure deterministically; one producer run can satisfy many test contracts, and re-ingestion is idempotent.
10
+ - Evidence moves to the `kibi.proof-run.v1` artifact (typed environment, run-level outcome, factual attempt history with `native_case`/`aggregate_run` provenance) evaluated into `kibi.proof-receipt.v1` receipts bound to the live snapshot, contract hash, and effective execution fingerprint. Command proof is the universal fallback, so every project can prove requirements without a first-party framework adapter; strict first-attempt policy never upgrades unknown attempt history into passing evidence.
11
+ - Breaking removals: `kibi verify`, `kb_ingest_verification`, `kibi.playwright-run.v1`, `verification_contract`/`verification_receipts` entity fields (replaced by `proof_contract`/`proof_bindings`/`proof_receipts`), the `required_case_symbols`×`required_projects` Cartesian contract, and `retries` fields. Migrate by re-running `kibi prove` after bootstrap configures proof for your repository.
12
+
13
+ DRY: hard cutover to the proof-evidence protocol across CLI, MCP, runtime skills, Prolog proof evaluation, coverage/repair/report surfaces, agent skills, and repository self-proof (packed e2e steps now execute through `kibi prove --all`).
14
+
15
+ ### Patch Changes
16
+
17
+ - b0271ac: Cursor now starts the bundled Kibi MCP server reliably when it launches plugin processes from a home directory or another unrelated working directory. Consumer workspaces with spaces continue to resolve their project-local `kibi-mcp` installation, while the portable Agent Plugin keeps its separate `npx --no-install` configuration.
18
+
19
+ - Fix `kibi-cursor` MCP launcher arguments to use Cursor's `${CURSOR_PLUGIN_ROOT}` expansion.
20
+ - Add source-install manifest regression coverage for consumer-local resolution from unrelated host directories.
21
+
22
+ - b1682f1: Agents receive clearer guidance for repairing the actual supplied mutation request and preserving approved predicate bindings. The scoped additions retain the existing workflow while separating payload recovery from conditional relational modeling.
23
+
24
+ - Update `kibi-usage` to 2.1.2 in CLI/runtime sources and the generated Codex/Cursor distributions.
25
+ - Preserve the other three skills and all existing resource content.
26
+ - Retain production-adoption safeguards; development comparisons are not held-out evidence.
27
+
28
+ - ee0dc49: Plugin hooks, the Cursor MCP launcher, and skill validation now expose the
29
+ same entry paths tests already spawn as processes. In-process coverage can
30
+ exercise stdin, CLI guards, and realpath failures instead of leaving those
31
+ lines invisible to Codecov.
32
+
33
+ - Export hook CLI helpers and Agent Plugin / launcher internals for tests.
34
+ - Use a namespace `fs` import in skill validation so realpath errors are testable.
35
+
36
+ - 5999143: Agent-facing skill docs now use the current status field names, so agents following the freshness and E2E receipt workflows look for fields that actually exist in `kb_status` output instead of stale ones.
37
+
38
+ - Bundled `kibi-freshness` and `kibi-usage` skills (all agent mirrors) now reference `proofSnapshotChanges` and `proofSnapshot` (previously `verificationSnapshotChanges`/`verificationSnapshot` from the pre-proof-architecture status schema).
39
+ - The skillopt-eval harness reads `proofSnapshot*` status fields and its held-out eval prompts name the current fields, so "dirty editor path" evidence gathering works against live status output again.
40
+
41
+ Dry: completes the `verificationSnapshot*` → `proofSnapshot*` rename from the proof architecture change in the surfaces that earlier commit missed.
42
+
43
+ ## 1.0.1
44
+
45
+ ### Patch Changes
46
+
47
+ - Cursor agents now get an always-on CLI recipe when Kibi MCP tools are missing, instead of treating Kibi as unavailable.
48
+
49
+ - Put the exact `npx --no-install kibi <route> --input -` command, MCP-to-CLI name mapping, and Shell-approval language in the always-applied workflow rule.
50
+ - Keep published plugin hooks advisory and untrusted by default; dogfood still opts into `--trusted-workspace` locally.
51
+ - Document the operator prerequisites (Agent mode, Shell, trusted workspace, project-local CLI) for the fallback to run.
52
+
3
53
  ## 1.0.0
4
54
 
5
55
  ### Major Changes
package/README.md CHANGED
@@ -56,16 +56,19 @@ cp -r "$(npm root)/kibi-cursor" ~/.cursor/plugins/local/kibi-cursor
56
56
  ## MCP configuration
57
57
 
58
58
  The plugin bundles `mcp.json` with a thin launcher that locates and starts the
59
- `kibi-mcp` package installed in the opened project. The launcher runs from the
60
- consumer workspace and sets `KIBI_WORKSPACE` to that root; it never downloads,
61
- bundles, or falls back to a global Kibi runtime:
59
+ `kibi-mcp` package installed in the opened project. The launcher starts the
60
+ resolved child from the consumer workspace and sets `KIBI_WORKSPACE` to that
61
+ root; it never downloads, bundles, or falls back to a global Kibi runtime:
62
62
 
63
63
  ```json
64
64
  {
65
65
  "mcpServers": {
66
66
  "kibi": {
67
67
  "command": "node",
68
- "args": ["bin/launch-kibi-mcp.mjs", "${workspaceFolder}"]
68
+ "args": [
69
+ "${CURSOR_PLUGIN_ROOT}/bin/launch-kibi-mcp.mjs",
70
+ "${workspaceFolder}"
71
+ ]
69
72
  }
70
73
  }
71
74
  }
@@ -73,6 +76,9 @@ bundles, or falls back to a global Kibi runtime:
73
76
 
74
77
  Toggle the bundled MCP server from **Settings → Features → Model Context Protocol** after installing the plugin.
75
78
 
79
+ Cursor expands `${CURSOR_PLUGIN_ROOT}` to the installed plugin directory and
80
+ `${workspaceFolder}` to the opened workspace before starting the command.
81
+
76
82
  Manual MCP fallback (no plugin install required):
77
83
 
78
84
  ```json
@@ -135,6 +141,21 @@ Per the thin-adapter architecture, `kibi-cursor` does not:
135
141
  - **Editor-specific value**: Cursor hooks for read/write reminders and session freshness follow-ups
136
142
  - **Foundation**: `kibi-core`, `kibi-cli`, and `kibi-mcp` remain required for project-local operations
137
143
 
144
+ ## CLI fallback when MCP is unavailable
145
+
146
+ The always-on `kibi-workflow` rule selects the trusted project-local CLI when Kibi MCP tools are not in the tool list. Hooks stay advisory and never execute that CLI themselves.
147
+
148
+ For the agent to actually run the fallback, the Cursor session needs:
149
+
150
+ - Agent mode with Shell enabled (Ask mode cannot run the CLI)
151
+ - A trusted workspace, or explicit operator approval of the project-local CLI
152
+ - Project-local `kibi-cli` (use `npx --no-install kibi` or `bunx --no-install kibi`; never a global or installing runner)
153
+ - Plugin rules loaded in the Cursor harness
154
+
155
+ If MCP tools are visible, use MCP and do not use this CLI path. If Shell is unavailable or the workspace is untrusted, stop and ask the operator; do not probe the CLI.
156
+
157
+ A Cursor model invoked outside Cursor's plugin harness will not load this rule. Inject the same always-on guidance into that host's system prompt or `AGENTS.md`.
158
+
138
159
  ## License
139
160
 
140
161
  AGPL-3.0-or-later
@@ -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": "1.0.0",
4
+ "version": "2.0.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",
@@ -39,7 +39,7 @@ echo '{}' | npx --no-install kibi status --input -
39
39
  matching `branch.json`; a `legacy_compat` attachment is read-only until an
40
40
  explicit old/new migration is approved.
41
41
  - Inspect bounded `staleReasons` (indexed source missing/newer or documentation
42
- source newer) and `verificationSnapshotChanges`. Kibi deliberately reports
42
+ source newer) and `proofSnapshotChanges`. Kibi deliberately reports
43
43
  editor/config paths such as editor dot-directories; do not silently ignore them.
44
44
  - Use `kb_query`, or `query --input`, with `sourceFile` and text references for source-linked discovery.
45
45
  - Re-run `kb_search`, or `search --input`, after sync gaps or stale context are detected.
@@ -2,7 +2,7 @@
2
2
  id: kibi-usage
3
3
  name: Kibi Usage
4
4
  description: Use Kibi's source-first, exact-Git, migration-aware, proof-aware operations safely across MCP or the trusted local CLI, including partial completion repair.
5
- version: 2.1.0
5
+ version: 2.1.2
6
6
  kibiCompatibility: ">=1.0.0"
7
7
  tags:
8
8
  - kibi
@@ -19,6 +19,7 @@ resources:
19
19
  - resources/relationship-directions.md
20
20
  - resources/fact-lanes.md
21
21
  - resources/workflows.md
22
+ - resources/proof.md
22
23
  - resources/ui-requirements.md
23
24
  - resources/logic-ir.md
24
25
  - resources/kb-improvement.md
@@ -67,13 +68,30 @@ mutability, and Prolog requirements of each operation.
67
68
  Kibi never Git-stages or commits those files. Do not read or edit `.kb`
68
69
  directly.
69
70
  5. Finish with targeted and final `kb_check`, then read status/coverage and
70
- state freshness, verification, proof, and limitations separately.
71
+ report the five independent closeout fields (not one inferred success flag).
71
72
 
72
73
  Run `kb_check` with specific rules during iteration and the unfiltered final
73
74
  check. Never fire `kb_upsert` calls in parallel; create or confirm endpoint
74
75
  entities before linking them. The canonical MCP names are `kb_search`,
75
76
  `kb_query`, `kb_upsert`, and `kb_check`.
76
77
 
78
+ For a task that explicitly supplies a malformed concrete mutation payload, locate and read that public request artifact before choosing an entity, preserving its exact entity ID, type, requested changes, and every intended relationship and endpoint. Do not substitute a seeded or convenient entity for the requested target. Start with kb_search, then exact-filter those targets with kb_query, and run kb_validate_upsert on that same payload; validation is not completion. Correct only diagnosed pre-commit errors and revalidate the corrected payload. Once authorized, apply the identical corrected and authorized payload with kb_upsert. If it returns committed_with_repairs, treat the mutation as committed, follow only the required repair actions, and neither retry it nor trigger unrelated semantic backfill for a schema-only repair. Exact-read every changed entity and relationship endpoint with kb_query, then finish with an unfiltered kb_check followed by a final kb_status.
79
+
80
+ ## Closeout fields
81
+
82
+ End every task with these five independent fields:
83
+
84
+ ```text
85
+ taskOutcome: complete | interim | blocked
86
+ kbState: clean_fresh | stale | dirty | legacy_compat | not_evaluated
87
+ verificationState: fresh | dirty | unavailable | not_evaluated
88
+ proofState: proven | mixed | unresolved | not_evaluated
89
+ limitationDisposition: none | accepted | unaccepted | not_applicable
90
+ ```
91
+
92
+ `taskOutcome` is whether the requested work finished. The other fields are
93
+ observed system state. A clean check can coexist with unresolved proof.
94
+
77
95
  ## Exact Git attachment
78
96
 
79
97
  The active ref is the exact KB identity. `KIBI_BRANCH` is used verbatim; Git's
@@ -114,22 +132,33 @@ safe normative claims; use `observation` or `meta` for bug/workaround notes and
114
132
  `flag` only for actual runtime/config gates. Requirements require scenarios,
115
133
  tests, symbol ownership, and fresh proof-bearing receipts before claiming proof.
116
134
  For an existing product KB that needs semantic backfill, read
117
- `resources/kb-improvement.md`.
135
+ `resources/kb-improvement.md`, and `resources/proof.md` for the proof workflow.
118
136
 
119
137
  ## Predicate Ontology Decision Tree
120
138
 
121
- Call `kb_semantic_advisor`, `kb_model_requirement`, or `kb_suggest_predicates`
122
- before encoding a normative clause. Use `fact_kind: predicate` with
123
- `requires_predicate` when a suitable schema exists; use `fact_kind: observation`
124
- for an ontology gap. Keep the `REQ -> TEST` chain and use `verified_by` for
125
- proof-bearing links. Relationship direction is fixed, and every `from` in a
126
- relationship batch must equal the upserted entity ID.
139
+ Call `kb_semantic_advisor` on the complete prose before encoding a clause.
140
+ Set requirement `logic_claims` to exactly the assertive `claim_key` values.
141
+ For each relational clause, call `kb_suggest_predicates` with that clause and
142
+ `existingLogicClaims`. If lexical rank is a false positive, retry with the
143
+ reviewed `schemaId`. If `binding_status` is `incomplete`, supply
144
+ `argumentBindings` and retry. Persist `fact_kind: predicate` with the same
145
+ `claim_key` / `claim_text`, then link `REQ -> fact` with `requires_predicate`.
146
+ Use `kb_model_requirement` for strict scalar clauses. Use
147
+ `fact_kind: observation` only for a true ontology gap. The manifest is not
148
+ grounding: run `logic-coverage` so each key binds to one ground fact.
149
+ Relationship direction is fixed, and every `from` in a relationship batch
150
+ must equal the upserted entity ID.
151
+
152
+ For conditional relational claims, after the initial `kb_suggest_predicates` and before any `kb_upsert`—including one needed for a missing schema—call read-only `kb_model_requirement` to preview suitable scalar or typed-rule modeling. Treat the preview as advisory: do not apply an irrelevant result or create unrequested facts, and retain an approved ground-predicate plan when it captures the whole claim. Preserve supplied arity, ordered argument roles, polarity, bound values, and one claim key per actual assertion; never split arguments across clauses or schemas or alter values to force uniqueness.
127
153
 
128
154
  ## Symbol-First Traceability
129
155
 
130
- Represent implementation ownership with a `symbol` entity and an `implements`
131
- relationship from the symbol to the requirement. Do not rely on legacy
132
- `// implements REQ-xxx` comments as the traceability record.
156
+ Represent implementation ownership with a `symbol` entity that has
157
+ `sourceFile`, `implements` to the requirement, and `covered_by` to the test.
158
+ Prolog `symbol-coverage` also requires the test to `validates` the requirement
159
+ (or the requirement `verified_by` the test). `covered_by` alone is not
160
+ enough. Do not rely on legacy `// implements REQ-xxx` comments as the
161
+ traceability record.
133
162
 
134
163
  ## Complete Logical Coverage
135
164
 
@@ -26,7 +26,7 @@ per operation. Effects are authoritative for mutability and adapter annotations.
26
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
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
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_verification` | `ingest-verification` | --input JSON | write | yes | kb-read, kb-write, workspace-read | peer; capability-selected | kibi.kb_ingest_verification.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
30
 
31
31
  ## JSON execution recipe
32
32
 
@@ -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`.
@@ -25,7 +25,7 @@ Receipt reuse is safe only when the live verification snapshot, contract hash,
25
25
  freshness window, and every required case result still match. Otherwise rerun
26
26
  the contracted command. If the contract changed, retain every older receipt
27
27
  unchanged, append evidence for the current contract, and keep proof unresolved
28
- with `verification_contract_mismatch` until that current receipt exists.
28
+ with `proof_contract_mismatch` until that current receipt exists.
29
29
  Obsolete symbols require current extraction or Git evidence before
30
30
  remap/deletion; transfer coverage only when existing test evidence supports it,
31
31
  then sync and read back status. Same-version packages with different export
@@ -46,7 +46,7 @@ The canonical workflow for any KB operation follows this pattern:
46
46
  7. **Create endpoints**: validated `kb_upsert` for new entities, sequentially
47
47
  8. **Link**: validated `kb_upsert` with `requires_rule`, `requires_predicate`, `constrains`, or `requires_property`, sequentially
48
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`
49
- 10. **Prove execution**: read `kb_status.verificationSnapshot`, run each scenario-backed E2E command exactly as declared by its `verification_contract.v1` through `kibi verify`, append the derived `kibi.verification-receipt.v2`, 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.
50
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
51
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
52
52
 
@@ -74,7 +74,7 @@ choose package managers, ground semantic claims, resolve contradictions, rerun
74
74
  E2E tests, rewrite receipt history, remap authored symbols, or accept
75
75
  limitations. Those actions remain explicit review/operator/execution steps.
76
76
 
77
- For `e2e_receipt_freshness_low`, query each listed requirement/test gap and run its exact current contract through `kibi verify`; this appends v2 evidence and preserves older 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.
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
78
 
79
79
  ## Creating a New Feature
80
80
  ```
@@ -101,12 +101,12 @@ Do not create a test-fact pair. Facts describe invariants; requirements or scena
101
101
  ## Fresh E2E Receipt Workflow
102
102
 
103
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.
104
- 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.
105
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.
106
- 4. Preserve every existing receipt byte-for-byte and append the derived `kibi.verification-receipt.v2` object with strictly later `finished_at`. Earlier receipts may bind older contracts; they remain audit history but cannot prove the current contract. 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.
107
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.
108
108
 
109
- Only the newest receipt matching both the live snapshot and current contract 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_verification_receipt`, `stale_verification_receipt`, `failed_verification_receipt`, `invalid_verification_receipt`, `verification_contract_mismatch`, 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.
110
110
 
111
111
  ## Predicate-First Requirement Modeling
112
112
 
@@ -1,5 +1,23 @@
1
1
  export function parseWorkspaceFolderPaths(value: unknown): string[];
2
2
 
3
+ export function nextAncestorDirectory(current: string): string | undefined;
4
+
5
+ export function packageJsonForResolvedFile(startPath: string): {
6
+ packageJsonPath: string;
7
+ packageRoot: string;
8
+ packageJson: Record<string, unknown>;
9
+ } | null;
10
+
11
+ export function hasConsumerNodeModulesLink(
12
+ workspaceRoot: string,
13
+ packageRoot: string,
14
+ ): boolean;
15
+
16
+ export function isProjectScopedPackage(
17
+ workspaceRoot: string,
18
+ packageRoot: string,
19
+ ): boolean;
20
+
3
21
  export function resolveProjectLocalMcp(workspaceRoot: string): {
4
22
  packageRoot: string;
5
23
  packageJsonPath: string;
@@ -7,12 +25,32 @@ export function resolveProjectLocalMcp(workspaceRoot: string): {
7
25
  binPath: string;
8
26
  };
9
27
 
28
+ export function hasDeclaredProjectDependency(workspaceRoot: string): boolean;
29
+
10
30
  export function resolveWorkspaceRoot(
11
31
  explicitWorkspace?: string,
12
32
  options?: { cwd?: string; env?: NodeJS.ProcessEnv },
13
33
  ): string;
14
34
 
35
+ export function signalExitCode(signal: NodeJS.Signals | string): number;
36
+
37
+ export function isLaunchEntrypoint(
38
+ argv1: string | undefined,
39
+ moduleUrl: string,
40
+ ): boolean;
41
+
42
+ export function runLaunchEntrypoint(
43
+ argv?: string[],
44
+ env?: NodeJS.ProcessEnv,
45
+ ): Promise<number>;
46
+
15
47
  export function launchKibiMcp(
16
48
  argv?: string[],
17
49
  env?: NodeJS.ProcessEnv,
50
+ spawnImpl?: typeof import("node:child_process").spawn,
18
51
  ): Promise<number>;
52
+
53
+ export function runLaunchIfEntrypoint(
54
+ isEntrypoint?: boolean,
55
+ start?: () => Promise<number> | Promise<void>,
56
+ ): Promise<void>;