Preserve Scattermind action signals in Ranker handoff
This commit is contained in:
@@ -45,7 +45,7 @@ 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 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. Ranker also accepts an already-laned Build Order object at top level, under `featureSet`, or as `conceptMap.buildOrder` (`doFirst` / `validateNext` / `deferred` / `parkingLot`, with aliases like `buildNow`, `testManually`, and `probablyNoise`). String items in those lanes are normalized into candidate actions, while object items can use `move`, `questionToAnswer`, or `evidenceQuestion` aliases. Empty wrapper arrays are ignored rather than allowed to shadow a real nested Concept Map action set, and non-empty normalized wrappers are merged with Concept Map validation/deferred/parking sections rather than dropping that context. That keeps partially-normalized Scattermind exports rankable without losing the source lane contract. It also returns a `brief` with source, next-48-hour actions, carried-forward assumptions/constraints/non-goals, and `whatWouldChangeRanking` checks, lane-level `buildOrderDetails` with each item's reason, next step, evidence question, source section, lane source, score, and confidence, 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. If Scattermind sends the current paid Concept Map shape as lenses rather than arrays, Ranker can parse `conceptMap.lenses.channel.content` / `buildOrder` labels (`Build first`, `Test manually`, `Defer`, `Probably noise`) into rank-ready candidates and can read guardrails from the risk lens. 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. Ranker also accepts an already-laned Build Order object at top level, under `featureSet`, or as `conceptMap.buildOrder` (`doFirst` / `validateNext` / `deferred` / `parkingLot`, with aliases like `buildNow`, `testManually`, and `probablyNoise`). String items in those lanes are normalized into candidate actions, while object items can use `move`, `questionToAnswer`, or `evidenceQuestion` aliases. Empty wrapper arrays are ignored rather than allowed to shadow a real nested Concept Map action set, and non-empty normalized wrappers are merged with Concept Map validation/deferred/parking sections rather than dropping that context. That keeps partially-normalized Scattermind exports rankable without losing the source lane contract. It also returns a `brief` with source, next-48-hour actions, carried-forward assumptions/constraints/non-goals, and `whatWouldChangeRanking` checks, lane-level `buildOrderDetails` with each item's reason, next step, evidence question, success/kill signals, source section, lane source, score, and confidence, plus a `handoff` object (`rank-feedback-result-v1`) with source provenance, item trace rows, explicit next-step/success/kill signals when Scattermind provides them, and contract warnings for missing artifact IDs, source sections, original prompt provenance, or evidence on active items. If Scattermind sends the current paid Concept Map shape as lenses rather than arrays, Ranker can parse `conceptMap.lenses.channel.content` / `buildOrder` labels (`Build first`, `Test manually`, `Defer`, `Probably noise`) into rank-ready candidates and can read guardrails from the risk lens. 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 1–10 `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`, inside `conceptMap.context`, or as a structured top-level `context` object with `summary`, `targetAudience`, `constraints`, `nonGoals` / `avoid`, and `assumptions`; Ranker merges these sources rather than letting a shallow wrapper context shadow deeper Concept Map guardrails. Lens-only Concept Maps may additionally send audience / constraints / assumptions / risk lens content, and Ranker will split sentence-style lens notes into readable decision context instead of leaking `[object Object]`. If Scattermind only has a flat context string, Ranker now extracts simple guardrails such as `Solo builder`, `Manual proof`, `Avoid ...`, `No ...`, and `Do not ...` into `input.decisionContext` / `handoff.decisionContext` so early bridge exports still protect against dashboard/auth/billing drift. 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. Ranker also accepts Scattermind's paid Concept Map object directly when it arrives with top-level `reference_code`, `working_name`, `ideaText`, and string-valued `lenses.channel` / `lenses.risk` fields; the reference code becomes source provenance, the working name becomes the source title, and labelled Build Order text is turned into rank-ready candidates without requiring Scattermind to wrap it first.
|
||||
|
||||
|
||||
@@ -524,7 +524,7 @@ try {
|
||||
},
|
||||
buildOrder: {
|
||||
doFirst: [
|
||||
{ id: 'manual-offer-proof', move: 'Manual offer proof', why: 'Send one copyable offer to three real prospects.', questionToAnswer: 'Will one prospect ask for the next step?' },
|
||||
{ id: 'manual-offer-proof', move: 'Manual offer proof', why: 'Send one copyable offer to three real prospects.', questionToAnswer: 'Will one prospect ask for the next step?', nextAction: 'Send the offer to three named prospects before touching the page design.', successSignal: 'One prospect asks how to buy or book the next step.', killSignal: 'All three prospects understand it but none want the next step.' },
|
||||
],
|
||||
validateNext: [
|
||||
'Copyable follow-up script',
|
||||
@@ -544,6 +544,11 @@ try {
|
||||
assert.equal(objectBuildOrder.input.optionCount, 4);
|
||||
assert.equal(objectBuildOrder.ranked[0].id, 'manual-offer-proof');
|
||||
assert.equal(objectBuildOrder.ranked[0].factors.evidenceNeeded, 'Will one prospect ask for the next step?');
|
||||
assert.equal(objectBuildOrder.ranked[0].nextStep, 'Send the offer to three named prospects before touching the page design.');
|
||||
assert.equal(objectBuildOrder.ranked[0].successSignal, 'One prospect asks how to buy or book the next step.');
|
||||
assert.equal(objectBuildOrder.ranked[0].killSignal, 'All three prospects understand it but none want the next step.');
|
||||
assert.equal(objectBuildOrder.buildOrderDetails.doFirst[0].successSignal, 'One prospect asks how to buy or book the next step.');
|
||||
assert.equal(objectBuildOrder.handoff.itemTrace.find(item => item.id === 'manual-offer-proof').nextStep, 'Send the offer to three named prospects before touching the page design.');
|
||||
assert.equal(objectBuildOrder.ranked.find(item => item.id === 'feature-1').title, 'Copyable follow-up script');
|
||||
assert.equal(objectBuildOrder.ranked.find(item => item.id === 'feature-1').lane.id, 'test');
|
||||
assert.equal(objectBuildOrder.handoff.itemTrace.find(item => item.id === 'feature-1').sourceSection, 'concept-map.buildOrder.validateNext');
|
||||
|
||||
@@ -647,6 +647,9 @@ function normalizeFeatureOption(item, index, fallbackId = 'feature', defaultSour
|
||||
const evidenceNeeded = cleanText(raw.evidenceNeeded || raw.evidence || raw.test || raw.evidenceQuestion || raw.questionToAnswer || '', 260);
|
||||
const userValue = cleanText(raw.userValue || raw.value || raw.outcome || raw.why, 260);
|
||||
const risk = cleanText(raw.risk || raw.assumption || raw.unknown || '', 220);
|
||||
const nextStep = cleanText(raw.nextStep || raw.nextAction || raw.firstStep || raw.manualStep || raw.actionToTake || '', 260);
|
||||
const successSignal = cleanText(raw.successSignal || raw.successCriteria || raw.successMetric || raw.greenLight || raw.signalToSee || '', 260);
|
||||
const killSignal = cleanText(raw.killSignal || raw.stopSignal || raw.redFlag || raw.failureSignal || raw.cutIf || '', 260);
|
||||
const sourceSection = cleanText(raw.sourceSection || raw.section || raw.lane || raw.origin || defaultSourceSection, 80);
|
||||
const recommendedLane = cleanText(raw.recommendedLane || raw.laneHint || raw.suggestedLane || defaultRecommendedLane || '', 40).toLowerCase();
|
||||
const descriptionParts = [
|
||||
@@ -654,6 +657,9 @@ function normalizeFeatureOption(item, index, fallbackId = 'feature', defaultSour
|
||||
userValue && `User value: ${userValue}`,
|
||||
evidenceNeeded && `Evidence needed: ${evidenceNeeded}`,
|
||||
risk && `Risk: ${risk}`,
|
||||
nextStep && `Next step: ${nextStep}`,
|
||||
successSignal && `Success signal: ${successSignal}`,
|
||||
killSignal && `Kill signal: ${killSignal}`,
|
||||
proofSteps.length && `Proof steps: ${proofSteps.join('; ')}`,
|
||||
dependencies.length && `Dependencies: ${dependencies.join(', ')}`,
|
||||
].filter(Boolean);
|
||||
@@ -661,7 +667,7 @@ function normalizeFeatureOption(item, index, fallbackId = 'feature', defaultSour
|
||||
id: cleanText(raw.id || raw.key || `${fallbackId}-${index + 1}`, 80) || `${fallbackId}-${index + 1}`,
|
||||
title,
|
||||
description: cleanText(descriptionParts.join(' '), 760),
|
||||
factors: { userValue, evidenceNeeded, risk, proofSteps, dependencies, recommendedLane, metricHints: cleanMetricHints(raw) },
|
||||
factors: { userValue, evidenceNeeded, risk, nextStep, successSignal, killSignal, proofSteps, dependencies, recommendedLane, metricHints: cleanMetricHints(raw) },
|
||||
provenance: {
|
||||
sourceId: cleanText(raw.sourceId || raw.sourceArtifactId || raw.id || '', 120),
|
||||
sourceSection,
|
||||
@@ -927,6 +933,7 @@ function evidenceQuestionFor(option) {
|
||||
|
||||
function nextStepFor(option) {
|
||||
if (!option) return '';
|
||||
if (option.factors?.nextStep) return option.factors.nextStep;
|
||||
if (option.lane?.id === 'do') return `Run one manual proof of “${option.title}” before building supporting machinery.`;
|
||||
if (option.lane?.id === 'test') return `Design the smallest evidence test for “${option.title}” and collect signal from real users.`;
|
||||
if (option.lane?.id === 'defer') return `Keep “${option.title}” sequenced after the active proof; do not parallel-build it.`;
|
||||
@@ -935,6 +942,7 @@ function nextStepFor(option) {
|
||||
|
||||
function successSignalFor(option) {
|
||||
if (!option) return '';
|
||||
if (option.factors?.successSignal) return option.factors.successSignal;
|
||||
if (option.metrics?.revenue >= 6.4) return 'A real prospect asks for the outcome, accepts a price, or requests the next step.';
|
||||
if (option.lane?.id === 'do') return 'At least 2 of 3 real users can name why this should be first and what they would do next.';
|
||||
if (option.lane?.id === 'test') return 'The test produces a clear yes/no learning, not polite interest.';
|
||||
@@ -943,6 +951,7 @@ function successSignalFor(option) {
|
||||
|
||||
function killSignalFor(option) {
|
||||
if (!option) return '';
|
||||
if (option.factors?.killSignal) return option.factors.killSignal;
|
||||
if (option.metrics?.nonGoalConflicts?.length) return 'It still conflicts with the source guardrails after review.';
|
||||
if (option.metrics?.feasibility <= 4.5) return 'The proof slice needs platform work before any user signal exists.';
|
||||
return 'People understand the idea but do not take, request, or value the next step.';
|
||||
@@ -1060,6 +1069,8 @@ function compactBuildItems(items = []) {
|
||||
reason: item.reason,
|
||||
nextStep: item.nextStep,
|
||||
evidenceQuestion: item.evidenceQuestion,
|
||||
successSignal: item.successSignal,
|
||||
killSignal: item.killSignal,
|
||||
concern: item.concern,
|
||||
sourceSection: item.provenance?.sourceSection || '',
|
||||
sourceId: item.provenance?.sourceId || '',
|
||||
@@ -1089,6 +1100,9 @@ function createHandoffContract({ ranked, provenance, decisionContext }) {
|
||||
originalId: item.provenance?.originalId || '',
|
||||
idNormalized: Boolean(item.provenance?.idNormalized),
|
||||
evidenceNeeded: item.factors?.evidenceNeeded || '',
|
||||
nextStep: item.nextStep || '',
|
||||
successSignal: item.successSignal || '',
|
||||
killSignal: item.killSignal || '',
|
||||
nonGoalConflicts: item.metrics?.nonGoalConflicts || [],
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user