Skip to content

Knowledge Graph

The knowledge graph connects entities with directional edges so you can traverse related context instead of only reading raw text.

This page covers edge types, how links are created, and how graph traversal is used in retrieval and entity inspection.

  1. Create manual links with relation labels:
Terminal window
pgm link <source-id> <target-id> --relation involves
  1. Expand a node’s neighborhood to see neighbors and relationship direction:
Terminal window
pgm expand <entity-id> --depth 2
  1. Use compact search edge summaries to decide when expansion is worth it:
Terminal window
pgm search "who approved the deploy plan" --toon

The search result may show edges.count and relation counts such as mentioned_in=2 or blocked_by=1. That summary confirms connected context exists without returning neighbor content.

  1. Delete outdated or incorrect edges when needed:
Terminal window
pgm unlink <edge-id>
  1. Use the same pattern through API endpoints:
  • POST /api/edges
  • DELETE /api/edges/:id
  • GET /api/entities/:id/graph
  • Default relation examples include involves, assigned_to, part_of, blocked_by, mentioned_in, and related_to.
  • Manual edges are typically high-confidence (confidence = 1.0); extracted edges carry model-derived confidence.
  • Memory entities are embedded for recall but do not produce extracted graph edges by default. Use EXTRACTION_MEMORY_MODE=extract_durable or EXTRACTION_MEMORY_MODE=extract_all only when memory-derived graph edges are intentional.
  • Duplicate edges are prevented by source/target/relation constraints.
  • Search edge summaries are traversal affordances. Use pgm expand <id>, pgm search --expand-graph, or REST/MCP expand_graph when a question needs connected context.