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)- all others: scan + structured NDJSON output (not-yet-implemented dispatch)
Architecture mirrors ingest_claude.rs: SCAN → JUDGE (LLM) → PERSIST, with a
SQLite queue DB (.enrich-queue.sqlite) for resume/retry support.
§DRY opportunity
extract_with_claude, parse_claude_output, emit_json, and the open_queue_db
queue schema in ingest_claude.rs are private functions that duplicate patterns used
here verbatim. A future refactoring could extract them into a shared
src/commands/llm_runner.rs module (or src/llm_runner.rs) without changing any
public APIs. That extraction requires editing ingest_claude.rs, which is outside
this stream’s boundary — flagged here for the Integration stream to evaluate.
Structs§
- Enrich
Args - Arguments for the
enrichsubcommand.
Enums§
- Enrich
Mode - LLM provider for enrichment.
- Enrich
Operation - Operation to perform in the
enrichcommand.
Functions§
- run
- Main entry point for the
enrichcommand.