Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(contradictions): judge prompt v4 — undated and same-day value conflicts stay contradictions (N2)
garrytanbc2354a6d758
diff --git a/docs/contradictions.md b/docs/contradictions.mdindex 3a374f1199..7304c6c6f4 100644--- a/docs/contradictions.md+++ b/docs/contradictions.md@@ -171,6 +171,13 @@ the text-date pre-filter in charge. A temporal verdict needs two differenttimes: same-date or undated value conflicts are contradictions. Claims abouttwo entities whose names merely look alike are never contradictions.+Prompt v4 asks two questions before any verdict: do both statements give a+value for the same attribute of the same entity (if not, nothing conflicts),+and is there evidence of two different times? It tells the judge never to+order two values by their size, the kind of document, or which statement is+listed first, and that a negative claim about one party ("Fund A is not+leading") and a positive claim about another ("Fund B is leading") agree.+The trajectory substrate builds on the same signal:`gbrain eval trajectory <entity>` shows the chronological typed-claimhistory with regressions flagged inline; `gbrain founder scorecarddiff --git a/src/core/eval-contradictions/judge.ts b/src/core/eval-contradictions/judge.tsindex 95f88028ef..fd4edd7196 100644--- a/src/core/eval-contradictions/judge.ts+++ b/src/core/eval-contradictions/judge.ts@@ -345,6 +345,17 @@ export function buildJudgePrompt(opts: {' classify what kind of difference this is, not just whether it exists.',' (date unknown) means the page has no temporal anchor — judge on text',' alone for that side.',+ '- Time check first. The three temporal verdicts need evidence of two',+ ' DIFFERENT times: different (from:) dates, different dates written in',+ ' the text, or explicit change wording ("now", "previously", "grew from").',+ ' Never infer an order from the values themselves (a larger or smaller',+ ' number), from the kind of document (memo, deck, call notes), or from',+ ' which statement is listed first. Without that evidence, two values for',+ ' the same fact are a contradiction, not a change over time.',+ '- A conflict or a change needs a value for the same attribute on BOTH',+ ' sides. Silence is not a conflict: when one statement does not mention',+ ' the attribute the other states (it lists other facts), use',+ ' no_contradiction.','- Pick exactly one verdict from the six values below.','- Use temporal_supersession when the newer-dated claim updates or replaces',' the older one (role change, status change). Not an error.',@@ -358,13 +369,15 @@ export function buildJudgePrompt(opts: {'- Use contradiction ONLY for genuinely conflicting claims at the same point',' in time, where the dates do not explain the difference.','- Use no_contradiction when the statements are compatible.',- '- The three temporal verdicts need two DIFFERENT times: different (from:)',- ' dates, or different dates stated in the text. When both sides carry the',- ' same date, or nothing dates either side, time does not explain the',- ' difference: two values for the same fact are a contradiction.',+ '- When both sides carry the same date, or nothing dates either side,',+ ' time does not explain the difference: two values for the same fact are',+ ' a contradiction.','- Only claims about the SAME entity can conflict. Two entities whose names',' merely look alike (e.g. "Northwind" vs "Northgate") are',' different entities: use no_contradiction for their differing values.',+ '- A negative claim about one party and a positive claim about a different',+ ' party agree ("Fund A is not leading the round" and "Fund B is leading',+ ' the round"): use no_contradiction.','','- Subjective opinions held at different times by the SAME holder may be',' a contradiction (a flip). Opinions held by DIFFERENT holders are not.',diff --git a/src/core/eval-contradictions/types.ts b/src/core/eval-contradictions/types.tsindex 37a0af419e..79a959da34 100644--- a/src/core/eval-contradictions/types.ts+++ b/src/core/eval-contradictions/types.ts@@ -22,8 +22,11 @@ export const SCHEMA_VERSION = 1 as const;* or `(date unknown)` per side. Old v1 verdicts are silently invalidated.* v3 (N2-3, 2026-10): temporal verdicts need two different times; look-alike* names are different entities.+ * v4 (N2 undated conflicts, 2026-10): a same-fact check, then a time check+ * that forbids ordering two values by size, document kind or listing order;+ * a negative claim about one party and a positive claim about another agree.*/-export const PROMPT_VERSION = '3' as const;+export const PROMPT_VERSION = '4' as const;/** Truncation policy string baked into the cache key. */export const TRUNCATION_POLICY = '1500-chars-utf8-safe' as const;diff --git a/test/eval-contradictions-judge.test.ts b/test/eval-contradictions-judge.test.tsindex d72d4f9ec4..21d8ee4030 100644--- a/test/eval-contradictions-judge.test.ts+++ b/test/eval-contradictions-judge.test.ts@@ -116,10 +116,24 @@ describe('buildJudgePrompt', () => {b: { slug: 'b', text: 'B', effective_date: '2025-01-16' },maxPairChars: 1500,});- expect(p).toContain('The three temporal verdicts need two DIFFERENT times');- expect(p).toContain('time does not explain the');+ expect(p).toContain('The three temporal verdicts need evidence of two');+ expect(p).toContain('time does not explain the difference');expect(p).toContain('Only claims about the SAME entity can conflict.');- expect(PROMPT_VERSION).toBe('3');+ });++ test('N2 undated conflicts: the time check comes first, forbids ordering by value, document kind or position, and silence is not a conflict', () => {+ const p = buildJudgePrompt({+ query: 'headcount',+ a: { slug: 'a', text: 'A' },+ b: { slug: 'b', text: 'B' },+ maxPairChars: 1500,+ });+ expect(p.indexOf('Time check first.')).toBeLessThan(p.indexOf('Use temporal_supersession'));+ expect(p).toContain('Silence is not a conflict');+ expect(p).toContain('"Fund A is not leading the round"');+ expect(p).toContain('Never infer an order from the values themselves');+ expect(p).toContain('which statement is listed first');+ expect(PROMPT_VERSION).toBe('4');});});