Fact extraction (v0.2.9)

Long responses get distilled into searchable facts.

When a memory's content exceeds 500 characters, mnueron can run a Claude Haiku call to extract 1-5 discrete facts — decisions, recommendations, conclusions, action items — and save each as its own searchable memory.

Cost: $0.002 per extraction. Combined with summarization ($0.0015) your max per-long-save cost is ~$0.005.

Enabling extraction

Two opt-in paths:

  1. Per-deploy: set environment variable ENABLE_FACT_EXTRACTION=true on your hosted account. Every memory above the threshold gets extraction automatically.

  2. Per-call: include metadata.extract_facts: true in your save:

    mem.save(
        content=long_assistant_response,
        namespace="user-123",
        metadata={"extract_facts": True},
    )
    

What gets saved

Each extracted fact becomes its own memory in the same namespace:

FieldValue
contentThe fact text (1-2 sentences)
namespaceSame as parent
tags["extracted-fact", <category>]
source"fact-extraction"
source_refparent memory id
metadata.derived_fromparent memory id
metadata.categorydecision / recommendation / fact / action_item

To query just the extracted facts later:

# All decisions across this user's history
mem.search(
    "what did we decide about pricing",
    metadata_filter={"category": "decision"},
    namespace=f"user-{user_id}",
    k=5,
)

Failure mode

Fail-open. If the Anthropic API call fails (rate limit, network error, no ANTHROPIC_API_KEY configured), no facts are saved and the parent memory write still succeeds normally. No client-side error.

Trigger timing

Fact extraction runs after the parent memory is saved (so the parent id is known) and doesn't block the response — the user sees the parent insert succeed immediately, and children land within a few seconds as the Haiku call completes.

Last updated 2026-05-16edit