Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

P8: preregistration for the held-out runs, dev results, and the P0 decision kit's dev spec and verdict

garrytan6c958d6e246d
diff --git a/docs/architecture/key-files/core-cycle-continued.md b/docs/architecture/key-files/core-cycle-continued.md
index 0a4e9c9569..a522cf5251 100644
--- a/docs/architecture/key-files/core-cycle-continued.md
+++ b/docs/architecture/key-files/core-cycle-continued.md
@@ -10,7 +10,7 @@ Synthesis, patterns, consolidation and connector atom gating.
- `src/core/cycle/phases/consolidate.ts` — the consolidate phase: clusters facts per page and promotes the best claim into a take. Take identity for the upsert lookup is `(page_id, claim)` restricted to rows this phase authors (`kind='fact' AND holder='self'`) — `since_date` is NOT identity (it derives from MIN(valid_from) of the cluster and moves whenever extract_facts re-inserts, which degraded the lookup into duplicate INSERTs); deliberately NOT filtered on `active` (a superseded take still owns its claim — skipping it would resurrect a retired claim via the INSERT path); `ORDER BY id` keeps the pick deterministic across pre-existing duplicate rows. A resolved take is immutable — its id is reused for consolidation but the row is left untouched. Managed local consolidation passes the cycle source ID, publishes take, contributing facts and validity changes atomically. Retired/resolved matching takes produce a durable skipped receipt; semantic intent excludes vectors/timestamps/cache metadata, while a genuine newer fact/page snapshot changes request identity. Only live world-visible evidence is promoted; private facts remain private.
-- `src/core/cycle/synthesize-verify.ts` — Mechanical claim verification on every page a synthesis child wrote (zero LLM). Exports the shared grounding primitive `normalizeForGrounding` (whitespace/curly-quote/dash/ellipsis/case folding WITH an offset map back to the original string, so every replacement is a verbatim transcript slice) + `normForGrounding` (plain form, also used by `buildTriageMapBlock` and triage-rescue). `groundSource(path, content)` prepares a transcript: offset map, speaker turns (`parseSpeakerTurns`: bold `**Name** (ts):` anchors and standalone `[user]` / `[assistant]` / `[system]` role lines (the session-corpus renderer's turn boundaries, so a `Name:` label inside one turn never carries into the next) always, plain `Label:` anchors when the label is a role word or opens two or more lines), canonical numbers and dates (`numericFacts`: `$250K` = `$250,000` = `250 thousand`, `2026-03-14` = `March 14th`; the file basename counts), and speaker-mention patterns. `groundQuote` runs the ladder exact → normalized → near (word-trigram anchors, window clipped to the anchor's speaker turn, ≥0.8 token overlap, ambiguity within 0.05 falls through, trimmed to the first/last shared token, refused above 1.3x the quote length) and never accepts a match that touches a speaker label (`reason: 'crosses_speakers'`). `verifyBody` splits a body into claim units (`claimUnits`: sentences within a line, whole list items, whole table rows; no boundary inside a quote) and checks each NEW unit: every quote must ground in some source, a quote whose sentence names a transcript speaker must name the speaker of the matched turn, and every numeric/date claim (outside grounded quotes, code, wikilinks and link targets) must appear in a source; a unit saying a named speaker decided, agreed, committed or will act (and recording no proposal, refusal or negation) must carry only numbers and dates that speaker stated, or that the turn they explicitly accepted stated (`numbersBySpeaker`; bare years and numbers no turn states are not attributed). Any failure removes the whole unit from the body; `verifyDreamPage` records it in frontmatter `unverified_claims` (`text`, `reason` = `quote_not_in_source` / `quote_crosses_speakers` / `speaker_mismatch` / `number_not_in_source` / `decision_misattributed`, `detail`, `sources`, `detected_at`) and records every grounded quote's source path, character span and speaker in `grounding.quotes`; records from the pre-run revision carry forward, capped at 100 / 200. Frontmatter is neither chunked nor searched, so quarantined claims stay reviewable through `get_page` but out of search, recall, think and context packs. A page whose every unit failed keeps `ALL_CLAIMS_QUARANTINED_BODY`. Scope (`verifyAndRepairDreamPages(engine, refs, transcriptsByPath, { since, sinceByTranscript, checkedAt })`): sources are the transcripts of every child that wrote the page; the page epoch is the child's first write to that page (`first_write_at` on the ref) when known, so a page another writer created while the child ran is diffed rather than treated as the run's own; otherwise the earliest `loadChildWriteEpochs` entry of its sources (child job `created_at`, so resumed or coalesced children keep their original epoch), else `since` (`readVerifyEpoch`, taken before fan-out). Pages created at or after the epoch are verified whole; older pages are verified only on units absent from their pre-epoch revision (`loadPreRunRevision`: the first `page_versions` snapshot at or after the epoch; none means the page was not overwritten → `skipped_unchanged`). Write-back goes through `importFromContent` (`noEmbed`; the phase-end embed sweep backfills) with a `beforeCommit` that re-projects timeline entries, facts, takes (`prepareCanonicalProjections` as a `preserving` writer bound to the page's current snapshot) and automatic links (`prepareAutomaticLinks`) from the verified body in the same transaction, so no derived row outlives its quarantined claim while database-only timeline history is kept. `verifyBody` skips units inside a validly marked bullet (`materializedHistoryRanges`) only when that bullet is absent from the pre-run revision, i.e. it was materialized from the database during the run; a new page gets no exemption, and a claim added under a marked bullet that already existed is verified. Fail-open per page (read-back miss / write throw → `errors` + continue; abort still unwinds). Kill switch `dream.synthesize.quote_verify` (default on). Telemetry shape = `QuoteVerifyStats` in `details.synthesis.quote_verify`. Pinned by `test/cycle-synthesize-verify.test.ts`, the write-path mini-eval `test/cycle-write-path-mini-eval.test.ts`, and the three-cycle repeated-consolidation pin `test/cycle-repeated-consolidation.test.ts` (harness `test/helpers/repeated-consolidation.ts`, printable run `scripts/repeated-consolidation-experiment.ts`). System One S8: `verifyBody` also returns `groundingUnits` (new units that pass only because they carry no quote, number or attribution; ≥5 words, not headings) without changing any other field; `verifyDreamPage` returns them per body, `verifyAndRepairDreamPages` takes an optional `grounding: GroundingPass` applied before write-back, and `quarantineUnits` removes S8-rejected units into `unverified_claims` with reason `unsupported_paraphrase`. `verifyBody(…, { checks: 'quotes' })` grounds quotes and speaker attribution only (no number, date or decision checks) for writers that legitimately derive numbers. `groundAnswerQuotes` is the span-level variant for live answers. `dreamQuoteVerifyEnabled` reads `dream.quote_verify`, with `dream.synthesize.quote_verify` as its alias, for synthesis, patterns and concepts. `synthesize_concepts` grounds each LLM narrative against the atom titles and bodies its prompt carried before writing (failing units to `unverified_claims`; pinned by `test/cycle/synthesize-concepts-quote-verify.test.ts`).
+- `src/core/cycle/synthesize-verify.ts` — Mechanical claim verification on every page a synthesis child wrote (zero LLM). Exports the shared grounding primitive `normalizeForGrounding` (whitespace/curly-quote/dash/ellipsis/case folding, markdown link syntax read as its link text, WITH an offset map back to the original string, so every replacement is a transcript slice; repairs drop link targets) + `normForGrounding` (plain form, also used by `buildTriageMapBlock` and triage-rescue). `groundQuote` also grounds a quote whose words match once closing punctuation and elision marks at its edges are set aside (counted exact). `groundSource(path, content)` prepares a transcript: offset map, speaker turns (`parseSpeakerTurns`: bold `**Name** (ts):` anchors and standalone `[user]` / `[assistant]` / `[system]` role lines (the session-corpus renderer's turn boundaries, so a `Name:` label inside one turn never carries into the next) always, plain `Label:` anchors when the label is a role word or opens two or more lines), canonical numbers and dates (`numericFacts`: `$250K` = `$250,000` = `250 thousand`, `2026-03-14` = `March 14th`; the file basename counts), and speaker-mention patterns. `groundQuote` runs the ladder exact → normalized → near (word-trigram anchors, window clipped to the anchor's speaker turn, ≥0.8 token overlap, ambiguity within 0.05 falls through, trimmed to the first/last shared token, refused above 1.3x the quote length) and never accepts a match that touches a speaker label (`reason: 'crosses_speakers'`). `verifyBody` splits a body into claim units (`claimUnits`: sentences within a line, whole list items, whole table rows; no boundary inside a quote) and checks each NEW unit: every quote must ground in some source, a quote whose sentence names a transcript speaker must name the speaker of the matched turn, and every numeric/date claim (outside grounded quotes, code, wikilinks and link targets) must appear in a source; a unit saying a named speaker decided, agreed, committed or will act (and recording no proposal, refusal or negation) must carry only numbers and dates that speaker stated, or that the turn they explicitly accepted stated (`numbersBySpeaker`; bare years and numbers no turn states are not attributed). Any failure removes the whole unit from the body; `verifyDreamPage` records it in frontmatter `unverified_claims` (`text`, `reason` = `quote_not_in_source` / `quote_crosses_speakers` / `speaker_mismatch` / `number_not_in_source` / `decision_misattributed`, `detail`, `sources`, `detected_at`) and records every grounded quote's source path, character span and speaker in `grounding.quotes`; records from the pre-run revision carry forward, capped at 100 / 200. Frontmatter is neither chunked nor searched, so quarantined claims stay reviewable through `get_page` but out of search, recall, think and context packs. A page whose every unit failed keeps `ALL_CLAIMS_QUARANTINED_BODY`. Scope (`verifyAndRepairDreamPages(engine, refs, transcriptsByPath, { since, sinceByTranscript, checkedAt })`): sources are the transcripts of every child that wrote the page; the page epoch is the child's first write to that page (`first_write_at` on the ref) when known, so a page another writer created while the child ran is diffed rather than treated as the run's own; otherwise the earliest `loadChildWriteEpochs` entry of its sources (child job `created_at`, so resumed or coalesced children keep their original epoch), else `since` (`readVerifyEpoch`, taken before fan-out). Pages created at or after the epoch are verified whole; older pages are verified only on units absent from their pre-epoch revision (`loadPreRunRevision`: the first `page_versions` snapshot at or after the epoch; none means the page was not overwritten → `skipped_unchanged`). Write-back goes through `importFromContent` (`noEmbed`; the phase-end embed sweep backfills) with a `beforeCommit` that re-projects timeline entries, facts, takes (`prepareCanonicalProjections` as a `preserving` writer bound to the page's current snapshot) and automatic links (`prepareAutomaticLinks`) from the verified body in the same transaction, so no derived row outlives its quarantined claim while database-only timeline history is kept. `verifyBody` skips units inside a validly marked bullet (`materializedHistoryRanges`) only when that bullet is absent from the pre-run revision, i.e. it was materialized from the database during the run; a new page gets no exemption, and a claim added under a marked bullet that already existed is verified. Fail-open per page (read-back miss / write throw → `errors` + continue; abort still unwinds). Kill switch `dream.synthesize.quote_verify` (default on). Telemetry shape = `QuoteVerifyStats` in `details.synthesis.quote_verify`. Pinned by `test/cycle-synthesize-verify.test.ts`, the write-path mini-eval `test/cycle-write-path-mini-eval.test.ts`, and the three-cycle repeated-consolidation pin `test/cycle-repeated-consolidation.test.ts` (harness `test/helpers/repeated-consolidation.ts`, printable run `scripts/repeated-consolidation-experiment.ts`). System One S8: `verifyBody` also returns `groundingUnits` (new units that pass only because they carry no quote, number or attribution; ≥5 words, not headings) without changing any other field; `verifyDreamPage` returns them per body, `verifyAndRepairDreamPages` takes an optional `grounding: GroundingPass` applied before write-back, and `quarantineUnits` removes S8-rejected units into `unverified_claims` with reason `unsupported_paraphrase`. `verifyBody(…, { checks: 'quotes' })` grounds quotes and speaker attribution only (no number, date or decision checks) for writers that legitimately derive numbers. `groundAnswerQuotes` is the span-level variant for live answers. `dreamQuoteVerifyEnabled` reads `dream.quote_verify`, with `dream.synthesize.quote_verify` as its alias, for synthesis, patterns and concepts. `synthesize_concepts` grounds each LLM narrative against the atom titles and bodies its prompt carried before writing (failing units to `unverified_claims`; pinned by `test/cycle/synthesize-concepts-quote-verify.test.ts`).
- `src/core/cycle/synthesize.ts` — Synthesize phase: conversation-transcript-to-brain pipeline, a two-stage cascade where cheap scored triage gates frontier synthesis. Reads `dream.synthesize.session_corpus_dir`, runs `runTriagePass` (exported; bounded pool `dream.triage.concurrency` default 4, wall-clock cache-MISS budget `dream.triage.max_ms` default 5 min — cache hits are free and deferred files report `deferred: true`, never cached, so the next pass continues) whose judge `judgeSignificance` emits `{score 0-1 ordinal salience, content_type, segments ≤8 verbatim quotes, entities ≤12, reasons}` (non-overlapping bands LOW 0-0.29 / MEDIUM 0.30-0.69 / HIGH 0.70-1.0; head 50%/middle 20%/tail 30% sample within `dream.triage.max_chars` default 24K via `safeSplitIndex`; out-of-[0,1] scores are `unparseable`, never clamped) cached in `dream_verdicts` with the judging `model` + `TRIAGE_VERSION` — cache validity requires BOTH to match (switching `models.dream.triage` re-judges; `max_chars`/`max_tokens` deliberately excluded from validity — `dream retriage --force` re-judges under new sampling knobs). Degenerate verdicts (`truncated`/`refusal`/`unparseable`) are never cached. THE gate is `passesTriageGate` (triage-rescue.ts): `score >= dream.triage.threshold` (default 0.5) OR the verified-segment rescue, applied at report construction inside `runTriagePass` at READ time — retuning the threshold or rescue knobs re-gates with zero re-judging; the stored `worth_processing` boolean derives from the fixed `DEFAULT_TRIAGE_THRESHOLD` constant (back-compat only, never the live dial). Passing files fan out one subagent per chunk with `max_turns` from `dream.synthesize.max_turns` (default 16) and a bounded advisory `buildTriageMapBlock` (exported; score/type/entities + chunk-filtered segments, '' for legacy/degraded verdicts so the prompt is unchanged for those) spliced into `buildSynthesisPrompt`, with `allowed_slug_prefixes` (sourced from `skills/_brain-filing-rules.json` `dream_synthesize_paths.globs`; when `dream.synthesize.output_root` is set, `loadAllowedSlugPrefixes(outputRoot)` remaps the `wiki/`-rooted globs to the configured namespace, and the same root drives the prompt slug templates; default 'wiki', validated against the slug grammar via the exported `loadOutputRoot`). The phase is source-scoped: cycle.ts threads `cycleSourceId` as `opts.sourceId` → each child's `SubagentHandlerData.source_id` → the subagent tool registry's `OperationContext.sourceId`, so put_page writes, collected refs, the summary page, and reverse-writes all target the cycle's resolved source ('default' when unscoped; reverse-writes for the cycle's own source land at `brainDir/<slug>.md`, foreign sources under `brainDir/.sources/<id>/`). Orchestrator collects slugs from `subagent_tool_executions` (NOT `pages.updated_at`) and reverse-renders DB → markdown via `serializeMarkdown`. Cooldown via `dream.synthesize.last_completion_ts`, written only when children completed and neither synthesis-budget nor triage-budget deferrals remain. Idempotency keys `dream:synth-v2:<enc source>:filename:<enc basename>:<hash16>[:c<i>of<n>]` (byte-stable, pinned by `test/dream-synthesize-chunking.serial.test.ts`; grammar parsed by exported `parseSynthV2Key`). Fan-out self-heals idempotency-coalesced rows stranded `waiting` in a FOREIGN dead `dream-inline-*` queue (cancel releases the key slot → re-add into the live run's queue) instead of burning the 35-min wait on a row no worker will ever claim. Opt-in per-source daily submission cap `dream.synthesize.max_submissions_per_source_per_day` (default 0 = off; skips whole files — never partial chunk sets; bypassed for explicit `--input/--date/--from/--to` targets; count-query failure fails CLOSED: the run submits nothing and reports `daily_cap_unavailable`). Every transcript's whole chunk set is checked against a per-run USD `BudgetMeter` before submission (`dream.synthesize.budget_usd`, default 5; `0` submits nothing, `unlimited` removes the cap; estimate = prompt chars/4 plus the child output cap, times `max_turns` in agentic mode); a denied transcript and the rest of the run are deferred into `budget_deferred_transcripts` without a cooldown stamp, and `details.budget_usd` / `estimated_spend_usd` report the gate. `--dry-run` runs triage, skips synthesis; deferral-aware headlines append "(N not yet triaged — time budget...)" so a time-boxed cold pass never reads as mass rejection. `details.triage` (threshold/judged/cache_hits/unreliable/degraded/deferred/below_threshold + rescue_band/rescue_checked/rescue_fired + tokens_in/tokens_out/cost_usd) + `details.synthesis` (jobs/avg_turns/max_turns_config + quote_verify/spend/children_zero_pages) carry the phase telemetry. Subagent never gets fs-write access. The child prompt's date hint and the summary are dated by the cycle date (`cycleDate` from runCycle, else `resolveCycleDate`); opt-in `dream.synthesize.attribution_rules=true` adds `SYNTH_ATTRIBUTION_RULE` (keep who proposed what and later corrections explicit). `renderPageToMarkdown` (exported) stamps `dream_generated: true` + `dream_cycle_date` into every reverse-written dream-owned page (`isDreamOwnedPage`: created at or after the child's first put_page, or already stamped; a human page a child edited is rendered without the marker); `writeSummaryPage` does the same on the summary index — this marker is the explicit identity surface `isDreamOutput` checks in `transcript-discovery.ts`. `stampDreamProvenance` additionally persists the same marker into the `pages.frontmatter` JSONB row (merge via `executeRawJsonb`, raw object bound to `$N::jsonb`) for every page a child created (the refs from `collectChildPutPageSlugs` carry `first_write_at`, the child's earliest put_page `started_at` per slug) or that is already stamped, BEFORE reverse-rendering; a pre-existing human page is never stamped, so generated pages are DB-queryable and a later put_page write-through (which re-renders from the DB row) can't erase the stamp. `judgeSignificance`, `JudgeClient`, `runTriagePass`, `buildTriageMapBlock`, `parseSynthV2Key`, `loadSynthConfig`, `TRIAGE_VERSION`, and `DEFAULT_TRIAGE_THRESHOLD` are exported; the triage model resolves via an explicit pre-read of `models.dream.triage` (preferred; through exported `resolveAlias`) falling back to the standard `resolveModel` chain (`models.dream.synthesize_verdict` → deprecated `dream.synthesize.verdict_model` → tier `utility`). `splitTranscriptByBudget(content, contentHash, maxChars)` splits oversized transcripts at paragraph boundaries (`## Topic:` → `---` → `\n` ladder) using a deterministic offset seeded from the first 32 bits of `contentHash` so retries chunk identically; per-chunk char budget = `MODEL_CONTEXT_TOKENS[resolvedModel] × 0.9 × 3.5 chars/token` (non-Anthropic ids fall back to a 180K-token safe default + once-per-process stderr warn); operator overrides `dream.synthesize.max_prompt_tokens` (floor 100K, wins) and `dream.synthesize.max_chunks_per_transcript` (default 24); per-chunk subagent job/wait timeouts are `dream.synthesize.subagent_timeout_ms` / `dream.synthesize.subagent_wait_timeout_ms` (defaults 30/35 min). Legacy `dream:synth:` keys are never produced — `loadSuccessfulSynthesisKeys(engine, sourceId, keyPrefix)` reads the completed rows of BOTH key families once per phase, unioned with `dream_synthesis_completions` (where `MinionQueue.prune` archives completed `dream:synth%` keys before deleting their rows, so `jobs prune` never makes a synthesized transcript eligible again), so existing brains skip with `already_synthesized_legacy_single_chunk`/`_chunked` instead of re-spending the synthesis model, and a transcript whose synth-v2 children already completed skips with `already_synthesized_v2_single_chunk`/`_chunked` (`findSynthV2Completion`; a cancelled row never counts) BEFORE its link manifest is built — otherwise queue.add's idempotency fast path coalesces onto the completed children and they re-enter writtenRefs, so their old pages get quote-repaired, restamped, reverse-written and re-embedded every night. `collectChildPutPageSlugs` raw-fetches every (job_id, slug) pair (not `SELECT DISTINCT`) and rewrites bare-hash6 slugs to `<hash6>-c<idx>` for chunked children (orchestrator-side, zero Sonnet trust). Cap-hit skips write nothing new to `dream_verdicts` (the pass's cached triage verdict remains — a free cache hit on retry) and record no synthesis job, so raising the cap on next run re-attempts cleanly. Bounds INITIAL prompt size only; tool-loop turn-N accumulation is caught by terminal-error classification in `subagent.ts`. Verdict routing is gateway-routed: `makeJudgeClient(verdictModel)` (exported) mirrors `tryBuildGatewayClient` in `src/core/think/index.ts` — a construction-time provider/key probe returns `null` on a clear miss (unknown provider id via `resolveRecipe` AIConfigError, or Anthropic provider with no key via `hasAnthropicKey()`). The verdict loop wraps `judgeSignificance` in try/catch for `AIConfigError` so mid-run provider failures surface as per-transcript `worth=false, reasons=['gateway error: ...']` instead of crashing the phase. Canonical config key `models.dream.synthesize_verdict` (per `PER_TASK_KEYS` in `src/core/model-config.ts`); `JudgeClient` signature preserved verbatim for test-seam stability; CI guard `scripts/check-gateway-routed-no-direct-anthropic.sh` prevents reintroducing `new Anthropic()` here or in `think/index.ts`. At the queue.add boundary a conditional `anthropic:` prefix is applied ONLY when the resolved model has no colon AND starts with `claude-` (because `resolveModel` returns bare ids from `TIER_DEFAULTS`/`DEFAULT_ALIASES` and the subagent validator requires `provider:model` form) — avoids changing the shared constants which would ripple across every `resolveModel` caller. Pinned by `test/cycle/synthesize-gateway-adapter.test.ts`, `test/e2e/dream-synthesize-pglite.test.ts` (gateway-adapter mid-run AIConfigError catch), `test/cycle/regression-pr-wave-r1-r2-r4.test.ts`. Drain-loop lock renewal runs through exported `runDrainRenewalTick` (per-call AbortSignal + timeout + re-entrancy guard) — a hung renewLock cannot stack one checked-out slot per interval firing. Pinned by `test/cycle-drain-renewal.test.ts`. Execution mode: `dream.synthesize.mode` (default `oneshot`) threads to every child as `data.mode` alongside `oneshot_slug_suffix` (the structural suffix contract) and `require_writes: true`; `details.synthesis` adds mode/oneshot_jobs/fallback_jobs/agentic_jobs/fallback_reasons plus the drain telemetry (inline_concurrency_config/effective, drain_ms, queue-wait + runtime p50/p95, dead_jobs, degraded). Pre-retrieval LINK CANDIDATES manifest (link-manifest.ts, `dream.synthesize.link_manifest` default on) is built once per transcript from the cached triage entities/segment notes and spliced into `buildSynthesisPrompt` together with an ALLOWED WRITE PATHS block rendered from the trusted allow-list (the oneshot path never sees a tool schema, so the fence lives in the prompt; rule 2 points at the candidates first). Phase outcome gate: ALL children dead/cancelled → phase fails with SYNTH_ALL_CHILDREN_DEAD (fan-out details preserved on the failure); ANY non-completed child → the cooldown stamp is skipped so released idempotency keys retry next run; 'timeout' (parent stopped waiting) degrades but never triggers the all-dead error. Phase-end deferred-embed closure: whenever the phase wrote pages (regardless of mode — an agentic revert still sweeps debt left by earlier oneshot runs), a 120s-bounded `embedStalePages` (embed-stale.ts) embeds the NULL-embedding chunks of exactly the pages this phase wrote — never a source-wide sweep; the pre-existing stale backlog stays with the budget-tracked embed-backfill machinery — closing the gap on invocation shapes that never reach the global embed phase (`--phase synthesize`, autopilot per-source NON_GLOBAL_PHASES). Best-effort (never fails a phase that wrote its pages) and stamps the current embedding signature on fully-re-embedded pages so they stay inside the model-drift invalidation contract. The inline drain lives in `src/core/cycle/inline-drain.ts` (re-exported here for patterns.ts + `__testing`). Budget clamping: clamped to the remaining parent-job budget when `opts.deadlineAtMs` is threaded (via patterns.ts's `clampSubagentBudgets` template): the clamp re-runs against the live clock PER SUBMIT (the phase is a fan-out with claim-time-anchored child kill switches, so one phase-start clamp only bounds the first child); under the minimum child budget the phase skips honestly (`insufficient_cycle_budget`) or defers the remaining transcripts (`details.budget_deferred_transcripts`), the inline drain stops CLAIMING when the budget can't fit another child and unclaimed children are cancelled + deferred (they'd otherwise strand forever in the run's private queue), each completion wait is additionally bounded by the remaining parent budget (floored at 1s so already-terminal children still resolve), and a deferring run neither writes the 12h cooldown timestamp nor counts deferred transcripts as processed — deferral genuinely retries next cycle. THE gate is `passesTriageGate` (triage-rescue.ts) applied at report construction inside `runTriagePass`: threshold pass OR the verified-segment rescue for band scores `[dream.triage.rescue_floor (0.30), threshold)` with content_type in `dream.triage.rescue_content_types` and ≥ `dream.triage.rescue_min_segments` (default 2; 0 = off) of the judge's segments verifying as normalized transcript substrings (≥40 chars, deduped) — reports carry `rescued`/`verified_segments`, `details.triage` adds rescue_band/rescue_checked/rescue_fired + judge tokens_in/tokens_out/cost_usd (null when unpriced), and dream-retriage's reconcile/audit read the SAME predicate. TRIAGE_VERSION is 2 (peak-not-average rubric; segment selection prefers concrete facts/decisions). After slug collection and BEFORE the provenance stamp/reverse-write/embed sweep, the claim verification pass (synthesize-verify.ts, `dream.synthesize.quote_verify` default on) runs on every page the children wrote, scoped by `readVerifyEpoch` (taken before fan-out) and `loadChildWriteEpochs`; the phase is wrapped in `withChatPhase('phase:synthesize')` (children keep their own job tag — minion_jobs stays the child-spend authority) and `details.synthesis` adds `quote_verify`, `children_zero_pages` (completed children with zero put_page writes — the rule-D disposition), and `spend` (`cost_basis: 'in+out+cache_read'`; children summed from minion_jobs tokens_input/output/cache_read priced at the configured synth model, triage from the pass usage; total_usd null unless both price) `buildSynthesisPrompt` is mode-aware (`mode: 'agentic' | 'oneshot'`, passed from `config.mode` at the sole submit site): agentic children keep the search-tool and final-summary guidance; tool-less oneshot children receive neither, so the prompt never contradicts `ONESHOT_SYSTEM`'s JSON-only rule (the oneshot prompt is stored as `data.prompt` and reused verbatim by the in-job agentic fallback, whose tools stay in the schema). Pinned by `test/cycle-dream-output-root.test.ts`. Managed enabled local synthesis uses durable page admission with original authority and canonical-mirror validation; completed source-incarnation-qualified children survive restart. Quote-repair failure cannot silently certify grounded publication. Remote maintenance remains unsupported. Before submitting a transcript's chunk set, the phase asks the paid-loop breaker (`dream-breaker.ts`) and records a `dream_breaker_tripped` skip with the reset command instead of submitting; the opt-in daily cap counts dead rows through their released key. System One: `runTriagePass` takes `cfg.decide` (S7, `triage-decide.ts`; undefined when the slot is off) — when S7 acts, `processOne` delegates to it and falls back to the LLM path (`processLlm`) for margin_hold/incomplete decisions; the phase passes `grounding` (S8, `grounding-decide.ts`) to both verify call sites and adds `triage.decide` / `synthesis.grounding` details only when a slot is not off. Discovery is the corpus walk plus imported `type: conversation` pages from the database (`transcript-discovery.ts`, `dream.synthesize.conversation_pages`). Each written page is credited to its transcript's capturing seat (`seat` frontmatter, #4618) on both write paths; the `dream:synth-v2:` idempotency key never includes the seat, so a sidecar that appears after synthesis triggers no re-run (`test/session-seat-synthesize.test.ts`).
diff --git a/docs/eval/decisions/p8-dev-20261004/decision.json b/docs/eval/decisions/p8-dev-20261004/decision.json
new file mode 100644
index 0000000000..73042c5113
--- /dev/null
+++ b/docs/eval/decisions/p8-dev-20261004/decision.json
@@ -0,0 +1,109 @@
+{
+ "schema_version": 1,
+ "decision_id": "p8-dev-20261004",
+ "plan": "P8",
+ "title": "P8 dev comparison",
+ "verdict_type": "correctness",
+ "stage": "dev",
+ "candidate": {
+ "gbrain": "/workspace/gbrain@850e8ef3dfadcaf15e1547d1d754398caf0edd41",
+ "config": {}
+ },
+ "baseline": {
+ "gbrain": "/workspace/gbrain@6622a119e40ea09a7719233046aca24741863ed2",
+ "config": {}
+ },
+ "sources": [
+ {
+ "id": "n5-forget-residue",
+ "kind": "category",
+ "category": "n5-forget-residue",
+ "script": "eval/runner/n5-forget-residue.ts",
+ "args": [
+ "--seed",
+ "1"
+ ],
+ "paid": false,
+ "comparisons": [],
+ "contracts": [
+ {
+ "path": "verdict",
+ "op": "eq",
+ "value": "pass",
+ "description": "forget leaves no residue and no collateral damage"
+ }
+ ]
+ },
+ {
+ "id": "n1-knowledge-update",
+ "kind": "category",
+ "category": "n1-knowledge-update",
+ "script": "eval/runner/n1-knowledge-update.ts",
+ "args": [
+ "--seed",
+ "1"
+ ],
+ "paid": false,
+ "comparisons": [],
+ "contracts": [
+ {
+ "path": "verdict",
+ "op": "eq",
+ "value": "pass",
+ "description": "knowledge-update safety contracts hold"
+ }
+ ]
+ },
+ {
+ "id": "lme-s-dev",
+ "kind": "memory-qa",
+ "benchmark": "lme-s",
+ "split": "dev",
+ "embed": "real",
+ "limit": null,
+ "search_pins": {
+ "search.mode": "balanced",
+ "search.reranker.enabled": "false",
+ "search.autocut": "false"
+ },
+ "top_k": 10,
+ "id_field": "id",
+ "exclude_when": [
+ "abstention=true"
+ ],
+ "min_clusters": 10,
+ "comparisons": [
+ {
+ "id": "recall-all-5",
+ "metric": "recall_all_at_5",
+ "gate": "noninferiority",
+ "direction": "higher",
+ "tolerance": 0.01,
+ "cluster_by": "conversation",
+ "description": "guardrail: strict recall does not drop by more than one point"
+ },
+ {
+ "id": "ndcg-10",
+ "metric": "ndcg_at_10",
+ "gate": "exploratory",
+ "direction": "higher",
+ "cluster_by": "conversation"
+ },
+ {
+ "id": "latency",
+ "metric": "latency_ms",
+ "gate": "exploratory",
+ "direction": "lower",
+ "cluster_by": "conversation"
+ }
+ ],
+ "estimate_usd": 24
+ }
+ ],
+ "alpha": 0.05,
+ "seed": 42,
+ "draws": 10000,
+ "budget_usd": 24,
+ "created_at": "2026-10-04T19:39:28.116Z",
+ "notes": "Semantic forget, model-judged supersession lane, surface shrink, write-path moat: forget and update contracts plus an LME-S guardrail; cost-speed columns land in milestone M2."
+}
diff --git a/docs/eval/decisions/p8-dev-20261004/verdict.json b/docs/eval/decisions/p8-dev-20261004/verdict.json
new file mode 100644
index 0000000000..1ea455c3f8
--- /dev/null
+++ b/docs/eval/decisions/p8-dev-20261004/verdict.json
@@ -0,0 +1,203 @@
+{
+ "decision_id": "p8-dev-20261004",
+ "plan": "P8",
+ "stage": "dev",
+ "eligible_for_default": false,
+ "eligibility_note": "Dev verdicts come from development data and never set a default. A held-out verdict comes from the custodian after a committed preregistration.",
+ "verdict_type": "correctness",
+ "overall": "pass",
+ "decided_at": "2026-10-04T23:07:12.616Z",
+ "sources": [
+ {
+ "source": "n5-forget-residue",
+ "verdict": "pass",
+ "arms": {
+ "baseline": "0.60.48.0",
+ "candidate": "0.60.48.0"
+ },
+ "contracts": [
+ {
+ "path": "verdict",
+ "op": "eq",
+ "value": "pass",
+ "candidate": "pass",
+ "baseline": "pass",
+ "ok": true
+ }
+ ]
+ },
+ {
+ "source": "n1-knowledge-update",
+ "verdict": "pass",
+ "arms": {
+ "baseline": "0.60.48.0",
+ "candidate": "0.60.48.0"
+ },
+ "contracts": [
+ {
+ "path": "verdict",
+ "op": "eq",
+ "value": "pass",
+ "candidate": "pass",
+ "baseline": "pass",
+ "ok": true
+ }
+ ]
+ },
+ {
+ "source": "lme-s-dev",
+ "verdict": "pass",
+ "arms": {
+ "baseline": {
+ "package": "gbrain",
+ "declared_pin": "github:garrytan/gbrain#739e5cc89ca43b9b9351f0f203c7b12a7c0c571c",
+ "declared_sha": "739e5cc89ca43b9b9351f0f203c7b12a7c0c571c",
+ "version": "0.60.48.0",
+ "package_sha256": "fab1c3142270c58c8357f2298bb3f7bf9b59a1062f5954684e95bd1d1cc11c01",
+ "loaded_git_head": "6622a119e40ea09a7719233046aca24741863ed2"
+ },
+ "candidate": {
+ "package": "gbrain",
+ "declared_pin": "github:garrytan/gbrain#739e5cc89ca43b9b9351f0f203c7b12a7c0c571c",
+ "declared_sha": "739e5cc89ca43b9b9351f0f203c7b12a7c0c571c",
+ "version": "0.60.48.0",
+ "package_sha256": "e1ee8f75b641083bfc321af009ef2316d709db4a9403c72591fde76525d8aa1a",
+ "loaded_git_head": "850e8ef3dfadcaf15e1547d1d754398caf0edd41"
+ }
+ },
+ "family": {
+ "family_id": "p8-dev-20261004:lme-s-dev",
+ "verdict": "pass",
+ "reasons": [],
+ "alpha": 0.05,
+ "holm_family": [
+ "recall-all-5"
+ ],
+ "comparisons": [
+ {
+ "id": "recall-all-5",
+ "metric": "recall_all_at_5",
+ "gate": "noninferiority",
+ "status": "pass",
+ "reasons": [],
+ "n_pairs": 470,
+ "n_clusters": 470,
+ "n_excluded": 30,
+ "stats": {
+ "n_pairs": 470,
+ "n_clusters": 470,
+ "mean_a": 0.9276595744680851,
+ "mean_b": 0.9276595744680851,
+ "delta": 0,
+ "se_cluster": 0,
+ "se_iid": 0,
+ "design_effect": null,
+ "effective_n": null,
+ "ci95": [
+ 0,
+ 0
+ ],
+ "p_two_sided": 1,
+ "p_greater": 1,
+ "p_less": 1,
+ "p_method": "degenerate"
+ },
+ "mcnemar": {
+ "losses": 0,
+ "wins": 0,
+ "both_pass": 436,
+ "both_fail": 34,
+ "discordant": 0,
+ "p_two_sided": 1
+ },
+ "power": {
+ "alpha": 0.05,
+ "power": 0.8,
+ "mde": null,
+ "min_one_sided_discordant": 6,
+ "note": "no paired variation was observed, so the detectable effect cannot be estimated from this data; an exact McNemar test needs at least 6 wins with zero losses to reach 0.05"
+ },
+ "direction": "higher",
+ "p_holm": 0,
+ "tolerance": 0.01,
+ "p_noninferiority": 0
+ },
+ {
+ "id": "ndcg-10",
+ "metric": "ndcg_at_10",
+ "gate": "exploratory",
+ "status": "report_only",
+ "reasons": [],
+ "n_pairs": 470,
+ "n_clusters": 470,
+ "n_excluded": 30,
+ "stats": {
+ "n_pairs": 470,
+ "n_clusters": 470,
+ "mean_a": 0.9429294330024023,
+ "mean_b": 0.9429414225547724,
+ "delta": 0.0000119895523700806,
+ "se_cluster": 0.000011989552370080597,
+ "se_iid": 0.000011989552370080599,
+ "design_effect": 0.9999999999999998,
+ "effective_n": 470.0000000000001,
+ "ci95": [
+ 0,
+ 0.0000359686571102418
+ ],
+ "p_two_sided": 1,
+ "p_greater": 0.49905009499050096,
+ "p_less": 1,
+ "p_method": "monte-carlo-sign-flip"
+ },
+ "power": {
+ "alpha": 0.05,
+ "power": 0.8,
+ "mde": 0.000033589752700607585,
+ "min_one_sided_discordant": null,
+ "note": "with 470 pairs in 470 clusters, a two-sided 0.05 test has 80% power for an absolute change of about 0.0000; the observed delta is below that size, so a null result here is not evidence of no effect"
+ },
+ "direction": "higher"
+ },
+ {
+ "id": "latency",
+ "metric": "latency_ms",
+ "gate": "exploratory",
+ "status": "report_only",
+ "reasons": [],
+ "n_pairs": 470,
+ "n_clusters": 470,
+ "n_excluded": 30,
+ "stats": {
+ "n_pairs": 470,
+ "n_clusters": 470,
+ "mean_a": 255.9219148936171,
+ "mean_b": 252.40595744680843,
+ "delta": -3.5159574468085055,
+ "se_cluster": 6.813703022819454,
+ "se_iid": 6.813703022819456,
+ "design_effect": 0.9999999999999996,
+ "effective_n": 470.0000000000002,
+ "ci95": [
+ -16.65276595744684,
+ 9.602553191489367
+ ],
+ "p_two_sided": 0.6028397160283971,
+ "p_greater": 0.6982301769823017,
+ "p_less": 0.30186981301869814,
+ "p_method": "monte-carlo-sign-flip"
+ },
+ "power": {
+ "alpha": 0.05,
+ "power": 0.8,
+ "mde": 19.089169674342838,
+ "min_one_sided_discordant": null,
+ "note": "with 470 pairs in 470 clusters, a two-sided 0.05 test has 80% power for an absolute change of about 19.0892; the observed delta is below that size, so a null result here is not evidence of no effect"
+ },
+ "direction": "lower"
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/docs/eval/decisions/p8/DEV_RESULTS.md b/docs/eval/decisions/p8/DEV_RESULTS.md
new file mode 100644
index 0000000000..30450dd848
--- /dev/null
+++ b/docs/eval/decisions/p8/DEV_RESULTS.md
@@ -0,0 +1,92 @@
+# P8 dev results
+
+These are development-split results for each switchable P8 part. They guided the work and fixed the
+[preregistration](PREREGISTRATION.md); none of them turns a default on. Receipts live in gbrain-evals under
+`docs/benchmarks/2026-10-04-p8-dev/` (branch `p8-dev-evals`), and the P0 decision kit's spec and verdict are in
+[`../p8-dev-20261004/`](../p8-dev-20261004/).
+
+## Decision kit guardrails (P0 `eval:decide`, candidate 850e8ef3d vs master 6622a119e)
+
+| Source | Result |
+|---|---|
+| LME-S dev, recall_all@5 (non-inferiority) | 0.9277 → 0.9277, Δ 0.0000 (n 470) |
+| LME-S dev, nDCG@10 (report only) | 0.9429 → 0.9429 |
+| N5 forget residue contracts | pass on both builds; prohibited outputs after forget 0, reinstatement 100% |
+| N1 knowledge update contracts | pass on both builds |
+
+P8 does not change retrieval; the identical recall is the expected result.
+
+## Write cost (part 1)
+
+LongMemEval-S sessions written as `note` pages through MCP `put_page` on a fresh PGLite brain, one `remember` per
+page, background jobs drained with `gbrain jobs work`. 1,000 pages, 10,313 messages, 991 remembered facts, build
+ef0de8657, `text-embedding-3-large`.
+
+| Arm | Commit-path generative attempts | Generative calls | $ per 1,000 pages | $ per 1,000 messages | `put_page` p50 / p95 | `remember` p50 / p95 | Job drain |
+|---|---|---|---|---|---|---|---|
+| Fact extraction on (default) | 0 | 996 (`claude-sonnet-4-6`, facts-absorb) | $11.97 | $1.16 | 80 / 170 ms | 285 / 398 ms | 96 min |
+| Fact extraction off | 0 | 0 | $0.32 | $0.03 | 88 / 173 ms | 275 / 378 ms | none queued |
+
+Every model call on a write happens after commit, in the background extraction job. Embedding is the only work on
+the write itself. On PGLite the extraction jobs drain about one at a time even with `--concurrency 4`. Two pages per
+arm were refused with `revision_conflict` because the session picker gave two sessions the same slug (a harness
+issue).
+
+## Semantic withdrawal review (part 2)
+
+Seed A: 150 model-written families (`p8-withdraw-review-gen@1`), 1,050 pairs, about 30% restatements. The conflict
+slot was calibrated for the `review_withdraw` call site on the calibrate half and qualified on the eval half
+(TypeSafe `jev-1.13.0`).
+
+- Threshold 0.930; on the calibrate half, precision and recall were both 1.000 (n 511).
+- Qualification: 77 of 77 families correct over 153 actions. The action precision lower bound is 0.952 (gate 0.90).
+ The lane would withdraw 153 of 154 restatements (classifier recall 99%).
+- Neighbour retrieval at the 0.80 cosine floor: restatements 99.3%, negations 95.3%, past-tense versions 87.3%,
+ compound claims 81.3%, corrected values 39.3%, independent facts 0%. End-to-end recall is about 98%.
+- There were no proposals on corrected values, negations, past-tense versions or compound claims.
+
+The caveat: model-written paraphrases are easy. The sealed set adds human-written paraphrases and disjoint names and
+values. The kind stays off by default until that set qualifies.
+
+## Quote grounding (part 4)
+
+`gbrain think` (`claude-sonnet-5-5`) on 50 dev questions over amara-life-v1 (35 quote-eliciting, 15 natural). Each
+quoted span in what the model wrote is labelled by `gpt-6.1-sol` against the exact evidence the model was given.
+
+| Build | Supported spans | Wrongly flagged | Rate (Wilson 95% upper) | Unsupported spans caught |
+|---|---|---|---|---|
+| 56a4dbbe2 (first grounding) | 150 | 24 | 16.0% (22.7%) | 1 of 1 real (3 extractor artifacts) |
+| 98cae3c98, same answers replayed | 150 | 2 | 1.3% (4.7%) | — |
+| 98cae3c98, fresh answers | 151 | 2 | 1.3% (4.7%) | 2 of 2 |
+
+The first run found the real defect. Writers put closing punctuation inside quotation marks ("the deal,"), quoted
+from excerpts that end in an ellipsis, and quoted words that sit inside markdown links in the evidence. The fix grounds
+the words with edge punctuation and ellipses set aside, and reads `[text](target)` as its text. At the question level
+the bound is still wide (2 of 45 questions, upper bound 14.8%); the sealed set is sized for at least 300 supported
+spans.
+
+## Advertised tool surface (part 5)
+
+Cat 40 on model-ladder-v1 (not sealed: these tasks shaped earlier releases). The gbrain arm is callable `full` in
+every arm, with advertised `full` / `starter` / `verbs`. 25 tasks (5 per family) × 4 models × 1 repeat, uncapped tool
+results, build 8f585b0ce.
+
+| Advertised | Success | Δ vs full (95% task-bootstrap interval) | Leaks | Write family (F) | $ | Input tokens | `request_tools` calls |
+|---|---|---|---|---|---|---|---|
+| full (control) | 90/100 | — | 0 | 20/20 | $38.09 | 30.4M | 0 |
+| starter | 92/100 | +2.0 (−2.0, +7.0) | 0 | 20/20 | $29.54 | 14.7M | 0 |
+| verbs | 88/100 | −2.0 (−7.0, +3.0) | 0 | 20/20 | $28.24 | 12.8M | 3 |
+
+By model (full / starter / verbs): Sonnet 5.5 22 / 21 / 19, GPT-6.1-sol 24 / 25 / 23, Opus 5.5 22 / 23 / 22,
+Fable 5.1 22 / 23 / 24, each out of 25. Misses are in the true-now (B) and evidence (E) families on every arm.
+
+Starter cuts dollars by 22% and input tokens by 52% at no measured success cost. Verbs is within the 3-point bar on
+its point estimate, but its interval reaches −7. These tasks have no hidden-tool family, so `request_tools`
+discovery is untested here; the sealed world adds one. `NEW_INSTALL_ADVERTISED_SURFACE` stays `full` until the sealed
+run decides.
+
+## Spend
+
+About $140 of recorded dev spend, plus one Cat 40 run lost when its VM became unreachable before results were pulled
+(an estimated $70 to $110, unrecorded). Recorded: Cat 40 $97.01 (pilot $22.44, rest $74.57), decision kit $14.94,
+write cost $12.33, plus quote grounding, family generation and calibration under $15.
diff --git a/docs/eval/decisions/p8/PREREGISTRATION.md b/docs/eval/decisions/p8/PREREGISTRATION.md
new file mode 100644
index 0000000000..aaa0be4622
--- /dev/null
+++ b/docs/eval/decisions/p8/PREREGISTRATION.md
@@ -0,0 +1,111 @@
+# P8 held-out evaluation: preregistration
+
+This file fixes, before any sealed data is opened, what the held-out runs for P8 compare, on which data, with which
+models, and what result turns each switchable part on by default. The custodian (P0) runs the sealed splits; the
+implementer never sees them. Dev results that informed these choices are in [DEV_RESULTS.md](DEV_RESULTS.md).
+
+Changing a gate, a metric, a model or a split after a sealed cell has run requires a dated amendment in this file
+with its reason, written before the next cell runs.
+
+## Builds
+
+- **Baseline:** gbrain master at the P8 pull request's merge base, pinned by SHA in each decision spec.
+- **Candidate:** the P8 pull request head, pinned by SHA. Uncommitted edits are never measured.
+- **Harness:** gbrain-evals `p0-heldout-harness`, plus the P8 dev harness additions on `p8-dev-evals` (Cat 40
+ `--advertised` arms and mid-run tool lists, the write-cost runner, the withdrawal-review generator and the
+ quote-grounding runner), pinned by SHA at the sealed run.
+- Same-window controls: every build comparison runs baseline and candidate in the same window on the same machine
+ class.
+
+## Models
+
+Newest frontier model of each family, per the eval model rules: `claude-opus-5-5`, `claude-sonnet-5-5`,
+`gpt-6.1-sol`, `claude-fable-5-1`. No older generation is added: the dev runs share all four with the sealed runs.
+`gpt-5.4-mini` is not run and no finding from it drives a decision. Results are reported Sonnet and GPT first (the
+models people use most), then Opus and Fable. A model at or near 100% on every arm is reported as a ceiling and does
+not count as evidence of no difference.
+
+## Comparisons and gates
+
+Every paid run starts with a metered 10% pilot; the full budget is extrapolated from the pilot and enforced by the
+budget ledger. An underpowered, incomplete or invalid run never turns a default on.
+
+### 1. Write-inference guard (part 1) — always on
+
+- Evidence: CI only. `test/write-path-zero-llm.serial.test.ts`, `test/write-path-no-egress.serial.test.ts`,
+ `test/op-write-inference.test.ts`, `scripts/check-ai-sdk-importers.sh`, the layering rule.
+- Gate: every write-classified operation and CLI writer makes zero generative attempts before commit. No sealed run.
+
+### 2. Write cost (part 1, published)
+
+- Runner: `eval/runner/p8-write-cost.ts`. Unit: LongMemEval-S sessions written as extraction-eligible `note` pages
+ through MCP `put_page`, plus one `remember` per page; background jobs drained afterwards.
+- Arms: fact extraction on (default, headline) and off (floor). 1,000 pages per arm.
+- Reported per 1,000 messages and per 1,000 pages: generative attempts, embedding tokens, dollars by model,
+ `put_page` and `remember` latency p50/p95, job drain time, jobs outstanding after drain.
+- Gate: commit-path generative attempts = 0 in both arms. The rest is published, not gated. Cost limit $50.
+
+### 3. Semantic withdrawal review (part 2, `decide.slots.conflict.review_withdraw`)
+
+- Data: withdrawal-review families from `eval/generators/p8-withdraw-review-gen.ts` with a sealed seed and disjoint
+ names and attribute values (custodian-generated), plus at least 50 human-written paraphrase pairs. At least 200
+ actionable families. About 30% of candidates are restatements; the rest are corrected values, negations, past-tense
+ versions, compound claims and independent facts about the same person.
+- Procedure: `gbrain decide calibrate --slot conflict --call-site review_withdraw` on the calibrate half, then
+ `gbrain decide qualify` on the eval half (family-level Wilson bound). Neighbour retrieval measured with production
+ embeddings (`text-embedding-3-large`, 1536 dimensions) against the lane's 0.80 cosine floor, by slice.
+- Gates, all required:
+ - action precision lower bound ≥ 0.90;
+ - end-to-end recall (retrieval × classifier) ≥ 0.60, with retrieval and classifier recall reported separately;
+ - zero proposals on corrected-value candidates;
+ - N5 forget residue unchanged (`n5-forget-residue` contracts pass on the candidate).
+- On pass: the kind turns on by default where the conflict slot is on (a TypeSafe key present). On fail: it ships off.
+- Cost limit $30.
+
+### 4. Duplicate review kinds (part 2, `review_duplicate_page`, `review_duplicate_entity`)
+
+- Same protocol per kind, on pairs P5 (page duplicates) and P1 (entity leftovers) generate once those plans land.
+ Each kind turns on only if its own qualification passes. Until P1/P5 enqueue candidates, both stay off. Cost limit
+ $60.
+
+### 5. `remember.replaces` (part 3) — on
+
+- Evidence: conformance and race tests (`test/remember-replaces.test.ts`,
+ `test/e2e/p8-memory-writes-postgres.test.ts`). Zero model calls. No sealed run.
+
+### 6. Quote grounding (part 4, `think.quote_verify`, `dream.quote_verify`)
+
+- Hermetic: planted fabricated, speaker-swapped, near-match and supported quotes per writer
+ (`test/think-quote-verify.test.ts`, `test/cycle-synthesize-verify.test.ts`, concept and pattern tests).
+ Gate: planted fabricated quotes persisted = 0.
+- Paid: `eval/runner/p8-quote-grounding.ts` — `gbrain think` (`claude-sonnet-5-5`) on held-out quote-eliciting and
+ natural questions over amara-life-v1 and sealed-confirmation-v2 that were never used in dev, sized to at least 300
+ supported quote spans, clustered by question. An independent judge (`gpt-6.1-sol`) labels each span against the
+ exact evidence the model was given.
+- Gate: supported spans wrongly flagged, Wilson 95% upper bound ≤ 5% (span level), with the question-clustered bound
+ reported. Supported information lost is reported. Cost limit $80.
+- On fail: the kill switches ship off.
+
+### 7. Advertised tool surface (part 5, `mcp.advertised_surface`, new installs only)
+
+- Cat 40 (`eval/runner/cat40-model-ladder.ts`), gbrain arm, callable surface `full` in every arm, advertised
+ `full` (control) vs `starter` vs `verbs`, the four models above, 2 repeats, uncapped tool results.
+- Data: a new seed-disjoint world from P0 with at least 100 tasks, including at least 20 hidden-tool tasks that need
+ an operation outside the starter set (for example `add_link`, `find_trajectory`, takes search). Memory-only and
+ page-authoring strata reported separately.
+- Gates for an arm, all required, against the same-window `full` control:
+ - pooled success no more than 3 points below control (paired task-bootstrap 95% interval reported);
+ - no rise in leaks or context exposures;
+ - hidden-tool family success no more than 5 points below control.
+ Token and dollar cuts are reported as a sanity check only.
+- Decision: among passing arms, the narrower wins and becomes `NEW_INSTALL_ADVERTISED_SURFACE`; if `verbs` wins,
+ `rate_answer` joins it as the eighth verb. If neither passes, fresh installs keep advertising `full`.
+- Cost limit $800, about 8 hours on Ubicloud.
+
+## Total
+
+About $1,020 across the sealed runs, under the $1,200 program cap including pilots and retries.
+
+## Amendments
+
+None yet.