kibi-cli 2.23.0 → 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 (59) hide show
  1. package/dist/cli-operation-metadata.d.ts +1 -1
  2. package/dist/cli-operation-metadata.js +1 -1
  3. package/dist/commands/migrate.d.ts.map +1 -1
  4. package/dist/commands/migrate.js +23 -0
  5. package/dist/decision-firmness.d.ts +16 -4
  6. package/dist/decision-firmness.d.ts.map +1 -1
  7. package/dist/decision-firmness.js +29 -6
  8. package/dist/extractors/markdown.d.ts.map +1 -1
  9. package/dist/extractors/markdown.js +2 -1
  10. package/dist/intent-search.d.ts +2 -0
  11. package/dist/intent-search.d.ts.map +1 -1
  12. package/dist/intent-search.js +16 -5
  13. package/dist/operations/bootstrap/candidate-helpers.d.ts +6 -0
  14. package/dist/operations/bootstrap/candidate-helpers.d.ts.map +1 -1
  15. package/dist/operations/bootstrap/candidate-helpers.js +19 -0
  16. package/dist/operations/bootstrap/intent-claims.d.ts.map +1 -1
  17. package/dist/operations/bootstrap/intent-claims.js +2 -2
  18. package/dist/operations/bootstrap/markdown-candidates.d.ts.map +1 -1
  19. package/dist/operations/bootstrap/markdown-candidates.js +2 -2
  20. package/dist/operations/migration/firm-supersede.d.ts +19 -0
  21. package/dist/operations/migration/firm-supersede.d.ts.map +1 -0
  22. package/dist/operations/migration/firm-supersede.js +60 -0
  23. package/dist/operations/migration/schema6.d.ts.map +1 -1
  24. package/dist/operations/migration/schema6.js +41 -0
  25. package/dist/operations/mutation/requirement-semantics.d.ts +3 -1
  26. package/dist/operations/mutation/requirement-semantics.d.ts.map +1 -1
  27. package/dist/operations/mutation/requirement-semantics.js +13 -2
  28. package/dist/public/operations/catalog.d.ts +1 -1
  29. package/dist/public/operations/decision-firmness.d.ts +14 -0
  30. package/dist/public/operations/decision-firmness.d.ts.map +1 -1
  31. package/dist/public/operations/decision-firmness.js +60 -7
  32. package/dist/public/operations/discovery-executors.d.ts.map +1 -1
  33. package/dist/public/operations/discovery-executors.js +19 -6
  34. package/dist/public/operations/source-path-dangling.js +1 -1
  35. package/dist/public/operations/specs/upsert.d.ts +1 -1
  36. package/dist/public/operations/specs/upsert.js +1 -1
  37. package/dist/public/schemas/entity.js +1 -1
  38. package/dist/public/skills/kibi-bootstrap/SKILL.md +3 -3
  39. package/dist/public/skills/kibi-usage/SKILL.md +31 -14
  40. package/dist/schemas/entity.schema.json +1 -1
  41. package/dist/search-answer.d.ts.map +1 -1
  42. package/dist/search-answer.js +9 -1
  43. package/dist/types/entities.d.ts +2 -2
  44. package/dist/types/entities.d.ts.map +1 -1
  45. package/dist/utils/kb-manifest.d.ts +7 -0
  46. package/dist/utils/kb-manifest.d.ts.map +1 -1
  47. package/dist/utils/kb-manifest.js +6 -0
  48. package/dist/utils/schema-version.d.ts +1 -1
  49. package/dist/utils/schema-version.d.ts.map +1 -1
  50. package/dist/utils/schema-version.js +3 -1
  51. package/package.json +1 -1
  52. package/src/public/operations/decision-firmness.ts +83 -10
  53. package/src/public/operations/discovery-executors.ts +28 -5
  54. package/src/public/operations/source-path-dangling.ts +1 -1
  55. package/src/public/operations/specs/upsert.ts +1 -1
  56. package/src/public/schemas/entity.ts +1 -1
  57. package/src/public/skills/kibi-bootstrap/SKILL.md +3 -3
  58. package/src/public/skills/kibi-usage/SKILL.md +31 -14
  59. package/src/schemas/entity.schema.json +1 -1
