Skip to main content

Module extraction

Module extraction 

Source
Expand description

The provider-agnostic post-turn memory extractor (docs/reference/personas.md §5, issue #214).

After a turn commits, a cheap model distills the transcript into durable facts about the person — never in the turn’s hot path. The extractor is handed the persona’s existing ACTIVE facts so contradictions come back as invalidations (paired with the replacing fact) rather than duplicates; the store then closes the old fact’s validity interval — invalidate, never delete.

Like the participation classifier next door, this is deliberately provider-agnostic and tolerant on the way out: a reply that isn’t the expected JSON extracts nothing (memory is best-effort enrichment; a flaky cheap model must never break the pipeline).

Structs§

CandidateFact
One fact the extractor proposes to remember.
ExistingFact
An existing active fact, as shown to the extractor for contradiction checks.
ExtractedMemories
What one extraction pass proposes.
Invalidation
One existing fact the extractor proposes to invalidate (contradicted by this turn).

Constants§

MAX_FACTS_PER_TURN
Most facts one turn may add. A chatty turn distills to a few durable facts; dozens means the model is transcribing, not distilling.
MIN_CONFIDENCE_BPS
Write-time confidence floor (#796).

Functions§

extract_memories
Distill one committed turn into memory operations.
looks_like_authorization_claim
The post-parse authorization-claim heuristic (#1925).
looks_like_pii
The post-parse PII heuristic (#796): a refused-category keyword or a long digit run anywhere in the text.