Compare commits

...

4 Commits

Author SHA1 Message Date
OpenClaw Bot 36e8bfae58 Support sectioned Concept Map rank imports 2026-05-26 23:21:29 +02:00
OpenClaw Bot 10f6efcbd3 Harden Scattermind rank feedback candidate fallback 2026-05-26 23:18:03 +02:00
OpenClaw Bot 2f49155ed8 Harden rank feedback duplicate ids 2026-05-26 23:07:08 +02:00
OpenClaw Bot 7fd2430914 Strengthen rank feedback decision brief 2026-05-26 23:03:27 +02:00
4 changed files with 189 additions and 25 deletions
+2 -2
View File
@@ -45,9 +45,9 @@ Ranker's continuation job is narrow:
`Snapshot / Concept Map → candidate feature/action set → Rank-ready build order`
`POST /api/rank-feedback` accepts a `prioritix-feature-set-v1`-style payload from Scattermind and returns ranked items plus `buildOrder.doFirst / validateNext / defer / park`. It accepts candidate arrays as `features`, `actions`, `nextMoves`, or `candidates` either at the top level or under `featureSet`, and it can consume a nested `conceptMap.nextActions / nextMoves` artifact directly, so Scattermind can hand off Concept Map next actions without renaming them into fake software features. It also returns a `handoff` object (`rank-feedback-result-v1`) with source provenance, item trace rows, and contract warnings for missing artifact IDs, source sections, original prompt provenance, or evidence on active items. Keep this contract action-first; do not use it as a reason to add generic dashboard, auth, billing, or workspace layers before the bridge has proof.
`POST /api/rank-feedback` accepts a `prioritix-feature-set-v1`-style payload from Scattermind and returns ranked items plus `buildOrder.doFirst / validateNext / defer / park`. It accepts candidate arrays as `features`, `actions`, `nextMoves`, or `candidates` either at the top level or under `featureSet`, and it can consume a nested Concept Map directly, so Scattermind can hand off `conceptMap.nextActions / nextMoves` without renaming them into fake software features. Sectioned Concept Maps may also include `validateNext`, `deferred`, and `parkingLot`; Ranker combines those sections into one build-order pass while preserving `sourceSection` and treating deferred/parked sections as lane hints. Empty wrapper arrays are ignored rather than allowed to shadow a real nested Concept Map action set, which keeps partially-normalized Scattermind exports rankable. It also returns a `brief` with source, next-48-hour actions, carried-forward assumptions/constraints/non-goals, and `whatWouldChangeRanking` checks, plus a `handoff` object (`rank-feedback-result-v1`) with source provenance, item trace rows, and contract warnings for missing artifact IDs, source sections, original prompt provenance, or evidence on active items. Keep this contract action-first; do not use it as a reason to add generic dashboard, auth, billing, or workspace layers before the bridge has proof.
Candidate items may include optional 110 `rankerHints` (`value`, `effort`, `confidence`, `urgency`, `revenue`, `novelty`, `risk`). Ranker blends those explicit Scattermind hints with text heuristics; `effort` is inverted into feasibility. Hints improve the defended order, but `recommendedLane: "defer"` or `"park"` remains a safety rail so dashboard-swamp items do not get promoted by flashy wording. For clean bridge handoff, Scattermind should send `sourceSection` and `evidenceNeeded` on each active next move. Scattermind can also send `targetAudience`, `constraints`, `assumptions`, and `nonGoals` / `avoid` at the top level, in `featureSet`, or inside `conceptMap.context`; Ranker returns that decision context in `input.decisionContext` and `handoff.decisionContext`, and penalizes candidates that conflict with source non-goals (for example saved workspaces/auth/billing before the continuation proof).
Candidate items may include optional 110 `rankerHints` (`value`, `effort`, `confidence`, `urgency`, `revenue`, `novelty`, `risk`). Ranker blends those explicit Scattermind hints with text heuristics; `effort` is inverted into feasibility. Hints improve the defended order, but `recommendedLane: "defer"` or `"park"` remains a safety rail so dashboard-swamp items do not get promoted by flashy wording. For clean bridge handoff, Scattermind should send `sourceSection` and `evidenceNeeded` on each active next move. Scattermind can also send `targetAudience`, `constraints`, `assumptions`, and `nonGoals` / `avoid` at the top level, in `featureSet`, or inside `conceptMap.context`; Ranker returns that decision context in `input.decisionContext` and `handoff.decisionContext`, and penalizes candidates that conflict with source non-goals (for example saved workspaces/auth/billing before the continuation proof). If Scattermind sends duplicate candidate IDs, Ranker keeps the first ID, suffixes later duplicates (`preview-2`), and reports the normalization in `handoff.warnings` / `handoff.itemTrace` so downstream build-order references remain addressable.
Recommended payload shape:
+21 -9
View File
@@ -1,14 +1,14 @@
const sample = {
idea: 'Im building a lightweight product feedback tool for people with too many ideas and too many possible features. It should feel useful before becoming a workspace.',
optionsText: `- Ranked feedback map for pasted feature lists
- Expert reflections on the top options
idea: 'Scattermind clarified a messy course idea. Now I need the first build order, not a dashboard.',
optionsText: `- Manual build-order preview from one Concept Map
- Copyable decision brief with Do first / Validate next / Defer / Park
- Evidence questions beside each next move
- Accounts and saved workspaces
- Team voting on feature priority
- Exportable decision brief for Slack or Notion
- Custom criteria builder
- Paid deeper product strategy pass`,
context: 'MVP, solo builder, needs to feel valuable in under two minutes, avoid dashboard swamp.',
mode: 'progress',
- Team voting on roadmap priority
- Subscription billing layer
- Polished export for sharing the defended order`,
context: 'Snapshot / Concept Map handoff, solo builder, tired non-AI-native user, avoid auth/workspaces/billing before proof.',
mode: 'mvp',
};
const form = document.querySelector('#rankForm');
@@ -89,6 +89,18 @@ function renderResults(data) {
<span>Next 48 hours</span>
<ol>${(brief.next48Hours || []).map((step) => `<li>${escapeHtml(step)}</li>`).join('')}</ol>
</article>
${(brief.whatWouldChangeRanking || []).length ? `
<article class="brief-card next-card">
<span>What would change the order</span>
<ol>${brief.whatWouldChangeRanking.map((change) => `<li>${escapeHtml(change)}</li>`).join('')}</ol>
</article>
` : ''}
${(brief.assumptions || []).length ? `
<article class="brief-card">
<span>Context carried forward</span>
<ul>${brief.assumptions.map((assumption) => `<li>${escapeHtml(assumption)}</li>`).join('')}</ul>
</article>
` : ''}
${(brief.expertReflections || []).map((reflection) => `
<article class="brief-card">
<span>${escapeHtml(reflection.lens)}</span>
+95 -1
View File
@@ -84,6 +84,8 @@ try {
assert.ok(data.brief.next48Hours.some(item => /Open the source artifact \(snapshot_123\)/i.test(item)));
assert.ok(data.brief.next48Hours.some(item => /Evidence to collect/i.test(item)));
assert.match(data.brief.summary, /nearest follow-up|strongest signal/i);
assert.ok(data.brief.whatWouldChangeRanking.some(item => /evidence fails|re-run the order/i.test(item)));
assert.ok(Array.isArray(data.brief.assumptions));
const hintedResponse = await fetch(`${base}/api/rank-feedback`, {
method: 'POST',
@@ -169,6 +171,69 @@ try {
assert.equal(nestedConcept.ranked.find(item => item.id === 'lesson-library').lane.id, 'park');
assert.deepEqual(nestedConcept.handoff.warnings, []);
const sectionedConceptResponse = await fetch(`${base}/api/rank-feedback`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
sourceName: 'Scattermind',
artifactId: 'concept_map_sectioned_lanes',
originalPrompt: 'The Concept Map separates next actions, validation ideas, deferred items, and a parking lot.',
idea: 'Ranker should combine a sectioned Concept Map into one defended build order without losing lane provenance.',
mode: 'mvp',
conceptMap: {
nextActions: [
{ id: 'one-source-preview', action: 'One-source build-order preview', why: 'Turn the Concept Map into a defended first move.', evidence: 'Can one tired user say what to do next?', rankerHints: { value: 9, effort: 2, confidence: 8, urgency: 8, risk: 2 } },
],
validateNext: [
{ id: 'copyable-handoff', action: 'Copyable handoff brief', why: 'Let the user paste the build order into notes.', evidence: 'Does the copied brief preserve the action and reason?' },
],
deferred: [
{ id: 'visual-polish-pass', action: 'Visual polish pass', why: 'Improve the result screen after the bridge proves useful.', evidence: 'Do users understand the rough brief first?' },
],
parkingLot: [
{ id: 'saved-team-workspace', action: 'Saved team workspace', why: 'Accounts, auth dashboard, collaboration, and sync for every idea.', evidence: 'No proof yet' },
],
},
}),
});
assert.equal(sectionedConceptResponse.status, 200);
const sectionedConcept = await sectionedConceptResponse.json();
assert.equal(sectionedConcept.input.optionCount, 4);
assert.equal(sectionedConcept.ranked[0].id, 'one-source-preview');
assert.equal(sectionedConcept.ranked.find(item => item.id === 'copyable-handoff').lane.id, 'test', 'validateNext sections should default into Validate next');
assert.equal(sectionedConcept.ranked.find(item => item.id === 'copyable-handoff').lane.source, 'hint');
assert.equal(sectionedConcept.ranked.find(item => item.id === 'visual-polish-pass').lane.id, 'defer', 'deferred sections should not enter the active proof slice');
assert.equal(sectionedConcept.ranked.find(item => item.id === 'saved-team-workspace').lane.id, 'park', 'parking lot sections should stay parked');
assert.equal(sectionedConcept.handoff.itemTrace.find(item => item.id === 'saved-team-workspace').sourceSection, 'concept-map.parkingLot');
assert.deepEqual(sectionedConcept.handoff.warnings, []);
const emptyWrapperResponse = await fetch(`${base}/api/rank-feedback`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
sourceName: 'Scattermind',
artifactId: 'concept_map_empty_wrappers',
originalPrompt: 'The export includes empty feature arrays plus real Concept Map next actions.',
idea: 'Ranker should ignore empty wrapper arrays and rank the real nested action set.',
mode: 'mvp',
features: [],
featureSet: { features: [], actions: [] },
conceptMap: {
nextActions: [
{ id: 'source-action-proof', action: 'Source action proof', why: 'Use the Concept Map next action directly to defend the first move.', evidence: 'Can this action become a build-order preview?', suggestedLane: 'do-first' },
{ id: 'source-action-export', action: 'Copyable action brief', why: 'Keep the handoff artifact-shaped for a tired user.', evidence: 'Can the brief be pasted into notes?', suggestedLane: 'validate-next' },
{ id: 'empty-shadow-dashboard', action: 'Saved dashboard after empty import', why: 'Auth workspace dashboard that should not win.', suggestedLane: 'park' },
],
},
}),
});
assert.equal(emptyWrapperResponse.status, 200);
const emptyWrapper = await emptyWrapperResponse.json();
assert.equal(emptyWrapper.input.optionCount, 3);
assert.equal(emptyWrapper.ranked[0].id, 'source-action-proof', 'empty top-level arrays must not shadow nested Concept Map actions');
assert.equal(emptyWrapper.ranked.find(item => item.id === 'source-action-proof').provenance.sourceSection, 'concept-map.nextActions');
assert.deepEqual(emptyWrapper.handoff.warnings, []);
const nonGoalResponse = await fetch(`${base}/api/rank-feedback`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@@ -197,6 +262,8 @@ try {
const nonGoal = await nonGoalResponse.json();
assert.equal(nonGoal.input.decisionContext.targetAudience, 'Tired non-AI-native solo operator');
assert.deepEqual(nonGoal.input.decisionContext.nonGoals, ['Avoid saved workspaces', 'No auth dashboard', 'No billing layer before proof']);
assert.ok(nonGoal.brief.assumptions.includes('Constraint: No account before first value'));
assert.ok(nonGoal.brief.assumptions.includes('Non-goal: Avoid saved workspaces'));
assert.equal(nonGoal.ranked[0].id, 'manual-next-move', 'non-goal conflicts should beat flashy positive hints');
const workspace = nonGoal.ranked.find(item => item.id === 'workspace-autopilot');
assert.ok(workspace.metrics.nonGoalConflicts.length >= 2);
@@ -204,7 +271,34 @@ try {
assert.deepEqual(nonGoal.handoff.itemTrace.find(item => item.id === 'workspace-autopilot').nonGoalConflicts, workspace.metrics.nonGoalConflicts);
assert.ok(!nonGoal.buildOrder.doFirst.includes('workspace-autopilot'));
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, provenance: data.input.provenance, buildOrder: data.buildOrder }, null, 2));
const duplicateIdResponse = await fetch(`${base}/api/rank-feedback`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
sourceName: 'Scattermind',
artifactId: 'concept_map_duplicate_ids',
originalPrompt: 'I pasted duplicated next-move IDs from a messy Concept Map export.',
idea: 'Ranker should keep handoff rows addressable even if Scattermind sends duplicate candidate IDs.',
mode: 'mvp',
conceptMap: {
nextActions: [
{ id: 'preview', action: 'Manual build-order preview', why: 'Defends the first move without dashboard machinery.', evidence: 'Can one user act on the preview?', suggestedLane: 'do-first' },
{ id: 'preview', action: 'Copyable preview brief', why: 'Exports the defended order into notes.', evidence: 'Does the copied brief preserve the next action?', suggestedLane: 'validate-next' },
{ id: 'workspace', action: 'Saved workspace', why: 'Auth dashboard for every idea.', evidence: 'None yet', suggestedLane: 'park' },
],
},
}),
});
assert.equal(duplicateIdResponse.status, 200);
const duplicateIds = await duplicateIdResponse.json();
assert.deepEqual(duplicateIds.ranked.map(item => item.id).sort(), ['preview', 'preview-2', 'workspace']);
assert.equal(new Set(duplicateIds.handoff.itemTrace.map(item => item.id)).size, duplicateIds.handoff.itemTrace.length);
assert.equal(duplicateIds.handoff.itemTrace.find(item => item.id === 'preview-2').originalId, 'preview');
assert.equal(duplicateIds.handoff.itemTrace.find(item => item.id === 'preview-2').idNormalized, true);
assert.ok(duplicateIds.handoff.warnings.some(item => /duplicate source id preview normalized to preview-2/.test(item)));
assert.ok(Object.values(duplicateIds.buildOrder).flat().includes('preview-2'));
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, duplicateIds: duplicateIds.ranked.map(item => item.id), provenance: data.input.provenance, buildOrder: data.buildOrder }, null, 2));
} finally {
server.kill('SIGTERM');
}
+71 -13
View File
@@ -448,7 +448,7 @@ function nonGoalConflicts(optionText, decisionContext = {}) {
});
}
function normalizeFeatureOption(item, index, fallbackId = 'feature', defaultSourceSection = '') {
function normalizeFeatureOption(item, index, fallbackId = 'feature', defaultSourceSection = '', defaultRecommendedLane = '') {
const title = cleanText(item?.title || item?.name || item?.action || '', 140);
const proofSteps = cleanTextList(item?.proofSteps || item?.proof || item?.validationSteps, 5, 180);
const dependencies = cleanTextList(item?.dependencies || item?.blockedBy, 5, 120);
@@ -456,7 +456,7 @@ function normalizeFeatureOption(item, index, fallbackId = 'feature', defaultSour
const userValue = cleanText(item?.userValue || item?.value || item?.outcome || item?.why, 260);
const risk = cleanText(item?.risk || item?.assumption || item?.unknown || '', 220);
const sourceSection = cleanText(item?.sourceSection || item?.section || item?.lane || item?.origin || defaultSourceSection, 80);
const recommendedLane = cleanText(item?.recommendedLane || item?.laneHint || item?.suggestedLane || '', 40).toLowerCase();
const recommendedLane = cleanText(item?.recommendedLane || item?.laneHint || item?.suggestedLane || defaultRecommendedLane || '', 40).toLowerCase();
const descriptionParts = [
item?.description || item?.brief || '',
userValue && `User value: ${userValue}`,
@@ -477,8 +477,39 @@ function normalizeFeatureOption(item, index, fallbackId = 'feature', defaultSour
};
}
function normalizeOptionIds(options = []) {
const seen = new Map();
return options.map((option, index) => {
const baseId = cleanText(option.id || `option-${index + 1}`, 80) || `option-${index + 1}`;
const count = seen.get(baseId) || 0;
seen.set(baseId, count + 1);
if (count === 0) return { ...option, id: baseId };
return {
...option,
id: cleanText(`${baseId}-${count + 1}`, 80),
provenance: {
...(option.provenance || {}),
originalId: baseId,
idNormalized: true,
},
};
});
}
function candidateArrayFrom(...entries) {
return entries.find(entry => Array.isArray(entry?.items)) || null;
return entries.find(entry => Array.isArray(entry?.items) && entry.items.length > 0) || null;
}
function candidateGroupFrom(...groups) {
return groups.find(group => group.some(entry => Array.isArray(entry?.items) && entry.items.length > 0)) || null;
}
function normalizeCandidateGroup(group = []) {
const options = group.flatMap(entry => {
const fallbackId = entry.sourceSection.toLowerCase().includes('action') ? 'action' : 'feature';
return (entry.items || []).slice(0, 24).map((item, index) => normalizeFeatureOption(item, index, fallbackId, entry.sourceSection, entry.defaultLane));
}).filter(item => item.title).slice(0, 24);
return normalizeOptionIds(options);
}
function optionsFromBody(body = {}) {
@@ -492,20 +523,26 @@ function optionsFromBody(body = {}) {
{ items: body.nextMoves, sourceSection: 'nextMoves' },
{ items: featureSet.nextMoves, sourceSection: 'feature-set.nextMoves' },
{ items: body.candidates, sourceSection: 'candidates' },
{ items: featureSet.candidates, sourceSection: 'feature-set.candidates' },
{ items: conceptMap.nextActions, sourceSection: 'concept-map.nextActions' },
{ items: conceptMap.nextMoves, sourceSection: 'concept-map.nextMoves' },
{ items: conceptMap.features, sourceSection: 'concept-map.features' },
{ items: conceptMap.candidates, sourceSection: 'concept-map.candidates' }
{ items: featureSet.candidates, sourceSection: 'feature-set.candidates' }
);
if (rawCandidates) {
const fallbackId = rawCandidates.sourceSection.toLowerCase().includes('action') ? 'action' : 'feature';
return rawCandidates.items.slice(0, 24).map((item, index) => normalizeFeatureOption(item, index, fallbackId, rawCandidates.sourceSection)).filter(item => item.title);
return normalizeOptionIds(rawCandidates.items.slice(0, 24).map((item, index) => normalizeFeatureOption(item, index, fallbackId, rawCandidates.sourceSection)).filter(item => item.title));
}
const conceptMapCandidates = candidateGroupFrom([
{ items: conceptMap.nextActions, sourceSection: 'concept-map.nextActions' },
{ items: conceptMap.nextMoves, sourceSection: 'concept-map.nextMoves' },
{ items: conceptMap.features, sourceSection: 'concept-map.features' },
{ items: conceptMap.candidates, sourceSection: 'concept-map.candidates' },
{ items: conceptMap.validateNext || conceptMap.validate || conceptMap.validation, sourceSection: 'concept-map.validateNext', defaultLane: 'validate-next' },
{ items: conceptMap.deferred || conceptMap.defer || conceptMap.later, sourceSection: 'concept-map.deferred', defaultLane: 'defer' },
{ items: conceptMap.parkingLot || conceptMap.park || conceptMap.parked, sourceSection: 'concept-map.parkingLot', defaultLane: 'park' },
]);
if (conceptMapCandidates) return normalizeCandidateGroup(conceptMapCandidates);
if (Array.isArray(body.options)) {
return body.options.slice(0, 24).map((item, index) => normalizeFeatureOption(item, index, 'option', 'options')).filter(item => item.title);
return normalizeOptionIds(body.options.slice(0, 24).map((item, index) => normalizeFeatureOption(item, index, 'option', 'options')).filter(item => item.title));
}
return parseOptionsFromText(body.optionsText || featureSet.optionsText || conceptMap.optionsText || '');
return normalizeOptionIds(parseOptionsFromText(body.optionsText || featureSet.optionsText || conceptMap.optionsText || ''));
}
function scoreOption(option, mode, context = '', decisionContext = {}) {
@@ -598,13 +635,29 @@ function concernFor(option) {
return 'The main risk is sequencing: do it only if it supports the first useful proof.';
}
function createDecisionBrief({ idea, context, mode, ranked, provenance }) {
function whatWouldChangeRanking(top, second, risky) {
if (!top) return ['Add at least two concrete next moves with evidence needed.'];
const changes = [];
if (top.factors?.evidenceNeeded) changes.push(`If evidence fails for “${top.title}” (${top.factors.evidenceNeeded}), move it out of Do first.`);
else changes.push(`If “${top.title}” cannot name a cheap proof step, demote it until the evidence question is clear.`);
if (second) changes.push(`If “${second.title}” gets stronger proof or meaningfully lower effort, it can overtake the current first move.`);
if (risky && risky.id !== top.id) changes.push(`If the riskiest assumption around “${risky.title}” is answered cheaply, re-rank before building around it.`);
changes.push('If the source Concept Map adds new constraints or non-goals, re-run the order instead of editing around stale context.');
return changes.slice(0, 4);
}
function createDecisionBrief({ idea, context, mode, ranked, provenance, decisionContext }) {
const top = ranked[0];
const second = ranked[1];
const risky = ranked.slice().sort((a, b) => b.metrics.risk - a.metrics.risk)[0];
const deferred = ranked.filter(item => ['defer', 'park'].includes(item.lane.id)).slice(0, 3);
const sourceLabel = [provenance?.snapshotTitle, provenance?.artifactId].filter(Boolean).join(' · ');
const theme = top ? `The strongest signal is “${top.title}” because ${reasonFor(top)}.` : 'The list needs at least two options before ranking becomes useful.';
const assumptions = [
...(decisionContext?.assumptions || []),
...(decisionContext?.constraints || []).map(item => `Constraint: ${item}`),
...(decisionContext?.nonGoals || []).map(item => `Non-goal: ${item}`),
].slice(0, 6);
return {
headline: top ? `Start with ${top.title}` : 'Add options to get a ranked feedback map',
summary: `${theme}${second ? `${second.title}” is the nearest follow-up, not a parallel first step.` : ''}${sourceLabel ? ` Source: ${sourceLabel}.` : ''}`,
@@ -635,6 +688,8 @@ function createDecisionBrief({ idea, context, mode, ranked, provenance }) {
'Put it in front of 35 real people or run it manually once.',
`Do not touch ${deferred[0] ? `${deferred[0].title}` : 'the parked ideas'} until the first signal is real.`,
] : ['Paste 310 options.', 'Choose what the ranking should care about.', 'Run the first-pass judgement.'],
assumptions,
whatWouldChangeRanking: whatWouldChangeRanking(top, second, risky),
caution: 'This is first-pass judgement, not an oracle. Change the criteria if the context changes.',
};
}
@@ -646,6 +701,7 @@ function createHandoffContract({ ranked, provenance, decisionContext }) {
const itemTrace = ranked.map(item => {
if (!item.provenance?.sourceSection) warnings.push(`missing source section for ${item.id}`);
if (item.provenance?.idNormalized) warnings.push(`duplicate source id ${item.provenance.originalId} normalized to ${item.id}`);
if (!item.factors?.evidenceNeeded && ['do', 'test'].includes(item.lane?.id)) warnings.push(`missing evidence needed for active item ${item.id}`);
if (item.metrics?.nonGoalConflicts?.length && ['do', 'test'].includes(item.lane?.id)) warnings.push(`active item ${item.id} conflicts with source non-goals: ${item.metrics.nonGoalConflicts.join('; ')}`);
return {
@@ -654,6 +710,8 @@ function createHandoffContract({ ranked, provenance, decisionContext }) {
lane: item.lane?.id || 'defer',
sourceSection: item.provenance?.sourceSection || '',
sourceId: item.provenance?.sourceId || '',
originalId: item.provenance?.originalId || '',
idNormalized: Boolean(item.provenance?.idNormalized),
evidenceNeeded: item.factors?.evidenceNeeded || '',
nonGoalConflicts: item.metrics?.nonGoalConflicts || [],
};
@@ -701,7 +759,7 @@ app.post('/api/rank-feedback', (req, res) => {
concern: concernFor(rankedOption),
};
});
const brief = createDecisionBrief({ idea, context, mode, ranked: options, provenance });
const brief = createDecisionBrief({ idea, context, mode, ranked: options, provenance, decisionContext });
const handoff = createHandoffContract({ ranked: options, provenance, decisionContext });
res.json({
ok: true,