Expand description
Handler for the enrich CLI subcommand (GAP-14 + GAP-18).
Enriches the knowledge graph by running LLM-powered analysis over memories and entities that are missing key structural data. Operations are:
memory-bindings: memories withoutmemory_entitiesrows get entity extractionentity-descriptions: entities with NULL/empty descriptions get LLM descriptionsbody-enrich: memories with short bodies get expanded by the LLM (GAP-18)re-embed: memories without a vector row get re-embedded without rewriting body
Architecture mirrors ingest_claude.rs: SCAN → JUDGE (LLM) → PERSIST, with a
SQLite queue DB derived next to --db (GAP-SG-64) for resume/retry support.
§DRY note
v1.0.97: claude_runner.rs now hosts the shared Claude invocation helpers
(run_claude, parse_claude_output, spawn_with_memory_limit). The queue
DB schema in ingest_claude.rs still duplicates open_queue_db here — a
future pass can unify them.
Structs§
- Dead
Item - GAP-SG-23: one dead-letter row reported by
--list-dead. - Dead
Summary - GAP-SG-23/11: summary footer for
--list-deadand--requeue-dead. - Enrich
Args - Arguments for the
enrichsubcommand. - Enrich
Status - Read-only
enrich --statusreport (no LLM, no singleton). - Waiting
Item - GAP-SG-16: one pending queue row waiting on its backoff cooldown.
Enums§
- Enrich
Mode - LLM provider for enrichment.
- Enrich
Operation - Operation to perform in the
enrichcommand.
Functions§
- cleanup_
queue_ entry - GAP-SG-13: remove a memory’s enrich-queue entry when the memory is deleted or
force-merged, so the dead-letter / pending sidecar never references a row
that no longer exists. Best-effort and a no-op when the queue file is absent
(the common case after a clean run, which removes it). Targets BOTH
memory_id(populated at enqueue for memory ops, GAP-SG-12) anditem_key(the memory name) so pending rows enqueued before id resolution are also cleared. Errors are logged, never propagated — cleanup must not fail the caller’s delete/upsert. - run
- Main entry point for the
enrichcommand.