Docs · graph schema

Graph schema

Nodes, edges, layers, confidence

The four semantic layers

Causalist inherits Tracey's multi-layer separation, informed by MAGMA's finding that orthogonal graphs for different signal types beat a flat unified memory.

LayerSourceExamples
CodeStatic AST + filesystemfiles, functions, classes, imports
ExecutionRuntime + tool callsobservations, errors, tool-use events
KnowledgeLLM reasoningbugs, solutions, patterns, decisions
ProjectUser messagestasks, constraints, goals

In the viewer, each layer gets its own color; selecting a node reveals only edges within its layer plus cross-layer "explains" bridges.

Node kinds

Every node has a kind:

  • file — a source file
  • module — a logical unit (package, directory with a role)
  • function / type — AST-level entities
  • external — npm/cargo/pip dependencies

Edge kinds

Edges are typed. This is the key thing most dependency-graph tools miss — not all "X depends on Y" relationships are the same.

EdgeSemantics
importsX statically imports Y. From AST. Highest trust.
callsX invokes Y at runtime. From AST + call-site resolution.
readsX reads state from Y (DB row, config key, cache). Often inferred.
writesX mutates Y. Narrower than reads; invariant-critical.
extendsX inherits / implements / conforms to Y.
causedExecution-layer: event e1e_1 directly triggered e2e_2.
explainsKnowledge-layer: learned pattern pp accounts for observation oo.

Confidence scoring

Each edge carries a confidence score c[0,1]c \in [0, 1]:

cedge  =  csourceeλ(tt0)c_{\text{edge}} \;=\; c_{\text{source}} \cdot e^{-\lambda (t - t_0)}
  • csourcec_{\text{source}} depends on provenance: AST-derived edges start at 1.01.0, LLM-inferred at 0.60.6.
  • The decay eλ(tt0)e^{-\lambda (t - t_0)} means edges not touched for a long time lose trust. A file refactor that nobody has looked at for six months has a softer claim on the graph than yesterday's lint rule.

Edges below threshold are dimmed in the viewer. Queries with min_confidence filter them out of reasoning context.

Structural invariants

The verifier checks three properties after every update:

  1. Acyclicity on causal edges — cycles indicate incorrectly-directed edges. A cycle ABAA \to B \to A on caused edges is a contradiction by definition.
  2. No contradictionsXX cannot both prevent and cause YY at overlapping timestamps.
  3. Typed consistency — a node of kind: "external" cannot appear as the target of an extends edge from a local node in a language without multiple inheritance.

Violations don't halt the agent; they get surfaced as warnings you can investigate.