feat(confidence-engine): isolate finding-informed understanding

This commit is contained in:
2026-08-28 08:16:37 +01:00
parent c45b703b3a
commit e221bd3bf8
3 changed files with 186 additions and 2 deletions
+38
View File
@@ -166,3 +166,41 @@ export function applyFindingsToSummary(summary, validatedFindings) {
return text + " [" + parts.join(" | ") + "]";
}
// ── Post-authoritative experimental understanding producer ──
/**
* Deterministic proof-seam: produce Current Understanding from validated findings
* AFTER authoritative graph update is settled.
*
* Eligibility contract (closed):
* null → eligible provisional working interpretation
* "agree" → eligible confirmed evidence
* other/falsy → excluded (not_relevant, rejected, etc.)
*
* Output affects ONLY the summary/current understanding string.
*/
export function produceFindingInformedSummary(originalSummary, appendedFindings) {
if (!appendedFindings || appendedFindings.length === 0) {
return originalSummary;
}
const parts = [];
for (const f of appendedFindings) {
if (f.evaluation === "rejected") continue;
// null disposition → eligible (provisional working interpretation)
// "agree" disposition → eligible (confirmed evidence)
if (f.userDisposition === null || f.userDisposition === "agree") {
parts.push(f.proposition);
}
// not_relevant and not_quite → excluded
}
if (parts.length === 0) {
return originalSummary; // no eligible findings
}
const evidenceText = `Evidence: [${parts.join("; ")}]`;
return originalSummary + " " + evidenceText;
}
+10 -2
View File
@@ -30,7 +30,7 @@ import {
selectActiveUnknownCandidate,
validateGraphReferences,
} from "./utils.js";
import { validateFindings } from "./finding-helpers.js";
import { validateFindings, produceFindingInformedSummary } from "./finding-helpers.js";
function toValidationErrors(error) {
return (
@@ -853,6 +853,14 @@ async function updateCaseWithDependencies(body, dependencies = {}) {
appendedFindings = normalized;
}
// ── Post-authoritative finding-informed understanding seam ────
const authoritativeSummary =
applicationResult.updatedSituationGraph?.currentSummary ?? "";
const experimentalSummary = produceFindingInformedSummary(
authoritativeSummary,
appendedFindings,
);
return {
success: true,
stage: "update_applied",
@@ -866,7 +874,7 @@ async function updateCaseWithDependencies(body, dependencies = {}) {
newActiveUnknownNodeId: applicationResult.newActiveUnknownNodeId,
changesApplied: applicationResult.changesApplied,
appendedFindings,
summary: applicationResult.updatedSituationGraph?.currentSummary ?? "",
summary: experimentalSummary,
diagnostics: buildUpdateDiagnostics({
promptVersion,
modelName,