Skip to content

πŸ”§ Make LLM enrichment the default extraction path (deprecate dumb kv extractor)Β #227

Closed

Description

@hurttlocker

Problem

The rule-based fact extractor produces massive amounts of low-quality kv facts. Our DB had 537K kv facts out of 587K total (91.6%) β€” most were garbage: section headers, partial sentences, raw log entries. A 250:1 fact-to-memory ratio is broken.

Meanwhile, LLM enrichment (Grok 4.1 Fast) finds higher quality facts β€” decisions, relationships, state tracking, implicit connections β€” that rules can never catch.

Proposal

  1. Make --enrich the default when importing. LLM enrichment should run by default on every import unless --no-enrich is passed.
  2. Reduce rule-based extraction aggressiveness β€” the current regex rules extract too many false positives. Tighten the governor:
    • Reduce AutoCaptureGovernorConfig.MaxFacts from 15 β†’ 8
    • Add minimum predicate length (skip 1-2 char predicates)
    • Add minimum object length (skip empty/trivial values)
    • Skip facts where subject is a section header or markdown formatting
  3. Classification at import time β€” after enrichment, auto-classify any remaining kv facts using DeepSeek V3.2. This means facts are properly typed from birth, not bulk-reclassified later.
  4. Add --no-enrich and --no-classify flags for offline/budget-conscious use.

Context

  • Nuked 589K facts on Feb 24, 2026 β€” rebuilding clean with LLM pipeline
  • Benchmarked 6 models: Grok 4.1 Fast best for enrichment, DeepSeek V3.2 best for classification
  • Cost: ~$2-3 per full corpus reimport (2,335 memories)
  • Old pipeline: 250 facts/memory average. Target: 5-10 quality facts/memory.

Acceptance Criteria

  • cortex import <file> --extract runs enrichment by default (uses DefaultEnrichModel)
  • cortex import <file> --extract --no-enrich skips LLM enrichment (rule-only, for offline use)
  • Rule extractor produces ≀50% fewer kv facts per memory (tighter filters)
  • New --classify-on-import flag (or auto-classify when enriching)
  • Governor config updated with minimum lengths + header detection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    v0.9.0

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions