Auto-Sort overview
What happens between clicking Auto Sort and reviewing the diff.
The pipeline
Auto-Sort is a constraint-solver pipeline. Each stage contributes constraints; a final pass merges them by priority and topologically sorts the result.
Gather creations
Read Plugins.txt and ContentCatalog.txt. Group multi-file creations.
Run each sorter
TES4, LOOT, Categories, Rule Books — each emits its own constraint set.
Topological sort
Produce a total ordering consistent with the merged constraints.
Stage 1 — gather creations
The tool reads the game's metadata files into a list of creation info records. Multi-file
creations (one creation that ships, say, an .esm and a patch .esp) are
grouped so they always move together — the game can break if they're split.
Stage 2 — run each sorter
Four sorters run in parallel. Each produces a bag of sort constraints. The constraint vocabulary is small:
load_after(A, B)— A must load after B.load_before(A, B)— normalized toload_after(B, A).tier(X, N)— X belongs in the Nth tier (a soft constraint — overridable by a hardload_after).
Every constraint carries a source (which sorter produced it) and a priority.
Stage 3 — merge
When two sorters disagree (one says A-before-B, another says B-before-A; or two rule books give different tiers), the constraint with the higher priority wins. The loser is retained in a rejected list — this is what the Hint dialog shows.
Stage 4 — solve
The merged constraint set forms a directed graph. A stable topological sort turns it into a linear order, breaking ties by original read order (so unaffected creations don't jump around). See Constraints solver for the gory details, including cycle detection.
Stage 5 — diff
The proposal is presented to you. The tool does not write Plugins.txt
until you Apply. On Apply, a final TES4 validation pass ensures
the ordering respects master dependencies; if it doesn't, the write is refused.
Design properties
- Additive. New sorters can be added without touching the others — they just emit constraints.
- Explainable. Every move in the diff can point at the specific constraint that caused it.
- Reviewable. Nothing is written until you look at it.
- Safe. TES4 is a hard gate; the tool refuses to produce game-breaking orderings.