extract_atoms: per-type extraction policy, so authoritative sources are not rewritten as shareable nuggets
Summary
extract_atoms applies one hardcoded prompt (EXTRACT_PROMPT, src/core/cycle/extract-atoms.ts) to every extractable page. The prompt defines an atom as an idea "that could become a tweet, quote, or short essay angle" and requires virality_score and emotional_register. That objective suits transcripts, podcasts and essays. It does not suit pages whose value is their exact wording: statutes, regulations, contracts, standards, policies, safety or clinical procedures. On those pages, optimising for a shareable claim removes the qualifiers that carry the meaning.
Version: 0.59.18.0.
What we observed
On a corpus of primary legal texts (details withheld), atoms showed three repeatable failure classes:
- Modal inversion. Discretionary wording ("may", "is considered", "subject to") rewritten as an obligation or an automatic consequence ("must", "automatically").
- Condition read as consequence. A threshold or trigger restated as what happens once it is met.
- Dropped qualifier. An exception, date, cross-reference or conditional phrase removed, which in one case reversed who a rule benefits.
Measured: 7 of 44 atoms from primary legal text were defective (16%); 9 of 9 from analytical prose were correct. With the local prompt addition below, 1 of 52 (1.9%), the remaining failure being a dropped condition. Small samples; the direction is clear.
The failures are hard to see: the atoms are well-formed, and the quote can even verify, while the claim says something the source does not.
Why this is general, not niche
- Any brain holding authoritative material (law, regulation, compliance, medicine, engineering standards, contracts) is exposed.
- The error compounds: atoms feed
synthesize_concepts, takes and retrieval, so an inverted obligation becomes a downstream "fact". - It cannot be opted out of by type today.
LEGACY_EXTRACTABLE_TYPESincludessource, and the pack'sextractableflags are unioned with that floor (unionExtractableTypes), so a pack can add types but cannot removesource,meeting,articleand the rest. - The only remedy today is editing the installed source, which every upgrade reverts.
Proposal (any one solves it; in order of preference)
- Per-type extraction policy in the schema pack, for example
extraction: skip | default | fidelityper page type, with the pack allowed to override the legacy floor (soskipworks forsource). - A built-in fidelity prompt selected by that policy: keep modal verbs as written; keep conditions, exceptions, thresholds, dates and cross-references; prefer no atom to a distorted one; do not ask for virality or emotional register, or record them only as descriptions of the atom written.
- Minimum: a config key to supply the prompt text (for example
cycle.extract_atoms.prompt_file), plus a way to print the effective prompt, so a local adaptation survives upgrades and can be verified.
Related:
- #5705 shows the same root from another angle: one prompt for every page type fails on chat transcripts too (the model continues the conversation instead of returning JSON). A per-type policy would give both cases a home.
- The existing
v0.42+ TODO: read atom_type enum from active pack manifestin the same file.
Acceptance
- A page type can be excluded from
extract_atomsthrough the pack, including legacy-floor types. - A page type can be routed to a fidelity prompt without editing source.
- The effective prompt per type can be printed (CLI or
doctor). - A fixture with a discretionary modal verb and a conditional exception keeps both in fidelity mode.
What we run locally meanwhile
A clause inserted before the concepts are kebab-case English TOPIC labels paragraph of EXTRACT_PROMPT, re-applied after every upgrade. We will retire it when an upstream mechanism covers this.
FIDELITY OVERRIDES VIRALITY. A quotable atom that misstates the source is a
defect, not a win. When the source qualifies a claim, the atom carries the
qualification even though that makes it less shareable:
- PRESERVE MODALITY. "is considered", "may", "can", "subject to", "at the
discretion of" must NOT become "will", "must", "always", "automatic".
Never add "automatically", "removes discretion", "bright-line", "no
exceptions" or "guarantees" unless the source states it.
- A CONDITION IS NOT A CONSEQUENCE. If the source names a threshold or a
trigger, do not invent what follows from it.
- KEEP the exceptions, thresholds, dates and cross-references that change
what the claim means. Dropping one inverts it.
- Attribute correctly. In a dialogue, do not report a questioner's wording
as the answerer's testimony.
If the faithful atom is dull, emit it dull. If no faithful atom exists, emit
none. virality_score and emotional_register describe the atom you wrote; they
are never a reason to write a different one.Happy to test a branch against our corpus and report the same metrics.
Source: garrytan/gbrain