kb_compile_intent
Compile a change intent into a deterministic, read-only plan before coding; it checks propositions, reports contradictions, proposes traceability links, and emits ordered upsert steps; no mutations.
Instructions
Compile complete change intent into a deterministic, snapshot-bound read-only plan. Use it before editing code for a change request that may touch several requirements; use kb_model for one requirement's prose and kb_plan_bootstrap for first-time onboarding. Reuses intent-aware discovery and semantic modeling, accounts for every proposition, reports contradiction witnesses, proposes traceability links, and emits dependency-ordered kb_upsert-style steps only for resolved typed claims. contradictionAnalysis.outcome is no_conflict only when the check could decide: an unmodeled proposition or a related current requirement without logic leaves it unresolved with reasons and reviewCandidates to compare and judge through conflictReviews. No mutation side effects.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes | Create a new requirement or update an existing one. Update auto-selection is allowed only with a high-confidence, well-separated candidate. | |
| title | No | Optional requirement title; existing title is preserved for updates when omitted. | |
| intent | Yes | Complete post-change normative intent. Send the desired behavior, not a patch fragment. | |
| clauses | No | Optional complete atomic clause decomposition. Each clause must be a verbatim fragment of intent (whitespace may differ); a clause that does not occur in intent fails the call with VALIDATION_FAILED naming it. Each assertive clause receives independent proposition accounting. | |
| context | No | Why the requirement exists, who asked and anything that does not fit its checked meaning. Required when mode is create (validation error naming this field otherwise); rendered as a '## Context' section of the requirement document, never as part of the checked meaning. Never invent a reason: write 'Reason not stated' when the requester gave none. An update keeps the existing document body unless context is supplied. | |
| testDrafts | No | Optional test drafts. Tests are attached to scenarios with verified_by; direct req -> test proof links are not emitted. | |
| requirementId | No | Optional exact requirement ID. Required for an update when automatic selection is below the confidence and margin gates. | |
| sourceExcerpt | No | Optional verbatim text the intent came from (a ticket, a message, a document passage). Rendered as a blockquote in the requirement's '## Source' section; requires context. | |
| workspaceRoot | No | Optional absolute path of the workspace this call is about when it differs from the one the server started in, for example the git worktree you are working in. The server answers from that workspace's knowledge base when it is a worktree of the same repository or lies under the client's MCP roots; otherwise it answers from its own workspace and adds a workspace_mismatch diagnostic. Host hooks fill this in automatically where available. | |
| scenarioDrafts | No | Optional scenario drafts. Each is linked requirement -> scenario with specified_by. | |
| semanticFacets | No | Host-agent facets forwarded to deterministic intent-v1 discovery. | |
| conflictReviews | No | Your verdict on each contradictionAnalysis.reviewCandidates entry of a previous compile: whether the intent contradicts that current requirement, which Kibi could not compare logically. A conflict verdict blocks the plan; a no_conflict verdict clears that candidate. A verdict may also name a current requirement discovery did not rank. | |
| interpretations | No | Optional host-supplied typed kibi.logic.v1 interpretations; Kibi validates them before including rule steps. | |
| sourceLocations | No | Workspace-relative source coordinates used for discovery and before-hash binding. | |
| sourceReference | No | Optional locator of the source text (ticket id, URL, path). Rendered in the requirement's '## Source' section; requires context. | |
| proposalDecisions | No | Explicit decisions for deterministic traceability proposals. Pending proposals never enter steps. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | ||
| error | No | ||
| status | Yes | ||
| effects | Yes | ||
| operation | Yes | ||
| diagnostics | Yes | ||
| nextActions | Yes | ||
| kibiProtocol | Yes | ||
| resultVersion | Yes |