Complexity Lab / Production / Categorical X-Ray
Architectural OfferStructural DiagnosticsSoftware Production Systems

The Categorical X-Ray

A purely structural diagnostic for complex production systems. The X-Ray turns a tangle of microservices, agents, queues, and policy gates into a name-invariant fingerprint that reveals hidden bottlenecks, structural symmetries, and multi-way dependencies the architecture diagram cannot see.

01Beyond Diagrams

A bridge between intuition and formal structure.

Architecture diagrams describe what should be. Traces and dashboards describe what is, at the moment of observation. Between the two sits a structural backbone — the way components actually depend on one another, taken as a whole — that neither view exposes. The Categorical X-Ray fills that gap.

The X-Ray is a formal apparatus drawn from a recent result in graph neural network theory (Choi, Kim & Yun, 2026). We take its mathematical core — categorical lifting of hypergraphs into graded posets, followed by Weisfeiler–Lehman refinement — and apply it not to learning, but to diagnosis. No model is trained. No data is required. Only the architecture itself, taken as a multi-way interaction graph, is needed.

The X-Ray is not a monitoring tool. It is a name-invariant structural fingerprint of the architecture, computed once from the spec and re-computable on every refactor.
02The Problem

A configuration thousands of teams share.

Thirty microservices. Three LLM agents. A shared policy gate. A few queues. A common database. The architecture diagram looks like a plate of spaghetti. Someone makes an innocent refactoring of the policy component, and two days later the pipeline silently starts dropping events. The cause is a hidden dependency the diagram never showed — because it was not pairwise. It was multi-way: three services simultaneously depended on the same policy gate within a single transaction.

Standard graphs cannot see this. An edge connects two nodes. A real dependency — Router → Agent A → Policy Gate → Auth Context — connects four. Decompose it into pairs and you lose the fact that all four participate together, not merely in pairwise links.

i · Multi-way Reality

Pairwise edges lose the truth

A four-way relation cannot be faithfully expressed as edges between pairs. Every standard graph view of your system is throwing away exactly the information you need to find the bottleneck.

ii · Refactoring Blindness

Diagrams cannot diff themselves

When the policy component is reworked, no diagram-level tool can tell you which downstream roles changed structurally and which only changed cosmetically. The next incident is the diff.

iii · Hidden Roles

Symmetries invisible at the diagram level

Two agents may appear interchangeable in the diagram and be structurally distinct. A policy gate may sit at the center of five hyperedges, but on the canvas it is just another box with arrows on it.

03Failure Mode

Pairwise edges. Multi-way reality.

Most serious production failures in distributed and agentic systems are not isolated component failures. They are failures of interaction — three or four components participating in a single multi-way relation, one of them refactored in a way that quietly changes the relation's shape. The schema still validates. The dashboards still look normal. The diagram still resembles the system. But the formal structure of the system is no longer what anyone thought it was.

The Categorical X-Ray targets this class of failure: structurally critical components and relations whose role is invisible to pairwise graph models, dashboards, and the architecture diagram itself.

The dashboard is green. The schema validates. The diagram still resembles the system. And the formal structure is no longer what anyone thought it was.
04Two Functors & A Deeper Layer

Two functors, two diagnostic regimes.

The X-Ray begins with a lifting: a structure-preserving transformation of the hypergraph of the architecture into a richer object — a graded poset. The choice of lifting determines what becomes visible. The CatWL framework provides two principled options, and a deeper layer that hangs runtime data on top of the static skeleton.

01 Incidence Functor

The flat view: global connectivity

Nodes at level 0, hyperedges at level 1. A simple two-level poset. The most efficient lifting. Best when the architecture has many hyperedges and the diagnostic signal lies in which components touch which interactions across the whole system.

Linear in incidences · Always tractable
02 Symmetric Simplicial Functor

The deep view: intersection geometry

Every subset of every hyperedge becomes a distinct element. A multi-level poset. Best when there are few but internally rich hyperedges and the signal lies in how they intersect — which subsets shared, which sub-relations preserved, which broken.

Polynomial in cardinality · Truncated above ~20
03 Sheaves on the Skeleton

Statics → live diagnostics

Once the X-Ray gives you the skeleton, you can hang data on it — metrics, states, policies, SLAs. Formally: a sheaf on the graded poset. When per-node data disagrees with per-interaction data, the discrepancy lands in a cohomology class — a precise signal of where structure and behavior are out of sync.

Next layer · See Architectural Background →
05The Architecture

Five steps, two levels of resolution.

The X-Ray pipeline is pure combinatorics. No training. No probabilistic inference. The output is a deterministic, name-invariant coloring of every component in the system — a structural fingerprint computed in milliseconds for architectures of tens to hundreds of components.

