Preserve Scattermind action-thread signals

This commit is contained in:
OpenClaw Bot
2026-05-27 20:22:25 +02:00
parent 0447e89ca6
commit f44d5c3cc3
2 changed files with 42 additions and 1 deletions
+12 -1
View File
@@ -1241,13 +1241,20 @@ function optionsFromProofLensText(text = '', sourceSection = 'concept-map.lenses
}
function laneFromActionThread(text = '') {
if (/\b(probably noise|set aside|park|parking lot|do not build|don't build|not worth|distraction)\b/i.test(text)) return 'park';
if (/\b(probably noise|set aside|park|parking lot|do not build|don't build|do not let this become|don't let this become|not worth|distraction)\b/i.test(text)) return 'park';
if (/\b(defer|not yet|later|hold for later|after proof|wait until)\b/i.test(text)) return 'defer';
if (/^(manual|start|ship|build|show|turn one)\b/i.test(text)) return 'do-first';
if (/\b(test|validate|proof|ask|interview|observe|learn|evidence|signal)\b/i.test(text)) return 'validate-next';
return '';
}
function signalFromThreadText(text = '', labels = []) {
const pattern = labels.map(label => label.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|');
if (!pattern) return '';
const match = cleanMultiline(text, 520).match(new RegExp(`\\b(?:${pattern})\\b\\s*(?:is|if|:|-|—|)?\\s*([^.;\\n]{8,180})`, 'i'));
return cleanText(match?.[1] || '', 180);
}
function optionsFromActionThreads(items = [], sourceSection = 'concept-map.threadsToHold', sourceTitle = 'Action thread') {
if (!Array.isArray(items)) return [];
return items.slice(0, 8).map((item, index) => {
@@ -1255,6 +1262,8 @@ function optionsFromActionThreads(items = [], sourceSection = 'concept-map.threa
const objectItem = objectFrom(item);
const text = cleanMultiline(raw || objectItem.text || objectItem.content || objectItem.thread || objectItem.action || objectItem.title || '', 420);
const lane = laneFromActionThread(text);
const successSignal = signalFromThreadText(text, ['success signal', 'green flag', 'working if', 'working when']);
const failureSignal = signalFromThreadText(text, ['failure signal', 'red flag', 'failing if', 'failing when', 'stop if']);
return {
id: `action-thread-${index + 1}`,
action: titleFromBuildOrderFragment(text),
@@ -1262,6 +1271,8 @@ function optionsFromActionThreads(items = [], sourceSection = 'concept-map.threa
evidence: /\b(evidence|signal|proof|test|validate|ask|observe)\b/i.test(text)
? text
: 'What smallest real-world signal would prove this action deserves the active build slot?',
greenFlag: successSignal,
redFlag: failureSignal,
suggestedLane: lane,
rankerHints: lane === 'do-first'
? { value: 8, effort: 2, confidence: 7, urgency: 7, risk: 2 }