Skip to main content

Module coupling

Module coupling 

Source
Expand description

Module coupling metrics — Robert C. Martin’s afferent/efferent coupling and instability.

High coupling makes a change ripple across files, which inflates the agent’s blast radius (and token cost) per edit. Computed from a directed dependency edge list so it is pure and deterministic; the graph wiring (interconnection phase) feeds real import edges from the property graph, while tests drive it directly without an index.

Structs§

ModuleCoupling
Coupling figures for one module (file).

Functions§

module_coupling
Compute per-module coupling from directed dependency edges (dependent_module, dependency_module). Self-edges and duplicates are ignored. Output is sorted by module name for determinism.