kibi-cli 2.22.1 → 2.24.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 (159) hide show
  1. package/dist/cli-operation-metadata.d.ts +1 -1
  2. package/dist/cli-operation-metadata.js +1 -1
  3. package/dist/cli-register-foundation.d.ts.map +1 -1
  4. package/dist/cli-register-foundation.js +1 -0
  5. package/dist/commands/check.d.ts.map +1 -1
  6. package/dist/commands/check.js +51 -3
  7. package/dist/commands/doctor.d.ts.map +1 -1
  8. package/dist/commands/doctor.js +28 -0
  9. package/dist/commands/migrate.d.ts +10 -0
  10. package/dist/commands/migrate.d.ts.map +1 -1
  11. package/dist/commands/migrate.js +81 -9
  12. package/dist/commands/sync.d.ts.map +1 -1
  13. package/dist/commands/sync.js +15 -1
  14. package/dist/decision-firmness.d.ts +16 -4
  15. package/dist/decision-firmness.d.ts.map +1 -1
  16. package/dist/decision-firmness.js +29 -6
  17. package/dist/extractors/markdown.d.ts.map +1 -1
  18. package/dist/extractors/markdown.js +39 -36
  19. package/dist/intent-search.d.ts +2 -0
  20. package/dist/intent-search.d.ts.map +1 -1
  21. package/dist/intent-search.js +43 -4
  22. package/dist/operations/bootstrap/activation.d.ts +7 -1
  23. package/dist/operations/bootstrap/activation.d.ts.map +1 -1
  24. package/dist/operations/bootstrap/activation.js +27 -2
  25. package/dist/operations/bootstrap/candidate-helpers.d.ts +6 -0
  26. package/dist/operations/bootstrap/candidate-helpers.d.ts.map +1 -1
  27. package/dist/operations/bootstrap/candidate-helpers.js +19 -0
  28. package/dist/operations/bootstrap/generate.d.ts.map +1 -1
  29. package/dist/operations/bootstrap/generate.js +56 -16
  30. package/dist/operations/bootstrap/guidance-actions.d.ts.map +1 -1
  31. package/dist/operations/bootstrap/guidance-actions.js +14 -2
  32. package/dist/operations/bootstrap/guidance.d.ts.map +1 -1
  33. package/dist/operations/bootstrap/guidance.js +6 -2
  34. package/dist/operations/bootstrap/intent-claims.d.ts.map +1 -1
  35. package/dist/operations/bootstrap/intent-claims.js +2 -2
  36. package/dist/operations/bootstrap/markdown-candidates.d.ts.map +1 -1
  37. package/dist/operations/bootstrap/markdown-candidates.js +2 -2
  38. package/dist/operations/bootstrap/presentation.d.ts.map +1 -1
  39. package/dist/operations/bootstrap/presentation.js +75 -9
  40. package/dist/operations/bootstrap/types.d.ts +6 -0
  41. package/dist/operations/bootstrap/types.d.ts.map +1 -1
  42. package/dist/operations/migration/firm-supersede.d.ts +19 -0
  43. package/dist/operations/migration/firm-supersede.d.ts.map +1 -0
  44. package/dist/operations/migration/firm-supersede.js +60 -0
  45. package/dist/operations/migration/kb-sources.d.ts +8 -5
  46. package/dist/operations/migration/kb-sources.d.ts.map +1 -1
  47. package/dist/operations/migration/kb-sources.js +50 -14
  48. package/dist/operations/migration/schema6.d.ts.map +1 -1
  49. package/dist/operations/migration/schema6.js +52 -2
  50. package/dist/operations/migration/source-paths.d.ts +18 -1
  51. package/dist/operations/migration/source-paths.d.ts.map +1 -1
  52. package/dist/operations/migration/source-paths.js +111 -16
  53. package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
  54. package/dist/operations/modeling/suggest-predicates.js +22 -7
  55. package/dist/operations/mutation/requirement-semantics.d.ts +19 -1
  56. package/dist/operations/mutation/requirement-semantics.d.ts.map +1 -1
  57. package/dist/operations/mutation/requirement-semantics.js +63 -2
  58. package/dist/operations/mutation/strict-fact.js +1 -1
  59. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  60. package/dist/operations/mutation/upsert.js +2 -1
  61. package/dist/operations/planning/apply-plan.d.ts.map +1 -1
  62. package/dist/operations/planning/apply-plan.js +22 -2
  63. package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
  64. package/dist/operations/semantic-advisor/analyze-prose.js +49 -17
  65. package/dist/public/impact/analyzer.d.ts.map +1 -1
  66. package/dist/public/impact/analyzer.js +7 -1
  67. package/dist/public/impact/diagnostics.d.ts.map +1 -1
  68. package/dist/public/impact/diagnostics.js +16 -3
  69. package/dist/public/impact/types.d.ts +2 -0
  70. package/dist/public/impact/types.d.ts.map +1 -1
  71. package/dist/public/operations/catalog.d.ts +8 -3
  72. package/dist/public/operations/catalog.d.ts.map +1 -1
  73. package/dist/public/operations/check-executor.d.ts.map +1 -1
  74. package/dist/public/operations/check-executor.js +10 -3
  75. package/dist/public/operations/check-helpers.d.ts +10 -0
  76. package/dist/public/operations/check-helpers.d.ts.map +1 -1
  77. package/dist/public/operations/check-helpers.js +54 -0
  78. package/dist/public/operations/contracts.d.ts.map +1 -1
  79. package/dist/public/operations/contracts.js +1 -0
  80. package/dist/public/operations/decision-firmness.d.ts +14 -0
  81. package/dist/public/operations/decision-firmness.d.ts.map +1 -1
  82. package/dist/public/operations/decision-firmness.js +60 -7
  83. package/dist/public/operations/discovery-executors.d.ts +18 -0
  84. package/dist/public/operations/discovery-executors.d.ts.map +1 -1
  85. package/dist/public/operations/discovery-executors.js +80 -8
  86. package/dist/public/operations/schema6-check-actions.d.ts +4 -0
  87. package/dist/public/operations/schema6-check-actions.d.ts.map +1 -1
  88. package/dist/public/operations/schema6-check-actions.js +39 -2
  89. package/dist/public/operations/source-path-dangling.d.ts +1 -1
  90. package/dist/public/operations/source-path-dangling.d.ts.map +1 -1
  91. package/dist/public/operations/source-path-dangling.js +11 -2
  92. package/dist/public/operations/specs/composite.d.ts +1 -1
  93. package/dist/public/operations/specs/discovery.d.ts +5 -0
  94. package/dist/public/operations/specs/discovery.d.ts.map +1 -1
  95. package/dist/public/operations/specs/discovery.js +5 -0
  96. package/dist/public/operations/specs/planning.d.ts +1 -1
  97. package/dist/public/operations/specs/planning.js +1 -1
  98. package/dist/public/operations/specs/reporting.d.ts.map +1 -1
  99. package/dist/public/operations/specs/reporting.js +6 -4
  100. package/dist/public/operations/specs/semantic.d.ts +1 -1
  101. package/dist/public/operations/specs/semantic.d.ts.map +1 -1
  102. package/dist/public/operations/specs/semantic.js +4 -2
  103. package/dist/public/operations/specs/upsert.d.ts +1 -1
  104. package/dist/public/operations/specs/upsert.js +1 -1
  105. package/dist/public/schemas/entity.js +1 -1
  106. package/dist/public/skills/kibi-bootstrap/SKILL.md +5 -4
  107. package/dist/public/skills/kibi-usage/SKILL.md +36 -16
  108. package/dist/public/skills/kibi-usage/resources/workflows.md +3 -1
  109. package/dist/schemas/entity.schema.json +1 -1
  110. package/dist/search-answer.d.ts +14 -0
  111. package/dist/search-answer.d.ts.map +1 -1
  112. package/dist/search-answer.js +51 -5
  113. package/dist/traceability/git-change-snapshot.d.ts +46 -0
  114. package/dist/traceability/git-change-snapshot.d.ts.map +1 -1
  115. package/dist/traceability/git-change-snapshot.js +187 -3
  116. package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
  117. package/dist/traceability/staged-diagnostics.js +5 -6
  118. package/dist/traceability/staged-inventory-drift.d.ts +24 -0
  119. package/dist/traceability/staged-inventory-drift.d.ts.map +1 -0
  120. package/dist/traceability/staged-inventory-drift.js +84 -0
  121. package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
  122. package/dist/traceability/staged-symbols-manifest.js +1 -2
  123. package/dist/types/entities.d.ts +2 -2
  124. package/dist/types/entities.d.ts.map +1 -1
  125. package/dist/utils/content-freshness.d.ts +9 -0
  126. package/dist/utils/content-freshness.d.ts.map +1 -1
  127. package/dist/utils/content-freshness.js +33 -0
  128. package/dist/utils/kb-manifest.d.ts +7 -0
  129. package/dist/utils/kb-manifest.d.ts.map +1 -1
  130. package/dist/utils/kb-manifest.js +6 -0
  131. package/dist/utils/merge-driver-setup.d.ts +10 -0
  132. package/dist/utils/merge-driver-setup.d.ts.map +1 -0
  133. package/dist/utils/merge-driver-setup.js +69 -0
  134. package/dist/utils/rule-registry.generated.d.ts +1 -1
  135. package/dist/utils/rule-registry.generated.js +1 -1
  136. package/dist/utils/schema-version.d.ts +1 -1
  137. package/dist/utils/schema-version.d.ts.map +1 -1
  138. package/dist/utils/schema-version.js +3 -1
  139. package/package.json +2 -2
  140. package/src/public/impact/analyzer.ts +13 -1
  141. package/src/public/impact/diagnostics.ts +20 -3
  142. package/src/public/impact/types.ts +2 -0
  143. package/src/public/operations/check-executor.ts +16 -4
  144. package/src/public/operations/check-helpers.ts +65 -0
  145. package/src/public/operations/contracts.ts +1 -0
  146. package/src/public/operations/decision-firmness.ts +83 -10
  147. package/src/public/operations/discovery-executors.ts +124 -7
  148. package/src/public/operations/schema6-check-actions.ts +43 -2
  149. package/src/public/operations/source-path-dangling.ts +12 -2
  150. package/src/public/operations/specs/discovery.ts +6 -0
  151. package/src/public/operations/specs/planning.ts +1 -1
  152. package/src/public/operations/specs/reporting.ts +6 -4
  153. package/src/public/operations/specs/semantic.ts +4 -2
  154. package/src/public/operations/specs/upsert.ts +1 -1
  155. package/src/public/schemas/entity.ts +1 -1
  156. package/src/public/skills/kibi-bootstrap/SKILL.md +5 -4
  157. package/src/public/skills/kibi-usage/SKILL.md +36 -16
  158. package/src/public/skills/kibi-usage/resources/workflows.md +3 -1
  159. package/src/schemas/entity.schema.json +1 -1
