Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
feat(graph): certify claude-haiku-4-5, claude-sonnet-5-5, claude-opus-5-5, claude-fable-5-1 and gpt-6.1-sol for apply mode from the E2 held-out verdict; notice and docs (GBRA-49 P1)
garrytan62a4bb8d24cb
diff --git a/docs/eval/decisions/p1-dev-2026-10-04-r2/README.md b/docs/eval/decisions/p1-dev-2026-10-04-r2/README.mdindex 0d66a3f33e..4b62f48601 100644--- a/docs/eval/decisions/p1-dev-2026-10-04-r2/README.md+++ b/docs/eval/decisions/p1-dev-2026-10-04-r2/README.md@@ -78,7 +78,8 @@ minimum of 10), which makes the overall kit verdict `inconclusive`.+0.20 (superiority, cluster-bootstrap interval above zero); current-employer andlive-edge recall non-inferior within 0.02; traps ≥ 0.99; order invariance 1 on everyitem; no guardrail failing. `graph.edge_validity` stays on only if E1 passes.-2. **E2 and E3** as preregistered in round 1, run on this frozen build after E1.+2. **E2 and E3** as preregistered in round 1, run on this frozen build after E1. E2+ passed for all five models: [p1-e2-2026-10-05](../p1-e2-2026-10-05/README.md).## Held-out verdictsdiff --git a/docs/eval/decisions/p1-e2-2026-10-05/README.md b/docs/eval/decisions/p1-e2-2026-10-05/README.mdnew file mode 100644index 0000000000..c2fc2b7a22--- /dev/null+++ b/docs/eval/decisions/p1-e2-2026-10-05/README.md@@ -0,0 +1,42 @@+# P1 temporal typed edges, E2: per-model certification of `apply` mode++**Held-out verdict: pass for all five models.** Each is in `CERTIFIED_APPLY_MODELS`+(`src/core/cycle/edge-contradictions.ts`), so with no explicit+`dream.edge_contradictions.mode` the nightly relationship check applies its closures+with any of them. Every other chat model proposes.++## Run++Custodian (P0), phrasing set C, 3 runs per model, frozen build `feb077ef9`. The ledger+holds only dated "joined" lines (as an employment history usually reads), so every+closure comes from the contradiction phase; undated and out-of-order sub-ledgers check+that undated pairs are never closed and that late-recorded evidence is born closed.++Preregistered bar ([round 1](../p1-dev-2026-10-04/README.md)): wrong closures ≤ 1% in+every run, and as-of exact at least 10 points above the deterministic E1 arm.++Models: claude-haiku-4-5 (the utility default), claude-sonnet-5-5, gpt-6.1-sol,+claude-opus-5-5 and claude-fable-5-1.++| Check (all five models, every run) | Result |+|---|---|+| Wrong closures | 0 |+| As-of exact vs the E1 arm | +0.111 to +0.115 (bar +0.10) |+| Undated pairs closed | 0 |++Each run applied 65–66 closures. Judge output errors: claude-sonnet-5-5 returned 3 and 6+malformed outputs in two runs and claude-fable-5-1 6 in one; those pairs were not+proposed, which is the designed behavior for a malformed answer.++## What the result does not show++1. **No model is better than another here.** The model only flags that two current+ relationships cannot both hold; date arithmetic picks which one ended and when. All+ five sit at the same ceiling, so the pass certifies that `apply` is safe with each of+ them, not a ranking.+2. **Closures are often late.** 41 of the 66 closures are dated after the real end: with only "joined" lines, a gap between jobs closes the earlier job on the next+ start date. That is late, not wrong, and it is why as-of clears the bar by about 1.5+ points. Follow-up: close at the gap when an explicit end date exists, and otherwise+ record the end date as an upper bound.+3. **Proposals go stale within a cycle.** 51 proposals per model went stale in the same+ cycle and are judged again the next night.diff --git a/docs/guides/temporal-edges.md b/docs/guides/temporal-edges.mdindex ebb25f864e..4466c9f426 100644--- a/docs/guides/temporal-edges.md+++ b/docs/guides/temporal-edges.md@@ -133,9 +133,18 @@ whether they can both hold now; date arithmetic decides which one ended and whenrelationship that started earlier ends on the date the other started. Relationshipswithout a dated start are never closed; the proposal asks for a date instead.+A certified model passed a held-out run with no wrong closures, so with no explicit mode+its closures are applied as timeline lines, each undoable. Set+`dream.edge_contradictions.mode propose` to review every closure first.++The closure date is the newer relationship's start. When someone left one job and+started the next later, and only the "joined" lines are written, the earlier job closes+on the later start date: late, not wrong. An explicit end line+(`Ended works_at [[companies/x]]`) or a "left" line dates it exactly.+| Setting | Default ||---|---|-| `dream.edge_contradictions.mode` | `propose` with a chat model; `apply` only for models that passed the held-out certification; `off` without a chat model |+| `dream.edge_contradictions.mode` | `apply` for certified models (`claude-haiku-4-5`, the utility default, plus `claude-sonnet-5-5`, `claude-opus-5-5`, `claude-fable-5-1`, `gpt-6.1-sol`); `propose` for any other chat model; `off` without one || `models.dream.edge_contradictions` | utility tier || `dream.edge_contradictions.max_subjects` | 200 per cycle || `dream.edge_contradictions.max_usd` | $1.00 per cycle |diff --git a/src/core/cycle/edge-contradictions.ts b/src/core/cycle/edge-contradictions.tsindex d15dee02d6..be3eef5d0c 100644--- a/src/core/cycle/edge-contradictions.ts+++ b/src/core/cycle/edge-contradictions.ts@@ -76,10 +76,20 @@ export interface EdgeContradictionsOpts {/*** Models whose sealed held-out run met the certification bar (wrong closures- * ≤ 1% on every run). With no explicit mode, a certified model defaults to- * `apply`; every other configured model defaults to `propose`.+ * ≤ 1% on every run and as-of +10 points over the deterministic arm): E2 on+ * set C, 3 runs each, 0 wrong closures (docs/eval/decisions/p1-e2-2026-10-05).+ * With no explicit mode, a certified model defaults to `apply`; every other+ * configured model defaults to `propose`. Matched without the provider prefix+ * and dated snapshot suffix ("anthropic:claude-haiku-4-5-20251001").*/-export const CERTIFIED_APPLY_MODELS: readonly string[] = [];+export const CERTIFIED_APPLY_MODELS: readonly string[] = [+ 'claude-haiku-4-5', 'claude-sonnet-5-5', 'claude-opus-5-5', 'claude-fable-5-1', 'gpt-6.1-sol',+];++export function isCertifiedApplyModel(model: string): boolean {+ const id = model.trim().toLowerCase().replace(/^[a-z0-9_-]+:/, '').replace(/-\d{8}$/, '');+ return CERTIFIED_APPLY_MODELS.includes(id);+}const DEFAULT_MAX_SUBJECTS = 200;const DEFAULT_BUDGET_USD = 1.0;@@ -91,7 +101,7 @@ export async function loadEdgeContradictionsConfig(engine: BrainEngine, model: sconst raw = (await engine.getConfig('dream.edge_contradictions.mode'))?.trim().toLowerCase();const explicit = raw === 'propose' || raw === 'apply' || raw === 'off';const mode: EdgeContradictionsMode = explicit ? raw as EdgeContradictionsMode- : CERTIFIED_APPLY_MODELS.includes(model) ? 'apply' : 'propose';+ : isCertifiedApplyModel(model) ? 'apply' : 'propose';const subjects = Number.parseInt((await engine.getConfig('dream.edge_contradictions.max_subjects')) ?? '', 10);return {mode,diff --git a/src/core/temporal-edges-upgrade-notice.ts b/src/core/temporal-edges-upgrade-notice.tsindex a8223b720c..1086e28e6c 100644--- a/src/core/temporal-edges-upgrade-notice.ts+++ b/src/core/temporal-edges-upgrade-notice.ts@@ -1,8 +1,8 @@// Temporal typed edges: one-shot post-upgrade notice. Graph reads now return// relationships that are true today (history on request), and the// edge_contradictions dream phase proposes closures for live relationships-// that cannot both hold (paid chat calls; proposals only unless the model is-// certified for automatic application). Printed by `gbrain post-upgrade` once.+// that cannot both hold (paid chat calls; applied automatically for models+// certified in held-out runs, proposals for every other model). Printed by `gbrain post-upgrade` once.import type { BrainEngine } from './engine.ts';import { agentBlock } from './agent-markers.ts';@@ -36,12 +36,14 @@ export async function temporalEdgesUpgradeNotice(engine: BrainEngine): Promise<s'"Ended works_at [[companies/x]]" lines and past-tense prose, so "who works at X" stops listing former employees. ' +`The dream cycle's relationship check (mode: ${mode}) sends a subject's competing relationships and their context lines to ` +`${model ?? 'the configured chat model'} once per changed subject (cap $${config.budgetUsd.toFixed(2)} per cycle). ` +- 'In propose mode it writes nothing to pages until the user accepts a proposal (gbrain edge-proposals list).',+ (mode === 'apply'+ ? `${model} is certified for apply mode (0 wrong closures in held-out runs), so each closure is written as an "(inferred) Ended <relation> [[target]]" timeline line; gbrain edge-proposals undo <id> (or --all-applied) removes them.`+ : 'In propose mode it writes nothing to pages until the user accepts a proposal (gbrain edge-proposals list).'),consent: 'paid, egress',actor: 'user',next: 'ask_user',- if_yes: 'Nothing to run; the defaults stay. Review proposals with gbrain edge-proposals list.',- if_no: 'Run gbrain config set graph.edge_validity off (every edge, as before) and/or gbrain config set dream.edge_contradictions.mode off.',+ if_yes: 'Nothing to run; the defaults stay. Review what the check did with gbrain edge-proposals list --status all.',+ if_no: 'Run gbrain config set graph.edge_validity off (every edge, as before), gbrain config set dream.edge_contradictions.mode propose (review before anything is written) or gbrain config set dream.edge_contradictions.mode off.',verify: 'gbrain doctor --only edge_validity --json',}, {showUser: 'GBrain now tracks when relationships started and ended, so it stops treating old jobs as current. A nightly check can also ' +diff --git a/test/cycle-edge-contradictions.test.ts b/test/cycle-edge-contradictions.test.tsindex e322bee0a9..ca916175c8 100644--- a/test/cycle-edge-contradictions.test.ts+++ b/test/cycle-edge-contradictions.test.ts@@ -12,6 +12,7 @@ import type { OperationContext } from '../src/core/operations.ts';import { resetGateway } from '../src/core/ai/gateway.ts';import {runPhaseEdgeContradictions, applyEdgeProposal, undoEdgeProposal, rejectEdgeProposal, parseEdgeJudgeOutput, type EdgeJudgeFn,+ isCertifiedApplyModel, loadEdgeContradictionsConfig,} from '../src/core/cycle/edge-contradictions.ts';import { relationshipFilterSql } from '../src/core/link-validity.ts';@@ -46,6 +47,7 @@ const proposals = () => engine.executeRaw<{ id: number; status: string; close_dadescribe('edge_contradictions', () => {test('propose mode records a proposal and writes nothing canonical; accept applies; undo reopens', async () => {+ await engine.setConfig('dream.edge_contradictions.mode', 'propose');await seed(DATED);expect(await liveWorksAt()).toEqual(['companies/acme-example', 'companies/widget-co']);const r = await runPhaseEdgeContradictions(engine, { judge: conflict });@@ -121,6 +123,7 @@ describe('edge_contradictions', () => {});test('reject keeps both relationships; mode off skips', async () => {+ await engine.setConfig('dream.edge_contradictions.mode', 'propose');await seed(DATED);await runPhaseEdgeContradictions(engine, { judge: conflict });const [p] = await proposals();@@ -130,4 +133,15 @@ describe('edge_contradictions', () => {try { expect((await runPhaseEdgeContradictions(engine, { judge: conflict })).status).toBe('skipped'); }finally { await engine.setConfig('dream.edge_contradictions.mode', 'propose'); }});++ test('certified models default to apply; others to propose; an explicit mode wins', async () => {+ expect(isCertifiedApplyModel('anthropic:claude-haiku-4-5-20251001')).toBe(true);+ expect(isCertifiedApplyModel('openai:gpt-6.1-sol')).toBe(true);+ expect(isCertifiedApplyModel('claude-opus-5-5')).toBe(true);+ expect(isCertifiedApplyModel('gpt-5.4-mini')).toBe(false);+ expect((await loadEdgeContradictionsConfig(engine, 'anthropic:claude-haiku-4-5-20251001')).mode).toBe('apply');+ expect((await loadEdgeContradictionsConfig(engine, 'openai:gpt-5.4-mini')).mode).toBe('propose');+ await engine.setConfig('dream.edge_contradictions.mode', 'propose');+ expect((await loadEdgeContradictionsConfig(engine, 'claude-sonnet-5-5')).mode).toBe('propose');+ });});diff --git a/test/temporal-edges-upgrade-notice.test.ts b/test/temporal-edges-upgrade-notice.test.tsnew file mode 100644index 0000000000..e0d43abc80--- /dev/null+++ b/test/temporal-edges-upgrade-notice.test.ts@@ -0,0 +1,32 @@+/**+ * Temporal typed edges — the one-shot post-upgrade [AGENT] notice states the+ * contradiction-check mode the brain will actually run: apply (certified+ * model, closures written as undoable timeline lines) or propose.+ */+import { afterAll, beforeAll, describe, expect, setDefaultTimeout, test } from 'bun:test';+import { PGLiteEngine } from '../src/core/pglite-engine.ts';+import { resetGateway } from '../src/core/ai/gateway.ts';+import { withEnv } from './helpers/with-env.ts';+import { temporalEdgesUpgradeNotice, printTemporalEdgesUpgradeNotice } from '../src/core/temporal-edges-upgrade-notice.ts';++setDefaultTimeout(60_000);+let engine: PGLiteEngine;+beforeAll(async () => { engine = new PGLiteEngine(); await engine.connect({}); await engine.initSchema(); });+afterAll(async () => { await engine.disconnect(); resetGateway(); });++describe('temporal edges upgrade notice', () => {+ test('a certified default model announces apply mode and how to undo; an explicit propose says so; printed once', async () => {+ await withEnv({ ANTHROPIC_API_KEY: 'sk-ant-test-placeholder' }, async () => {+ resetGateway();+ const apply = (await temporalEdgesUpgradeNotice(engine))!.join('\n');+ expect(apply).toContain('certified for apply mode');+ expect(apply).toContain('gbrain edge-proposals undo');+ await engine.setConfig('dream.edge_contradictions.mode', 'propose');+ const propose = (await temporalEdgesUpgradeNotice(engine))!.join('\n');+ expect(propose).toContain('In propose mode it writes nothing to pages');+ const lines: string[] = [];+ expect(await printTemporalEdgesUpgradeNotice(engine, l => lines.push(l))).toBe(true);+ expect(await printTemporalEdgesUpgradeNotice(engine, l => lines.push(l))).toBe(false);+ });+ });+});