
Description
Hand-maintained .asmdef reference lists drift in both directions: dead references that slow every refactor, and missing ones that surface as CS0246 at the worst moment. Assembly Warden maintains them from the one source that cannot be wrong about what code uses: the compiler's own emitted AssemblyRef tables, mapped back onto your assembly definitions.
It acts, and proves each action safe:
Adds every reference your code uses but never declared
Deletes references nothing uses — then recompiles to verify, and rolls the files back byte-identically if anything breaks (the backup survives the domain reload)
Surgical writes: only the references array changes; key order, indentation, line endings, versionDefines and defineConstraints survive untouched
It refuses what it cannot prove — and shows the reasoning:
Const-inlined usages emit no AssemblyRef yet are load-bearing: caught by a second, independent source-text channel and kept as Uncertain
References used only inside #if branches for other platforms: kept, with the explanation, because no recompile on this machine can prove them safe to cut
Architecture, enforced:
Layering rules as a project asset ("Gameplay must not reference UI")
Violations reported — including emitted references your .asmdef never declared
Batch-mode CI gate: exit 0 clean / 2 violations / 3 refused-because-broken-compile
Designed, not default: a layered graph canvas with verdict-coloured bezier edges, node cards, and per-reference reasoning — you can screenshot your architecture.
Includes full readable C# source in named Editor-only asmdefs, a demo scene with a guided tour, JSON reporting for CI, and 21 EditMode tests. Editor-only: nothing enters your build.
Requires Unity 6000.x (verified on 6000.5.7f1).
Documentation
Full documentation, including installation, a getting-started walkthrough and the complete Technical Information block: https://github.com/onefreeman1337/csaf-releases/blob/main/docs/assembly-warden/README.md — plus Readme_for_Users.md inside the package.
Installation
In Unity, choose Assets > Import Package > Custom Package...
Select AssemblyWarden.unitypackage and click Import, leaving every item ticked.
Everything lands under Assets/CSAF/AssemblyWarden/. There is no Resources/ folder, so nothing is added to your build.
Getting Started — how to launch it
Open the main window from the menu: Window > CSAF > Assembly Warden
The window opens on the assembly graph. Press Scan to build the graph from the compiled assemblies in Library/ScriptAssemblies. Every assembly appears as a node card and every reference as a verdict-coloured edge, with the reasoning attached. Nothing is written until you choose an action, so it is safe to run on a real project immediately.
A demo scene ships at Assets/CSAF/AssemblyWarden/Demo/AssemblyWardenDemo.unity — press Play to read the in-scene guided tour.
Usage in CI (headless)
Unity.exe -batchmode -quit -projectPath <project> -executeMethod CSAF.AssemblyWarden.CI.WardenCI.Run -wardenFailOn layering,redundant -wardenReport artifacts/assembly-warden.json
Exit codes: 0 = clean against the -wardenFailOn set · 2 = a fail-on condition was met · 3 = the scan refused, because the project does not compile and the graph would mean nothing.
Technical Information
Features: Adds every assembly reference your code uses but never declared; removes references nothing uses, then recompiles to verify and restores the files byte-identically if anything breaks; surgical writes that change only the references array, leaving key order, indentation, line endings, versionDefines and defineConstraints untouched; refuses what it cannot prove and shows the reasoning; architecture layering rules as a project asset, with violations reported; a batch-mode CI gate with three distinct exit codes; a designed layered graph canvas with verdict-coloured edges and per-reference reasoning.
Code Modules: CSAF.AssemblyWarden.Editor (Editor-only) · CSAF.AssemblyWarden.Demo (Runtime, demo scene only)
Number of .cs Scripts: 11
Supported Development Platforms: Windows
Supported Target Build Platforms: All — this is editor-only tooling and ships nothing into a build. The Editor assembly definition carries includePlatforms: ["Editor"], so it cannot enter a player build.
Supported Unity Pipelines: Built-in, URP, HDRP and custom SRPs. There is no pipeline coupling — the tool references only UnityEditor and compiled assembly metadata, and never touches rendering.
Dependencies: None. No Asset Store package dependencies and no third-party libraries — both shipped .asmdef files declare an empty references array.
Documentation: the release page linked above, plus Readme_for_Users.md inside the package
Example Project: Yes — a demo scene at Assets/CSAF/AssemblyWarden/Demo/AssemblyWardenDemo.unity with a guided in-scene tour, shipped in its own runtime assembly definition (CSAF.AssemblyWarden.Demo)
Versioning: 1.0.0
Support: through this Fab product page's support channel
Minimum Unity version: Unity 6 (built and gated on 6000.5.7f1)







