Skip to content

Graph API

@contextlint/core exposes a set of functions that build a dependency graph from parsed documents and let you query impact sets, related documents, dependency order, and more. The Graph API is the programmatic interface for calling these functions directly.

Use it when you want to work with relationships between documents from scripts or tooling rather than using contextlint as a linter. The MCP context-graph / context-slice / impact-analysis tools call this API internally as well (see AI Agents).

For the design philosophy and the reasoning behind why the Context Graph exists, see Context Graph. This category focuses on how to use the API.