Merge Scattermind decision context sources

This commit is contained in:
OpenClaw Bot
2026-05-27 00:03:49 +02:00
parent 25c7c08543
commit b556c67a4c
3 changed files with 95 additions and 14 deletions
+41 -1
View File
@@ -417,7 +417,47 @@ try {
assert.ok(lensOnly.ranked.find(item => item.id === 'build-order-4').metrics.nonGoalConflicts.length >= 1);
assert.deepEqual(lensOnly.handoff.warnings, []);
console.log(JSON.stringify({ ok: true, top: data.ranked[0].id, hintedTop: hinted.ranked[0].id, actionTop: actions.ranked[0].id, nestedConceptTop: nestedConcept.ranked[0].id, nonGoalTop: nonGoal.ranked[0].id, structuredContextTop: structuredContext.ranked[0].id, lensOnlyTop: lensOnly.ranked[0].id, duplicateIds: duplicateIds.ranked.map(item => item.id), provenance: data.input.provenance, buildOrder: data.buildOrder }, null, 2));
const mergedContextResponse = await fetch(`${base}/api/rank-feedback`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
sourceName: 'Scattermind',
artifactId: 'concept_map_merged_context',
originalPrompt: 'Scattermind sent summary context plus deeper Concept Map guardrails and lenses.',
idea: 'Ranker should merge context sources instead of letting a shallow top-level summary shadow Concept Map constraints.',
mode: 'mvp',
context: { summary: 'Continuation bridge for an overwhelmed non-AI-native operator.' },
conceptMap: {
context: {
targetAudience: 'Overwhelmed non-AI-native shop owner',
constraints: ['Manual proof before saved projects'],
nonGoals: ['Avoid workspace dashboard'],
assumptions: ['A copyable brief is enough for the first pass'],
},
lenses: {
constraints: { content: 'No auth before first value. Keep the result copyable.' },
assumptions: { content: 'The user is tired; one defended next move beats a backlog.' },
},
nextActions: [
{ id: 'defended-next-move', action: 'Defended next-move brief', why: 'One copyable build order with source provenance.', evidence: 'Can the shop owner name the next step?', suggestedLane: 'do-first', rankerHints: { value: 9, effort: 2, confidence: 8, urgency: 8, risk: 2 } },
{ id: 'workspace-dashboard', action: 'Workspace dashboard', why: 'Accounts, saved projects, and auth dashboard.', evidence: 'No proof yet', suggestedLane: 'do-first', rankerHints: { value: 10, effort: 2, confidence: 9, urgency: 9, risk: 2 } },
],
},
}),
});
assert.equal(mergedContextResponse.status, 200);
const mergedContext = await mergedContextResponse.json();
assert.equal(mergedContext.input.decisionContext.targetAudience, 'Overwhelmed non-AI-native shop owner');
assert.ok(mergedContext.input.decisionContext.constraints.includes('Manual proof before saved projects'));
assert.ok(mergedContext.input.decisionContext.constraints.includes('No auth before first value'));
assert.ok(mergedContext.input.decisionContext.nonGoals.includes('Avoid workspace dashboard'));
assert.ok(mergedContext.input.decisionContext.assumptions.includes('A copyable brief is enough for the first pass'));
assert.ok(mergedContext.input.decisionContext.assumptions.includes('The user is tired'));
assert.equal(mergedContext.ranked[0].id, 'defended-next-move');
assert.equal(mergedContext.ranked.find(item => item.id === 'workspace-dashboard').lane.source, 'source-non-goal');
assert.deepEqual(mergedContext.handoff.warnings, []);
console.log(JSON.stringify({ ok: true, top: data.ranked[0].id, hintedTop: hinted.ranked[0].id, actionTop: actions.ranked[0].id, nestedConceptTop: nestedConcept.ranked[0].id, nonGoalTop: nonGoal.ranked[0].id, structuredContextTop: structuredContext.ranked[0].id, lensOnlyTop: lensOnly.ranked[0].id, mergedContextTop: mergedContext.ranked[0].id, duplicateIds: duplicateIds.ranked.map(item => item.id), provenance: data.input.provenance, buildOrder: data.buildOrder }, null, 2));
} finally {
server.kill('SIGTERM');
}