From 39287ea2e3cbb4c88fcab559e09b9852927c1f7e Mon Sep 17 00:00:00 2001 From: OpenClaw Bot Date: Wed, 27 May 2026 19:01:17 +0200 Subject: [PATCH] Accept Scattermind evidence question aliases --- README.md | 2 +- scripts/check-rank-feedback.mjs | 28 ++++++++++++++++++++++++++++ server.js | 20 ++++++++++++++------ 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 07f0a40..1257dfa 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Candidate items may include optional 1–10 `rankerHints` (`value`, `effort`, `c Candidate trace note: candidate-level `sourceItemId` / `traceId`, `sourceTitle` / `lensTitle`, and `sourceExcerpt` / `sourceQuote` are preserved in ranked items, `buildOrderDetails`, and `handoff.itemTrace`. Lens-only Build Order text is also split into deterministic `concept-map.lenses.channel#N` source IDs with the original labelled sentence carried as `sourceQuote`, so pasted paid Concept Maps remain traceable even without explicit candidate objects. String items in laned Build Order arrays now also receive deterministic section-local source IDs such as `concept-map.buildOrder.validateNext#1` and carry the original string as `sourceQuote`, so simple Scattermind exports stay addressable downstream instead of becoming anonymous `feature-1` rows. Ranker also accepts the current Scattermind storage-row shape with `referenceCode`, `ideaText`, `context`, and string-valued `fullReadingJson` / `full_reading_json`; it expands the saved paid Concept Map before ranking so operators do not have to hand-copy lenses out of Appwrite rows. If the row only has free Snapshot data (`glimpseJson` / `glimpse_json` / `snapshotJson`), Ranker expands that Snapshot into a minimal continuation order: one manual proof plus the first evidence question, with the Snapshot reference code/title preserved for provenance. The public paste form mirrors this: a prose-wrapped/fenced Appwrite row paste stays intact for the API instead of unwrapping the stringified reading into nonsense fields. The decision `brief.quickGlance.sourceTrace` now repeats the winning item's source section/id/title/quote, and both `brief.source.originalPromptExcerpt` / `handoff.source.originalPromptExcerpt` or, when the original prompt is unavailable, `sourceSummaryExcerpt` carry the source context so a downstream Scattermind handoff can show why the build order exists without digging through `input.provenance`. Scattermind should use these when a next move came from a specific Concept Map lens sentence, so Ranker can defend not just what wins but where the judgement came from. -Soft Scattermind labels are accepted at the bridge boundary so Scattermind does not need to use harsh verdict copy in its own product surface. Lens text can say `Continue first`, `Make tangible`, `Try next`, `Evidence next`, `Hold for later`, or `Set aside`, with either colon or reader-friendly dash separators (`Continue first: …`, `Continue first — …`, `Evidence next - …`). Build Order objects and direct bridge/envelope sections can use matching camel/snake-case keys such as `continueFirst`, `evidenceNext`, `holdForLater`, and `setAside`. Ranker maps those to `doFirst / validateNext / defer / park` while preserving the softer original label in `sourceQuote` or candidate source trace. Ranker also accepts softer continuation envelopes named `rankerBridge`, `continuation`, or `continuationPlan`, candidate arrays named `possibleNextMoves`, `suggestedNextMoves`, `recommendations`, or `opportunities`, and laned `buildOrderPreview` / `build_order_preview` objects so Scattermind can pass a paid Concept Map preview without renaming it into software-feature language. +Soft Scattermind labels are accepted at the bridge boundary so Scattermind does not need to use harsh verdict copy in its own product surface. Lens text can say `Continue first`, `Make tangible`, `Try next`, `Evidence next`, `Hold for later`, or `Set aside`, with either colon or reader-friendly dash separators (`Continue first: …`, `Continue first — …`, `Evidence next - …`). Build Order objects and direct bridge/envelope sections can use matching camel/snake-case keys such as `continueFirst`, `evidenceNext`, `holdForLater`, and `setAside`. Ranker maps those to `doFirst / validateNext / defer / park` while preserving the softer original label in `sourceQuote` or candidate source trace. Ranker also accepts softer continuation envelopes named `rankerBridge`, `continuation`, or `continuationPlan`, candidate arrays named `possibleNextMoves`, `suggestedNextMoves`, `recommendations`, or `opportunities`, laned `buildOrderPreview` / `build_order_preview` objects, and evidence-question fallback arrays (`evidenceQuestions` / `evidence_questions`, `decisionQuestions`, `questionsToAnswer`, `followupQuestions`) so Scattermind can pass a paid Concept Map preview without renaming it into software-feature language. Lane safety note: explicit Scattermind `defer` / `park` hints are hard rails, not mild suggestions. Source `nonGoals` / `avoid` guardrails are also hard enough to keep conflicting candidates out of Do first / Validate next even when their local scoring hints look attractive; soft guardrail language such as “this is not a dashboard” or “keep auth/billing/workspaces out until proof” is promoted into non-goals, not merely background context. The result will mark the lane source as `source-non-goal` so the handoff can explain that the candidate needs guardrail resolution before active work. Handoff `source.requiresSourceTrace` is true only when a real source artifact/title is present; plain idea-only ranking still warns about a missing artifact ID when it carries prompt provenance, but it does not spam source-section/evidence warnings meant for Scattermind artifacts. Handoff `readiness` now gives downstream bridge consumers a deterministic gate: `ready`, `usable-with-warnings`, `needs-source-context`, or `blocked`, with blockers and next checks for missing evidence, source trace, duplicate IDs, or active source-non-goal conflicts. Handoff `activeSlice` (`ranker-active-slice-v1`) is the compact machine-readable continuation unit: one active item, its proof/evidence/success/kill signals, source anchor, held-back items, readiness status, and the rule that only this slice is build-ready. For tired first-screen users, `brief.decisionReceipt` repeats the one active move, first proof step, evidence question, held-back items, source anchor, and the handoff rule that only Do first is active; use it as the compact result strip before showing the full lane board. For low-friction handoff, `/api/rank-feedback` also detects a raw Scattermind/Concept Map JSON object pasted into `idea`, `ideaText`, `optionsText`, or wrapper keys such as `payload`; it expands that object before ranking and reports `input.embeddedPayloadSource` so the public form can accept copy/paste exports without a custom import screen. Exact free Snapshot JSON (`working_name`, `restated_idea`, `lenses.shape`, `questions_to_sit_with`, `reference_code`) is rankable too: Ranker derives a manual proof active slice plus evidence questions, carrying the Snapshot reference code/title into provenance so a Snapshot-only handoff does not need a paid Concept Map before it can produce a useful build order. If a Concept Map only carries `questions_to_sit_with` / `questionsToSitWith` / `openQuestions` and no explicit build-order lanes or action threads, Ranker converts those questions into Validate-next evidence actions with source trace instead of pretending they are software features. diff --git a/scripts/check-rank-feedback.mjs b/scripts/check-rank-feedback.mjs index 23985e0..62e8dda 100644 --- a/scripts/check-rank-feedback.mjs +++ b/scripts/check-rank-feedback.mjs @@ -1505,6 +1505,34 @@ try { assert.equal(questionsFallback.handoff.readiness.status, 'ready'); assert.deepEqual(questionsFallback.handoff.warnings, []); + const evidenceQuestionsAliasResponse = await fetch(`${base}/api/rank-feedback`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + sourceName: 'Scattermind', + artifactId: 'SM-EVIDENCE-QUESTIONS-1', + snapshotTitle: 'Evidence questions alias', + originalPrompt: 'Scattermind exported evidence questions instead of questions_to_sit_with.', + context: 'Manual proof first. Avoid saved dashboards before one user acts.', + conceptMap: { + evidence_questions: [ + 'Can one tired user explain the first source-traced move?', + { question: 'Does the copyable handoff preserve enough provenance to trust the build order?', proof_steps: ['Paste the handoff into notes and ask one non-AI-native user what comes first.'] }, + 'Would a saved dashboard distract from the manual proof?' + ], + }, + mode: 'validation', + }), + }); + assert.equal(evidenceQuestionsAliasResponse.status, 200); + const evidenceQuestionsAlias = await evidenceQuestionsAliasResponse.json(); + assert.equal(evidenceQuestionsAlias.input.provenance.artifactId, 'SM-EVIDENCE-QUESTIONS-1'); + assert.equal(evidenceQuestionsAlias.input.optionCount, 3); + assert.equal(evidenceQuestionsAlias.ranked[0].provenance.sourceSection, 'concept-map.questionsToSitWith'); + assert.match(evidenceQuestionsAlias.ranked[0].factors.evidenceNeeded, /provenance|source-traced/i); + assert.equal(evidenceQuestionsAlias.handoff.readiness.status, 'ready'); + assert.deepEqual(evidenceQuestionsAlias.handoff.warnings, []); + const freeSnapshotResponse = await fetch(`${base}/api/rank-feedback`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, diff --git a/server.js b/server.js index bb5bb96..72431d2 100644 --- a/server.js +++ b/server.js @@ -639,6 +639,14 @@ function looksLikeRankPayload(value = {}) { || Array.isArray(value.action_threads) || Array.isArray(value.questions_to_sit_with) || Array.isArray(value.questionsToSitWith) + || Array.isArray(value.evidenceQuestions) + || Array.isArray(value.evidence_questions) + || Array.isArray(value.decisionQuestions) + || Array.isArray(value.decision_questions) + || Array.isArray(value.questionsToAnswer) + || Array.isArray(value.questions_to_answer) + || Array.isArray(value.followupQuestions) + || Array.isArray(value.followup_questions) || Array.isArray(value.openQuestions) || Array.isArray(value.open_questions) ); @@ -1171,7 +1179,7 @@ function optionsFromSnapshotReading(source = {}, sourceSection = 'snapshot') { const shapeText = cleanMultiline(lensContent(rawShapeLens), 700); const workingName = cleanText(reading.working_name || reading.workingName || reading.snapshotTitle || reading.snapshot_title || reading.title || reading.name || '', 90); const restatedIdea = cleanText(reading.restated_idea || reading.restatedIdea || reading.ideaText || reading.idea_text || reading.idea || '', 260); - const questions = cleanFlexibleTextList(reading.questions_to_sit_with || reading.questionsToSitWith || reading.openQuestions || reading.open_questions, 4, 240); + const questions = cleanFlexibleTextList(reading.questions_to_sit_with || reading.questionsToSitWith || reading.evidenceQuestions || reading.evidence_questions || reading.decisionQuestions || reading.decision_questions || reading.questionsToAnswer || reading.questions_to_answer || reading.followupQuestions || reading.followup_questions || reading.openQuestions || reading.open_questions, 4, 240); const hasSnapshotShape = Boolean(workingName || restatedIdea || shapeText || questions.length); if (!hasSnapshotShape || (!shapeText && !restatedIdea && questions.length < 1)) return []; @@ -1350,11 +1358,11 @@ function optionsFromBody(body = {}) { ); if (actionThreadOptions.length >= 2) return normalizeCandidateGroup([{ items: actionThreadOptions, sourceSection: actionThreadSource.sourceSection || 'threadsToHold' }]); const questionSource = firstArraySource([ - { items: conceptMap.questions_to_sit_with || conceptMap.questionsToSitWith || conceptMap.openQuestions || conceptMap.open_questions, sourceSection: 'concept-map.questionsToSitWith' }, - { items: snapshot.questions_to_sit_with || snapshot.questionsToSitWith || snapshot.openQuestions || snapshot.open_questions, sourceSection: 'snapshot.questionsToSitWith' }, - { items: envelope.questions_to_sit_with || envelope.questionsToSitWith || envelope.openQuestions || envelope.open_questions, sourceSection: 'ranker-input.questionsToSitWith' }, - { items: featureSet.questions_to_sit_with || featureSet.questionsToSitWith || featureSet.openQuestions || featureSet.open_questions, sourceSection: 'feature-set.questionsToSitWith' }, - { items: body.questions_to_sit_with || body.questionsToSitWith || body.openQuestions || body.open_questions, sourceSection: 'questionsToSitWith' }, + { items: conceptMap.questions_to_sit_with || conceptMap.questionsToSitWith || conceptMap.evidenceQuestions || conceptMap.evidence_questions || conceptMap.decisionQuestions || conceptMap.decision_questions || conceptMap.questionsToAnswer || conceptMap.questions_to_answer || conceptMap.followupQuestions || conceptMap.followup_questions || conceptMap.openQuestions || conceptMap.open_questions, sourceSection: 'concept-map.questionsToSitWith' }, + { items: snapshot.questions_to_sit_with || snapshot.questionsToSitWith || snapshot.evidenceQuestions || snapshot.evidence_questions || snapshot.decisionQuestions || snapshot.decision_questions || snapshot.questionsToAnswer || snapshot.questions_to_answer || snapshot.followupQuestions || snapshot.followup_questions || snapshot.openQuestions || snapshot.open_questions, sourceSection: 'snapshot.questionsToSitWith' }, + { items: envelope.questions_to_sit_with || envelope.questionsToSitWith || envelope.evidenceQuestions || envelope.evidence_questions || envelope.decisionQuestions || envelope.decision_questions || envelope.questionsToAnswer || envelope.questions_to_answer || envelope.followupQuestions || envelope.followup_questions || envelope.openQuestions || envelope.open_questions, sourceSection: 'ranker-input.questionsToSitWith' }, + { items: featureSet.questions_to_sit_with || featureSet.questionsToSitWith || featureSet.evidenceQuestions || featureSet.evidence_questions || featureSet.decisionQuestions || featureSet.decision_questions || featureSet.questionsToAnswer || featureSet.questions_to_answer || featureSet.followupQuestions || featureSet.followup_questions || featureSet.openQuestions || featureSet.open_questions, sourceSection: 'feature-set.questionsToSitWith' }, + { items: body.questions_to_sit_with || body.questionsToSitWith || body.evidenceQuestions || body.evidence_questions || body.decisionQuestions || body.decision_questions || body.questionsToAnswer || body.questions_to_answer || body.followupQuestions || body.followup_questions || body.openQuestions || body.open_questions, sourceSection: 'questionsToSitWith' }, ]); const questionOptions = optionsFromQuestionsToSitWith( questionSource.items,