Skip to content

Graph Maintenance

The graph improves over time, but changes in models and content can create gaps.

How to identify weak graph areas and re-run extraction safely.

  1. Find likely extraction gaps:
Terminal window
./bin/pgm-admin sql "
SELECT id, char_length(content) AS chars
FROM entities
WHERE type = 'document'
AND extraction_status = 'completed'
AND NOT EXISTS (
SELECT 1 FROM edges WHERE source_id = id AND source = 'llm-extraction'
)
ORDER BY chars DESC
LIMIT 20
"
  1. Targeted refresh:
Terminal window
./bin/pgm-admin reextract --type document --no-edges-only
  1. Full refresh with cleanup:
Terminal window
./bin/pgm-admin reextract --all --clean-edges
  1. Quality and edge hygiene:
  • prune-edges --below <threshold>
  • validate-edges --limit 200
  • reextract clears extraction state but keeps non-LLM edges intact.
  • improve-graph can rerun with alternate model/provider per batch.
  • Validate before production rollouts; use --dry-run on risky commands.