@@ -234,23 +234,36 @@ function isVerificationScope(value) {
234
234
  function isVerificationPerspective(value) {
235
235
  return value === "internal" || value === "consumer";
236
236
  }
237
- function parseFrontmatter(content) {
237
+ /**
238
+ * Splits a document into its front matter block and body. Delimiters are
239
+ * whole lines of `---`; a `---` glued onto a value (`priority: must---`) or
240
+ * inside a value does not close the block.
241
+ */
242
+ function splitFrontmatter(content) {
238
243
  const trimmedStart = content.trimStart();
239
- if (!trimmedStart.startsWith("---")) {
240
- return { data: {}, content };
244
+ const opening = /^---[^\S\r\n]*(?:\r?\n|$)/.exec(trimmedStart);
245
+ if (!opening) {
246
+ return null;
241
247
  }
242
- const parts = trimmedStart.split("---");
243
- if (parts.length < 3) {
244
- return { data: {}, content };
248
+ const rest = trimmedStart.slice(opening[0].length);
249
+ const closing = /^---[^\S\r\n]*(?:\r?\n|$)/m.exec(rest);
250
+ if (!closing) {
251
+ return "unclosed";
245
252
  }
246
- const frontmatter = parts[1];
247
- if (frontmatter === undefined) {
253
+ return {
254
+ frontmatter: rest.slice(0, closing.index),
255
+ body: rest.slice(closing.index + closing[0].length),
256
+ };
257
+ }
258
+ function parseFrontmatter(content) {
259
+ const split = splitFrontmatter(content);
260
+ if (split === null || split === "unclosed") {
248
261
  return { data: {}, content };
249
262
  }
250
- const parsed = yamlLoad(frontmatter);
263
+ const parsed = yamlLoad(split.frontmatter);
251
264
  return {
252
265
  data: isObjectRecord(parsed) ? parsed : {},
253
- content: parts.slice(2).join("---"),
266
+ content: split.body,
254
267
  };
255
268
  }
256
269
  /**
@@ -280,14 +293,12 @@ export function requirementSemanticText(body) {
280
293
  return legacyRequirementSemanticText(withoutContextSections(body));
281
294
  }
282
295
  function hasLikelyUnquotedColonInTitle(content) {
283
- if (!content.trim().startsWith("---")) {
284
- return false;
285
- }
286
- const parts = content.split("---");
287
- if (parts.length < 2) {
288
- return false;
289
- }
290
- const frontmatter = parts[1];
296
+ const split = splitFrontmatter(content);
297
+ const frontmatter = split === null
298
+ ? undefined
299
+ : split === "unclosed"
300
+ ? content
301
+ : split.frontmatter;
291
302
  return frontmatter
292
303
  ? /^\s*title:\s*(?!["'])(?![>|])[^#\n]*:\s+\S.*$/m.test(frontmatter)
293
304
  : false;
@@ -343,16 +354,13 @@ data, entityType) {
343
354
  // implements REQ-007, REQ-004
344
355
  function extractFromMarkdownContent(content, filePath) {
345
356
  try {
346
- const { data, content: body } = parseFrontmatter(content);
347
- if (content.trim().startsWith("---")) {
348
- const parts = content.split("---");
349
- if (parts.length < 3) {
350
- throw new FrontmatterError("Missing closing --- delimiter", filePath, {
351
- classification: "Missing closing ---",
352
- hint: "Ensure the frontmatter is enclosed between two '---' delimiters.",
353
- });
354
- }
357
+ if (splitFrontmatter(content) === "unclosed") {
358
+ throw new FrontmatterError("Missing closing --- delimiter", filePath, {
359
+ classification: "Missing closing ---",
360
+ hint: "Ensure the frontmatter is enclosed between two '---' delimiter lines; a '---' appended to the last value does not close it.",
361
+ });
355
362
  }
363
+ const { data, content: body } = parseFrontmatter(content);
356
364
  const type = data.type || inferTypeFromPath(filePath);
357
365
  if (!type) {
358
366
  throw new FrontmatterError("Could not determine entity type from path or frontmatter", filePath, {
@@ -513,7 +521,8 @@ function extractFromMarkdownContent(content, filePath) {
513
521
  entity.rationale = data.rationale;
514
522
  }
515
523
  // implements REQ-kb-decision-firmness
516
- // How firmly a requirement or ADR was decided; absent reads as default.
524
+ // How firmly a requirement or ADR was decided; when absent, readers derive
525
+ // it from the origin (default for an agent's write, else firm).
517
526
  if (data.firmness !== undefined) {
518
527
  if (!carriesFirmness(type) || !isFirmness(data.firmness)) {
519
528
  throw new FrontmatterError(carriesFirmness(type)
@@ -717,14 +726,8 @@ function extractFromMarkdownContent(content, filePath) {
717
726
  hint =
718
727
  'Wrap values containing colons in quotes (e.g., title: "Foo: Bar").';
719
728
  }
720
- else if (!content.trim().startsWith("---") ||
721
- content.split("---").length < 3) {
722
- if (content.trim().startsWith("---") &&
723
- content.split("---").length < 3) {
724
- classification = "Missing closing ---";
725
- hint =
726
- "Ensure the frontmatter is enclosed between two '---' delimiters.";
727
- }
729
+ else if (splitFrontmatter(content) === null) {
730
+ // No front matter block: keep the generic classification.
728
731
  }
729
732
  else if (message.includes("unexpected end of the stream") ||
730
733
  message.includes("flow collection") ||
@@ -61,6 +61,8 @@ type GraphEdge = Readonly<{
61
61
  from: string;
62
62
  to: string;
63
63
  }>;
64
+ /** Workspace file paths the question names in its text, in order, once each. */
65
+ export declare function questionPaths(query: string): string[];
64
66
  /** Markdown bodies already read in this search, keyed by entity source. */
65
67
  export type MarkdownBodyCache = Map<string, string | null>;
66
68
  export declare function rankIntentEntities(entities: readonly Record<string, unknown>[], options: IntentSearchOptions, workspaceRoot: string, graphEdges?: readonly GraphEdge[], bodyCache?: MarkdownBodyCache): Promise<IntentSearchResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"intent-search.d.ts","sourceRoot":"","sources":["../src/intent-search.ts"],"names":[],"mappings":"AAKA,O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H,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC,OAAO,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACtC,QAAQ,EAAE,oBAAoB,CAAC;CAChC,CAAC,CAAC;AAEH,KAAK,SAAS,GAAG,QAAQ,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC,CAAC;AA6IH,gFAAgF;AAChF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAQrD;AA2WD,2EAA2E;AAE3E,MAAM,MAAM,iBAAiB,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;AA8B3D,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAC5C,OAAO,EAAE,mBAAmB,EAC5B,aAAa,EAAE,MAAM,EACrB,UAAU,GAAE,SAAS,SAAS,EAAO,EACrC,SAAS,GAAE,iBAA6B,GACvC,OAAO,CAAC,kBAAkB,CAAC,CAqJ7B;AAoCD,wBAAgB,SAAS,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,MAAM,CAO1E;AA8FD,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,mBAAmB,EAC5B,MAAM,EAAE,UAAU,EAClB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,kBAAkB,CAAC,CAoD7B;AAGD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI,CA0C1E"}
@@ -116,8 +116,46 @@ const AMBIGUOUS_MARGIN = 0.05;
116
116
  const MAX_CANDIDATES = 10_000;
117
117
  const MAX_GRAPH_SEEDS = 5;
118
118
  const MAX_GRAPH_EDGES = 2_000;
119
+ // A code identifier names its words without spaces ("canExport",
120
+ // "toggleViewMode"). An entity keeps it whole and also reads it word by
121
+ // word; a question reads it word by word only, so the identifier does not
122
+ // weigh twice. A question about a helper then meets the requirement that
123
+ // uses its words.
124
+ const CAMEL_IDENTIFIER = /[A-Za-z0-9]*[a-z0-9][A-Z][A-Za-z0-9]*/g;
125
+ function splitIdentifier(identifier) {
126
+ return identifier.replace(/([a-z0-9])([A-Z])/g, "$1 $2");
127
+ }
128
+ function expandIdentifiers(value) {
129
+ return value.replace(CAMEL_IDENTIFIER, (identifier) => `${identifier} ${splitIdentifier(identifier)}`);
130
+ }
131
+ // A workspace file path written in the question: at least one directory
132
+ // and a file extension ("src/app/auth.service.ts"), not a URL.
133
+ const QUESTION_PATH = /(?<![\w:/.-])(?:\.{1,2}\/)?(?:[\w@~+-][\w@.~+-]*\/)+[\w@~+-][\w@.~+-]*\.[A-Za-z0-9]{1,8}(?![\w/])/g;
134
+ // implements REQ-kibi-intent-aware-source-discovery
135
+ /** Workspace file paths the question names in its text, in order, once each. */
136
+ export function questionPaths(query) {
137
+ return [
138
+ ...new Set([...query.matchAll(QUESTION_PATH)].map((match) => match[0].replace(/^\.\//, ""))),
139
+ ];
140
+ }
141
+ /**
142
+ * The question's topic text: identifiers expanded, and file paths removed,
143
+ * both the ones it passes as `sourceLocations` and the ones written in the
144
+ * question. A path's words ("src", "services", "ts") are not the topic and
145
+ * would only dilute the words that are; `sourceLocations` is how a path
146
+ * reaches the search as source evidence.
147
+ */
148
+ function topicText(query, locations = []) {
149
+ let topic = query.replace(QUESTION_PATH, " ");
150
+ for (const location of locations) {
151
+ const located = location.path.replace(/^\.\//, "");
152
+ if (located.length > 0)
153
+ topic = topic.split(located).join(" ");
154
+ }
155
+ return topic.replace(CAMEL_IDENTIFIER, splitIdentifier);
156
+ }
119
157
  function normalize(value) {
120
- return value
158
+ return expandIdentifiers(value)
121
159
  .trim()
122
160
  .toLowerCase()
123
161
  .replace(/[-_]+/g, " ")
@@ -406,13 +444,14 @@ async function readBodies(entities, workspaceRoot, cache) {
406
444
  }
407
445
  // implements REQ-kibi-intent-aware-source-discovery, REQ-bootstrap-provenance-stubs
408
446
  export async function rankIntentEntities(entities, options, workspaceRoot, graphEdges = [], bodyCache = new Map()) {
409
- const queryTokens = tokens(options.query);
447
+ const query = topicText(options.query, options.sourceLocations);
448
+ const queryTokens = tokens(query);
410
449
  const facets = facetValues(options.semanticFacets);
411
450
  const facetTokens = facets.flatMap((facet) => tokens(facet.value));
412
451
  const allTokens = Array.from(new Set([...queryTokens, ...facetTokens]));
413
452
  // Each clause of a compound question is also scored on its own, so the
414
453
  // words of one clause do not dilute a match on another.
415
- const clauseTokenSets = queryClauses(options.query).map((clause) => Array.from(new Set([...clause, ...facetTokens])));
454
+ const clauseTokenSets = queryClauses(query).map((clause) => Array.from(new Set([...clause, ...facetTokens])));
416
455
  const bodies = await readBodies(entities, workspaceRoot, bodyCache);
417
456
  const documentFrequency = buildDocumentFrequency(entities, bodies);
418
457
  const supersededIds = new Set(graphEdges
@@ -586,7 +625,7 @@ async function queryGraphEdges(prolog, seedIds) {
586
625
  }
587
626
  async function loadIntentCandidates(prolog, options) {
588
627
  const terms = [
589
- options.query,
628
+ topicText(options.query, options.sourceLocations),
590
629
  ...facetValues(options.semanticFacets).map((facet) => facet.value),
591
630
  ].filter((term, index, all) => term.trim() && all.indexOf(term) === index);
592
631
  const candidates = new Map();
@@ -1,5 +1,11 @@
1
1
  import type { OperationContext } from "../../public/operations/runtime-types.js";
2
- import type { ActivationPolicy } from "./types.js";
2
+ import type { ActivationPolicy, Candidate } from "./types.js";
3
3
  export declare function missingManifestActivation(vendored: boolean, projectSignal: boolean): ActivationPolicy;
4
+ /**
5
+ * On a seeded KB the plan may hold declared intent claims, already
6
+ * deduplicated against the existing KB. Such a plan is applicable like a thin
7
+ * bootstrap plan; a seeded plan holding anything else stays a handoff.
8
+ */
9
+ export declare function claimPlanActivation(policy: ActivationPolicy, candidates: readonly Candidate[]): ActivationPolicy;
4
10
  export declare function classifyActivation(context: OperationContext, files?: readonly string[]): Promise<ActivationPolicy>;
5
11
  //# sourceMappingURL=activation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"activation.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/activation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAGjF,OAAO,KAAK,EAAE,gBAAgB,EAAmB,MAAM,YAAY,CAAC;AAIpE,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,OAAO,EACjB,aAAa,EAAE,OAAO,GACrB,gBAAgB,CAIlB;AAmHD,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,gBAAgB,EACzB,KAAK,GAAE,SAAS,MAAM,EAAO,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CAyE3B"}
1
+ {"version":3,"file":"activation.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/activation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAGjF,OAAO,KAAK,EAAE,gBAAgB,EAAmB,SAAS,EAAE,MAAM,YAAY,CAAC;AAI/E,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,OAAO,EACjB,aAAa,EAAE,OAAO,GACrB,gBAAgB,CAIlB;AAkED;;;;GAIG;AAGH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,gBAAgB,EACxB,UAAU,EAAE,SAAS,SAAS,EAAE,GAC/B,gBAAgB,CAelB;AAyDD,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,gBAAgB,EACzB,KAAK,GAAE,SAAS,MAAM,EAAO,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CAyE3B"}
@@ -16,6 +16,7 @@ function activationFor(state) {
16
16
  // Discovery remains useful for explaining the next step, but the
17
17
  // resulting plan is blocked until `kibi init` establishes the root.
18
18
  allowCandidateGeneration: true,
19
+ allowDeclaredClaims: true,
19
20
  reason: "Workspace has no attached root KB yet; run `kibi init` before planning bootstrap knowledge.",
20
21
  handoffMessage: "Kibi infrastructure is not initialized. Run `kibi init`, then ask the agent to bootstrap this repository.",
21
22
  };
@@ -25,6 +26,7 @@ function activationFor(state) {
25
26
  activationMode: "repair_bootstrap",
26
27
  applyBlocked: true,
27
28
  allowCandidateGeneration: true,
29
+ allowDeclaredClaims: true,
28
30
  reason: "Workspace root is only partially configured; run a repair bootstrap scan and keep apply blocked until the root is repaired.",
29
31
  };
30
32
  case "vendored_only":
@@ -33,6 +35,7 @@ function activationFor(state) {
33
35
  activationMode: "vendored_blocked",
34
36
  applyBlocked: true,
35
37
  allowCandidateGeneration: false,
38
+ allowDeclaredClaims: false,
36
39
  reason: "Workspace appears to contain vendored Kibi sources only; bootstrap generation is blocked in this posture.",
37
40
  handoffMessage: "Vendored Kibi posture detected. Move to the real project root before attempting bootstrap.",
38
41
  };
@@ -42,19 +45,41 @@ function activationFor(state) {
42
45
  activationMode: "attached_thin_bootstrap",
43
46
  applyBlocked: false,
44
47
  allowCandidateGeneration: true,
48
+ allowDeclaredClaims: true,
45
49
  reason: "Workspace has an attached but unseeded KB; deterministic bootstrap planning is eligible.",
46
50
  };
47
51
  case "root_active_seeded":
48
52
  return {
49
53
  activationState: state,
50
54
  activationMode: "attached_seeded_handoff",
55
+ // Blocked until the plan holds declared claims; see claimPlanActivation.
51
56
  applyBlocked: true,
52
57
  allowCandidateGeneration: false,
53
- reason: "Workspace already has an attached seeded KB; bootstrap synthesis is replaced by an explicit seeded handoff.",
54
- handoffMessage: "Attached seeded KB detected. Use existing KB context instead of generating bootstrap candidates.",
58
+ allowDeclaredClaims: true,
59
+ reason: "Workspace already has an attached seeded KB; discovered bootstrap candidates are replaced by an explicit seeded handoff, and only declared intent claims are planned against the existing KB.",
60
+ handoffMessage: "Attached seeded KB detected. Kibi does not generate discovered bootstrap candidates here: use kb_search and kb_query for existing KB context. Declare cited intentClaims in bootstrapContext to plan them against the existing KB, or compile each claim with kb_compile_intent.",
55
61
  };
56
62
  }
57
63
  }
64
+ /**
65
+ * On a seeded KB the plan may hold declared intent claims, already
66
+ * deduplicated against the existing KB. Such a plan is applicable like a thin
67
+ * bootstrap plan; a seeded plan holding anything else stays a handoff.
68
+ */
69
+ // implements REQ-bootstrap-discovered-candidate-budget
70
+ // covered_by TEST-KIBI-BOOTSTRAP-PLAN-APPLY
71
+ export function claimPlanActivation(policy, candidates) {
72
+ if (policy.activationState !== "root_active_seeded" ||
73
+ candidates.length === 0 ||
74
+ candidates.some((candidate) => candidate.sourceKind !== "intent_claim"))
75
+ return policy;
76
+ return {
77
+ ...policy,
78
+ applyBlocked: false,
79
+ reason: "Workspace already has an attached seeded KB; discovered bootstrap candidates are not generated, and the plan holds only declared intent claims that are not yet in the KB.",
80
+ handoffMessage: "Attached seeded KB detected. The plan holds only your declared intent claims, deduplicated against the existing KB: review it and call kb_apply_plan after explicit approval. Discovered candidates are not generated here; use kb_search and kb_query for existing knowledge, and compile any claim left in sourceOnlySignals with kb_compile_intent.",
81
+ };
82
+ }
58
83
  async function exists(context, target) {
59
84
  try {
60
85
  await context.fs?.stat(target);
@@ -15,6 +15,12 @@ export declare function strictPlan(writeSet: StrictWriteSet): readonly Readonly<
15
15
  * more than its front matter.
16
16
  */
17
17
  export declare function withDocumentBody(step: Readonly<Record<string, unknown>>, body: string): Readonly<Record<string, unknown>>;
18
+ /**
19
+ * Record a requirement bootstrap read from a person's document as theirs: an
20
+ * import with a reference to the passage, and `firmness: firm`, so an agent
21
+ * asks before changing it instead of treating it as its own default choice.
22
+ */
23
+ export declare function asImportedRule(step: Readonly<Record<string, unknown>>, ref: string): Readonly<Record<string, unknown>>;
18
24
  /**
19
25
  * Where a deterministic bootstrap provider found an entry. No reason was
20
26
  * stated in the source, so the sentence records provenance instead of
@@ -1 +1 @@
1
- {"version":3,"file":"candidate-helpers.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/candidate-helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,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AAO,CAAC,CAAC,EACvC,GAAG,EAAE,MAAM,GACV,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAanC;AAED;;;;GAIG;AAEH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM,CAER;AAED,yEAAyE;AAEzE,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAExE;AAED;;;GAGG;AAEH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED;;;GAGG;AAEH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,MAAM,CAMR"}
@@ -69,6 +69,25 @@ export function strictPlan(writeSet) {
69
69
  export function withDocumentBody(step, body) {
70
70
  return { ...step, document: { body } };
71
71
  }
72
+ /**
73
+ * Record a requirement bootstrap read from a person's document as theirs: an
74
+ * import with a reference to the passage, and `firmness: firm`, so an agent
75
+ * asks before changing it instead of treating it as its own default choice.
76
+ */
77
+ // implements REQ-kb-decision-firmness
78
+ export function asImportedRule(step, ref) {
79
+ const properties = step.properties !== null && typeof step.properties === "object"
80
+ ? step.properties
81
+ : {};
82
+ return {
83
+ ...step,
84
+ properties: {
85
+ ...properties,
86
+ origin: { kind: "import", ref },
87
+ firmness: "firm",
88
+ },
89
+ };
90
+ }
72
91
  /**
73
92
  * Where a deterministic bootstrap provider found an entry. No reason was
74
93
  * stated in the source, so the sentence records provenance instead of
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/generate.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAcjF,OAAO,KAAK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AE,SAAS,SAAS,EAAE,EAC3B,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAC1C,OAAO,EAAE,MAAM,GACd;IACD,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,UAAU,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;IAClE,QAAQ,CAAC,iBAAiB,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACxD,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC,CAwJA;AAkMD,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,mBAAmB,CAAC,CAqI9B"}
@@ -4,6 +4,7 @@ import { loadEntityIds } from "../../public/operations/discovery-entities.js";
4
4
  import { executeStatus } from "../../public/operations/discovery-executors.js";
5
5
  import { readWorkspaceSnapshot } from "../../public/operations/workspace-snapshot.js";
6
6
  import { stagedLogicalGroundingError, } from "../semantic-advisor/ingestion-boundary.js";
7
+ import { claimPlanActivation } from "./activation.js";
7
8
  import { buildBootstrapCandidates, isProvenanceStubCandidate, } from "./candidates.js";
8
9
  import { discoverBootstrap } from "./discovery.js";
9
10
  import { buildIntentClaimCandidates } from "./intent-claims.js";
@@ -218,13 +219,40 @@ function stagedGroundingError(candidate, planned) {
218
219
  }
219
220
  return null;
220
221
  }
221
- async function existingEntityIds(context) {
222
- if (!context.prolog)
223
- return new Set();
222
+ /**
223
+ * One suppressedCandidates row per declared claim the activation mode does
224
+ * not plan, so the per-source accounting names the real reason.
225
+ */
226
+ // implements REQ-bootstrap-intent-claim-accounting
227
+ function activationSuppressedClaims(declared, activation) {
228
+ const sources = new Set((declared.knowledgeSources ?? []).map((source) => source.id));
229
+ return (declared.intentClaims ?? [])
230
+ .filter((claim) => sources.has(claim.sourceId))
231
+ .map((claim) => ({
232
+ candidateId: "",
233
+ reason: "suppressed_by_activation",
234
+ sourcePath: claim.reference,
235
+ entityType: (claim.kind ?? "intent") === "intent" ? "req" : "fact",
236
+ statement: claim.statement,
237
+ sourceId: claim.sourceId,
238
+ activationMode: activation.activationMode,
239
+ }));
240
+ }
241
+ /**
242
+ * IDs already in the KB, so declared claims and discovered candidates that
243
+ * exist are counted under entity_exists instead of being planned again. An
244
+ * attached root starts the lazy engine when the host supplied none (the CLI
245
+ * does so for status anyway); an unattached root never starts one.
246
+ */
247
+ // implements REQ-bootstrap-intent-claim-accounting
248
+ async function existingEntityIds(context, attached) {
224
249
  try {
250
+ const prolog = context.prolog ?? (attached ? await context.ensureProlog?.() : undefined);
251
+ if (!prolog)
252
+ return new Set();
225
253
  // Ids only: materializing every entity (receipt histories included)
226
254
  // just to build this set exceeds the bounded engine output.
227
- return new Set((await loadEntityIds(context.prolog)).filter(Boolean));
255
+ return new Set((await loadEntityIds(prolog)).filter(Boolean));
228
256
  }
229
257
  catch (error) {
230
258
  throw new Error(`Bootstrap binding could not read existing entity IDs: ${error instanceof Error ? error.message : String(error)}`);
@@ -317,13 +345,12 @@ export async function executePlanBootstrap(args, context) {
317
345
  const minConfidence = clamp(args.minConfidence ?? 0.8, 0.6, 0.95);
318
346
  const maxCandidates = clamp(Math.trunc(args.maxCandidates ?? 50), 1, 200);
319
347
  const entityBindingDiagnostics = [];
320
- const [discovery, existingIds] = await Promise.all([
321
- discoverBootstrap(context),
322
- existingEntityIds(context).catch((error) => {
323
- entityBindingDiagnostics.push(error.message);
324
- return new Set();
325
- }),
326
- ]);
348
+ const discovery = await discoverBootstrap(context);
349
+ const existingIds = await existingEntityIds(context, discovery.activation.activationState === "root_active_thin" ||
350
+ discovery.activation.activationState === "root_active_seeded").catch((error) => {
351
+ entityBindingDiagnostics.push(error.message);
352
+ return new Set();
353
+ });
327
354
  // Discovery runs before planning so its evidence paths can be bound into
328
355
  // the exact plan rather than leaving the reviewer to reconstruct them.
329
356
  const bound = await expectedSnapshots(context, discovery.evidence
@@ -341,13 +368,17 @@ export async function executePlanBootstrap(args, context) {
341
368
  diagnostics: [],
342
369
  };
343
370
  // Intent harvested from declared knowledge sources joins the repository
344
- // evidence under the same activation policy, filters, and selection.
345
- const claimed = discovery.activation.allowCandidateGeneration
371
+ // evidence under the same filters and selection. A seeded KB still plans
372
+ // declared claims (deduplicated against the existing KB); only discovered
373
+ // candidates stay off there.
374
+ const allowDeclaredClaims = discovery.activation.allowDeclaredClaims ??
375
+ discovery.activation.allowCandidateGeneration;
376
+ const claimed = allowDeclaredClaims
346
377
  ? buildIntentClaimCandidates(declared, existingIds, minConfidence, subjectKeys)
347
378
  : {
348
379
  candidates: [],
349
380
  sourceOnlySignals: [],
350
- suppressed: [],
381
+ suppressed: activationSuppressedClaims(declared, discovery.activation),
351
382
  diagnostics: [],
352
383
  };
353
384
  const filteredSignals = filterSourceOnlySignals([...built.sourceOnlySignals, ...claimed.sourceOnlySignals], args.entityTypes);
@@ -361,10 +392,19 @@ export async function executePlanBootstrap(args, context) {
361
392
  entityType: "",
362
393
  }));
363
394
  const { bindingDiagnostics, ...expected } = bound;
395
+ // A seeded plan holding only declared claims is applicable.
396
+ const activation = claimPlanActivation(discovery.activation, shared.candidates);
364
397
  return presentBootstrap({
365
398
  root: context.workspaceRoot,
366
- activation: discovery.activation,
367
- discoverySummary: discovery.summary,
399
+ activation,
400
+ discoverySummary: {
401
+ ...discovery.summary,
402
+ applyBlocked: activation.applyBlocked,
403
+ reason: activation.reason,
404
+ ...(activation.handoffMessage
405
+ ? { handoffMessage: activation.handoffMessage }
406
+ : {}),
407
+ },
368
408
  migrationWarning: discovery.migrationWarning,
369
409
  pluginOffers: discovery.pluginOffers,
370
410
  ...(args.bootstrapContext
@@ -1 +1 @@
1
- {"version":3,"file":"guidance-actions.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/guidance-actions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACxB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAkBpB,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,gBAAgB,EAC5B,QAAQ,EAAE,wBAAwB,EAClC,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACpC,MAAM,GAAE,SAAS,WAAW,EAAO,GAClC,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAgF9C"}
1
+ {"version":3,"file":"guidance-actions.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/guidance-actions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACxB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAkBpB,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,gBAAgB,EAC5B,QAAQ,EAAE,wBAAwB,EAClC,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACpC,MAAM,GAAE,SAAS,WAAW,EAAO,GAClC,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CA6F9C"}
@@ -52,6 +52,8 @@ export function buildActions(root, activation, declared, candidates, signals, of
52
52
  : "Use kb_coverage to review traceability and identify areas needing attention.",
53
53
  });
54
54
  }
55
+ const seeded = activation.activationMode === "attached_seeded_handoff";
56
+ const declaredClaims = declared.intentClaims?.length ?? 0;
55
57
  if (activation.applyBlocked)
56
58
  result.push({
57
59
  order: order++,
@@ -62,14 +64,24 @@ export function buildActions(root, activation, declared, candidates, signals, of
62
64
  result.push({
63
65
  order: order++,
64
66
  kind: "plan",
65
- description: `Review the ${candidates.length} safe candidate(s) in the hash-bound plan, then call kb_apply_plan after explicit approval.`,
67
+ description: seeded
68
+ ? `Review the ${candidates.length} candidate(s) planned from declared intent claims (discovered candidates are not generated on a seeded KB, and claims already in the KB are not planned again), then call kb_apply_plan after explicit approval.`
69
+ : `Review the ${candidates.length} safe candidate(s) in the hash-bound plan, then call kb_apply_plan after explicit approval.`,
66
70
  candidateIds: candidates.map((candidate) => candidate.candidateId),
67
71
  });
72
+ // On a seeded KB, declared claims the plan does not write go through the
73
+ // compile workflow, not a second bootstrap.
74
+ if (seeded && declaredClaims > 0 && candidates.length === 0)
75
+ result.push({
76
+ order: order++,
77
+ kind: "handoff",
78
+ description: "No declared intent claim could be planned. Claims already in the KB need nothing; compile each remaining claim with kb_compile_intent, citing its source and reference (see the Knowledge source diagnostics).",
79
+ });
68
80
  if (signals.length > 0)
69
81
  result.push({
70
82
  order: order++,
71
83
  kind: "handoff",
72
- description: `Author ${[...new Set(signals.map((signal) => signal.kind.toUpperCase()))].join("/")} entities manually from source-only evidence.`,
84
+ description: `Author ${[...new Set(signals.map((signal) => signal.kind.toUpperCase()))].join("/")} entities manually from source-only evidence${seeded ? "; compile declared claims left there with kb_compile_intent" : ""}.`,
73
85
  });
74
86
  for (const offer of offers)
75
87
  result.push({
@@ -1 +1 @@
1
- {"version":3,"file":"guidance.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/guidance.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACxB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAwFpB,wBAAgB,UAAU,CACxB,UAAU,EAAE,gBAAgB,EAC5B,QAAQ,EAAE,wBAAwB,EAClC,UAAU,EAAE,SAAS,SAAS,EAAE,E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,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAkEnC;AAGD,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAC5C,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;CAC1C,GAAG;IACF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACvD,QAAQ,CAAC,OAAO,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;CAChE,CA2BA"}
@@ -51,7 +51,10 @@ function prompt(root, activation, declared, candidates, signals, warnings) {
51
51
  }
52
52
  else if (declared.verificationAnchors.length > 0)
53
53
  bullets.push(`- Verify after kb_check with ${summary(declared.verificationAnchors, 2)}.`);
54
- if (activation.activationMode === "attached_thin_handoff" ||
54
+ if (activation.activationMode === "attached_seeded_handoff" &&
55
+ !activation.applyBlocked)
56
+ bullets.push("- Seeded KB: only declared intent claims are planned; use kb_search or kb_query for existing knowledge.");
57
+ else if (activation.activationMode === "attached_thin_handoff" ||
55
58
  activation.activationMode === "attached_seeded_handoff")
56
59
  bullets.push("- Handoff: use kb_search, kb_query, or gap/coverage tools to work with existing KB.");
57
60
  if (warnings.length > 0)
@@ -78,7 +81,8 @@ export function confidence(activation, declared, candidates, signals, promptBloc
78
81
  repair_bootstrap: -0.05,
79
82
  attached_thin_bootstrap: 0.04,
80
83
  attached_thin_handoff: -0.12,
81
- attached_seeded_handoff: -0.18,
84
+ // A seeded plan of declared claims weighs like a thin bootstrap plan.
85
+ attached_seeded_handoff: activation.applyBlocked ? -0.18 : 0.04,
82
86
  vendored_blocked: -0.25,
83
87
  }[activation.activationMode];
84
88
  reasons.push(`${activation.activationMode} determined the bootstrap posture.`);
@@ -1 +1 @@
1
- {"version":3,"file":"intent-claims.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/intent-claims.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,kBAAkB,EAGxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,wBAAwB,EAGxB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAQpB,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,iBAAiB,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACxD,QAAQ,CAAC,UAAU,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;IAClE,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC,CAAC;AAyOF;;;;;;;GAOG;AAEH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,wBAAwB,EAClC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,aAAa,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,kBAAkB,GAC/B,sBAAsB,CAyKxB"}
1
+ {"version":3,"file":"intent-claims.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/intent-claims.ts"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,kBAAkB,EAGxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,wBAAwB,EAGxB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAQpB,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,iBAAiB,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACxD,QAAQ,CAAC,UAAU,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;IAClE,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC,CAAC;AAyOF;;;;;;;GAOG;AAEH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,wBAAwB,EAClC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,aAAa,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,kBAAkB,GAC/B,sBAAsB,CA4KxB"}
@@ -1,7 +1,7 @@
1
1
  import { createHash } from "node:crypto";
2
2
  import { renderRequirementBody } from "../../entity-body-context.js";
3
3
  import { buildStrictWriteSet } from "../../utils/strict-modeling.js";
4
- import { confidenceBand, strictPlan, upsert } from "./candidate-helpers.js";
4
+ import { asImportedRule, confidenceBand, strictPlan, upsert, } from "./candidate-helpers.js";
5
5
  import { claimFor, planSubjectKey, } from "./requirement-claims.js";
6
6
  /** How much a claim is trusted follows the authority the human assigned. */
7
7
  const AUTHORITY_CONFIDENCE = {
@@ -298,7 +298,7 @@ export function buildIntentClaimCandidates(declared, existingIds, minConfidence,
298
298
  to,
299
299
  })),
300
300
  applyPlan: strictPlan(writeSet).map((step) => step.type === "req"
301
- ? withClaimBody(withRationale(step, claim.rationale), claimBody(source, claim))
301
+ ? withClaimBody(asImportedRule(withRationale(step, claim.rationale), provenance), claimBody(source, claim))
302
302
  : step),
303
303
  });
304
304
  continue;
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-candidates.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/markdown-candidates.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,KA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CAAC,CAAC,EAAE,CAAC;CACnE,CAAC;AAyGF;;;;GAIG;AAEH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,MAAM,GACnB,MAAM,GAAG,SAAS,CAYpB;AA4FD,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,iBAAiB,EACvB,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,aAAa,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,kBAAkB,GAC/B,oBAAoB,CAoFtB"}
@@ -1,6 +1,6 @@
1
1
  import path from "node:path";
2
2
  import { buildStrictWriteSet } from "../../utils/strict-modeling.js";
3
- import { bootstrapProvenance, confidenceBand, provenanceBody, provenanceRequirementBody, slug, strictPlan, upsert, withDocumentBody, } from "./candidate-helpers.js";
3
+ import { asImportedRule, bootstrapProvenance, confidenceBand, provenanceBody, provenanceRequirementBody, slug, strictPlan, upsert, withDocumentBody, } from "./candidate-helpers.js";
4
4
  import { claimFor, normalizeClaimStatement, planSubjectKey, } from "./requirement-claims.js";
5
5
  function headingSignals(heading, sourcePath, textRef, minConfidence) {
6
6
  const result = [];
@@ -150,7 +150,7 @@ function requirementCandidate(item, statement, line, heading, headingLine, exist
150
150
  to,
151
151
  })),
152
152
  applyPlan: strictPlan(writeSet).map((step) => step.type === "req"
153
- ? withDocumentBody(step, provenanceRequirementBody(statement, bootstrapProvenance("generic markdown", `${relativePath} line ${line}${heading ? ` under the heading "${heading}"` : ""}`, confidence), `${relativePath}#L${line}`))
153
+ ? withDocumentBody(asImportedRule(step, `${relativePath}#L${line}`), provenanceRequirementBody(statement, bootstrapProvenance("generic markdown", `${relativePath} line ${line}${heading ? ` under the heading "${heading}"` : ""}`, confidence), `${relativePath}#L${line}`))
154
154
  : step),
155
155
  };
156
156
  }
@@ -1 +1 @@
1
- {"version":3,"file":"presentation.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/presentation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,o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