audit-foundation-models
Scan Foundation Models / Apple Intelligence integration code for issues that crash on unsupported devices, freeze the UI, or mishandle guardrail responses.
What This Command Does
Launches the foundation-models-auditor agent to flag the most common mistakes when integrating on-device language models — missing availability gates, blocking calls on the main actor, and brittle parsing of structured output.
What It Checks
- Missing availability checks —
LanguageModelSessionuse withoutisAvailableor device-capability gating - Main thread blocking — synchronous model calls on
@MainActor, freezing the UI during inference - Manual JSON parsing —
JSONDecoderagainst model output where@Generablewould give compiler-checked structure - Missing error handling — no recovery for
.guardrailViolation,.unsupportedLanguage,.assetsUnavailable - Session lifecycle — sessions created per-message instead of reused, or held across app states without checkpointing
Related Agent
- foundation-models-auditor — The agent that powers this command
- foundation-models-ref — Foundation Models reference