kibi-cli 2.20.0 → 2.21.2
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.
- package/dist/cli-operation-metadata.d.ts +1 -1
- package/dist/cli-operation-metadata.js +1 -1
- package/dist/commands/doctor.js +13 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +15 -3
- package/dist/commands/legacy-storage-migration.d.ts.map +1 -1
- package/dist/commands/legacy-storage-migration.js +26 -1
- package/dist/commands/migrate.d.ts +2 -0
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +155 -11
- package/dist/commands/sync/discovery.d.ts.map +1 -1
- package/dist/commands/sync/discovery.js +14 -2
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +4 -0
- package/dist/decision-firmness.d.ts +39 -0
- package/dist/decision-firmness.d.ts.map +1 -0
- package/dist/decision-firmness.js +115 -0
- package/dist/extractors/markdown.d.ts +2 -0
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +16 -1
- package/dist/operations/migration/kb-sources.d.ts +5 -1
- package/dist/operations/migration/kb-sources.d.ts.map +1 -1
- package/dist/operations/migration/kb-sources.js +28 -1
- package/dist/operations/migration/schema6.d.ts +2 -0
- package/dist/operations/migration/schema6.d.ts.map +1 -1
- package/dist/operations/migration/schema6.js +44 -1
- package/dist/operations/migration/supersedes-reason.d.ts +26 -0
- package/dist/operations/migration/supersedes-reason.d.ts.map +1 -0
- package/dist/operations/migration/supersedes-reason.js +69 -0
- package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-applyplan.js +10 -2
- package/dist/operations/modeling/predicate-loader.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-loader.js +11 -0
- package/dist/operations/modeling/predicate-types.d.ts +32 -1
- package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
- package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
- package/dist/operations/modeling/suggest-predicates.js +175 -35
- package/dist/operations/mutation/delete.d.ts +5 -1
- package/dist/operations/mutation/delete.d.ts.map +1 -1
- package/dist/operations/mutation/delete.js +223 -17
- package/dist/operations/mutation/serialization.d.ts.map +1 -1
- package/dist/operations/mutation/serialization.js +1 -0
- package/dist/operations/mutation/source-authoring.d.ts +8 -0
- package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
- package/dist/operations/mutation/source-authoring.js +33 -0
- package/dist/operations/mutation/types.d.ts +37 -0
- package/dist/operations/mutation/types.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +54 -2
- package/dist/operations/mutation/validation.d.ts.map +1 -1
- package/dist/operations/mutation/validation.js +2 -1
- package/dist/operations/planning/apply-plan.d.ts +6 -1
- package/dist/operations/planning/apply-plan.d.ts.map +1 -1
- package/dist/operations/planning/apply-plan.js +8 -2
- package/dist/operations/semantic-advisor/clauses.d.ts +9 -0
- package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/clauses.js +24 -0
- package/dist/public/operations/catalog.d.ts +14 -5
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/check-executor.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +3 -0
- package/dist/public/operations/contracts.d.ts.map +1 -1
- package/dist/public/operations/contracts.js +29 -1
- package/dist/public/operations/decision-firmness.d.ts +34 -0
- package/dist/public/operations/decision-firmness.d.ts.map +1 -0
- package/dist/public/operations/decision-firmness.js +216 -0
- package/dist/public/operations/discovery-executors.d.ts.map +1 -1
- package/dist/public/operations/discovery-executors.js +16 -2
- package/dist/public/operations/migration-plan.d.ts.map +1 -1
- package/dist/public/operations/migration-plan.js +37 -7
- package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
- package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
- package/dist/public/operations/specs/check-rules.generated.js +5 -1
- package/dist/public/operations/specs/check.d.ts +1 -1
- package/dist/public/operations/specs/mutation-schemas.d.ts +7 -2
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation-schemas.js +13 -17
- package/dist/public/operations/specs/mutation.d.ts +6 -2
- package/dist/public/operations/specs/mutation.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation.js +6 -2
- package/dist/public/operations/specs/upsert.d.ts +7 -2
- package/dist/public/operations/specs/upsert.d.ts.map +1 -1
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +13 -13
- package/dist/public/skills/kibi-traceability/SKILL.md +6 -4
- package/dist/public/skills/kibi-usage/SKILL.md +52 -10
- package/dist/public/skills/kibi-usage/resources/fact-lanes.md +1 -1
- package/dist/public/skills/kibi-usage/resources/source-authoring.md +4 -2
- package/dist/public/skills/kibi-usage/resources/ui-requirements.md +2 -2
- package/dist/public/skills/kibi-usage/resources/workflows.md +1 -1
- package/dist/relationships/shards.d.ts +10 -0
- package/dist/relationships/shards.d.ts.map +1 -1
- package/dist/relationships/shards.js +27 -11
- package/dist/schemas/entity.schema.json +30 -25
- package/dist/search-answer.d.ts +31 -2
- package/dist/search-answer.d.ts.map +1 -1
- package/dist/search-answer.js +115 -17
- package/dist/types/entities.d.ts +4 -0
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/utils/kb-manifest.d.ts +6 -0
- package/dist/utils/kb-manifest.d.ts.map +1 -1
- package/dist/utils/kb-manifest.js +6 -0
- package/dist/utils/rule-registry.generated.d.ts +21 -0
- package/dist/utils/rule-registry.generated.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.js +25 -0
- package/dist/utils/schema-version.d.ts +1 -1
- package/dist/utils/schema-version.d.ts.map +1 -1
- package/dist/utils/schema-version.js +3 -1
- package/package.json +2 -2
- package/schema/entities.pl +6 -0
- package/src/public/operations/check-executor.ts +6 -0
- package/src/public/operations/contracts.ts +33 -1
- package/src/public/operations/decision-firmness.ts +280 -0
- package/src/public/operations/discovery-executors.ts +17 -2
- package/src/public/operations/migration-plan.ts +41 -9
- package/src/public/operations/specs/check-rules.generated.ts +5 -1
- package/src/public/operations/specs/mutation-schemas.ts +14 -17
- package/src/public/operations/specs/mutation.ts +7 -2
- package/src/public/schemas/entity.ts +14 -13
- package/src/public/skills/kibi-traceability/SKILL.md +6 -4
- package/src/public/skills/kibi-usage/SKILL.md +52 -10
- package/src/public/skills/kibi-usage/resources/fact-lanes.md +1 -1
- package/src/public/skills/kibi-usage/resources/source-authoring.md +4 -2
- package/src/public/skills/kibi-usage/resources/ui-requirements.md +2 -2
- package/src/public/skills/kibi-usage/resources/workflows.md +1 -1
- package/src/schemas/entity.schema.json +30 -25
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
import * as path from "node:path";
|
|
4
|
+
import { planLegacyStorageMigration } from "../../commands/legacy-storage-migration.js";
|
|
4
5
|
import { BRANCH_STORE_NOT_COMPILED } from "../../utils/branch-store.js";
|
|
5
6
|
import { legacyConfigExists } from "../../utils/config.js";
|
|
6
7
|
import { MTIME_SOURCE_REASON_CODES } from "../../utils/content-freshness.js";
|
|
@@ -488,6 +489,13 @@ export function buildActionsFromStatus(input) {
|
|
|
488
489
|
}
|
|
489
490
|
const storeState = typeof store?.state === "string" ? store.state : null;
|
|
490
491
|
const legacyStorageMigrationRequired = legacyConfigExists(input.workspaceRoot);
|
|
492
|
+
// A legacy cutover that cannot move its files (a destination already
|
|
493
|
+
// exists, a malformed config) is an operator decision, not an automatic
|
|
494
|
+
// step that fails when applied and takes the compile with it.
|
|
495
|
+
const legacyStorage = legacyStorageMigrationRequired
|
|
496
|
+
? planLegacyStorageMigration(input.workspaceRoot)
|
|
497
|
+
: null;
|
|
498
|
+
const legacyStorageBlocked = legacyStorage !== null && legacyStorage.blockers.length > 0;
|
|
491
499
|
if (storeState === "missing") {
|
|
492
500
|
actions.push(migrationAction({
|
|
493
501
|
id: "branch-store-ensure",
|
|
@@ -520,6 +528,7 @@ export function buildActionsFromStatus(input) {
|
|
|
520
528
|
}));
|
|
521
529
|
}
|
|
522
530
|
if (configStatus.needsMigration || legacyStorageMigrationRequired) {
|
|
531
|
+
const operatorOnly = configStatus.status === "newer" || legacyStorageBlocked;
|
|
523
532
|
actions.push(migrationAction({
|
|
524
533
|
id: "schema-config-upgrade",
|
|
525
534
|
code: configStatus.status === "invalid"
|
|
@@ -528,17 +537,34 @@ export function buildActionsFromStatus(input) {
|
|
|
528
537
|
? "legacy_storage_migration"
|
|
529
538
|
: "schema_version_upgrade",
|
|
530
539
|
category: "schema",
|
|
531
|
-
state:
|
|
532
|
-
safety:
|
|
533
|
-
invocation:
|
|
540
|
+
state: operatorOnly ? "blocked" : "ready",
|
|
541
|
+
safety: operatorOnly ? "operator" : "automatic",
|
|
542
|
+
invocation: legacyStorageBlocked
|
|
543
|
+
? {
|
|
544
|
+
kind: "review",
|
|
545
|
+
instruction: `The legacy .kb/config.json still names knowledge files outside .kb/ and Kibi cannot move them: ${legacyStorage?.blockers.join(" ")} Compare each legacy copy with its .kb/ copy and keep the current one: replace the .kb/ copy when the legacy one is newer, or remove (git rm) the legacy copy when it is a stale duplicate. Then run 'kibi migrate --yes' to retire .kb/config.json.`,
|
|
546
|
+
}
|
|
547
|
+
: { kind: "cli", command_argv: ["kibi", "migrate", "--yes"] },
|
|
534
548
|
affectedFiles: [
|
|
535
549
|
".kb/manifest.json",
|
|
536
550
|
".kb/migrations",
|
|
537
551
|
".kb/config.json",
|
|
552
|
+
...(legacyStorage?.moves.map((move) => move.from) ?? []),
|
|
538
553
|
],
|
|
539
|
-
evidence: {
|
|
554
|
+
evidence: {
|
|
555
|
+
configStatus,
|
|
556
|
+
...(legacyStorage === null
|
|
557
|
+
? {}
|
|
558
|
+
: {
|
|
559
|
+
legacyStorage: {
|
|
560
|
+
moves: legacyStorage.moves,
|
|
561
|
+
blockers: legacyStorage.blockers,
|
|
562
|
+
legacyConfig: legacyStorage.legacyConfig,
|
|
563
|
+
},
|
|
564
|
+
}),
|
|
565
|
+
},
|
|
540
566
|
dependsOn: storeState === "missing" ? ["branch-store-ensure"] : [],
|
|
541
|
-
autoApplicable:
|
|
567
|
+
autoApplicable: !operatorOnly,
|
|
542
568
|
}));
|
|
543
569
|
}
|
|
544
570
|
// implements REQ-cli-status-pre-first-sync
|
|
@@ -558,9 +584,13 @@ export function buildActionsFromStatus(input) {
|
|
|
558
584
|
typeof store?.path === "string" ? store.path : ".kb/branches",
|
|
559
585
|
],
|
|
560
586
|
evidence: { reason: uncompiled },
|
|
587
|
+
// A blocked schema step waits on an operator; the compile still runs
|
|
588
|
+
// from the .kb/ sources Kibi already reads.
|
|
561
589
|
dependsOn: actions
|
|
562
|
-
.
|
|
563
|
-
.
|
|
590
|
+
.filter((action) => action.state === "ready" &&
|
|
591
|
+
(action.id === "branch-store-ensure" ||
|
|
592
|
+
action.id === "schema-config-upgrade"))
|
|
593
|
+
.map((action) => action.id),
|
|
564
594
|
postconditions: [{ branchStore: "compiled" }],
|
|
565
595
|
autoApplicable: true,
|
|
566
596
|
}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Every selectable kb_check rule name, registry order. */
|
|
2
2
|
export declare const SELECTABLE_RULE_NAMES: readonly string[];
|
|
3
3
|
/** Comma-separated "Allowed:" fragment for the kb_check rules description. */
|
|
4
|
-
export declare const SELECTABLE_RULES_ALLOWED = "must-priority-coverage, symbol-coverage, symbol-traceability, no-dangling-refs, source-relationship-parity, branch-store-not-compiled, source-path-dangling, no-cycles, required-fields, deprecated-adr-no-successor, superseded-requirement-open, scenario-feasibility, scenario-feasibility-unknown, exception-claim-keys, numeric-string-value, rule-key-arguments-missing, domain-contradictions, logic-coverage, rule-safety, rule-verifiability, query-plan-safety, req-status-vocabulary, strict-fact-shape, strict-req-fact-pairing, predicate-verifiability, strict-readiness, semantic-completeness, related-requirement-unmodeled, proof-contract-symbols, entity-id-style, domain-redundancy, domain-implication, subject-key-identity, subject-key-shape, ontology-quality, exception-unapproved, exception-approval-self-attested, agent-requirement-unapproved, requirement-rationale-missing, symbol-owner-superseded, adr-unlinked, adr-proposed, predicate-schema-conformance, entity-context-missing, entity-context-acknowledged, policy-ownership, policy-markers";
|
|
4
|
+
export declare const SELECTABLE_RULES_ALLOWED = "must-priority-coverage, symbol-coverage, symbol-traceability, no-dangling-refs, source-relationship-parity, branch-store-not-compiled, source-path-dangling, no-cycles, required-fields, deprecated-adr-no-successor, superseded-requirement-open, scenario-feasibility, scenario-feasibility-unknown, exception-claim-keys, numeric-string-value, rule-key-arguments-missing, domain-contradictions, logic-coverage, rule-safety, rule-verifiability, query-plan-safety, req-status-vocabulary, strict-fact-shape, strict-req-fact-pairing, predicate-verifiability, strict-readiness, semantic-completeness, related-requirement-unmodeled, proof-contract-symbols, entity-id-style, domain-redundancy, domain-implication, subject-key-identity, subject-key-shape, ontology-quality, exception-unapproved, exception-approval-self-attested, agent-requirement-unapproved, requirement-rationale-missing, symbol-owner-superseded, adr-unlinked, adr-proposed, predicate-schema-conformance, entity-context-missing, entity-context-acknowledged, decision-firm-unreferenced, decision-firm-superseded, supersedes-reason-missing, supersedes-reason-acknowledged, policy-ownership, policy-markers";
|
|
5
5
|
//# sourceMappingURL=check-rules.generated.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-rules.generated.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/check-rules.generated.ts"],"names":[],"mappings":"AAUA,2DAA2D;AAC3D,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"check-rules.generated.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/check-rules.generated.ts"],"names":[],"mappings":"AAUA,2DAA2D;AAC3D,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAoDlD,CAAC;AAGF,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB,4oCACsmC,CAAC"}
|
|
@@ -54,9 +54,13 @@ export const SELECTABLE_RULE_NAMES = [
|
|
|
54
54
|
"predicate-schema-conformance",
|
|
55
55
|
"entity-context-missing",
|
|
56
56
|
"entity-context-acknowledged",
|
|
57
|
+
"decision-firm-unreferenced",
|
|
58
|
+
"decision-firm-superseded",
|
|
59
|
+
"supersedes-reason-missing",
|
|
60
|
+
"supersedes-reason-acknowledged",
|
|
57
61
|
"policy-ownership",
|
|
58
62
|
"policy-markers",
|
|
59
63
|
];
|
|
60
64
|
// implements REQ-006
|
|
61
65
|
/** Comma-separated "Allowed:" fragment for the kb_check rules description. */
|
|
62
|
-
export const SELECTABLE_RULES_ALLOWED = "must-priority-coverage, symbol-coverage, symbol-traceability, no-dangling-refs, source-relationship-parity, branch-store-not-compiled, source-path-dangling, no-cycles, required-fields, deprecated-adr-no-successor, superseded-requirement-open, scenario-feasibility, scenario-feasibility-unknown, exception-claim-keys, numeric-string-value, rule-key-arguments-missing, domain-contradictions, logic-coverage, rule-safety, rule-verifiability, query-plan-safety, req-status-vocabulary, strict-fact-shape, strict-req-fact-pairing, predicate-verifiability, strict-readiness, semantic-completeness, related-requirement-unmodeled, proof-contract-symbols, entity-id-style, domain-redundancy, domain-implication, subject-key-identity, subject-key-shape, ontology-quality, exception-unapproved, exception-approval-self-attested, agent-requirement-unapproved, requirement-rationale-missing, symbol-owner-superseded, adr-unlinked, adr-proposed, predicate-schema-conformance, entity-context-missing, entity-context-acknowledged, policy-ownership, policy-markers";
|
|
66
|
+
export const SELECTABLE_RULES_ALLOWED = "must-priority-coverage, symbol-coverage, symbol-traceability, no-dangling-refs, source-relationship-parity, branch-store-not-compiled, source-path-dangling, no-cycles, required-fields, deprecated-adr-no-successor, superseded-requirement-open, scenario-feasibility, scenario-feasibility-unknown, exception-claim-keys, numeric-string-value, rule-key-arguments-missing, domain-contradictions, logic-coverage, rule-safety, rule-verifiability, query-plan-safety, req-status-vocabulary, strict-fact-shape, strict-req-fact-pairing, predicate-verifiability, strict-readiness, semantic-completeness, related-requirement-unmodeled, proof-contract-symbols, entity-id-style, domain-redundancy, domain-implication, subject-key-identity, subject-key-shape, ontology-quality, exception-unapproved, exception-approval-self-attested, agent-requirement-unapproved, requirement-rationale-missing, symbol-owner-superseded, adr-unlinked, adr-proposed, predicate-schema-conformance, entity-context-missing, entity-context-acknowledged, decision-firm-unreferenced, decision-firm-superseded, supersedes-reason-missing, supersedes-reason-acknowledged, policy-ownership, policy-markers";
|
|
@@ -12,7 +12,7 @@ export declare const checkSpec: {
|
|
|
12
12
|
readonly type: "string";
|
|
13
13
|
readonly enum: readonly string[];
|
|
14
14
|
};
|
|
15
|
-
readonly description: "Optional rule subset. Allowed: must-priority-coverage, symbol-coverage, symbol-traceability, no-dangling-refs, source-relationship-parity, branch-store-not-compiled, source-path-dangling, no-cycles, required-fields, deprecated-adr-no-successor, superseded-requirement-open, scenario-feasibility, scenario-feasibility-unknown, exception-claim-keys, numeric-string-value, rule-key-arguments-missing, domain-contradictions, logic-coverage, rule-safety, rule-verifiability, query-plan-safety, req-status-vocabulary, strict-fact-shape, strict-req-fact-pairing, predicate-verifiability, strict-readiness, semantic-completeness, related-requirement-unmodeled, proof-contract-symbols, entity-id-style, domain-redundancy, domain-implication, subject-key-identity, subject-key-shape, ontology-quality, exception-unapproved, exception-approval-self-attested, agent-requirement-unapproved, requirement-rationale-missing, symbol-owner-superseded, adr-unlinked, adr-proposed, predicate-schema-conformance, entity-context-missing, entity-context-acknowledged, policy-ownership, policy-markers. If omitted, server runs canonical and advisory rules plus the full-KB qualityDiagnostics audit scan, including usage telemetry acceptance when evidence exists; migration rules run only when explicitly selected. Advisory and migration findings are non-blocking qualityDiagnostics. If supplied, server preserves scoped validation and skips the full-KB advisory scan.";
|
|
15
|
+
readonly description: "Optional rule subset. Allowed: must-priority-coverage, symbol-coverage, symbol-traceability, no-dangling-refs, source-relationship-parity, branch-store-not-compiled, source-path-dangling, no-cycles, required-fields, deprecated-adr-no-successor, superseded-requirement-open, scenario-feasibility, scenario-feasibility-unknown, exception-claim-keys, numeric-string-value, rule-key-arguments-missing, domain-contradictions, logic-coverage, rule-safety, rule-verifiability, query-plan-safety, req-status-vocabulary, strict-fact-shape, strict-req-fact-pairing, predicate-verifiability, strict-readiness, semantic-completeness, related-requirement-unmodeled, proof-contract-symbols, entity-id-style, domain-redundancy, domain-implication, subject-key-identity, subject-key-shape, ontology-quality, exception-unapproved, exception-approval-self-attested, agent-requirement-unapproved, requirement-rationale-missing, symbol-owner-superseded, adr-unlinked, adr-proposed, predicate-schema-conformance, entity-context-missing, entity-context-acknowledged, decision-firm-unreferenced, decision-firm-superseded, supersedes-reason-missing, supersedes-reason-acknowledged, policy-ownership, policy-markers. If omitted, server runs canonical and advisory rules plus the full-KB qualityDiagnostics audit scan, including usage telemetry acceptance when evidence exists; migration rules run only when explicitly selected. Advisory and migration findings are non-blocking qualityDiagnostics. If supplied, server preserves scoped validation and skips the full-KB advisory scan.";
|
|
16
16
|
};
|
|
17
17
|
readonly sourceFiles: {
|
|
18
18
|
readonly type: "array";
|
|
@@ -118,6 +118,11 @@ export declare const ENTITY_PROPERTIES_SCHEMA: {
|
|
|
118
118
|
readonly minLength: 1;
|
|
119
119
|
readonly description: "Requirement-only. Optional reference to the exception's approval decision record.";
|
|
120
120
|
};
|
|
121
|
+
readonly firmness: {
|
|
122
|
+
readonly type: "string";
|
|
123
|
+
readonly enum: readonly ["firm", "default", "exploratory"];
|
|
124
|
+
readonly description: "req/adr only. firm = a human stated it as a rule (needs origin.ref to their words); default (when absent) = delegated or agent choice; exploratory = flagged guess.";
|
|
125
|
+
};
|
|
121
126
|
readonly rationale: {
|
|
122
127
|
readonly type: "string";
|
|
123
128
|
readonly minLength: 1;
|
|
@@ -522,11 +527,11 @@ export declare const ENTITY_PROPERTIES_SCHEMA: {
|
|
|
522
527
|
readonly claim_key: {
|
|
523
528
|
readonly type: "string";
|
|
524
529
|
readonly pattern: "^CLAIM-[A-F0-9]{16}$";
|
|
525
|
-
readonly description: "Stable
|
|
530
|
+
readonly description: "Stable key of the atomic prose clause grounded by this fact, derived from claim_text. Optional: when omitted, Kibi derives it; when sent, it must equal the derived key.";
|
|
526
531
|
};
|
|
527
532
|
readonly claim_text: {
|
|
528
533
|
readonly type: "string";
|
|
529
|
-
readonly description: "Exact atomic requirement clause represented by this fact, retained for human audit.
|
|
534
|
+
readonly description: "Exact atomic requirement clause represented by this fact, retained for human audit. On a grounding fact Kibi derives claim_key from it; an observation or meta fact quotes the clause it is about without a key.";
|
|
530
535
|
};
|
|
531
536
|
readonly predicate_name: {
|
|
532
537
|
readonly type: "string";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutation-schemas.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/mutation-schemas.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,YAAY,gFASf,CAAC;
|
|
1
|
+
{"version":3,"file":"mutation-schemas.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/mutation-schemas.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,YAAY,gFASf,CAAC;AAWX,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0X3B,CAAC;AAEX,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;CA8CvB,CAAC"}
|
|
@@ -11,22 +11,13 @@ export const ENTITY_TYPES = [
|
|
|
11
11
|
"symbol",
|
|
12
12
|
"fact",
|
|
13
13
|
];
|
|
14
|
-
//
|
|
15
|
-
//
|
|
14
|
+
// A claim_key names the clause in claim_text, so it never travels alone. The
|
|
15
|
+
// reverse is open: Kibi derives a missing claim_key from claim_text on a
|
|
16
|
+
// grounding fact, and an observation or meta fact quotes a claim without one.
|
|
17
|
+
// implements REQ-kibi-review-observation-claim-text-v2
|
|
16
18
|
const CLAIM_PROVENANCE_CONDITIONAL = JSON.parse(`{
|
|
17
|
-
"if": {
|
|
18
|
-
|
|
19
|
-
{ "required": ["claim_key"] },
|
|
20
|
-
{
|
|
21
|
-
"required": ["claim_text"],
|
|
22
|
-
"not": {
|
|
23
|
-
"properties": { "fact_kind": { "enum": ["observation", "meta"] } },
|
|
24
|
-
"required": ["fact_kind"]
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
},
|
|
29
|
-
"then": { "required": ["claim_key", "claim_text"] }
|
|
19
|
+
"if": { "required": ["claim_key"] },
|
|
20
|
+
"then": { "required": ["claim_text"] }
|
|
30
21
|
}`);
|
|
31
22
|
export const ENTITY_PROPERTIES_SCHEMA = {
|
|
32
23
|
type: "object",
|
|
@@ -111,6 +102,11 @@ export const ENTITY_PROPERTIES_SCHEMA = {
|
|
|
111
102
|
minLength: 1,
|
|
112
103
|
description: "Requirement-only. Optional reference to the exception's approval decision record.",
|
|
113
104
|
},
|
|
105
|
+
firmness: {
|
|
106
|
+
type: "string",
|
|
107
|
+
enum: ["firm", "default", "exploratory"],
|
|
108
|
+
description: "req/adr only. firm = a human stated it as a rule (needs origin.ref to their words); default (when absent) = delegated or agent choice; exploratory = flagged guess.",
|
|
109
|
+
},
|
|
114
110
|
rationale: {
|
|
115
111
|
type: "string",
|
|
116
112
|
minLength: 1,
|
|
@@ -251,11 +247,11 @@ export const ENTITY_PROPERTIES_SCHEMA = {
|
|
|
251
247
|
claim_key: {
|
|
252
248
|
type: "string",
|
|
253
249
|
pattern: "^CLAIM-[A-F0-9]{16}$",
|
|
254
|
-
description: "Stable
|
|
250
|
+
description: "Stable key of the atomic prose clause grounded by this fact, derived from claim_text. Optional: when omitted, Kibi derives it; when sent, it must equal the derived key.",
|
|
255
251
|
},
|
|
256
252
|
claim_text: {
|
|
257
253
|
type: "string",
|
|
258
|
-
description: "Exact atomic requirement clause represented by this fact, retained for human audit.
|
|
254
|
+
description: "Exact atomic requirement clause represented by this fact, retained for human audit. On a grounding fact Kibi derives claim_key from it; an observation or meta fact quotes the clause it is about without a key.",
|
|
259
255
|
},
|
|
260
256
|
predicate_name: {
|
|
261
257
|
type: "string",
|
|
@@ -35,7 +35,7 @@ export declare const validateUpsertSpec: {
|
|
|
35
35
|
export declare const deleteSpec: {
|
|
36
36
|
readonly name: "kb_delete";
|
|
37
37
|
readonly cliName: "delete";
|
|
38
|
-
readonly description: "Delete entities by ID. Use only for intentional removals after dependency checks. Do not use as a bulk cleanup shortcut. Side effects: mutates and saves KB; skips entities with dependents.";
|
|
38
|
+
readonly description: "Delete entities by ID, or exact relationship triples. Use only for intentional removals after dependency checks. Do not use as a bulk cleanup shortcut. An entity authored in a Markdown or YAML source is not deleted directly: the call writes nothing and returns outcome plan_returned with a hash-bound deletionPlan and a nextActions entry holding the exact kb_apply_plan input ({plan, approvedPlanHash}); apply that unmodified, or repeat this call with approvedPlanHash = deletionPlan.planHash to apply the freshly computed plan in one step (a stale or different hash fails with DELETE_PLAN_HASH_MISMATCH and writes nothing). Authored requirements are never deleted: outcome supersession_required points to kb_upsert with a supersedes relationship. dryRun:true previews any delete and writes nothing. Side effects: mutates and saves KB and authored sources; skips entities with dependents; dryRun and plan_returned write nothing.";
|
|
39
39
|
readonly businessInputSchema: {
|
|
40
40
|
readonly type: "object";
|
|
41
41
|
readonly oneOf: readonly [{
|
|
@@ -85,7 +85,11 @@ export declare const deleteSpec: {
|
|
|
85
85
|
readonly approvedPlanHash: {
|
|
86
86
|
readonly type: "string";
|
|
87
87
|
readonly pattern: "^[a-fA-F0-9]{64}$";
|
|
88
|
-
readonly description: "
|
|
88
|
+
readonly description: "With ids only: the deletionPlan.planHash a prior call for the same ids returned. The plan is recomputed and applied through kb_apply_plan when its hash still matches; a mismatch fails with DELETE_PLAN_HASH_MISMATCH and writes nothing. Not allowed with relationships or dryRun.";
|
|
89
|
+
};
|
|
90
|
+
readonly dryRun: {
|
|
91
|
+
readonly type: "boolean";
|
|
92
|
+
readonly description: "Preview without writing. Relationship and direct entity deletes run their preflight and return outcome dry_run with wouldDelete counts, the sourceWrites (paths and hashes) a commit would make, and skippedEffects. Authored ids return the same deletion plan as without dryRun.";
|
|
89
93
|
};
|
|
90
94
|
};
|
|
91
95
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutation.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/mutation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAOvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iDAAiD,CAAC;AAIxF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsBuC,CAAC;AAEvE,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"mutation.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/mutation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAOvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iDAAiD,CAAC;AAIxF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsBuC,CAAC;AAEvE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDuC,CAAC"}
|
|
@@ -26,7 +26,7 @@ export const validateUpsertSpec = {
|
|
|
26
26
|
export const deleteSpec = {
|
|
27
27
|
name: "kb_delete",
|
|
28
28
|
cliName: "delete",
|
|
29
|
-
description: "Delete entities by ID. Use only for intentional removals after dependency checks. Do not use as a bulk cleanup shortcut. Side effects: mutates and saves KB; skips entities with dependents.",
|
|
29
|
+
description: "Delete entities by ID, or exact relationship triples. Use only for intentional removals after dependency checks. Do not use as a bulk cleanup shortcut. An entity authored in a Markdown or YAML source is not deleted directly: the call writes nothing and returns outcome plan_returned with a hash-bound deletionPlan and a nextActions entry holding the exact kb_apply_plan input ({plan, approvedPlanHash}); apply that unmodified, or repeat this call with approvedPlanHash = deletionPlan.planHash to apply the freshly computed plan in one step (a stale or different hash fails with DELETE_PLAN_HASH_MISMATCH and writes nothing). Authored requirements are never deleted: outcome supersession_required points to kb_upsert with a supersedes relationship. dryRun:true previews any delete and writes nothing. Side effects: mutates and saves KB and authored sources; skips entities with dependents; dryRun and plan_returned write nothing.",
|
|
30
30
|
businessInputSchema: {
|
|
31
31
|
type: "object",
|
|
32
32
|
oneOf: [
|
|
@@ -58,7 +58,11 @@ export const deleteSpec = {
|
|
|
58
58
|
approvedPlanHash: {
|
|
59
59
|
type: "string",
|
|
60
60
|
pattern: "^[a-fA-F0-9]{64}$",
|
|
61
|
-
description: "
|
|
61
|
+
description: "With ids only: the deletionPlan.planHash a prior call for the same ids returned. The plan is recomputed and applied through kb_apply_plan when its hash still matches; a mismatch fails with DELETE_PLAN_HASH_MISMATCH and writes nothing. Not allowed with relationships or dryRun.",
|
|
62
|
+
},
|
|
63
|
+
dryRun: {
|
|
64
|
+
type: "boolean",
|
|
65
|
+
description: "Preview without writing. Relationship and direct entity deletes run their preflight and return outcome dry_run with wouldDelete counts, the sourceWrites (paths and hashes) a commit would make, and skippedEffects. Authored ids return the same deletion plan as without dryRun.",
|
|
62
66
|
},
|
|
63
67
|
},
|
|
64
68
|
},
|
|
@@ -135,6 +135,11 @@ export declare const upsertSpec: {
|
|
|
135
135
|
readonly minLength: 1;
|
|
136
136
|
readonly description: "Requirement-only. Optional reference to the exception's approval decision record.";
|
|
137
137
|
};
|
|
138
|
+
readonly firmness: {
|
|
139
|
+
readonly type: "string";
|
|
140
|
+
readonly enum: readonly ["firm", "default", "exploratory"];
|
|
141
|
+
readonly description: "req/adr only. firm = a human stated it as a rule (needs origin.ref to their words); default (when absent) = delegated or agent choice; exploratory = flagged guess.";
|
|
142
|
+
};
|
|
138
143
|
readonly rationale: {
|
|
139
144
|
readonly type: "string";
|
|
140
145
|
readonly minLength: 1;
|
|
@@ -539,11 +544,11 @@ export declare const upsertSpec: {
|
|
|
539
544
|
readonly claim_key: {
|
|
540
545
|
readonly type: "string";
|
|
541
546
|
readonly pattern: "^CLAIM-[A-F0-9]{16}$";
|
|
542
|
-
readonly description: "Stable
|
|
547
|
+
readonly description: "Stable key of the atomic prose clause grounded by this fact, derived from claim_text. Optional: when omitted, Kibi derives it; when sent, it must equal the derived key.";
|
|
543
548
|
};
|
|
544
549
|
readonly claim_text: {
|
|
545
550
|
readonly type: "string";
|
|
546
|
-
readonly description: "Exact atomic requirement clause represented by this fact, retained for human audit.
|
|
551
|
+
readonly description: "Exact atomic requirement clause represented by this fact, retained for human audit. On a grounding fact Kibi derives claim_key from it; an observation or meta fact quotes the clause it is about without a key.";
|
|
547
552
|
};
|
|
548
553
|
readonly predicate_name: {
|
|
549
554
|
readonly type: "string";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upsert.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/upsert.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAQvE,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"upsert.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/upsert.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAQvE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DuC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/entity.ts"],"names":[],"mappings":"AAwTA,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAwazC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -22,19 +22,8 @@ import { PROOF_RECEIPT_SCHEMA } from "../proof-receipt.js";
|
|
|
22
22
|
import { SYMBOL_ROLES } from "../symbol-granularity.js";
|
|
23
23
|
const factConditionals = JSON.parse(`[
|
|
24
24
|
{
|
|
25
|
-
"if": {
|
|
26
|
-
|
|
27
|
-
{ "required": ["claim_key"] },
|
|
28
|
-
{
|
|
29
|
-
"required": ["claim_text"],
|
|
30
|
-
"not": {
|
|
31
|
-
"properties": { "fact_kind": { "enum": ["observation", "meta"] } },
|
|
32
|
-
"required": ["fact_kind"]
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
},
|
|
37
|
-
"then": { "required": ["claim_key", "claim_text"] }
|
|
25
|
+
"if": { "required": ["claim_key"] },
|
|
26
|
+
"then": { "required": ["claim_text"] }
|
|
38
27
|
},
|
|
39
28
|
{
|
|
40
29
|
"if": {
|
|
@@ -344,6 +333,11 @@ const entitySchema = {
|
|
|
344
333
|
text_ref: { type: "string" },
|
|
345
334
|
// Provenance of any authored entity: who wrote it and on what authority.
|
|
346
335
|
origin: ENTITY_ORIGIN_SCHEMA,
|
|
336
|
+
firmness: {
|
|
337
|
+
type: "string",
|
|
338
|
+
enum: ["firm", "default", "exploratory"],
|
|
339
|
+
description: "Requirement and ADR only. How firmly the decision was made. firm: a human stated it as a rule; it needs a ref (origin.ref, or approval_ref on a requirement) to their words, and only a human may change it. default (assumed when absent): a delegated or agent choice; a later agent may supersede it with evidence. exploratory: a flagged guess, expected to be revisited.",
|
|
340
|
+
},
|
|
347
341
|
expects: {
|
|
348
342
|
type: "string",
|
|
349
343
|
enum: ["success", "rejection", "error"],
|
|
@@ -691,6 +685,12 @@ const entitySchema = {
|
|
|
691
685
|
},
|
|
692
686
|
},
|
|
693
687
|
},
|
|
688
|
+
{
|
|
689
|
+
if: {
|
|
690
|
+
properties: { type: { enum: ["req", "adr"] } },
|
|
691
|
+
},
|
|
692
|
+
else: { not: { required: ["firmness"] } },
|
|
693
|
+
},
|
|
694
694
|
{
|
|
695
695
|
if: {
|
|
696
696
|
properties: { type: { const: "scenario" } },
|
|
@@ -43,10 +43,12 @@ sequential `kb_upsert`, then run final check and coverage. Kibi authors tracked
|
|
|
43
43
|
files transactionally but never Git-stages or commits them. Do not read or edit
|
|
44
44
|
`.kb` directly.
|
|
45
45
|
|
|
46
|
-
Use `kb_delete` only for intentional cleanup
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
Use `kb_delete` only for intentional cleanup; `dryRun: true` previews any
|
|
47
|
+
delete without writing. Authored entity deletion returns `outcome:
|
|
48
|
+
plan_returned` with a hash-bound plan whose `nextActions[0].input` is the exact
|
|
49
|
+
`kb_apply_plan` input; requirements return `supersession_required` and evolve
|
|
50
|
+
through a new requirement linked with `supersedes`. Relationship deletes patch
|
|
51
|
+
shards while preserving unrelated records.
|
|
50
52
|
|
|
51
53
|
## Typed recovery and proof
|
|
52
54
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
id: kibi-usage
|
|
3
3
|
name: Kibi Usage
|
|
4
4
|
description: Use Kibi's source-first, exact-Git, migration-aware, proof-aware operations safely across MCP or the trusted local CLI, including partial completion repair.
|
|
5
|
-
version: 2.
|
|
5
|
+
version: 2.16.0
|
|
6
6
|
kibiCompatibility: ">=1.0.0"
|
|
7
7
|
tags:
|
|
8
8
|
- kibi
|
|
@@ -188,8 +188,9 @@ returns `status: error`, `MIGRATION_PLAN_REFUSED` and `data.outcome:
|
|
|
188
188
|
refused`: nothing changed, so read the action `detail` and get a new plan.
|
|
189
189
|
`data.outcome: reconciliation_required` (status success) means an action
|
|
190
190
|
failed mid-way: inspect its effect before retrying. `kb_delete` of an
|
|
191
|
-
authored entity returns status success with `deleted: 0
|
|
192
|
-
|
|
191
|
+
authored entity returns status success with `deleted: 0` and `outcome:
|
|
192
|
+
plan_returned` (or `supersession_required` for a requirement): nothing was
|
|
193
|
+
deleted yet, and `nextActions` names the call that does it. If the status is
|
|
193
194
|
`committed_with_repairs`, the mutation already committed: inspect failed effects,
|
|
194
195
|
execute each required repair action in order, and never retry the original
|
|
195
196
|
operation. Record effect failures, followed actions, and unsafe retries in
|
|
@@ -302,12 +303,18 @@ authored. Each one is the order the write path accepts.
|
|
|
302
303
|
between the two writes `kb_check` reports the requirement until the
|
|
303
304
|
second lands.
|
|
304
305
|
3. **Deleting authored entities.** `kb_delete` on an authored entity that
|
|
305
|
-
is not a requirement (scenario, test, fact, ADR, …)
|
|
306
|
-
`
|
|
307
|
-
`
|
|
308
|
-
|
|
309
|
-
`
|
|
310
|
-
|
|
306
|
+
is not a requirement (scenario, test, fact, ADR, …) writes nothing and
|
|
307
|
+
returns `outcome: plan_returned` with a hash-bound
|
|
308
|
+
`kibi.entity-deletion-plan.v1` in `deletionPlan`. After review, run
|
|
309
|
+
`nextActions[0]` unchanged: `kb_apply_plan` with its `input` (`plan` plus
|
|
310
|
+
`approvedPlanHash: plan.planHash`), or repeat the `kb_delete` call with
|
|
311
|
+
`approvedPlanHash` to apply the freshly computed plan in one step (a
|
|
312
|
+
changed source fails with `DELETE_PLAN_HASH_MISMATCH`). `dryRun: true`
|
|
313
|
+
previews relationship and direct deletes without writing. For an
|
|
314
|
+
authored requirement the result is `outcome: supersession_required`, the
|
|
315
|
+
plan carries `supersessionRequired: true` and both routes refuse it
|
|
316
|
+
(`REQUIREMENT_SUPERSESSION_REQUIRED`): Kibi never deletes an authored
|
|
317
|
+
requirement. Evolve it instead with a new
|
|
311
318
|
requirement linked by `supersedes` and close the old one, or, for an
|
|
312
319
|
agent-origin requirement nobody approved and nothing links to, upsert it
|
|
313
320
|
with `status: closed` (keep its `title`); it stays on disk as history. A
|
|
@@ -342,6 +349,29 @@ human sets `approved_by`; `kb_check` flags approvals an agent recorded without
|
|
|
342
349
|
corroboration. Never fill in an approval yourself. Record why a requirement
|
|
343
350
|
exists in `rationale`, or link the ADR that explains it.
|
|
344
351
|
|
|
352
|
+
## Decision firmness
|
|
353
|
+
|
|
354
|
+
Requirements and ADRs carry `firmness`, which says what you may do with them.
|
|
355
|
+
Search answers, `kb_query` rows and hook snippets show it (snippets label only
|
|
356
|
+
`[firm]` and `[exploratory]`; an unlabeled decision is `default`).
|
|
357
|
+
|
|
358
|
+
- `firm`: a human stated it as a rule. Follow it; to change it, ask first.
|
|
359
|
+
`kb_check` blocks a firm decision without `origin.ref` to their words, and
|
|
360
|
+
a replacement of a firm decision that is not itself firm.
|
|
361
|
+
- `default` (when absent): a delegated or agent choice. Follow it unless the
|
|
362
|
+
task gives evidence against it; then supersede it in the same change and
|
|
363
|
+
list it under "Decisions I changed" for review, without asking first.
|
|
364
|
+
- `exploratory`: a flagged guess; revisit it when you touch the area.
|
|
365
|
+
|
|
366
|
+
Set `firmness` from what a human actually said: only their stated rule is
|
|
367
|
+
`firm` (with `origin.ref`); "do whatever" or your own pick is `default`; a
|
|
368
|
+
guess is `exploratory`. A supersede needs `## Why this changed` in the new
|
|
369
|
+
entity's body (at least 12 words): name the evidence (a failing test, a
|
|
370
|
+
measured cost, a constraint the old decision missed, a new requirement) and
|
|
371
|
+
answer the old decision's reasoning; `kb_check` blocks it otherwise. A
|
|
372
|
+
preference is not evidence: propose it instead of superseding. Kibi checks
|
|
373
|
+
only that a firm decision has a reference; never cite words nobody said.
|
|
374
|
+
|
|
345
375
|
Conditional clauses ("only when", "only if", "must not ... unless") compile
|
|
346
376
|
into typed `forbid` rules linked by `requires_rule`, not property facts; one
|
|
347
377
|
`kb_model` or `kb_compile_intent` cannot translate stays an `ontology_gap`.
|
|
@@ -369,6 +399,8 @@ For each relational clause, call `kb_model` with `mode: "predicates"`, that clau
|
|
|
369
399
|
reviewed `schemaId`. If `binding_status` is `incomplete`, supply
|
|
370
400
|
`argumentBindings` and retry. Persist `fact_kind: predicate` with the same
|
|
371
401
|
`claim_key` / `claim_text`, then link `REQ -> fact` with `requires_predicate`.
|
|
402
|
+
`claim_key` is derived from `claim_text`, so a ground fact may send the exact
|
|
403
|
+
clause alone and Kibi fills the key in; a sent key must equal the derived one.
|
|
372
404
|
Use `kb_model` with `mode: "requirement"` for strict scalar clauses. Use
|
|
373
405
|
`fact_kind: observation` only for a true ontology gap. The manifest is not
|
|
374
406
|
grounding: run `logic-coverage` so each key binds to one ground fact.
|
|
@@ -419,7 +451,17 @@ a second grounding link would fail, so keep the existing link or apply the
|
|
|
419
451
|
`kb_delete` of the old link, requirement link; between the last two `kb_check`
|
|
420
452
|
reports both `logic-coverage` and `strict-req-fact-pairing` for the
|
|
421
453
|
requirement, as `expected.kbCheckAfterStep` states; run `kb_check` after the
|
|
422
|
-
last step and apply `rollback` if it is not clean)
|
|
454
|
+
last step and apply `rollback` if it is not clean). `keep_existing_grounding`
|
|
455
|
+
means the requirement already links a predicate fact with the candidate's
|
|
456
|
+
`canonical_key` (`existingGrounding[].matchedBy` is `canonical_key` when the
|
|
457
|
+
claim was worded differently), so write nothing. `extend_requirement` means
|
|
458
|
+
the requirement's proposition ledger has no entry for this text, so a link
|
|
459
|
+
cannot be made and no fact is planned: add the clause to the requirement's
|
|
460
|
+
prose (`mode: "requirement"`, or `kb_upsert` with the extended `semantic_text`
|
|
461
|
+
and the ledger `mode: "analyze"` returns) and call `mode: "predicates"` again.
|
|
462
|
+
Read `decisionConflicts` and its warnings whenever `plan` is null: they name
|
|
463
|
+
the stored decision facts the candidate would contradict and the requirements
|
|
464
|
+
that own them. `provide_argument_bindings` and `record_ontology_gap` mean
|
|
423
465
|
the same as for an ungrounded claim, and the gap observation is not a grounding
|
|
424
466
|
link, so write it exactly as returned (tags, `claim_text`, `document.body`, no
|
|
425
467
|
`claim_key`, no relationships). Record an ontology gap only when no returned schema fits the
|
|
@@ -6,7 +6,7 @@ Requirement prose remains the human-readable source. Facts add queryable semanti
|
|
|
6
6
|
|
|
7
7
|
Logical coverage is clause-based, not entity-based. Give `kb_model` (`mode: "analyze"`) the complete requirement body and verify that its `clauses` list contains every atomic obligation. Supply the `clauses` input yourself when automatic splitting would combine or omit obligations. For every normative clause:
|
|
8
8
|
|
|
9
|
-
-
|
|
9
|
+
- put the exact clause as `claim_text` on its ground fact, with the returned stable key as `claim_key` or none (Kibi derives a missing key; a sent key must match);
|
|
10
10
|
- add the key to the exact current `logic_claims` set, removing only stale keys whose propositions no longer exist in the source;
|
|
11
11
|
- link it through exactly one `requires_property` for `property_value`, one `requires_predicate` for `predicate`, or one `requires_rule` for a safe `rule` fact;
|
|
12
12
|
- leave ambiguity and ontology gaps visibly unresolved—observations do not satisfy `logic-coverage`.
|
|
@@ -23,8 +23,10 @@ drift diagnostic. Unresolved Git index conflicts are likewise blocking; Kibi
|
|
|
23
23
|
never chooses a merge winner.
|
|
24
24
|
|
|
25
25
|
Relationship upserts and relationship deletes patch only the canonical shard,
|
|
26
|
-
preserving unrelated records. Authored entity deletion
|
|
27
|
-
|
|
26
|
+
preserving unrelated records. Authored entity deletion writes nothing and
|
|
27
|
+
returns a hash-bound plan (`outcome: plan_returned`); approve it by running the
|
|
28
|
+
returned `nextActions[0]` (`kb_apply_plan` with `{plan, approvedPlanHash}`)
|
|
29
|
+
unchanged, or by repeating `kb_delete` with `approvedPlanHash`. Evolve requirements with a new
|
|
28
30
|
requirement and `supersedes`, rather than deleting the old semantic claim.
|
|
29
31
|
|
|
30
32
|
On `committed_with_repairs`, inspect `effects` and execute the typed required
|
|
@@ -126,8 +126,8 @@ diagnostics (`symbol_semantic_review_needed`).
|
|
|
126
126
|
`requires_predicate`.
|
|
127
127
|
3. Scalar placement/alignment/order clauses: `kb_model` (`mode: "requirement"`), apply the strict
|
|
128
128
|
subject/property plan and `constrains` / `requires_property`.
|
|
129
|
-
4. Preserve `claim_key` / `claim_text
|
|
130
|
-
`logic_claims` manifest.
|
|
129
|
+
4. Preserve `claim_key` / `claim_text` (a missing key is derived from the
|
|
130
|
+
text); merge every key into the requirement `logic_claims` manifest.
|
|
131
131
|
5. `kb_upsert` with `dryRun: true`, create endpoints first, then sequential `kb_upsert`.
|
|
132
132
|
6. `kb_check` with `logic-coverage`, `predicate-verifiability`, `domain-contradictions`,
|
|
133
133
|
then a final unfiltered `kb_check`.
|
|
@@ -203,7 +203,7 @@ Optional per-project workflow for recording what the screen should look like. No
|
|
|
203
203
|
2. Run `kb_model` with `mode: "analyze"` on the description; audit or supply `clauses`.
|
|
204
204
|
3. For relational layout clauses ("X must remain visually aligned with Y"), call `kb_model` with `mode: "predicates"`, apply the returned `fact_kind: predicate` plan with `predicate_name: visual_layout_rule` and `requires_predicate`.
|
|
205
205
|
4. For scalar placement, alignment, and ordering clauses, call `kb_model` with `mode: "requirement"` and apply strict `fact_kind: subject` / `fact_kind: property_value` facts linked with `constrains` / `requires_property`. Model header order as indexed property keys (`nav_order_1`, `nav_order_2`, ...) against one subject region.
|
|
206
|
-
5. Preserve `claim_key` / `claim_text` on every ground fact and merge every key into the requirement `logic_claims` manifest.
|
|
206
|
+
5. Preserve `claim_key` / `claim_text` on every ground fact (a missing `claim_key` is derived from `claim_text`) and merge every key into the requirement `logic_claims` manifest.
|
|
207
207
|
6. Model UI components as `symbol` entities with `sourceFile` and `symbol_role: behavioral`, linked `implements` to the requirement.
|
|
208
208
|
7. `kb_upsert` with `dryRun: true`, create endpoints first, then sequential `kb_upsert`. Run `kb_check` with `logic-coverage`, `predicate-verifiability`, and `domain-contradictions`, then a final unfiltered `kb_check`.
|
|
209
209
|
|
|
@@ -61,6 +61,16 @@ export type RemovedRelationshipRecords = Readonly<{
|
|
|
61
61
|
* approve the bytes before writing (deletion plans) render without writing.
|
|
62
62
|
*/
|
|
63
63
|
export declare function renderShardWithout(text: string, selectors: readonly RelationshipSelector[], shardPath: string): string;
|
|
64
|
+
export type PlannedShardRemovals = Readonly<{
|
|
65
|
+
removals: RemovedRelationshipRecords[];
|
|
66
|
+
/** Shard path -> its body without the selected records. */
|
|
67
|
+
bodies: ReadonlyMap<string, string>;
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* Render every shard that holds a selected relationship without writing it,
|
|
71
|
+
* so a dry run can report the exact bytes a delete would publish.
|
|
72
|
+
*/
|
|
73
|
+
export declare function planRelationshipShardRemovals(kbRoot: string, selectors: readonly RelationshipSelector[]): PlannedShardRemovals;
|
|
64
74
|
export declare function removeRelationshipsFromShards(kbRoot: string, selectors: readonly RelationshipSelector[]): RemovedRelationshipRecords[];
|
|
65
75
|
/**
|
|
66
76
|
* Appends a relationship to the appropriate shard.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shards.d.ts","sourceRoot":"","sources":["../../src/relationships/shards.ts"],"names":[],"mappings":"AAwBA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED;;;GA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