Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(facts): a page can opt out of automatic fact extraction; meeting-ingestion uses it for the transcript and the draft (#6232)

time-attack02b98ac73265
diff --git a/docs/architecture/key-files/core-services-2.md b/docs/architecture/key-files/core-services-2.md
index 0b253be359..88a701fcf7 100644
--- a/docs/architecture/key-files/core-services-2.md
+++ b/docs/architecture/key-files/core-services-2.md
@@ -5,7 +5,8 @@ Current behavior and load-bearing invariants; history belongs in Git and CHANGEL
- `src/core/conversation-parser/` — 19-pattern built-in chat-format registry + opt-in LLM fallback. Modules: `types.ts` (PatternEntry + ParseResult + DateContext + CaptureMap + TimezonePolicy), `builtins.ts` (19 hand-vetted patterns sourced from public format docs — iMessage/Slack, Telegram bracket + text-export, bold-paren-time, bold-time-dash, bold-name-no-time, chatgpt-export-you-chatgpt, Discord classic + export, WhatsApp ISO + US, Signal, Matrix/Element, IRC classic + weechat, Teams export, markdown-heading-turn; module-load validation runs every `test_positive[]` + `test_negative[]` sample at startup so a typo in any built-in regex makes gbrain refuse to start; `DEFAULT_SPEAKER_CLEAN` exported as a module-level default), `parse.ts` (orchestrator with pattern-priority scoring across the first 10 lines + date derivation chain `explicit > frontmatter.date > effective_date > '1970-01-01'` + multi-line continuation + timezone warning; also populates `ParseResult.unrecognized_headings` — when the WINNING pattern is heading-anchored, heading-shaped lines whose label is outside the pattern's speaker set FOLD into the previous turn's body (or drop before the first anchor) while the parse still returns `regex_match`, silently crediting one speaker with another's words; detection is diagnostic-only and unconditional (not behind `opts.diagnostic` — the extractor's decline gate depends on it), fence-aware (a fence closes only on ITS OWN marker; an unclosed fence suppresses detection below it), labels deduped/capped at 10 entries ≤48 chars, undefined when empty so healthy-page JSON stays byte-identical; `gbrain conversation-parser scan` surfaces the field in both human and JSON output; `applyPattern` never DROPS a matched anchor whose date it cannot reconstruct (a localized month name, malformed digits) — dropping it would fold that speaker's body into the previous turn on a multi_line pattern, so the message opens anyway, inheriting the previous anchor's timestamp (page fallback date at midnight for the first), and the count surfaces as `ParseResult.date_fallback_count`, undefined when zero), `llm-base.ts` (shared `runLlmCall<T>` with content-hash cache in-process + DB-persistent via migration v97 + 4-strategy JSON repair + Anthropic-key probe; fallback is a thin wrapper), `llm-fallback.ts` (opt-IN; NO regex inference + NO persistence), `eval.ts` (`scoreFixture` + `aggregateScores` + `parseFixtureJsonl` for the fixture-corpus CI gate), `nightly-probe.ts` (DI-stubbed; mode-gated default tokenmax=ON, conservative/balanced opt-in; adversarial false-positive detection; an unreadable fixture returns `skipped` with `fixture_unavailable`, which the autopilot wiring audits, and the wiring reads the embedded fixtures from `cycle/nightly-probe-fixtures.ts`). Pattern `bold-name-no-time` (regex `/^\*\*(?!\[)(.+?):\*\*\s*(.*)$/`, ordered after the time-bearing bold patterns) parses `**Speaker:** text` with NO per-line timestamp (Circleback/Granola/Zoom), anchoring every message at `T00:00:00Z` of the frontmatter date (line order preserves sequence, same no-time convention as `irc-classic`); the `(?!\[)` lookahead rejects telegram-bracket `**[18:37] Name:**`; non-shadow is the colon-INSIDE-bold regex (NOT declaration order — `parse.ts` scores every candidate independently, order is only the tie-break). Because `**Label:** text` is a common prose idiom, the pattern sets optional `PatternEntry.score_full_body: true` so `parse.ts` recomputes the winner's acceptance score over the FULL body before the `SCORING_MIN_ACCEPTANCE` floor, keeping a bold-label notes page at `no_match`. Pattern `chatgpt-export-you-chatgpt` (regex `/^\*\*(You|ChatGPT):\*\*\s*(.*)$/`, declared just before `bold-name-no-time` so it wins the score tie on the two literal ChatGPT-export labels) parses ChatGPT's web-export → Markdown shape, where each turn's `**You:**` / `**ChatGPT:**` anchor is followed by a blank line and a multi-paragraph reply; `bold-name-no-time` alone cannot absorb that shape (`multi_line: false` scores a long reply's density near zero and falls below `SCORING_MIN_ACCEPTANCE`), so this pattern sets `multi_line: true` + `score_continuations_as_body: true` (excludes non-`**`-prefixed reply lines from the density denominator) + `score_full_body: true`. The speaker capture is a closed two-value enumeration (`You` or `ChatGPT` exactly, never an arbitrary `(.+?)` label), so it cannot reopen `bold-name-no-time`'s BROAD-REGEX GUARD against notes pages. Because a bare `**You:**`/`**ChatGPT:**` heading is plausible in prose ABOUT ChatGPT, the pattern also sets the optional `PatternEntry.score_continuations_min_distinct_speakers: 2`: `scoreFromLines` only grants the continuation-density-exclusion score when the anchor lines that fully match `regex` collectively capture at least that many DISTINCT `speaker_group` values, so a page with only one role falls back to the ordinary flat-density score. It ALSO sets `PatternEntry.score_continuations_max_preamble_lines: 5`, because one genuine pair embedded deep in an unrelated long document would otherwise pass: `scoreFromLines` tracks the index of the FIRST fully-matching anchor line and only grants the immunity when that index is at or before the bound (a short title preamble is tolerated). Pattern `bold-paren-time` parses `**Speaker** (HH:MM): text` and `(HH:MM:SS)` (date_source: frontmatter). Fallback gates: `SCORING_HEAD_TRIGGER_THRESHOLD = 0.3` triggers a full-body re-score when the head pass scores below that; `SCORING_MIN_ACCEPTANCE = 0.05` blocks essay false-positives. Exported `scorePatternFull(body, entry)`; private `getNonBlankLines(body, headCap?)` + `scoreFromLines(lines, entry)` DRY the quick_reject+regex loop. CLI surfaces at `src/commands/eval-conversation-parser.ts` (`gbrain eval conversation-parser <fixture.jsonl>` exit 0/1/2, wired into `bun run verify` via `check:conversation-parser`) and `src/commands/conversation-parser.ts` (`scan <slug>` debug, `list-builtins`, `validate <file>`). Doctor checks: `conversation_format_coverage`, `progressive_batch_audit_health`, `conversation_parser_probe_health`. Pinned by `test/conversation-parser/{parse,llm-base,llm-fallback,nightly-probe}.test.ts` + the 27-case baseline at `test/extract-conversation-facts.test.ts` (back-compat invariant). Migration v97 (`conversation_parser_llm_cache_table`). Fixtures at `test/fixtures/conversation-formats/{imessage,imessage-time-only-12h,telegram-bracket,whatsapp-iso,whatsapp-us,signal-export,irc-classic,irc-weechat,matrix-element,teams-export,all,adversarial,bold-name-no-time,bold-time-dash,chatgpt-export-you-chatgpt}.jsonl` with `scripts/check-fixture-privacy.sh` banning real-name leaks. Maintainer guidance: [conversation parser patterns](../conversation-parser-patterns.md).
-- `src/core/facts/conversation-types.ts` — single-source conversation-type allowlist (`ALLOWED_TYPES`: conversation, meeting, slack, email, imessage, imessage-daily + `AllowedType`). It also owns the granular collector aliases (`ALLOWED_TYPE_ALIASES`, `pageTypesForAllowed`) and the one eligibility rule (#5330): `isConversationFactsEligiblePage` and its SQL twin `conversationFactsEligibleSql` admit an allowed concrete type unless frontmatter says `conversation_parseable: false`; with `cycle.conversation_facts_backfill.require_parseable_flag` on, only `type: conversation` or `conversation_parseable: true`. The extractor (slug, batch and enumeration paths), the doctor backlog SQL and its in-process verifier, and the format-coverage sample all use it, so the backlog can drain. Every consumer derives from this frozen leaf module — `extract-conversation-facts.ts` (which re-exports both names verbatim for its existing importers), the cycle backfill phase, `doctor.ts` + `doctor/checks/search-eval.ts`, `sources.ts`, `jobs.ts` — so no hand-copied list can drift. It lives under `src/core/facts/` (not `src/commands/`) because `scripts/generate-flag-registry.ts` scans option-shaped literals one relative-import level deep — importing the constant straight from `extract-conversation-facts.ts` would transitively attribute that command's whole option surface to doctor/jobs/sources in the generated CLI_ONLY registry. Drift-guarded by `test/conversation-facts-type-allowlist-drift.test.ts`.
+- `src/core/facts/conversation-types.ts` — single-source conversation-type allowlist (`ALLOWED_TYPES`: conversation, meeting, slack, email, imessage, imessage-daily + `AllowedType`). It also owns the granular collector aliases (`ALLOWED_TYPE_ALIASES`, `pageTypesForAllowed`) and the one eligibility rule (#5330): `isConversationFactsEligiblePage` and its SQL twin `conversationFactsEligibleSql` admit an allowed concrete type unless frontmatter says `conversation_parseable: false`; with `cycle.conversation_facts_backfill.require_parseable_flag` on, only `type: conversation` or `conversation_parseable: true`. The extractor (slug, batch and enumeration paths), the doctor backlog SQL and its in-process verifier, and the format-coverage sample all use it, so the backlog can drain. Every consumer derives from this frozen leaf module — `extract-conversation-facts.ts` (which re-exports both names verbatim for its existing importers), the cycle backfill phase, `doctor.ts` + `doctor/checks/search-eval.ts`, `sources.ts`, `jobs.ts` — so no hand-copied list can drift. It lives under `src/core/facts/` (not `src/commands/`) because `scripts/generate-flag-registry.ts` scans option-shaped literals one relative-import level deep — importing the constant straight from `extract-conversation-facts.ts` would transitively attribute that command's whole option surface to doctor/jobs/sources in the generated CLI_ONLY registry. Drift-guarded by `test/conversation-facts-type-allowlist-drift.test.ts`. `isFrontmatterFlagOff` (the same off spellings) is shared with `facts/eligibility.ts`.
+- `src/core/facts/eligibility.ts` — `isFactsBackstopEligible`, the one automatic facts-extraction predicate (page-write outbox, its `body_unchanged` check, sync's post-import hook, the facts-absorb job's re-check). Skips `wiki/agents/`, `dream_generated: true`, `facts_backstop` set off (`opted_out`, #6232: a writer's opt-out for a page whose facts another page carries, such as a meeting's raw transcript; removing it re-offers the page even with an unchanged body), bodies under 80 characters, and types outside `ELIGIBLE_TYPES` unless the slug is under a rescue prefix. Receipt reasons are documented under `facts_backstop_skipped` in the error registry. Pinned by `test/facts-eligibility.test.ts`, `test/persistence-facts-backstop.test.ts`.
- `src/core/facts/extract.ts` — the LLM facts extractor (`extractFactsFromTurnWithOutcome` and friends; the output cap, truncation retry, and salvage behavior are described under the trajectory entry). Deterministic junk gate: `isJunkFact(text, kind?)` tests `JUNK_FACT_PATTERNS` — assistant plan/offer narration, meta-narration about the conversation itself, provider billing/rate-limit strings captured verbatim — and is kind-aware: a candidate the extractor classified `commitment` is exempt from the plan-narration arm ONLY ("I'll send the deck by Friday" is a genuine commitment); meta-narration and provider-error strings are junk for every kind. `isJunkFilterEnabled(engine)` is the config kill switch (fail-open on a config read error); `getFactsExtractionPromptAppendix` supplies the config-driven prompt appendix. Entity gate at the candidate loop (the ONE seam where LLM-emitted entity tokens become `entity_slug`): `isUnknownSpeakerLabel` (anonymous diarizer labels — `Speaker A`, `SPEAKER_00`, `spk_0`, `other|unknown|guest`) and `isNullLikeEntity` (placeholder STRINGS `"null"`/`"None"`/`"n/a"` where the prompt asked for JSON null; shared with `write-single.ts`) both null the attribution and KEEP the fact, so no consumer can mint `entity_slug='null'` through the resolver's fallback slugify. The provider-error arm is start-anchored (`^\W*`, optional error/status token or a `<step> stopped|failed because …` prefix, then `(spend|rate) (limit|cap) … (hit|exceeded|reached)`), so a genuine fact that merely mentions a spend limit or rate limit mid-sentence survives; the verbatim provider strings still match. Two config keys: `facts.extraction_prompt_appendix` (non-empty text is appended to the extraction prompt) and `facts.extraction_junk_filter` (`false` disables the deterministic junk gate; default on), plus the opt-in `facts.extraction_missing_confidence` (stored when confidence is missing, null or non-numeric; unset keeps 1.0). A numeric-string confidence (`"0.3"`) is read as the stated value; unknown kinds are still stored as `fact` but counted in a stderr warning. Every extractor `chat()` call (first attempt, the #2113 truncation retry, the malformed-output retry) carries `responseSchema: FACTS_EXTRACTION_SCHEMA` (mirrors `RawExtracted`: `facts[]` of `{fact, kind ∈ ALL_EXTRACT_KINDS}` plus `entity/confidence/notability/metric/value/unit/period` — EVERY property in `required`, the optional ones nullable via type unions, `additionalProperties: false` at both levels, so the schema is OpenAI-strict-safe for proxies that honor the SDK's default `strict: true`); the gateway honors it only on openai-compatible recipes that declare structured outputs (Ollama's server-side grammar), so small local models cannot emit malformed JSON, while `parseExtractorJsonDetailed` still validates the reply text on every lane. Pinned by `test/facts-extract-structured-output.test.ts`.
diff --git a/docs/architecture/key-files/entrypoints-and-docs.md b/docs/architecture/key-files/entrypoints-and-docs.md
index 7520b7c6a9..ed4adb0d92 100644
--- a/docs/architecture/key-files/entrypoints-and-docs.md
+++ b/docs/architecture/key-files/entrypoints-and-docs.md
@@ -92,7 +92,7 @@ Current behavior and load-bearing invariants; history belongs in Git and CHANGEL
- `skills/media-ingest/SKILL.md` — Video/audio/PDF/book with entity extraction
-- `skills/meeting-ingestion/SKILL.md` — Transcripts with attendee enrichment chaining
+- `skills/meeting-ingestion/SKILL.md` — Transcripts with attendee enrichment chaining. The transcript sidecar carries `facts_backstop: false`, and the meeting page is drafted with it until the verification checklist passes (#6232), so automatic fact extraction reads only the verified page; `test/facts-eligibility.test.ts` pins both literals.
- `skills/migrations/` — Version migration files with feature_pitch YAML frontmatter
diff --git a/docs/guides/concurrent-writes.md b/docs/guides/concurrent-writes.md
index 8df59c6fd9..a1c5bfa365 100644
--- a/docs/guides/concurrent-writes.md
+++ b/docs/guides/concurrent-writes.md
@@ -543,7 +543,9 @@ intent committed with the page; the `facts-backstop` effect becomes
`dispatched` when its durable worker job is accepted. Extraction availability
is checked by that worker. The handoff is idempotent and rechecks the source,
page revision and current writer grant. Confined writers, unchanged pages,
-disabled extraction and dream-generated content do not enqueue work.
+disabled extraction, dream-generated content and pages whose frontmatter sets
+`facts_backstop: false` (`skipped: "opted_out"`, #6232) do not enqueue work.
+Removing that line queues extraction again, even with an unchanged body.
Extraction reads only `compiled_truth`, so a write that leaves it unchanged on
a live page that was already eligible records
`facts_backstop: { skipped: "body_unchanged" }` and queues nothing. Title,
diff --git a/skills/meeting-ingestion/SKILL.md b/skills/meeting-ingestion/SKILL.md
index d4916d288d..7119c13dd4 100644
--- a/skills/meeting-ingestion/SKILL.md
+++ b/skills/meeting-ingestion/SKILL.md
@@ -123,7 +123,10 @@ page with `type: source` at `sources/meetings/YYYY-MM-DD-{slug}-transcript`
(the default pack files raw evidence as `source` under `sources/`; never
invent `meeting-transcript`, and don't write the `transcript` alias) or keep
the source file reachable, and link it from the meeting page. The transcript is the canonical
-evidence for every quote and claim check downstream.
+evidence for every quote and claim check downstream. Put
+`facts_backstop: false` in the sidecar's frontmatter: automatic fact
+extraction would otherwise mine the raw transcript, garbles and banter
+included, beside the verified meeting page (Phase 5).
**Redact before you retain.** A raw transcript routinely captures pasted
secrets and PII (a read-aloud API key, a screen-shared token, a private phone
@@ -229,6 +232,7 @@ and sometimes confidently WRONG names. Resolve by evidence:
---
type: meeting
attendees: [{comma-separated slugs of the same people, e.g. people/alice-example}]
+facts_backstop: false
---
# {Meeting Title} — {Date}
@@ -283,6 +287,21 @@ next cycle extracts it (`gbrain dream --phase chronicle` runs it now, paid), and
`life/events/` pages; edit the meeting page and extraction updates its events.
See `docs/guides/life-chronicle.md`.
+Facts (what `recall` returns) are also extracted from saved pages in the
+background, on by default, one paid chat call each time a page's body changes.
+Extraction files each fact on the entity page it names, so it reaches people
+and company pages without passing Phase 6, and it never takes back facts it
+filed from an earlier version of the page. That is why the template drafts
+the meeting page with `facts_backstop: false` (the receipt reads
+`facts_backstop: { skipped: "opted_out" }`): nothing is extracted while the
+page is still being corrected. When the verification checklist passes, save
+the page once more without that line; the receipt then reads
+`facts_backstop: { queued: true }`. Everything on the verified page is
+extraction input, so an uncertain note kept under the downgrade protocol
+becomes a lower-confidence fact. The transcript sidecar keeps its
+`facts_backstop: false`. Don't call `extract_facts` for the meeting or its
+transcript.
+
### Phase 6: Claim verification + consistency check (gate for every entity write)
Recorder summaries inject false facts: speech-to-text garbles proper nouns,
@@ -322,7 +341,9 @@ it as an explicitly-uncertain note on the meeting page — never in an entity
page's compiled truth or frontmatter.
**Propagation rule:** a claim that fails verification must not fan out. Do not
-copy it to other entity pages or timeline entries. A false claim written to
+copy it to other entity pages or timeline entries, and keep it off the
+verified meeting page too: fact extraction carries that page's claims to entity
+pages (Phase 5). A false claim written to
five pages costs five corrections.
### Phase 7: Attendee enrichment (MANDATORY)
@@ -499,13 +520,15 @@ failure axes, and V1–V5 never look at order. Verify the narrated sequence:
in the report, don't block on it.
**The loop:** fix → re-check → fix, until every item passes (or V6 is
-explicitly waived). Only then report.
+explicitly waived). Then save the meeting page without the draft
+`facts_backstop: false` line (Phase 5), and report.
## Sensitive meetings
If the title or transcript signals legal or deeply personal content
(deposition, attorney, counsel, privileged, health): keep the page minimal and
-factual, do not extract biographical color into other pages, and prefer
+factual, keep its `facts_backstop: false` unless the user agrees to fact
+extraction, do not extract biographical color into other pages, and prefer
restraint on back-links. When in doubt about whether content should propagate,
ask the user.
@@ -516,7 +539,9 @@ ingested: {N} attendees enriched, {N} entities updated, {N} action items
captured. Verification: passed. Sequence: PASS." If the sequence check was
waived, say so explicitly: "Sequence: WAIVED by user — {contradiction} stands
(acknowledged, not resolved)." If the recording was split, report one line per
-resulting meeting page. If a claim was withheld or a contradiction flagged by
+resulting meeting page. Name the final meeting-page save's `facts_backstop`
+receipt: `queued`, or `opted_out` with the reason extraction stays off (a
+sensitive meeting the user did not clear). If a claim was withheld or a contradiction flagged by
Phase 6, list each flag — the user resolves them, not silence. If any
checklist item cannot be made to pass, report the meeting as NOT ingested and
name the failing item.
diff --git a/src/core/error-registry.ts b/src/core/error-registry.ts
index c5d3191756..e40840de1e 100644
--- a/src/core/error-registry.ts
+++ b/src/core/error-registry.ts
@@ -153,6 +153,7 @@ export const CODES = {
fact_already_expired: { class: 'caller', summary: "The fact had already expired before this write." },
fact_not_found: { class: 'caller', summary: "Fact not found." },
facts_absorb_write_refused: { class: 'caller', summary: "Facts absorb refused the write." },
+ facts_backstop_skipped: { class: 'unavailable', summary: "A page write queued no automatic fact extraction; the receipt's `facts_backstop.skipped` reason says why (a `kind:<type>` reason names a page type that is not extracted).", reasons: ['opted_out', 'body_unchanged', 'extraction_disabled', 'dream_generated', 'subagent_namespace', 'too_short', 'no_parsed_page', 'slug_bound_client', 'operation_bound_client', 'not_imported', 'backstop_error'], docs: 'docs/guides/concurrent-writes.md', suggestion: 'Nothing failed. `opted_out` means the page frontmatter sets `facts_backstop: false`; remove that line and save the page to extract it.', fix: { argv: ['gbrain', 'get', '--source', '{source_id}', '--', '{slug}'], consent: [], actor: 'agent', why: 'Shows the page frontmatter that decided the skip.', requires_exclusive: false } },
facts_drain_deferred: { class: 'unavailable', summary: "The automatic facts drain left queued facts-absorb jobs waiting; `reason` says why and `fix`, when present, is the next step. Nothing is dropped: the jobs run on a later drain.", reasons: ['no_key', 'extraction_unavailable', 'budget_exhausted', 'daily_budget_exhausted', 'job_over_budget', 'no_pricing', 'provider_halted', 'drain_error'], docs: 'docs/guides/facts-drain.md#deferrals', suggestion: 'Read doctor `facts_drain`: its message names the cause and its fix the next step (raising a spend cap is paid; ask the user first).', fix: { argv: ['gbrain', 'doctor', '--only', 'facts_drain', '--json'], consent: [], actor: 'agent', why: 'Shows the drain status, the backlog and the last error with its fix.', requires_exclusive: false } },
facts_drain_job_failed: { class: 'server', summary: "A facts-absorb job failed inside the automatic facts drain; it retries with backoff until its attempts run out.", docs: 'docs/guides/facts-drain.md#deferrals', suggestion: 'Read doctor `facts_drain`: its message names the cause and its fix the next step (raising a spend cap is paid; ask the user first).', fix: { argv: ['gbrain', 'doctor', '--only', 'facts_drain', '--json'], consent: [], actor: 'agent', why: 'Shows the drain status, the backlog and the last error with its fix.', requires_exclusive: false } },
facts_payload_expired: { class: 'server', summary: "The accepted fact extraction failed and its retained payload has expired." },
diff --git a/src/core/facts/conversation-types.ts b/src/core/facts/conversation-types.ts
index 2254ee6908..ff8b86ce2c 100644
--- a/src/core/facts/conversation-types.ts
+++ b/src/core/facts/conversation-types.ts
@@ -78,6 +78,9 @@ const FLAG_TRUE = ['true', '1', 'yes', 'on'];
const FLAG_FALSE = ['false', '0', 'no', 'off'];
const flagText = (v: unknown): string => (typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean' ? String(v).trim().toLowerCase() : '');
+/** A frontmatter flag set off: `false`, `0`, `no` or `off`, as a YAML scalar or as text, in any case. */
+export const isFrontmatterFlagOff = (v: unknown): boolean => FLAG_FALSE.includes(flagText(v));
+
/** Strict eligibility (opt-in): only `type: conversation` or an explicit `conversation_parseable: true`. */
export async function requireParseableConversationFlag(engine: Pick<BrainEngine, 'getConfig'>): Promise<boolean> {
return FLAG_TRUE.includes(flagText(await engine.getConfig(REQUIRE_PARSEABLE_FLAG_CONFIG_KEY)));
diff --git a/src/core/facts/eligibility.ts b/src/core/facts/eligibility.ts
index 721bb9f769..9fa30adb1b 100644
--- a/src/core/facts/eligibility.ts
+++ b/src/core/facts/eligibility.ts
@@ -3,11 +3,10 @@
*
* Single source of truth for "should this page write fire the facts
* extraction backstop?" Used by:
- * - put_page (operations.ts:556 — MCP backstop hook)
- * - sync.ts post-import hook
- * - file_upload + code_import callers
- * - extract_facts MCP op (negative path: returns 'eligibility_failed' so
- * the caller sees a stable reason)
+ * - the page-write outbox (persistence/effect-facts.ts: prepareFactsBackstop
+ * for put_page, capture and edit_page, and its body_unchanged check)
+ * - runFactsBackstop (facts/backstop.ts), called by sync's post-import hook
+ * and by the facts-absorb job, which re-checks the page it reads
*
* Pre-extraction (PR1 commit 5), this lived inline at operations.ts:633
* and sync.ts had its own divergent type filter (`['conversation',
@@ -21,6 +20,10 @@
* own world; not user-meaningful for hot memory)
* - frontmatter.dream_generated is NOT `true` (anti-loop: never extract
* from dream-generated pages — they're already a digest)
+ * - frontmatter.facts_backstop is NOT off (`false`, `0`, `no`, `off`; #6232):
+ * the writer's opt-out for a page whose facts another page carries, such
+ * as a meeting's raw transcript, or a draft not yet verified. It stops
+ * future extraction only; facts already extracted from the page stay.
* - body length >= 80 chars (skip TODO-style snippets)
* - parsed.type ∈ {note, meeting, slack, email, calendar-event, source, writing}
* OR slug.startsWith('meetings/' | 'personal/' | 'daily/')
@@ -35,6 +38,7 @@
*/
import type { PageType } from '../types.ts';
+import { isFrontmatterFlagOff } from './conversation-types.ts';
export type EligibilityResult = { ok: true } | { ok: false; reason: string };
@@ -90,6 +94,7 @@ export function isFactsBackstopEligible(
if (parsed.frontmatter && parsed.frontmatter.dream_generated === true) {
return { ok: false, reason: 'dream_generated' };
}
+ if (isFrontmatterFlagOff(parsed.frontmatter?.facts_backstop)) return { ok: false, reason: 'opted_out' };
const body = (parsed.compiled_truth ?? '').trim();
if (body.length < MIN_BODY_CHARS) return { ok: false, reason: 'too_short' };
diff --git a/test/facts-eligibility.test.ts b/test/facts-eligibility.test.ts
index dd6028df2f..8e4ddafe09 100644
--- a/test/facts-eligibility.test.ts
+++ b/test/facts-eligibility.test.ts
@@ -131,3 +131,26 @@ describe('isFactsBackstopEligible — eligible-types coverage', () => {
});
}
});
+
+describe('#6232 facts_backstop opt-out', () => {
+ test.each([false, 'false', 'no', 'off', 0, '0', 'OFF', ' No '])('facts_backstop: %p opts the page out', (value) => {
+ const { slug, parsed } = fixture({ frontmatter: { facts_backstop: value } });
+ expect(isFactsBackstopEligible(slug, parsed)).toEqual({ ok: false, reason: 'opted_out' });
+ });
+
+ test.each([true, 'true', 'yes', undefined, null, 'maybe'])('facts_backstop: %p leaves an eligible page eligible', (value) => {
+ const { slug, parsed } = fixture({ frontmatter: { facts_backstop: value } });
+ expect(isFactsBackstopEligible(slug, parsed)).toEqual({ ok: true });
+ });
+
+ test('the meeting-ingestion skill writes opt-outs the predicate honors', async () => {
+ const { readFileSync } = await import('node:fs');
+ const { parseMarkdown } = await import('../src/core/markdown.ts');
+ const skill = readFileSync(new URL('../skills/meeting-ingestion/SKILL.md', import.meta.url), 'utf8');
+ expect(skill).toContain('`facts_backstop: false` in the sidecar\'s frontmatter');
+ const template = skill.match(/```markdown\n(---\ntype: meeting\n[\s\S]*?\n---\n)/)?.[1];
+ expect(template).toBeDefined();
+ const meeting = parseMarkdown(`${template}\n# Kickoff\n\n${LONG_BODY}\n`, 'meetings/2026-05-09-kickoff');
+ expect(isFactsBackstopEligible('meetings/2026-05-09-kickoff', meeting)).toEqual({ ok: false, reason: 'opted_out' });
+ });
+});
diff --git a/test/persistence-facts-backstop.test.ts b/test/persistence-facts-backstop.test.ts
index 590c8820f2..941911760b 100644
--- a/test/persistence-facts-backstop.test.ts
+++ b/test/persistence-facts-backstop.test.ts
@@ -253,3 +253,11 @@ test.each([
expect(work).toHaveLength(1);
expect(work[0].data.notabilityFilter).toBe(expected);
}));
+
+test('#6232: a page that sets facts_backstop: false queues no extraction, and removing the line queues it with the same body', () => fixture(async () => {
+ await publish();
+ await finishExtractions();
+ const optedOut = content.replace('title: Field notes', 'title: Field notes\nfacts_backstop: false');
+ expect(await rewrite(optedOut)).toEqual({ status: { skipped: 'opted_out' }, effectQueued: false });
+ expect(await rewrite(content)).toEqual({ status: { queued: true }, effectQueued: true });
+}));