foundation-models-auditor
Scans Foundation Models (Apple Intelligence) code for the 10 most critical violations — missing availability checks, main thread blocking, manual JSON parsing, missing error handling, and session lifecycle issues.
How to Use This Agent
Natural language (automatic triggering):
- "Can you check my Foundation Models code for issues?"
- "Review my @Generable structs for correctness"
- "Audit my Apple Intelligence integration"
- "My LanguageModelSession keeps crashing"
Explicit command:
bash
/axiom:audit foundation-modelsWhat It Does
- No Availability Check (CRITICAL) — Crash on devices without Apple Intelligence
- Synchronous respond() on Main Thread (CRITICAL) — UI freeze and watchdog kill
- Manual JSON Parsing (CRITICAL) — Use @Generable instead of JSONDecoder
- Missing exceededContextWindowSize Catch (HIGH) — Needs conversation trimming
- Missing guardrailViolation Catch (HIGH) — Needs user-facing safety messaging
- Session Created in Button Handler (HIGH) — Wasteful recreation on every tap
- No Streaming for Long Generations (MEDIUM) — Unresponsive UI during inference
- Missing @Guide Annotations (MEDIUM) — Unconstrained numeric/collection output
- Nested Type Without @Generable (MEDIUM) — Compilation or runtime failure
- No Fallback UI When Unavailable (LOW) — Broken UI on unsupported devices
Related
- foundation-models — On-device AI implementation patterns (iOS 26+)
- foundation-models-diag — Foundation Models troubleshooting
- foundation-models-ref — Complete API reference with WWDC examples