SOURCE X-RAY PIPELINE OUTPUT Architecture configs · IaC service mesh traces · DAGs 01 Extract build the hypergraph H 02 Lift functor I or S graded poset 03 Refine GWL refinement until stable 04 Diagnose classes · unique elements · diff OUT Report structural findings 05 Validate · cross-check against historical incidents

Fig. 01 The five-step X-Ray pipeline. The architecture is extracted as a hypergraph. The lifting functor (I or S) transforms it into a graded poset. GWL refinement assigns every element a name-invariant color. The diagnosis reads off equivalence classes (interchangeable components), unique elements (bottleneck candidates), and stabilization speed (structural complexity). Validation closes the loop against incident history.

01

Extract — the architecture as a hypergraph

From configs, IaC definitions, service mesh manifests, traces, or dependency declarations, we build the hypergraph H = (V, E, f). Every multi-way interaction — a transaction crossing three or more components — becomes a single hyperedge. No information is decomposed into pairs.

02

Lift — choose the functor

The incidence functor I for global connectivity. The symmetric simplicial functor S for intersection geometry. Functoriality guarantees that the lifting depends only on structure, not on component names — two isomorphic architectures produce isomorphic posets.

03

Refine — iterative coloring on the poset

GWL refinement runs on the lifted structure. Every element's color is updated from its boundary, coboundary, lower, and upper adjacencies until the coloring stabilizes. The result is a structural fingerprint.

04

Diagnose — read off the roles

Elements sharing the same final color are structurally interchangeable. Elements with unique colors are structurally one-of-a-kind — bottleneck candidates. The number of iterations to stabilization is a complexity index for the architecture itself.

05

Validate — against incident history

Cross-check the identified bottlenecks and equivalence classes against real failure points from the last twelve months. The X-Ray that does not recover known historical bottlenecks is mis-specified at the extraction step — the ontology is wrong, not the math.

06Structural Diff

Closing the refactoring loop.

The single most expensive moment in a complex production system is the moment a refactoring lands and no one knows whether anything structural changed. The change set is a thousand lines. The PR description says "internal cleanup." The dashboards stay green. Two weeks later, a transaction crossing three services fails in a way that should have been impossible.

The X-Ray gives a precise answer to the question "did this PR change structure or only cosmetics?" Run refinement on the architecture before and after. Compare the color histograms. Elements whose color changed are precisely the components whose structural role was affected. Nothing else changed structurally — and you can prove it.

Source components Interactions R A B C T P M Mon e₁ e₂ e₃ e₄ e₅ e₆
Hypergraph before categorical lifting
Colored structural roles First GWL refinement R A B C T P M Mon e₁ e₂ e₃ e₄ e₅ e₆
After first GWL refinement

Fig. 02 The first view preserves the system as a hypergraph: multi-way relations remain first-class objects. The second view shows the first GWL refinement, where equal colors indicate equal first-step structural signatures. This makes hidden equivalence classes and structurally unique elements visible without reducing the architecture to pairwise edges.

07Tiered Diagnostics

Not every architecture needs the deepest analysis.

The principle mirrors tiered intelligence in the Viable System Model: different levels of analysis for different levels of risk. The choice of tier is driven by what the system needs to know — and how expensive being wrong is. Tier boundaries are set by policy and can shift as the architecture evolves.

Tier I

Bottleneck identification

Incidence lift, single GWL refinement pass. Surfaces unique-color elements — components with structurally distinctive dependency profiles. Fast, almost free, runs on every PR. The Policy Gate appearing in five of six hyperedges shows up here.

~60%routine reviews
Tier II

Equivalence class discovery

Incidence lift, GWL refinement to stabilization. Identifies components that are structurally indistinguishable under the dependency model — candidates for redundancy planning, load balancing, and blast-radius analysis. Done at architecture-review cadence.

~30%moderately critical
Tier III

Simplicial lift + sheaf overlay

Symmetric simplicial lift. Reveals intersection geometry between hyperedges — which pairs and triples are shared. With sheaf data overlay, discrepancies between per-node metrics and per-interaction metrics land in a precise cohomology class.

~10%critical, irreversible

What the deepest tier catches

Consider an architecture that looks perfectly fine at the diagram level — every component is in its right place, every dependency is documented, every dashboard is green. The X-Ray's deepest tier targets failures invisible to all of these: a critical sub-relation that two hyperedges share through a different subset than expected; an interaction whose per-step metrics are healthy while the end-to-end behavior disagrees with the structural prediction. These are precisely the subtle errors — structurally valid, behaviorally consistent component-by-component, yet systemically wrong — that the simplicial lift and sheaf cohomology are meant to make visible.

08Composition Library

From single snapshot to continuous diagnostics.

The base X-Ray is a single snapshot. For many engagements, that single snapshot is the entire deliverable — it answers the question and the team takes it from there. For others, the X-Ray becomes a continuous capability: re-run on every release, on every architecture decision, on every postmortem. Three composition modes cover the full range.

