Skip to main content
xspec reads every .mdx file in your project and constructs a project-wide dependency graph that maps the structural and semantic relationships between your specification requirements and your codebase. This graph is the foundation for every analysis command xspec provides: coverage gaps, change impact, review scoping, and arbitrary graph queries all operate on the same underlying data structure stored at .xspec/graph.json.

Nodes

The graph contains three kinds of nodes: Every spec file automatically contributes a root node even if it contains no <S> sections. Code locations are registered when TypeScript markers reference them.

Edge Kinds

Edges express how nodes relate to one another. xspec distinguishes four kinds: contains edges represent document structure. The other three — depends, embeds, and references — carry semantic meaning and are used when calculating coverage and impact.
contains edges are intentionally excluded from coverage reachability. A parent requirement being referenced does not automatically make its children covered. Each leaf must be reached independently.

Building the Graph

Run xspec build to parse your spec files and write the graph to .xspec/graph.json:
The build step validates every requirement ID, resolves all d and {text(...)} references, and emits a type-annotated JSON file you can inspect or version-control.
You do not need to run xspec build manually before most read commands. The ids, show, coverage, impact, review, and query commands silently refresh graph data from your current files before reporting results.

Using the Graph

Once built, the graph powers a suite of read commands: The graph model means that any of these views is computed from the same source of truth — you never maintain separate coverage spreadsheets or impact matrices by hand.