knowledge_graph
Create, remove, invalidate, list, or traverse knowledge graph edges with temporal validity and code structure support. Manage relationships between entries.
Instructions
Knowledge graph operations with temporal validity and code structure support. Create/remove edges, traverse via directed BFS, bulk-import code graph edges. Relationship types: related_to, supersedes, depends_on, contradicts, specializes, part_of, alternative_to, builds_on, calls, imports, inherits. Code structure types (calls/imports/inherits) are created by knowledge-ingest and use "code:" prefixed node IDs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| as_of | No | ISO date — only return edges valid at this date (action=list/traverse, optional) | |
| depth | No | Max traversal depth in hops (action=traverse, default: 2) | |
| edges | No | Array of edges to create (action=bulk_link). Each: { source, target, rel_type, strength?, origin? } | |
| entry | No | Entry path for filtering (action=list) or BFS start (action=traverse) | |
| action | Yes | Action: link (create edge), unlink (remove edge), invalidate (set valid_to), list (list edges), traverse (directed BFS), bulk_link (batch-create edges), unlink_by_origin (delete all edges from a specific origin) | |
| origin | No | Edge origin to delete (action=unlink_by_origin). E.g. "tree-sitter" to clear code graph before re-ingest. | |
| source | No | Source entry path (action=link/unlink/invalidate), e.g. 'projects/my-project.md' | |
| target | No | Target entry path (action=link/unlink/invalidate), e.g. 'decisions/architecture.md' | |
| rel_type | No | Relationship type (required for link, optional filter for unlink/invalidate/list) | |
| strength | No | Edge strength 0-1 (action=link, default: 0.5) | |
| valid_to | No | ISO date the fact stopped being true (action=link/invalidate). For invalidate, defaults to today. | |
| direction | No | Traversal direction (action=traverse, default: both). outbound: follow source→target (what does X call?). inbound: follow target→source (who calls X?). both: undirected (default, preserves legacy behavior). | |
| valid_from | No | ISO date the fact became true (action=link, optional). Null/omitted = unbounded. |