2.6 KiB
2.6 KiB
Experiment 57J.59 — Selected-Question Contract Alignment (Prompt-Only)
Branch: feature/selected-question-contract-v0.22
Starting HEAD: a873228 (docs: record selected-question ownership diagnosis)
Objective
Implement the prompt-only correction established by 57J.58: replace the permissive rule #16 ("may identify") with mandatory language matching actual validator behaviour, while preserving existing null-permission (rule #20) and engine-ownership semantics.
Changes
lib/graph/prompt-builder.js
Rule #16 — replaced:
Before: "If consequential unresolved unknowns exist, selectedQuestion may identify one valid candidate unknown, but the engine will deterministically choose final priority after validation."
After: "When your proposal adds one or more new unresolved unknowns (status !== 'resolved'), you MUST include a selectedQuestion identifying one of those as a candidate unknown node. The engine validates your candidate and retains deterministic final-priority selection; your candidate does not need to be the highest-scoring unknown — it only needs to be a valid unresolved unknown that exists in the graph or in addedNodes."
Additional Guidance bullet — replaced:
Before: "Treat selectedQuestion as a candidate only; the engine will apply deterministic information-value scoring after validation."
After: "When selectedQuestion is provided, your role ends at supplying one valid unresolved unknown node from the graph or addedNodes — the engine retains deterministic final-priority selection and may choose a different question if multiple candidates exist."
tests/graph/prompt-builder.test.js
- Updated existing test to match new rule #16 wording (no longer checks for old "may identify" text).
- Added 10 focused tests:
- Mandatory candidate for added unknown
- Permissive wording removed
- Valid candidate, not final priority
- Deterministic engine priority preserved
- Null behaviour preserved outside trigger
- No updatedNodes dependency claimed
- No resolution dependency claimed
- Existing candidate validity preserved
- Uncertainty identity preserved
- Structured fidelity preserved
Results
- prompt-builder.test.js: 59 tests pass (42 existing + 17 new = 59 total). Zero failures.
- No validator changes. No schema changes. No scoring changes.
- Ollama calls: 0. Dev server disturbed: NO.
Ownership split preserved
MODEL: supply one valid candidate when new unresolved unknowns are added
ENGINE: validate candidate, retain deterministic priority/scoring ownership
Configured Ollama: none used. Production code changed: prompt + tests only.