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
+30
View File
@@ -1107,6 +1107,36 @@ try {
assert.ok(privateReadingEnvelope.input.decisionContext.nonGoals.includes('Avoid accounts, saved calendars, and payment dashboards until one workshop has real interest')); assert.ok(privateReadingEnvelope.input.decisionContext.nonGoals.includes('Avoid accounts, saved calendars, and payment dashboards until one workshop has real interest'));
assert.deepEqual(privateReadingEnvelope.handoff.warnings, []); assert.deepEqual(privateReadingEnvelope.handoff.warnings, []);
const actionThreadSignalsResponse = await fetch(`${base}/api/rank-feedback`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
reference_code: 'SM-THREAD-SIGNALS',
working_name: 'Game concept thread signals',
ideaText: 'A tiny driving bullet-heaven game needs a first playable prototype order.',
context: 'Solo builder. Manual playable proof first. Do not let this become a dashboard or account system.',
mode: 'mvp',
threads_to_hold: [
'Start with a five-minute greybox drive loop. Success signal: one player asks for another run. Failure signal: they cannot read threats while steering.',
'Test enemy pressure with one obstacle wave before adding upgrades. Green flag: players change path without explanation. Red flag: they ignore the wave and wait for UI prompts.',
'Do not let this become a saved-board dashboard with accounts and subscription tiers.',
],
questions_to_sit_with: ['Can a player understand the loop without a tutorial?'],
}),
});
assert.equal(actionThreadSignalsResponse.status, 200);
const actionThreadSignals = await actionThreadSignalsResponse.json();
assert.equal(actionThreadSignals.input.optionCount, 3);
assert.equal(actionThreadSignals.ranked[0].id, 'action-thread-1');
assert.equal(actionThreadSignals.ranked[0].factors.successSignal, 'one player asks for another run');
assert.equal(actionThreadSignals.ranked[0].factors.killSignal, 'they cannot read threats while steering');
assert.equal(actionThreadSignals.ranked.find(item => item.id === 'action-thread-2').factors.successSignal, 'players change path without explanation');
assert.equal(actionThreadSignals.ranked.find(item => item.id === 'action-thread-2').factors.killSignal, 'they ignore the wave and wait for UI prompts');
assert.equal(actionThreadSignals.ranked.find(item => item.id === 'action-thread-3').lane.id, 'park');
assert.equal(actionThreadSignals.ranked.find(item => item.id === 'action-thread-3').lane.source, 'hint');
assert.ok(actionThreadSignals.input.decisionContext.nonGoals.some(item => /Do not let this become a dashboard/i.test(item)));
assert.deepEqual(actionThreadSignals.handoff.warnings, []);
const softLabelLensResponse = await fetch(`${base}/api/rank-feedback`, { const softLabelLensResponse = await fetch(`${base}/api/rank-feedback`, {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
+12 -1
View File
@@ -1241,13 +1241,20 @@ function optionsFromProofLensText(text = '', sourceSection = 'concept-map.lenses
} }
function laneFromActionThread(text = '') { 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 (/\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 (/^(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'; if (/\b(test|validate|proof|ask|interview|observe|learn|evidence|signal)\b/i.test(text)) return 'validate-next';
return ''; 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') { function optionsFromActionThreads(items = [], sourceSection = 'concept-map.threadsToHold', sourceTitle = 'Action thread') {
if (!Array.isArray(items)) return []; if (!Array.isArray(items)) return [];
return items.slice(0, 8).map((item, index) => { return items.slice(0, 8).map((item, index) => {
@@ -1255,6 +1262,8 @@ function optionsFromActionThreads(items = [], sourceSection = 'concept-map.threa
const objectItem = objectFrom(item); const objectItem = objectFrom(item);
const text = cleanMultiline(raw || objectItem.text || objectItem.content || objectItem.thread || objectItem.action || objectItem.title || '', 420); const text = cleanMultiline(raw || objectItem.text || objectItem.content || objectItem.thread || objectItem.action || objectItem.title || '', 420);
const lane = laneFromActionThread(text); 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 { return {
id: `action-thread-${index + 1}`, id: `action-thread-${index + 1}`,
action: titleFromBuildOrderFragment(text), 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) evidence: /\b(evidence|signal|proof|test|validate|ask|observe)\b/i.test(text)
? text ? text
: 'What smallest real-world signal would prove this action deserves the active build slot?', : 'What smallest real-world signal would prove this action deserves the active build slot?',
greenFlag: successSignal,
redFlag: failureSignal,
suggestedLane: lane, suggestedLane: lane,
rankerHints: lane === 'do-first' rankerHints: lane === 'do-first'
? { value: 8, effort: 2, confidence: 7, urgency: 7, risk: 2 } ? { value: 8, effort: 2, confidence: 7, urgency: 7, risk: 2 }