@@ -71,7 +71,7 @@ export declare const CLI_OPERATION_METADATA: readonly [{
71
71
  }, {
72
72
  readonly name: "kb_upsert";
73
73
  readonly cliName: "upsert";
74
- readonly description: "Create or update one entity and optional relationships. Use for KB mutations after validating intent; prefer a dryRun:true call first because it validates without writing and returns semantic advisor receipts for prose-heavy requirements. Use kb_model (mode requirement) before hand-writing strict property facts from prose, and kb_model (mode predicates) before hand-writing ontology predicate facts. Use the `relationships` array for batch creation of multiple links in a single call (e.g., linking a requirement to multiple tests or facts). Prefer modeling requirements as reusable fact links (`constrains`, `requires_property`, or `requires_predicate`) so consistency and contradiction checks remain queryable. Relationship endpoints must already exist in KB. For requirements, the write will be rejected if it contradicts existing current requirements that constrain the same subject with incompatible properties. To replace a conflicting requirement, include a `supersedes` relationship from the new requirement to the old one in the same request, then upsert the old requirement with status closed (kb_check blocks a superseded requirement that is not closed). Successful writes may return non-blocking semantic advisor warnings; inspect and repair those warnings before treating prose as contradiction-checkable. Pass a sectioned `document.body` when creating a requirement (the statement, then `## Context` stating why it exists, who asked and the source, then `## Source` with the verbatim excerpt) and a prose body for scenarios, tests, ADRs and observation facts; a result warning reports an entity whose body lacks context, and kb_check blocks it under entity-context-missing. Never invent a reason the requester did not give: write 'Reason not stated'. Do not use for read-only inspection. Side effects: writes KB, may refresh symbol coordinates; dryRun:true writes nothing.";
74
+ readonly description: "Create or update one entity and optional relationships. Use for KB mutations after validating intent; prefer a dryRun:true call first because it validates without writing and returns semantic advisor receipts for prose-heavy requirements. Use kb_model (mode requirement) before hand-writing strict property facts from prose, and kb_model (mode predicates) before hand-writing ontology predicate facts. Use the `relationships` array for batch creation of multiple links in a single call (e.g., linking a requirement to multiple tests or facts). An update keeps the properties and relationships it leaves out: send the fields that change (with title and status) and only the links to add. Prefer modeling requirements as reusable fact links (`constrains`, `requires_property`, or `requires_predicate`) so consistency and contradiction checks remain queryable. Relationship endpoints must already exist in KB. For requirements, the write will be rejected if it contradicts existing current requirements that constrain the same subject with incompatible properties. To replace a conflicting requirement, include a `supersedes` relationship from the new requirement to the old one in the same request, then upsert the old requirement with status closed (kb_check blocks a superseded requirement that is not closed). Successful writes may return non-blocking semantic advisor warnings; inspect and repair those warnings before treating prose as contradiction-checkable. Pass a sectioned `document.body` when creating a requirement (the statement, then `## Context` stating why it exists, who asked and the source, then `## Source` with the verbatim excerpt) and a prose body for scenarios, tests, ADRs and observation facts; a result warning reports an entity whose body lacks context, and kb_check blocks it under entity-context-missing. Never invent a reason the requester did not give: write 'Reason not stated'. Do not use for read-only inspection. Side effects: writes KB, may refresh symbol coordinates; dryRun:true writes nothing.";
75
75
  }, {
76
76
  readonly name: "kb_delete";
77
77
  readonly cliName: "delete";
@@ -85,7 +85,7 @@ export const CLI_OPERATION_METADATA = [
85
85
  {
86
86
  name: "kb_upsert",
87
87
  cliName: "upsert",
88
- description: "Create or update one entity and optional relationships. Use for KB mutations after validating intent; prefer a dryRun:true call first because it validates without writing and returns semantic advisor receipts for prose-heavy requirements. Use kb_model (mode requirement) before hand-writing strict property facts from prose, and kb_model (mode predicates) before hand-writing ontology predicate facts. Use the `relationships` array for batch creation of multiple links in a single call (e.g., linking a requirement to multiple tests or facts). Prefer modeling requirements as reusable fact links (`constrains`, `requires_property`, or `requires_predicate`) so consistency and contradiction checks remain queryable. Relationship endpoints must already exist in KB. For requirements, the write will be rejected if it contradicts existing current requirements that constrain the same subject with incompatible properties. To replace a conflicting requirement, include a `supersedes` relationship from the new requirement to the old one in the same request, then upsert the old requirement with status closed (kb_check blocks a superseded requirement that is not closed). Successful writes may return non-blocking semantic advisor warnings; inspect and repair those warnings before treating prose as contradiction-checkable. Pass a sectioned `document.body` when creating a requirement (the statement, then `## Context` stating why it exists, who asked and the source, then `## Source` with the verbatim excerpt) and a prose body for scenarios, tests, ADRs and observation facts; a result warning reports an entity whose body lacks context, and kb_check blocks it under entity-context-missing. Never invent a reason the requester did not give: write 'Reason not stated'. Do not use for read-only inspection. Side effects: writes KB, may refresh symbol coordinates; dryRun:true writes nothing.",
88
+ description: "Create or update one entity and optional relationships. Use for KB mutations after validating intent; prefer a dryRun:true call first because it validates without writing and returns semantic advisor receipts for prose-heavy requirements. Use kb_model (mode requirement) before hand-writing strict property facts from prose, and kb_model (mode predicates) before hand-writing ontology predicate facts. Use the `relationships` array for batch creation of multiple links in a single call (e.g., linking a requirement to multiple tests or facts). An update keeps the properties and relationships it leaves out: send the fields that change (with title and status) and only the links to add. Prefer modeling requirements as reusable fact links (`constrains`, `requires_property`, or `requires_predicate`) so consistency and contradiction checks remain queryable. Relationship endpoints must already exist in KB. For requirements, the write will be rejected if it contradicts existing current requirements that constrain the same subject with incompatible properties. To replace a conflicting requirement, include a `supersedes` relationship from the new requirement to the old one in the same request, then upsert the old requirement with status closed (kb_check blocks a superseded requirement that is not closed). Successful writes may return non-blocking semantic advisor warnings; inspect and repair those warnings before treating prose as contradiction-checkable. Pass a sectioned `document.body` when creating a requirement (the statement, then `## Context` stating why it exists, who asked and the source, then `## Source` with the verbatim excerpt) and a prose body for scenarios, tests, ADRs and observation facts; a result warning reports an entity whose body lacks context, and kb_check blocks it under entity-context-missing. Never invent a reason the requester did not give: write 'Reason not stated'. Do not use for read-only inspection. Side effects: writes KB, may refresh symbol coordinates; dryRun:true writes nothing.",
89
89
  },
90
90
  {
91
91
  name: "kb_delete",
@@ -1 +1 @@
1
- {"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../src/commands/migrate.ts"],"names":[],"mappings":"AA+CA,OAAO,KAAK,EACV,eAAe,EAEhB,MAAM,wCAAwC,CAAC;AAwBhD,UAAU,cAAc;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,uFAAuF;IACvF,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,6EAA6E;IAC7E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qFAAqF;IACrF,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAA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AM,WAAW,mBAAmB;IAClC,kEAAkE;IAClE,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,oBAAoB,CAAC;IAC5B,0EAA0E;IAC1E,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAgJD,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,OAAO,EACzB,UAAU,EAAE,MAAM,GAAG,IAAI,GACxB,MAAM,CAUR;AAsOD,wBAAgB,+BAA+B,IAAI;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAKtE;AAGD,wBAAsB,cAAc,CAClC,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,mBAAmB,CAAA;CAAE,CAAC,CAmb9D;AAED;;;;GAIG;AAEH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAGzE;AA+WD;;;;;GAKG;AAEH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,GACpC,OAAO,CAOT"}
@@ -85,6 +85,12 @@ const SCHEMA_MIGRATION_STEPS = [
85
85
  to: 9,
86
86
  description: "Accept firmness on requirements and ADRs, and acknowledge in the manifest the current supersedes recorded without a 'Why this changed' section; no source file is rewritten and no reason is invented.",
87
87
  },
88
+ {
89
+ id: "firmness-from-origin-v10",
90
+ from: 9,
91
+ to: 10,
92
+ description: "Read a requirement or ADR without firmness as firm unless an agent wrote it, and acknowledge in the manifest the supersedes of such decisions recorded before; no source file is rewritten and no firmness is written.",
93
+ },
88
94
  ];
89
95
  function migrationStepsFor(fromVersion) {
90
96
  const start = Math.max(0, fromVersion ?? 0);
@@ -410,7 +416,9 @@ export async function migrateCommand(options = {}) {
410
416
  const polarityBackfill = planPolarityValueBackfill(cwd);
411
417
  const bodyContextStep = migrationSteps.some((step) => step.id === "entity-body-context-v8");
412
418
  const decisionFirmnessStep = migrationSteps.some((step) => step.id === "decision-firmness-v9");
419
+ const firmnessFromOriginStep = migrationSteps.some((step) => step.id === "firmness-from-origin-v10");
413
420
  const { mergeSupersedesAcknowledgements, planSupersedesReasonAcknowledgement, } = await import("../operations/migration/supersedes-reason.js");
421
+ const { mergeFirmSupersedeAcknowledgements, planFirmSupersedeAcknowledgement, } = await import("../operations/migration/firm-supersede.js");
414
422
  const { acknowledgedContextIds, applyContextMissingTags, applySemanticTextPins, countByType, planContextMissingTags, planSemanticTextPins, } = await import("../operations/migration/entity-body-context.js");
415
423
  if (options.dryRun) {
416
424
  if (polarityBackfill.length > 0)
@@ -432,6 +440,11 @@ export async function migrateCommand(options = {}) {
432
440
  if (unexplained.length > 0)
433
441
  console.log(`dry run: would acknowledge ${unexplained.length} supersede(s) recorded without a 'Why this changed' section (manifest only; no reason is written).`);
434
442
  }
443
+ if (firmnessFromOriginStep) {
444
+ const firmEdges = planFirmSupersedeAcknowledgement(cwd);
445
+ if (firmEdges.length > 0)
446
+ console.log(`dry run: would acknowledge ${firmEdges.length} supersede(s) of decisions that read as firm from schema 10 (manifest only; no firmness is written).`);
447
+ }
435
448
  if (storagePlan.moves.length > 0) {
436
449
  console.log(`dry run: would move ${storagePlan.moves.length} legacy knowledge file(s) into .kb/:`);
437
450
  for (const move of storagePlan.moves) {
@@ -512,6 +525,9 @@ export async function migrateCommand(options = {}) {
512
525
  const supersedesUnexplained = decisionFirmnessStep
513
526
  ? planSupersedesReasonAcknowledgement(cwd)
514
527
  : [];
528
+ const firmSupersedes = firmnessFromOriginStep
529
+ ? planFirmSupersedeAcknowledgement(cwd)
530
+ : [];
515
531
  const existingManifest = readKbManifest(cwd) ?? defaultKbManifest();
516
532
  writeKbManifest(cwd, {
517
533
  ...existingManifest,
@@ -532,9 +548,16 @@ export async function migrateCommand(options = {}) {
532
548
  supersedesReasonAcknowledged: mergeSupersedesAcknowledgements(existingManifest.supersedesReasonAcknowledged, supersedesUnexplained),
533
549
  }
534
550
  : {}),
551
+ ...(firmSupersedes.length > 0
552
+ ? {
553
+ firmSupersedeAcknowledged: mergeFirmSupersedeAcknowledgements(existingManifest.firmSupersedeAcknowledged, firmSupersedes),
554
+ }
555
+ : {}),
535
556
  });
536
557
  if (supersedesUnexplained.length > 0)
537
558
  console.log(`Acknowledged ${supersedesUnexplained.length} supersede(s) recorded without a 'Why this changed' section; new supersedes must explain themselves.`);
559
+ if (firmSupersedes.length > 0)
560
+ console.log(`Acknowledged ${firmSupersedes.length} supersede(s) of decisions without firmness that read as firm from schema 10; a new replacement of such a decision must be firm.`);
538
561
  const auditRecord = buildMigrationAuditRecord({
539
562
  branch,
540
563
  manifestPath: KB_MANIFEST_RELATIVE,
@@ -1,7 +1,7 @@
1
1
  /** Firmness values, firmest first. */
2
2
  export declare const FIRMNESS_VALUES: readonly ["firm", "default", "exploratory"];
3
3
  export type Firmness = (typeof FIRMNESS_VALUES)[number];
4
- /** The firmness of a decision that does not state one. */
4
+ /** The firmness of an agent-written decision that does not state one. */
5
5
  export declare const DEFAULT_FIRMNESS: Firmness;
6
6
  /** Entity types that carry firmness. */
7
7
  export declare const FIRMNESS_TYPES: readonly ["req", "adr"];
@@ -18,10 +18,22 @@ export declare function supersedeAcknowledgement(from: string, to: string): stri
18
18
  export declare function isFirmness(value: unknown): value is Firmness;
19
19
  export declare function carriesFirmness(type: unknown): boolean;
20
20
  /**
21
- * The firmness a decision is read with: the authored value, else `default`.
22
- * Undefined for types that carry no firmness.
21
+ * The firmness a decision is read with: the authored value, else what its
22
+ * origin implies. A decision an agent wrote (`origin.kind: agent`) without a
23
+ * firmness is a delegated choice, `default`. Any other decision without one
24
+ * (written by a person, imported from their documents, or carried over from
25
+ * before origins were recorded) is theirs, so it reads as `firm`: an agent
26
+ * asks before changing it. Undefined for types that carry no firmness.
23
27
  */
24
- export declare function effectiveFirmness(type: unknown, value: unknown): Firmness | undefined;
28
+ export declare function effectiveFirmness(type: unknown, value: unknown, origin?: unknown): Firmness | undefined;
29
+ /**
30
+ * Whether a decision's firmness comes from its origin rather than an authored
31
+ * `firmness` value. Rules that judge the author's own marking (a firm decision
32
+ * must cite the person's words) apply only to explicit values.
33
+ */
34
+ export declare function firmnessIsImplicit(type: unknown, value: unknown): boolean;
35
+ /** The `kind` of an origin record, or undefined when there is none. */
36
+ export declare function originKind(origin: unknown): string | undefined;
25
37
  /**
26
38
  * The reference that makes a firm decision traceable to a human's words:
27
39
  * `origin.ref`, or `approval_ref` on a requirement.
@@ -1 +1 @@
1
- {"version":3,"file":"decision-firmness.d.ts","sourceRoot":"","sources":["../src/decision-firmness.ts"],"names":[],"mappings":"AA4BA,sCAAsC;AAEtC,eAAO,MAAM,eAAe,6CAA8C,CAAC;AAG3E,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAExD,0DAA0D;AAE1D,eAAO,MAAM,gBAAgB,EAAE,QAAoB,CAAC;AAEpD,wCAAwC;AAExC,eAAO,MAAM,cAAc,yBAA0B,CAAC;AAEtD,0EAA0E;AAE1E,eAAO,MAAM,wBAAwB,qBAAqB,CAAC;AAE3D,+DAA+D;AAE/D,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAIxC;;;;GAIG;AAEH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAEzE;AAGD,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAK5D;AAGD,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAKtD;AAED;;;GAGG;AAEH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,OAAO,GACb,QAAQ,GAAG,SAAS,CAGtB;AAED;;;GAGG;AAEH,wBAAgB,WAAW,CAAC,MAAM,EAAE;IAClC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,E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I,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,MAAM,GAAG,SAAS,CAcrB;AAMD;;;GAGG;AAEH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAkBxD"}
@@ -26,7 +26,7 @@ import { parseBodySections } from "./entity-body-context.js";
26
26
  /** Firmness values, firmest first. */
27
27
  // implements REQ-kb-decision-firmness
28
28
  export const FIRMNESS_VALUES = ["firm", "default", "exploratory"];
29
- /** The firmness of a decision that does not state one. */
29
+ /** The firmness of an agent-written decision that does not state one. */
30
30
  // implements REQ-kb-decision-firmness
31
31
  export const DEFAULT_FIRMNESS = "default";
32
32
  /** Entity types that carry firmness. */
@@ -59,14 +59,37 @@ export function carriesFirmness(type) {
59
59
  FIRMNESS_TYPES.includes(type));
60
60
  }
61
61
  /**
62
- * The firmness a decision is read with: the authored value, else `default`.
63
- * Undefined for types that carry no firmness.
62
+ * The firmness a decision is read with: the authored value, else what its
63
+ * origin implies. A decision an agent wrote (`origin.kind: agent`) without a
64
+ * firmness is a delegated choice, `default`. Any other decision without one
65
+ * (written by a person, imported from their documents, or carried over from
66
+ * before origins were recorded) is theirs, so it reads as `firm`: an agent
67
+ * asks before changing it. Undefined for types that carry no firmness.
64
68
  */
65
- // implements REQ-kb-decision-firmness
66
- export function effectiveFirmness(type, value) {
69
+ // implements REQ-kb-decision-firmness, REQ-kb-decision-firmness-from-origin
70
+ export function effectiveFirmness(type, value, origin) {
67
71
  if (!carriesFirmness(type))
68
72
  return undefined;
69
- return isFirmness(value) ? value : DEFAULT_FIRMNESS;
73
+ if (isFirmness(value))
74
+ return value;
75
+ return originKind(origin) === "agent" ? DEFAULT_FIRMNESS : "firm";
76
+ }
77
+ /**
78
+ * Whether a decision's firmness comes from its origin rather than an authored
79
+ * `firmness` value. Rules that judge the author's own marking (a firm decision
80
+ * must cite the person's words) apply only to explicit values.
81
+ */
82
+ // implements REQ-kb-decision-firmness-from-origin
83
+ export function firmnessIsImplicit(type, value) {
84
+ return carriesFirmness(type) && !isFirmness(value);
85
+ }
86
+ /** The `kind` of an origin record, or undefined when there is none. */
87
+ // implements REQ-kb-decision-firmness-from-origin
88
+ export function originKind(origin) {
89
+ if (origin === null || typeof origin !== "object")
90
+ return undefined;
91
+ const kind = origin.kind;
92
+ return typeof kind === "string" ? kind : undefined;
70
93
  }
71
94
  /**
72
95
  * The reference that makes a firm decision traceable to a human's words:
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/extractors/markdown.ts"],"names":[],"mappings":"AAsBA,OAAO,EAEL,KAAK,QAAQ,EAGd,MAAM,yBAAyB,CAAC;AAMjC,OAAO,EACL,KAAK,YAAY,EAElB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,aAAa,EACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,KAAK,YAAY,EAElB,MAAM,4BAA4B,CAAC;AAuEpC,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,EAAE,CA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CAAC,EAC7B,UAAU,EAAE,MAAM,GACjB,MAAM,EAAE,CAkDV;AAiiBD,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,gBAAgB,CAElB;AAGD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAatE;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CASjE;AASD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAQpE"}
@@ -521,7 +521,8 @@ function extractFromMarkdownContent(content, filePath) {
521
521
  entity.rationale = data.rationale;
522
522
  }
523
523
  // implements REQ-kb-decision-firmness
524
- // 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).
525
526
  if (data.firmness !== undefined) {
526
527
  if (!carriesFirmness(type) || !isFirmness(data.firmness)) {
527
528
  throw new FrontmatterError(carriesFirmness(type)
@@ -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,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,KAAK,EAAE,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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"}
@@ -128,14 +128,25 @@ function splitIdentifier(identifier) {
128
128
  function expandIdentifiers(value) {
129
129
  return value.replace(CAMEL_IDENTIFIER, (identifier) => `${identifier} ${splitIdentifier(identifier)}`);
130
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
+ }
131
141
  /**
132
- * The question's topic text: identifiers expanded, and the paths it also
133
- * passes as `sourceLocations` removed. Those paths already reach the
134
- * search as source evidence; their words ("src", "services", "ts") are not
135
- * the topic and would only dilute the words that are.
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.
136
147
  */
137
148
  function topicText(query, locations = []) {
138
- let topic = query;
149
+ let topic = query.replace(QUESTION_PATH, " ");
139
150
  for (const location of locations) {
140
151
  const located = location.path.replace(/^\.\//, "");
141
152
  if (located.length > 0)
@@ -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,gCAAgC,CAAC;AAIrE,wBAAgB,cAAc,CAAC,KAAK,EAAE,MA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C,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":"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,MAA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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,KAAK,kBAAkB,EAIxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,iBAAiB,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACxD,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,UAAU,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,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
+ {"version":3,"file":"markdown-candidates.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/markdown-candidates.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,iBAAiB,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACxD,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,UAAU,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,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
  }
@@ -0,0 +1,19 @@
1
+ /** Migration action code for the schema 10 acknowledgement. */
2
+ export declare const FIRM_SUPERSEDE_ACKNOWLEDGE_CODE = "firm_supersede_acknowledge";
3
+ /**
4
+ * Supersede edges recorded before schema 10 that replace a decision which
5
+ * now reads as firm from its origin, by a decision that is not firm, and
6
+ * that the manifest does not acknowledge yet. Nothing in the sources
7
+ * changes: the manifest only records that these supersedes predate the
8
+ * rule. Read-only.
9
+ */
10
+ export declare function planFirmSupersedeAcknowledgement(workspaceRoot: string): string[];
11
+ /** The manifest list with the edges added, sorted and unique. */
12
+ export declare function mergeFirmSupersedeAcknowledgements(existing: readonly string[] | undefined, edges: readonly string[]): string[];
13
+ /**
14
+ * Record the acknowledged edges in the manifest; returns how many edges
15
+ * were acknowledged. Without a manifest there is no schema to upgrade from,
16
+ * so it refuses rather than report an acknowledgement it did not write.
17
+ */
18
+ export declare function applyFirmSupersedeAcknowledgement(workspaceRoot: string): number;
19
+ //# sourceMappingURL=firm-supersede.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firm-supersede.d.ts","sourceRoot":"","sources":["../../../src/operations/migration/firm-supersede.ts"],"names":[],"mappings":"AAyBA,+DAA+D;AAE/D,eAAO,MAAM,+BAA+B,+BAA+B,CAAC;AAE5E;;;;;;GAMG;AAEH,wBAAgB,gCAAgC,CAC9C,aAAa,EAAE,MAAM,GACpB,MAAM,EAAE,CASV;AAED,iEAAiE;AAEjE,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EACvC,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,MAAM,EAAE,CAEV;AAED;;;;GAIG;AAEH,wBAAgB,iCAAiC,CAC/C,aAAa,EAAE,MAAM,GACpB,MAAM,CAiBR"}
@@ -0,0 +1,60 @@
1
+ /*
2
+ Kibi — repo-local, per-branch, queryable long-term memory for software projects
3
+ Copyright (C) 2026 Piotr Franczyk
4
+
5
+ This program is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU Affero General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU Affero General Public License for more details.
14
+
15
+ You should have received a copy of the GNU Affero General Public License
16
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+ */
18
+ import { authoredSupersedes, implicitFirmSupersedes, listDecisionEntities, } from "../../public/operations/decision-firmness.js";
19
+ import { readKbManifest, writeKbManifest } from "../../utils/kb-manifest.js";
20
+ /** Migration action code for the schema 10 acknowledgement. */
21
+ // implements REQ-kb-decision-firmness-from-origin, REQ-cli-schema-migration
22
+ export const FIRM_SUPERSEDE_ACKNOWLEDGE_CODE = "firm_supersede_acknowledge";
23
+ /**
24
+ * Supersede edges recorded before schema 10 that replace a decision which
25
+ * now reads as firm from its origin, by a decision that is not firm, and
26
+ * that the manifest does not acknowledge yet. Nothing in the sources
27
+ * changes: the manifest only records that these supersedes predate the
28
+ * rule. Read-only.
29
+ */
30
+ // implements REQ-kb-decision-firmness-from-origin, REQ-cli-schema-migration
31
+ export function planFirmSupersedeAcknowledgement(workspaceRoot) {
32
+ const entities = listDecisionEntities(workspaceRoot);
33
+ const known = new Set(readKbManifest(workspaceRoot)?.firmSupersedeAcknowledged ?? []);
34
+ return implicitFirmSupersedes(entities, authoredSupersedes(workspaceRoot, entities)).filter((edge) => !known.has(edge));
35
+ }
36
+ /** The manifest list with the edges added, sorted and unique. */
37
+ // implements REQ-kb-decision-firmness-from-origin
38
+ export function mergeFirmSupersedeAcknowledgements(existing, edges) {
39
+ return [...new Set([...(existing ?? []), ...edges])].sort();
40
+ }
41
+ /**
42
+ * Record the acknowledged edges in the manifest; returns how many edges
43
+ * were acknowledged. Without a manifest there is no schema to upgrade from,
44
+ * so it refuses rather than report an acknowledgement it did not write.
45
+ */
46
+ // implements REQ-kb-decision-firmness-from-origin, REQ-cli-schema-migration
47
+ export function applyFirmSupersedeAcknowledgement(workspaceRoot) {
48
+ const edges = planFirmSupersedeAcknowledgement(workspaceRoot);
49
+ if (edges.length === 0)
50
+ return 0;
51
+ const manifest = readKbManifest(workspaceRoot);
52
+ if (manifest === null) {
53
+ throw new Error("Cannot acknowledge existing supersedes without .kb/manifest.json; run 'kibi migrate --yes', which writes the manifest and the acknowledgement together.");
54
+ }
55
+ writeKbManifest(workspaceRoot, {
56
+ ...manifest,
57
+ firmSupersedeAcknowledged: mergeFirmSupersedeAcknowledgements(manifest.firmSupersedeAcknowledged, edges),
58
+ });
59
+ return edges.length;
60
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"schema6.d.ts","sourceRoot":"","sources":["../../../src/operations/migration/schema6.ts"],"names":[],"mappings":"AAuBA,OAAO,EACL,KAAK,eAAe,EAErB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAEL,kCAAkC,EAClC,wBAAwB,EAC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ACpC,aAAa,EAAE,MAAM,GACpB,eAAe,GAAG,IAAI,CAqBxB;AAED,qEAAqE;AAErE,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,SAAS,MAAM,EAAE,GAC3B,eAAe,CAEjB;AAgDD,KAAK,YAAY,GAAG,QAAQ,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC,CAAC;AAEH,4DAA4D;AAE5D,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,IAAI,CAAC,CAoHf;AAED;;;GAGG;AAEH,eAAO,MAAM,+BAA+B,EAAE,WAAW,CAAC,MAAM,CAK9D,CAAC;AAGH,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAYtD,CAAC"}
@@ -17,10 +17,12 @@
17
17
  */
18
18
  import path from "node:path";
19
19
  import { extractFromMarkdown, } from "../../extractors/markdown.js";
20
+ import { FIRMNESS_FROM_ORIGIN_SCHEMA_VERSION } from "../../public/operations/decision-firmness.js";
20
21
  import { migrationAction, } from "../../public/operations/migration-plan.js";
21
22
  import { CLOSE_SUPERSEDED_REQUIREMENTS_ACTION_ID, CLOSE_SUPERSEDED_REQUIREMENTS_CODE, MIGRATION_SYNC_ACTION_ID, MIGRATION_SYNC_CODE, SOURCE_PATH_REWRITE_ACTION_ID, SOURCE_PATH_REWRITE_CODE, closeSupersededRequirementsActionInput, exceptionUnapprovedActionInput, migrationSyncActionInput, sourcePathReviewActionInput, sourcePathRewriteActionInput, supersessionCycleReviewActionInput, } from "../../public/operations/schema6-check-actions.js";
22
23
  import { readAllShards } from "../../relationships/shards.js";
23
24
  import { CONTEXT_MISSING_TAG_CODE, SEMANTIC_TEXT_PIN_CODE, applyContextMissingTags, applySemanticTextPins, countByType, planContextMissingTags, planSemanticTextPins, } from "./entity-body-context.js";
25
+ import { FIRM_SUPERSEDE_ACKNOWLEDGE_CODE, applyFirmSupersedeAcknowledgement, planFirmSupersedeAcknowledgement, } from "./firm-supersede.js";
24
26
  import { applyInventoryRederivation, applyInventoryRederivationDroppingGrounding, planInventoryRederivation, } from "./inventory-rederive.js";
25
27
  import { listLaneMarkdownFiles } from "./kb-sources.js";
26
28
  import { applyOriginBackfill, planOriginBackfill } from "./origin-backfill.js";
@@ -470,6 +472,40 @@ export function buildSchema6MigrationFragment(input) {
470
472
  }));
471
473
  }
472
474
  }
475
+ // Schema 10: a decision without firmness that an agent did not write now
476
+ // reads as firm. Acknowledge supersedes of such decisions recorded before
477
+ // that, so history does not block; new ones must come from a person.
478
+ if (input.currentSchemaVersion === null ||
479
+ input.currentSchemaVersion < FIRMNESS_FROM_ORIGIN_SCHEMA_VERSION) {
480
+ const edges = planFirmSupersedeAcknowledgement(input.workspaceRoot);
481
+ if (edges.length > 0) {
482
+ const id = "firm-supersede-acknowledge";
483
+ // Manifest only, but the bumped schema blocks without it.
484
+ sourceRewriteActionIds.push(id);
485
+ actions.push(migrationAction({
486
+ id,
487
+ code: FIRM_SUPERSEDE_ACKNOWLEDGE_CODE,
488
+ category: "schema",
489
+ safety: "automatic",
490
+ autoApplicable: true,
491
+ invocation: {
492
+ kind: "cli",
493
+ command_argv: ["kibi", "migrate", "--yes"],
494
+ },
495
+ affectedEntityIds: [
496
+ ...new Set(edges.map((edge) => edge.split(" -> ")[0] ?? edge)),
497
+ ].sort(),
498
+ affectedFiles: [".kb/manifest.json"],
499
+ postconditions: [{ rule: "decision-firm-superseded", findings: 0 }],
500
+ evidence: {
501
+ reason: "Schema 10 reads a requirement or ADR without firmness as firm unless an agent wrote it, and blocks a replacement of a firm decision that is not itself firm. Supersedes recorded before that are acknowledged in the manifest; no firmness is written.",
502
+ count: edges.length,
503
+ edges,
504
+ preserves: "every authored source file",
505
+ },
506
+ }));
507
+ }
508
+ }
473
509
  const drift = planInventoryRederivation(input.workspaceRoot);
474
510
  for (const plan of drift) {
475
511
  const action = plan.safe ? rederiveAction(plan) : reviewAction(plan);
@@ -670,6 +706,10 @@ export async function applySchema6MigrationAction(action, context) {
670
706
  applySupersedesReasonAcknowledgement(context.workspaceRoot);
671
707
  return;
672
708
  }
709
+ case FIRM_SUPERSEDE_ACKNOWLEDGE_CODE: {
710
+ applyFirmSupersedeAcknowledgement(context.workspaceRoot);
711
+ return;
712
+ }
673
713
  case SEMANTIC_INVENTORY_REDERIVE_CODE: {
674
714
  const requirementId = action.affectedEntityIds[0];
675
715
  if (requirementId === undefined)
@@ -749,6 +789,7 @@ export const SCHEMA6_AUTOMATIC_CODES = new Set([
749
789
  SEMANTIC_TEXT_PIN_CODE,
750
790
  CONTEXT_MISSING_TAG_CODE,
751
791
  SUPERSEDES_REASON_ACKNOWLEDGE_CODE,
792
+ FIRM_SUPERSEDE_ACKNOWLEDGE_CODE,
752
793
  SEMANTIC_INVENTORY_REDERIVE_CODE,
753
794
  ENTITY_ORIGIN_BACKFILL_CODE,
754
795
  CLOSE_SUPERSEDED_REQUIREMENTS_CODE,
@@ -8,7 +8,9 @@ import type { StagedUpsertState, UpsertInput } from "./types.js";
8
8
  * relationship (for example `specified_by`) and carries no `semantic_*` or
9
9
  * `logic_claims` field, and no `title` or `text_ref` that differs from the
10
10
  * stored value, is merged over the stored semantic contract (and the stored
11
- * `text_ref` it omits) before validation. The
11
+ * `text_ref` it omits) before validation. When the stored ledger reads its
12
+ * prose from `semantic_text`, a changed `text_ref` is merged the same way,
13
+ * since it is not the prose. The
12
14
  * proposition-complete check then runs against the merged requirement, which
13
15
  * is also what the write records. A payload that supplies any ledger field or
14
16
  * changes the prose is validated exactly as given.
@@ -1 +1 @@
1
- {"version":3,"file":"requirement-semantics.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/requirement-semantics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAE3E,OAAO,EAEL,KAAK,oBAAoB,EAE1B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,KAAK,kBAAkB,EAExB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAwCjE;;;;;;;;;;GAUG;AACH,wBAAsB,8BAA8B,CAClD,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,EACjC,MAAM,CAAC,EAAE,iBAAiB,EAC1B,MAAM,GAAE,kBAAqE,GAC5E,OAAO,CAAC,WAAW,CAAC,CA6BtB;AAuBD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,+BAA+B,CACnD,KAAK,EAAE,WAAW,EAClB,aAAa,EAAE,SAAS,oBAAoB,EAAE,EAC9C,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,EACjC,MAAM,CAAC,EAAE,iBAAiB,EAC1B,MAAM,GAAE,kBAAqE,GAC5E,OAAO,CAAC,IAAI,CAAC,CAmBf"}
1
+ {"version":3,"file":"requirement-semantics.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/requirement-semantics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAE3E,OAAO,EAEL,KAAK,oBAAoB,EAE1B,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EACL,KAAK,kBAAkB,EAExB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAwCjE;;;;;;;;;;;;GAYG;AACH,wBAAsB,8BAA8B,CAClD,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,EACjC,MAAM,CAAC,EAAE,iBAAiB,EAC1B,MAAM,GAAE,kBAAqE,GAC5E,OAAO,CAAC,WAAW,CAAC,CAsCtB;AAuBD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,+BAA+B,CACnD,KAAK,EAAE,WAAW,EAClB,aAAa,EAAE,SAAS,oBAAoB,EAAE,EAC9C,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,EACjC,MAAM,CAAC,EAAE,iBAAiB,EAC1B,MAAM,GAAE,kBAAqE,GAC5E,OAAO,CAAC,IAAI,CAAC,CAmBf"}