knowing

Edge Types Reference

This document catalogs every edge type in the knowing knowledge graph: what it represents, which extractors produce it, its provenance tier, and how it participates in blast radius traversal and context ranking.

Summary Table

Edge Type Meaning Provenance Confidence Producers Blast Radius RWR Weight
calls Function/method invocation ast_inferred / lsp_resolved 0.7 / 0.9 All 12 extractors, enricher Yes (traversed) 1.0
imports Module/package import ast_inferred 0.7 All 12 extractors No 0.5
implements Type satisfies an interface ast_inferred / lsp_resolved 0.7 / 0.9 Go extractor, enricher No 0.8
handles_route HTTP handler bound to a route ast_inferred 0.7 Go, TS, Python, Rust, Java, C# extractors No 0.7
references Non-call identifier usage ast_inferred / lsp_resolved / scip_resolved 0.7 / 0.9 / 0.95 Go extractor, Proto extractor, SQL extractor, SCIP ingestor, enricher No 0.4
depends_on Resource/symbol dependency ast_inferred 0.7 Terraform, SQL, CSS extractors No 0.5
deploys K8s Service routes to Deployment ast_inferred 0.7 K8s YAML extractor No 0.5
exposes K8s Ingress exposes Service ast_inferred 0.7 K8s YAML extractor No 0.5
configures ConfigMap/Secret provides config ast_inferred 0.7 K8s YAML extractor No 0.5
publishes Producer publishes to a topic/queue ast_inferred 0.7 Cloud extractor (Serverless, CFN) No 0.5
subscribes Consumer subscribes to a topic/queue ast_inferred 0.7 Cloud extractor (Serverless, CFN) No 0.5
connects_to Service connects to another service/network ast_inferred 0.7 Cloud extractor (Docker Compose) No 0.5
runtime_calls HTTP call observed in traces otel_trace 0.2 - 0.95 Trace ingestor No 0.3 (default)
runtime_rpc gRPC/RPC call observed in traces otel_trace 0.2 - 0.95 Trace ingestor No 0.3 (default)
runtime_produces Message published to a topic otel_trace 0.2 - 0.95 Trace ingestor No 0.3 (default)
runtime_consumes Message consumed from a topic otel_trace 0.2 - 0.95 Trace ingestor No 0.3 (default)

Static Edge Types

calls

A function or method invokes another function or method.

imports

A file imports a module or package.

implements

A concrete type satisfies an interface contract.

handles_route

An HTTP handler function is bound to a specific route pattern.

references

A non-call usage of an identifier (type annotations, variable reads, constant references).

depends_on

A resource or symbol depends on another resource or symbol.

deploys

A Kubernetes Service routes traffic to a Deployment (selector match).

exposes

A Kubernetes Ingress exposes a Service.

configures

A Kubernetes ConfigMap or Secret provides configuration to a Deployment.

publishes

A function or service publishes messages to a topic or queue.

subscribes

A function or service subscribes to (consumes from) a topic or queue.

connects_to

A service connects to another service or network resource.

Runtime Edge Types

Runtime edges are produced by the trace ingestor (internal/trace/ingestor.go) from OpenTelemetry spans and HTTP log entries. Their edge type is determined by the edgeTypeFromAttributes function, which inspects span attributes.

runtime_calls

An HTTP call between services observed in production traces.

runtime_rpc

A gRPC or RPC call between services observed in traces.

runtime_produces

A service publishes a message to a messaging topic.

runtime_consumes

A service consumes messages from a messaging system.

Provenance Tiers

Provenance tracks how an edge was discovered and determines its confidence level.

Provenance Confidence Source Meaning
ast_inferred 0.7 Tree-sitter extractors Edge inferred from AST structure without type resolution. Cross-package calls resolved heuristically from import aliases.
lsp_resolved 0.9 LSP enricher (gopls) Edge confirmed by querying the language server’s GetDefinition at the call site. The original ast_inferred edge is deleted and replaced.
scip_resolved 0.95 SCIP ingestor Edge resolved from a SCIP index file. Near-full confidence; SCIP indexes are produced by compiler-grade tools with complete type information.
ast_resolved 1.0 Python extractor Edge resolved with full confidence. (Python extractor uses this provenance, though cross-module targets may still be dangling.)
otel_trace 0.2 - 0.95 Trace ingestor Edge observed in production runtime data. Confidence varies by observation count and recency.

Runtime confidence scoring

Runtime edge confidence is computed by ComputeConfidence(observationCount, daysSinceLastObserved):

  1. If the edge has not been observed in over 90 days: 0.0 (garbage-collection eligible)
  2. If the edge has not been observed in over 30 days: 0.2 (stale)
  3. Otherwise, confidence is based on observation count via ConfidenceFromCount:
Observation Count Confidence
> 1000 0.95
>= 100 0.85
>= 10 0.70
>= 1 0.50
0 0.20

Edge Lifecycle

Creation

Edges are created during indexing. Each extractor walks the tree-sitter AST and emits edges with provenance ast_inferred and confidence 0.7. Edge identity is determined by the EdgeHash, which is computed from (source_hash, target_hash, edge_type, provenance). This means the same source-target pair can have multiple edges if the provenance differs (e.g., both an ast_inferred and an otel_trace edge for the same call relationship).

Upgrade via enrichment

After indexing, the enrichment pipeline (internal/enrichment/enricher.go) runs gopls to upgrade edges:

  1. Open files in gopls so it builds its workspace index.
  2. Upgrade call edges: For each ast_inferred edge with call-site position data, query GetDefinition at (file, line, column). If gopls returns a location, delete the old edge and insert a new one with provenance lsp_resolved and confidence 0.9. (Deletion is necessary because provenance is part of the edge hash.)
  3. Discover new edges: For each file, retrieve document symbols and query GetImplementation (producing implements edges) and GetReferences (producing references edges) to find relationships that tree-sitter missed.

Decay

Runtime edges decay over time based on how recently they were last observed:

The DecayBracket function in internal/trace/confidence.go categorizes edges into these buckets for diagnostics.

Garbage collection

Edges become eligible for garbage collection when their confidence reaches 0.0 (not observed for over 90 days). The ShouldGarbageCollect function checks whether time.Now() - lastObserved > gcThresholdDays * 86400. The RuntimeEdgeStats method on the trace ingestor reports GCEligible counts for monitoring.

Static edges (ast_inferred, lsp_resolved) are replaced on each re-index of the containing file rather than decayed. When a file is re-indexed, edges from the old snapshot that are not present in the new extraction result are effectively removed by the snapshot management system.