# `mix mob.audit_otp`
[🔗](https://github.com/genericjam/mob_dev/blob/master/lib/mix/tasks/mob.audit_otp.ex#L1)

Walks an OTP runtime tree and tells you which libraries are dead weight.

Reads each `.beam` file's `imports` chunk to build a call graph, seeds
reachability from your app's modules + the OTP runtime essentials
(kernel/stdlib/elixir/logger/sasl), and reports:

  * Libraries with zero reachable modules → safe to strip entirely
  * Duplicate library versions → keep only the newest
  * Foreign apps from another project's release tree → cache cruft
  * Per-lib breakdown of reachable vs total module count + KB

## Usage

    mix mob.audit_otp                                  # audit the most recent release tree
    mix mob.audit_otp --root path/to/otp               # audit a specific tree
    mix mob.audit_otp --json                           # machine-readable output
    mix mob.audit_otp --trace-json path/to/trace.json  # cross-reference against trace data

    # Multiple traces are UNIONED — a lib is trace-strippable only if
    # NONE of the captures observed any of its modules. Much safer
    # than a single window for production stripping decisions.
    mix mob.audit_otp       --trace-json /tmp/boot.json       --trace-json /tmp/ui.json       --trace-json /tmp/auth.json

## Where the audit reads from

Looks for an OTP root in this order:
  1. `--root` arg if given
  2. `_build/mob_release/<App>.app/otp` (latest release build)
  3. The iOS device cache at `~/.mob/cache/otp-ios-device-*`

## What this is NOT (yet)

Read-only. Does not modify the bundle. The companion `mix mob.release
--slim` will use the same audit to drive auto-stripping; this task is
the dry-run that lets you see what would happen.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
