feat(confidence-engine): anchor focused frontier to investigation relevance
This commit is contained in:
@@ -268,3 +268,247 @@ describe("FOCUSED_DECONSTRUCT_REGRESSION_CASES fixture integrity", () => {
|
||||
expect(errors).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
// ── Frontier relevance: prompt contains investigation-relevance anchor ──
|
||||
|
||||
describe("buildFocusedDeconstructPrompt — frontier is anchored to investigation relevance", () => {
|
||||
it("anchors 'nearest' to the central statement and target, not textual adjacency", () => {
|
||||
const prompt = buildFocusedDeconstructPrompt({
|
||||
targetLabel: "X",
|
||||
targetDescription: "Y",
|
||||
centralStatement: "Z",
|
||||
question: "Q?",
|
||||
answer: "A.",
|
||||
});
|
||||
expect(prompt).toContain('"nearest" means the smallest investigation-relevant gap');
|
||||
expect(prompt).toContain("anchored to the central statement and target description");
|
||||
});
|
||||
|
||||
it("explicitly prevents promoting working-example internal detail over investigation-progressing gaps", () => {
|
||||
const prompt = buildFocusedDeconstructPrompt({
|
||||
targetLabel: "X",
|
||||
targetDescription: "Y",
|
||||
centralStatement: "Z",
|
||||
question: "Q?",
|
||||
answer: "A.",
|
||||
});
|
||||
expect(prompt).toContain("Do NOT promote a detail inside an already-working example");
|
||||
});
|
||||
|
||||
it("requires preferring the gap that advances the current investigation", () => {
|
||||
const prompt = buildFocusedDeconstructPrompt({
|
||||
targetLabel: "X",
|
||||
targetDescription: "Y",
|
||||
centralStatement: "Z",
|
||||
question: "Q?",
|
||||
answer: "A.",
|
||||
});
|
||||
expect(prompt).toContain("prefer the gap that advances the current investigation");
|
||||
});
|
||||
|
||||
it("introduces working-example / structural-gap disambiguation condition", () => {
|
||||
const prompt = buildFocusedDeconstructPrompt({
|
||||
targetLabel: "X",
|
||||
targetDescription: "Y",
|
||||
centralStatement: "Z",
|
||||
question: "Q?",
|
||||
answer: "A.",
|
||||
});
|
||||
expect(prompt).toContain("If the answer contains both");
|
||||
});
|
||||
|
||||
it("preserves investigation-relevance qualifier (not just 'smallest unresolved')", () => {
|
||||
const prompt = buildFocusedDeconstructPrompt({
|
||||
targetLabel: "X",
|
||||
targetDescription: "Y",
|
||||
centralStatement: "Z",
|
||||
question: "Q?",
|
||||
answer: "A.",
|
||||
});
|
||||
expect(prompt).toContain("investigation-relevant gap");
|
||||
});
|
||||
});
|
||||
|
||||
// ── Assumption attribution: prompt contains answer-dependence test ──
|
||||
|
||||
describe("buildFocusedDeconstructPrompt — assumption attribution tightened", () => {
|
||||
it("requires an answer-dependence test before attributing assumptions", () => {
|
||||
const prompt = buildFocusedDeconstructPrompt({
|
||||
targetLabel: "X",
|
||||
targetDescription: "Y",
|
||||
centralStatement: "Z",
|
||||
question: "Q?",
|
||||
answer: "A.",
|
||||
});
|
||||
expect(prompt).toContain("Answer-dependence test");
|
||||
});
|
||||
|
||||
it("states the falsity test for attribution", () => {
|
||||
const prompt = buildFocusedDeconstructPrompt({
|
||||
targetLabel: "X",
|
||||
targetDescription: "Y",
|
||||
centralStatement: "Z",
|
||||
question: "Q?",
|
||||
answer: "A.",
|
||||
});
|
||||
expect(prompt).toContain("could be false and the user's answer would still make complete sense");
|
||||
});
|
||||
|
||||
it("prohibits generalising competence from one observed success", () => {
|
||||
const prompt = buildFocusedDeconstructPrompt({
|
||||
targetLabel: "X",
|
||||
targetDescription: "Y",
|
||||
centralStatement: "Z",
|
||||
question: "Q?",
|
||||
answer: "A.",
|
||||
});
|
||||
expect(prompt).toContain("One observed success in a single concrete example does NOT by itself establish a general rule");
|
||||
});
|
||||
|
||||
it("explicitly lists prohibited generalisation domains", () => {
|
||||
const prompt = buildFocusedDeconstructPrompt({
|
||||
targetLabel: "X",
|
||||
targetDescription: "Y",
|
||||
centralStatement: "Z",
|
||||
question: "Q?",
|
||||
answer: "A.",
|
||||
});
|
||||
expect(prompt).toContain("competence, readiness, training, safety, transferability");
|
||||
});
|
||||
|
||||
it("still permits assumptions: [] when no genuine assumption exists", () => {
|
||||
const prompt = buildFocusedDeconstructPrompt({
|
||||
targetLabel: "X",
|
||||
targetDescription: "Y",
|
||||
centralStatement: "Z",
|
||||
question: "Q?",
|
||||
answer: "A.",
|
||||
});
|
||||
expect(prompt).toContain("assumptions: []");
|
||||
});
|
||||
|
||||
it("does not suppress the original attribution principle", () => {
|
||||
const prompt = buildFocusedDeconstructPrompt({
|
||||
targetLabel: "X",
|
||||
targetDescription: "Y",
|
||||
centralStatement: "Z",
|
||||
question: "Q?",
|
||||
answer: "A.",
|
||||
});
|
||||
expect(prompt).toContain("what unstated proposition does the user's answer itself rely upon");
|
||||
});
|
||||
|
||||
it("does not suppress the original false-contradiction test", () => {
|
||||
const prompt = buildFocusedDeconstructPrompt({
|
||||
targetLabel: "X",
|
||||
targetDescription: "Y",
|
||||
centralStatement: "Z",
|
||||
question: "Q?",
|
||||
answer: "A.",
|
||||
});
|
||||
expect(prompt).toContain("would cease to make sense if they were false");
|
||||
});
|
||||
});
|
||||
|
||||
// ── Preservation: existing prompt rules still present ──
|
||||
|
||||
describe("buildFocusedDeconstructPrompt — existing rules preserved", () => {
|
||||
it("still requires exactly one uncertainty", () => {
|
||||
const prompt = buildFocusedDeconstructPrompt({
|
||||
targetLabel: "X",
|
||||
targetDescription: "Y",
|
||||
centralStatement: "Z",
|
||||
question: "Q?",
|
||||
answer: "A.",
|
||||
});
|
||||
expect(prompt).toContain("exactly one string");
|
||||
});
|
||||
|
||||
it("still requires exactly one follow-up question", () => {
|
||||
const prompt = buildFocusedDeconstructPrompt({
|
||||
targetLabel: "X",
|
||||
targetDescription: "Y",
|
||||
centralStatement: "Z",
|
||||
question: "Q?",
|
||||
answer: "A.",
|
||||
});
|
||||
expect(prompt).toContain("exactly one string — your single best follow-up question");
|
||||
});
|
||||
|
||||
it("still requires plain language (ordinary language for capable persons)", () => {
|
||||
const prompt = buildFocusedDeconstructPrompt({
|
||||
targetLabel: "X",
|
||||
targetDescription: "Y",
|
||||
centralStatement: "Z",
|
||||
question: "Q?",
|
||||
answer: "A.",
|
||||
});
|
||||
expect(prompt).toContain("ordinary language that a capable person with no specialist vocabulary can understand immediately");
|
||||
});
|
||||
|
||||
it("still prohibits future remedies and branches", () => {
|
||||
const prompt = buildFocusedDeconstructPrompt({
|
||||
targetLabel: "X",
|
||||
targetDescription: "Y",
|
||||
centralStatement: "Z",
|
||||
question: "Q?",
|
||||
answer: "A.",
|
||||
});
|
||||
expect(prompt).toContain("future constraints");
|
||||
});
|
||||
|
||||
it("still prohibits observation restatement as relationship", () => {
|
||||
const prompt = buildFocusedDeconstructPrompt({
|
||||
targetLabel: "X",
|
||||
targetDescription: "Y",
|
||||
centralStatement: "Z",
|
||||
question: "Q?",
|
||||
answer: "A.",
|
||||
});
|
||||
expect(prompt).toContain("Do not create a relationship by merely restating");
|
||||
});
|
||||
|
||||
it("still prohibits promotion of tentative meaning to relationship", () => {
|
||||
const prompt = buildFocusedDeconstructPrompt({
|
||||
targetLabel: "X",
|
||||
targetDescription: "Y",
|
||||
centralStatement: "Z",
|
||||
question: "Q?",
|
||||
answer: "A.",
|
||||
});
|
||||
expect(prompt).toContain("Tentative, speculative, or conditional language must not be promoted");
|
||||
});
|
||||
|
||||
it("still preserves cross-field ownership rule", () => {
|
||||
const prompt = buildFocusedDeconstructPrompt({
|
||||
targetLabel: "X",
|
||||
targetDescription: "Y",
|
||||
centralStatement: "Z",
|
||||
question: "Q?",
|
||||
answer: "A.",
|
||||
});
|
||||
expect(prompt).toContain("cross-field ownership");
|
||||
});
|
||||
|
||||
it("still prohibits importing scenario-level inference into assumptions", () => {
|
||||
const prompt = buildFocusedDeconstructPrompt({
|
||||
targetLabel: "X",
|
||||
targetDescription: "Y",
|
||||
centralStatement: "Z",
|
||||
question: "Q?",
|
||||
answer: "A.",
|
||||
});
|
||||
expect(prompt).toContain("Do NOT import plausible interpretations from the wider investigation context");
|
||||
});
|
||||
|
||||
it("still prohibits graph-mutation semantics", () => {
|
||||
const prompt = buildFocusedDeconstructPrompt({
|
||||
targetLabel: "X",
|
||||
targetDescription: "Y",
|
||||
centralStatement: "Z",
|
||||
question: "Q?",
|
||||
answer: "A.",
|
||||
});
|
||||
expect(prompt).toContain("Do NOT output graph mutations");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user