Skip to main content

Module ingest_heuristics

Module ingest_heuristics 

Source
Expand description

Deterministic heuristic for generating descriptions of ingested memories.

GAP-E2E-011 (FALTA-6): every ingested memory received the hardcoded description "ingested from <path>", which made the listing useless and degraded search results. This pure-Rust heuristic extracts the first meaningful line of the body, ignoring markdown headers.

Rules:

  • First non-empty line longer than 20 characters
  • Ignores lines starting with # (markdown headers)
  • Truncates at 100 characters via chars().take(100)
  • Fallback: "ingested document" when no line is valid

Determinism: zero hash-order-based allocation, zero LLM, zero dependency on filesystem order. Byte-for-byte reproducible output.

Functionsยง

extract_heuristic_description
Extracts a heuristic description from the body of an ingested document.