L · 01 Single Snapshot

Architectural review

Extract → Lift → Refine → Report. One review cycle on the current state of the system. The deliverable is a single document: equivalence classes, bottleneck candidates, structural complexity index, and prioritized recommendations.

L · 02 Iterative · Postmortem

Dialogue with the architecture

The team interprets the X-Ray, refines the hypergraph — some interactions were missing, some entities were too coarse — and re-runs the analysis. The cycle continues until the structural diagnosis matches the engineering team's lived understanding. Often, the gap between the two is the actual finding.

L · 03 Continuous Monitoring

Structural diff in CI

The X-Ray runs on every release. Every PR produces a structural diff against the previous version. PRs with no structural-role changes are flagged differently from PRs that alter a structurally unique component. Reviewers see structural impact before merge, not after the incident.

09What This Is

As a client engagement.

For the client

Give us the specification of your architecture. We build the X‑Ray — adapted to your domain, your ontology, your release cadence.

The X-Ray does not replace monitoring, tracing, or architecture review. It does not require instrumentation. It does not assume access to running traffic. It is a parallel diagnostic layer that takes the architecture as the team currently understands it — service inventory, mesh configuration, dependency manifests, IaC, the existing diagrams — and turns that understanding into a name-invariant structural fingerprint.

The result is a usable diagnostic tool, calibrated against your incident history, that distinguishes cosmetic from structural change in milliseconds and surfaces the multi-way dependencies the diagram cannot show.

Differentiation

Standard architecture review is human, qualitative, and pairwise. Standard observability watches behavior, not structure. The Categorical X-Ray is the missing third view — formal, structural, and multi-way — and it sits beside the other two without replacing either.

Diagrams & pairwise tools

  • Pairwise relations only
  • Multi-way dependencies collapsed into pairs
  • No name-invariant structural fingerprint
  • Refactoring impact interpreted by humans
  • No formal notion of structural role
  • No structural-role diff across versions

The Categorical X-Ray

  • Hyperedges preserve full multi-way interactions
  • Multi-way relations kept as first-class objects
  • Name-invariant structural fingerprint, by construction
  • Structural refactoring diff computed at CI cadence
  • Equivalence classes formally; bottleneck candidates structurally surfaced
  • Sheaf overlay turns the skeleton into metric-aware diagnostics
10Architectural Background

One instance of a broader categorical fusion.

The Categorical X-Ray is one production-facing instance of a broader line of work at Complexity Lab: the use of category theory not as an abstraction, but as a practical engineering tool for the diagnosis and design of complex systems. The X-Ray is the diagnostic form — formal structural fingerprinting for systems that already exist and cannot be redesigned from scratch.

The mathematical core is drawn from a recent advance in graph neural network theory, repurposed away from learning and toward structural diagnostics. The same categorical apparatus that makes hypergraph neural networks more expressive turns out to make architecture reviews more truthful.

Foundational paper

Weisfeiler & Lehman Go Categorical

The foundational paper introducing the CatWL framework: categorical lifting of hypergraphs into graded posets, the two principled functors (Incidence and Symmetric Simplicial), and the proof that both subsume the standard Hypergraph WL test. The X-Ray applies this apparatus as a diagnostic — no neural networks, no training — to complex production systems.

Choi, S., Kim, G., & Yun, S.-Y. (2026).
Weisfeiler and Lehman Go Categorical.
arXiv:2602.06787 [cs.LG].
Read on arXiv →
11Lab Research Direction

Toward an algebraic geometry of production complexity.

The Categorical X-Ray is also a practical entry point into a deeper research direction: lifting software and production architectures into mathematical objects on which categorical, sheaf-theoretic, homological, and, in deeper regimes, algebraic-geometric methods become applicable.

In this view, local metrics, component behavior, interaction constraints, and structural dependencies can be studied as forms of local data. Failures of global consistency become not merely bugs or incidents, but obstructions in the geometry of the system.

Research frontier

From architecture diagrams to geometric objects

This is not the first engagement deliverable. It is the laboratory direction behind the method: a way of treating production complexity as structured mathematical reality rather than as a collection of disconnected engineering symptoms.

12The Production Practice

Part of Complexity Lab's Production practice.

The Categorical X-Ray is one of four sibling offers in Complexity Lab's Production practice. Full descriptions live on the Production page; this section is only for orientation and direct navigation between the offers.

Full Production practice →

Is your architecture structurally what you think it is?

Send a brief description of the system you want to X-Ray — service inventory, mesh configuration, the existing diagram, anything you can share. We will assess fit, propose an ontology, and scope a single-snapshot PoC.

NDA-friendly. Anonymized specifications are enough to begin.

Back to Complexity Lab