Add proof script to Ranker handoff

This commit is contained in:
OpenClaw Bot
2026-05-27 23:42:10 +02:00
parent 9c0f4bebd3
commit 5fad144a8f
2 changed files with 22 additions and 0 deletions
+17
View File
@@ -1778,6 +1778,18 @@ function evidenceQuestionFor(option) {
return `Can 35 target users understand and act on “${option.title}” without extra explanation?`;
}
function proofScriptFor(option, provenance = {}) {
if (!option) return '';
const sourceName = cleanText(provenance?.source || 'Scattermind', 60);
const sourceLabel = cleanText(provenance?.snapshotTitle || provenance?.artifactId || '', 120);
const evidence = evidenceQuestionFor(option);
const next = nextStepFor(option);
const setup = sourceLabel
? `I have a ${sourceName} build-order recommendation for “${sourceLabel}”.`
: 'I am checking the next build move before adding more scope.';
return cleanText(`${setup} The proposed first move is “${option.title}”. ${next} The thing I need to learn is: ${evidence}`, 520);
}
function nextStepFor(option) {
if (!option) return '';
if (option.factors?.nextStep) return option.factors.nextStep;
@@ -1854,10 +1866,12 @@ function createDecisionBrief({ idea, context, mode, ranked, provenance, decision
const activeSourceAnchor = [top?.provenance?.sourceSection, top?.provenance?.sourceId || top?.provenance?.sourceTitle].filter(Boolean).join(' · ');
const activeSourceQuote = cleanText(top?.provenance?.sourceQuote || '', 260);
const activeSourceTitle = cleanText(top?.provenance?.sourceTitle || '', 140);
const activeProofScript = top ? proofScriptFor(top, provenance) : '';
const firstScreen = top ? {
headline: `Build only this first: ${top.title}`,
primaryAction: nextStepFor(top),
proofQuestion: evidenceQuestionFor(top),
proofScript: activeProofScript,
why: reasonFor(top),
sourceAnchor: activeSourceAnchor,
sourceTitle: activeSourceTitle,
@@ -1871,6 +1885,7 @@ function createDecisionBrief({ idea, context, mode, ranked, provenance, decision
activeLane: top.lane?.label || 'Do first',
firstProofStep: nextStepFor(top),
evidenceQuestion: evidenceQuestionFor(top),
proofScript: activeProofScript,
doNotStartYet: deferred.slice(0, 3).map(item => item.title),
sourceAnchor: activeSourceAnchor,
sourceTitle: activeSourceTitle,
@@ -2036,6 +2051,7 @@ function activeSliceFor({ ranked = [], provenance = {}, readiness = {} }) {
proof: {
nextStep: nextStepFor(active),
evidenceQuestion: evidenceQuestionFor(active),
proofScript: proofScriptFor(active, provenance),
successSignal: successSignalFor(active),
killSignal: killSignalFor(active),
},
@@ -2102,6 +2118,7 @@ function copyableHandoffText({ ranked = [], provenance = {}, decisionContext = {
`- Move: ${activeSlice.item.title}`,
`- Proof: ${activeSlice.proof.nextStep}`,
`- Evidence question: ${activeSlice.proof.evidenceQuestion}`,
activeSlice.proof.proofScript ? `- Proof script: ${activeSlice.proof.proofScript}` : '',
activeSlice.source.sourceSection ? `- Source: ${[activeSlice.source.sourceSection, activeSlice.source.sourceId].filter(Boolean).join(' · ')}` : '',
activeSlice.notNow.length ? `- Do not start yet: ${activeSlice.notNow.map(item => item.title).join('; ')}` : '',
].filter(Boolean).join('\n') : '';