From ac5fbe78967ecdc2e6d77f3de3963dc666a474ae Mon Sep 17 00:00:00 2001 From: robbond Date: Wed, 26 Aug 2026 14:07:16 +0100 Subject: [PATCH] fix(confidence-engine): preserve focused learning across turns --- components/reasoning-workspace.jsx | 86 +++++++++++++++++++++++++----- 1 file changed, 74 insertions(+), 12 deletions(-) diff --git a/components/reasoning-workspace.jsx b/components/reasoning-workspace.jsx index 46519cc..79b4f20 100644 --- a/components/reasoning-workspace.jsx +++ b/components/reasoning-workspace.jsx @@ -167,6 +167,7 @@ function FocusedQuestionBody({ setFocusedPresentationItemId, setDoneForNowIds, setFollowUpQuestion, + focusedContributions, }) { return ( <> @@ -199,22 +200,33 @@ function FocusedQuestionBody({ {focused?.result && ( <> + {/* Prior accumulated learning (prior turns, current turn excluded — shown above) */} + +

What this tells us

    {(focused.result.observations || []).map((o, i) => (
  • {o}
  • ))}

Still unclear

    {(focused.result.uncertainties || []).map((u, i) => (
  • {u}
  • ))}

Questions this raises

{(focused.result.possibleFollowUpQuestions || []).length > 0 ? (
- {focused.result.possibleFollowUpQuestions.map((q, i) => ( - - ))} + {focused.result.possibleFollowUpQuestions.map((q, i) => { + const isCurrentQuestion = q === focused?.question; + return ( + + ); + })}
) : (

None yet

@@ -403,7 +415,55 @@ function EvidenceLimitCard({ summary }) { ); } -// ── Per-thread contribution badge (compact indicator) ────────────── +// ── Prior contribution summary (embedded within FocusedQuestionBody) ─── + +function PriorContributionsSummary({ nodeId, contributions }) { + const threadContribs = contributions.filter((c) => c.targetNodeId === nodeId); + if (!threadContribs.length) return null; + + // Exclude the most recent contribution — it is already shown as the current result above. + const priorContribs = threadContribs.slice(0, -1); + if (!priorContribs.length) return null; + + return ( +
+

+ Previous learning +

+ {priorContribs.map((c, idx) => ( +
+ + Turn {c.sequence || idx + 1} — contribution ({c.observations?.length ?? 0} observations, {c.uncertainties?.length ?? 0} unclear) + +
+ {c.observations?.length ? ( +
+
What this tells us
+
    + {c.observations.map((o, i) => ( +
  • {o}
  • + ))} +
+
+ ) : null} + {c.uncertainties?.length ? ( +
+
Still unclear
+
    + {c.uncertainties.map((u, i) => ( +
  • {u}
  • + ))} +
+
+ ) : null} +
+
+ ))} +
+ ); +} + +// ── Thread contributions badge (standalone — used outside focused body) ─── function ThreadContributionsBadge({ nodeId, contributions }) { const threadContribs = contributions.filter((c) => c.targetNodeId === nodeId); @@ -965,6 +1025,7 @@ function OpenQuestionsPanel({ setFocusedPresentationItemId={setFocusedPresentationItemId} setDoneForNowIds={setDoneForNowIds} setFollowUpQuestion={setFollowUpQuestion} + focusedContributions={focusedContributions} /> {/* Thread contributions for this node */} @@ -1575,6 +1636,7 @@ export default function ReasoningWorkspace({ setFocusedPresentationItemId={setFocusedPresentationItemId} setDoneForNowIds={setDoneForNowIds} setFollowUpQuestion={setFollowUpQuestion} + focusedContributions={focusedContributions} /> ); })()}