swift-mlx-lm

swift-mlx-lm is a skill for Claude Code, Codex from kellyvv/PhoneClaw. It costs 52 tokens per session (3,596 once invoked), scanned A, original, Apache-2.0.

A Swift package guide for running language models, which generate text, and vision-language models, which also process images, locally on Apple Silicon. It covers inference, streaming output, tool calling, embeddings, model fine-tuning, and porting model architectures.

In plain words
What is it for?
Use it for local text or image-aware model inference, streamed generation, tool calling, embeddings for meaning-based search, LoRA or DoRA fine-tuning, and moving models from Python MLX-LM to Swift.
Why use it?
It helps developers use local models on Macs or iOS devices without treating the model as a remote service. It also explains memory coordination and the main MLX Swift components involved.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for local text or image-aware model inference, streamed generation, tool calling, embeddings for meaning-based search, LoRA or DoRA fine-tuning, and moving models from Python MLX-LM to Swift.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kellyvv/phoneclaw/mlx-swift-lm
About the project

PhoneClaw is a local AI agent framework that runs on phones and edge devices, using on-device models to understand requests and perform mobile tasks through native skills. It is for people who want an AI assistant on an iPhone or similar device with access to functions such as calendars, reminders, contacts, health data, voice, and image understanding, while optionally using web search or a Mac Gateway for selected tasks.

kellyvv/PhoneClaw · 1,239 stars · on GitHub · kellyvv.github.io

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add kellyvv/PhoneClaw --skill mlx-swift-lm
Clone the repo
git clone --depth 1 https://github.com/kellyvv/PhoneClaw

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for swift-mlx-lm

README.md
[![agentmods](https://agentmods.dev/badge/skills/kellyvv/phoneclaw/mlx-swift-lm/github.svg)](https://agentmods.dev/skills/kellyvv/phoneclaw/mlx-swift-lm)
Your own site
<a href="https://agentmods.dev/skills/kellyvv/phoneclaw/mlx-swift-lm"><img src="https://agentmods.dev/badge/skills/kellyvv/phoneclaw/mlx-swift-lm/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for swift-mlx-lm

Your own site · 80×15
<a href="https://agentmods.dev/skills/kellyvv/phoneclaw/mlx-swift-lm"><img src="https://agentmods.dev/badge/skills/kellyvv/phoneclaw/mlx-swift-lm.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,596 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00052 $0.03596
Opus 5 $0.00026 $0.01798
Sonnet 5 $0.00010 $0.00719
Haiku 4.5 $0.00005 $0.00360

Measured 11d ago against content hash 050a1a81cd31, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

swift-mlx-lm scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

2 near-identical copies found in the catalogue:

Packages/InferenceKit/skills/mlx-swift-lm/SKILL.md · 432 lines

How it starts

The opening of the file, as written. The whole thing — 432 lines — stays where its author put it; the contents beside it link to each section on GitHub.

mlx-swift-lm Skill

1. Overview & Triggers

mlx-swift-lm is a Swift package for running Large Language Models (LLMs) and Vision-Language Models (VLMs) on Apple Silicon using MLX. It supports local inference, streaming generation, wired-memory coordination, tool calling, LoRA/DoRA fine-tuning, and embeddings.

When to Use This Skill

  • Running LLM/VLM inference on macOS/iOS with Apple Silicon
  • Streaming text generation from local models
  • Coordinating concurrent inference with wired-memory policies and tickets
  • Tool calling / function calling with models
  • LoRA adapter training and fine-tuning
  • Text embeddings for RAG/semantic search
  • Porting model architectures from Python MLX-LM to Swift

Architecture Overview

MLXLMCommon     - Core infra (ModelContainer, ChatSession, Evaluate, KVCache, wired memory helpers)
MLXLLM          - Text-only LLM support (Llama, Qwen, Gemma, Phi, DeepSeek, etc.)
MLXVLM          - Vision-Language Models (Qwen-VL, PaliGemma, Gemma3, etc.)
MLXEmbedders    - Embedding models and pooling utilities

2. Key File Reference

Purpose File Path
Thread-safe model wrapper Libraries/MLXLMCommon/ModelContainer.swift
Simplified chat API Libraries/MLXLMCommon/ChatSession.swift
Generation & streaming APIs Libraries/MLXLMCommon/Evaluate.swift
KV cache types Libraries/MLXLMCommon/KVCache.swift
Wired-memory policies Libraries/MLXLMCommon/WiredMemoryPolicies.swift
Wired-memory measurement helpers Libraries/MLXLMCommon/WiredMemoryUtils.swift
Model configuration Libraries/MLXLMCommon/ModelConfiguration.swift
Chat message types Libraries/MLXLMCommon/Chat.swift
Tool call processing Libraries/MLXLMCommon/Tool/ToolCallFormat.swift
Concurrency utilities Libraries/MLXLMCommon/Utilities/SerialAccessContainer.swift
LLM factory & registry Libraries/MLXLLM/LLMModelFactory.swift
VLM factory & registry Libraries/MLXVLM/VLMModelFactory.swift
LoRA configuration Libraries/MLXLMCommon/Adapters/LoRA/LoRAContainer.swift
LoRA training Libraries/MLXLLM/LoraTrain.swift

Read the full file on GitHub · 432 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 432 lines · 52 tokens per session scan A 050a1a81cd31

Subscribe to this mod's changes

swift-mlx-lm is a skill published in the GitHub repository kellyvv/PhoneClaw (1,239 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 52 tokens to every session and 3,596 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

developing-genkit-dart

Generates code and provides documentation for the Genkit Dart SDK. Use when the user asks to build AI agents in Dart, use Genkit flows, or integrate LLMs into Dart/Flutter applications.

google/skills · 48 tokens

litert-compiled-model-migration

Rapidly migrate an Android application from legacy TensorFlow Lite (TFLite) to modern LiteRT CompiledModel API v2.1.6 in Open Source GitHub repositories. Supports True Async Execution (runAsync), Zero-Copy I/O Buffers, NPU JIT compilation, and automated 2-stage verification self-testing.

google-ai-edge/litert-samples · 76 tokens

compiled-model-app-scaffolding

Build a new Android app (Kotlin, Compose) around a verified LiteRT model using the CompiledModel API - the app architecture, the inference-layer lifecycle rules, model delivery, and the UI traps that masquerade as model bugs. Use when turning a converted and device-verified model into a demo or product app, when an…

google-ai-edge/litert-samples · 98 tokens

xcode-compilation-analyzer

Analyze Swift and mixed-language compile hotspots using build timing summaries and Swift frontend diagnostics, then produce a recommend-first source-level optimization plan. Use when a developer reports slow compilation, type-checking warnings, expensive clean-build compile phases, long CompileSwiftSources tasks…

AvdLee/Xcode-Build-Optimization-Agent-Skill · 74 tokens

build-feature

Build an iOS feature using ShipSwift components. Use when the user says "build", "create", "add a feature", or describes an iOS feature they want to implement.

signerlabs/ShipSwift · 40 tokens

ios-slim-bindings

Create iOS slim bindings for MAUI. USE FOR: slim iOS binding, Native Library Interop, Swift/Objective-C wrappers, XcodeGen project.yml, Podfile, CocoaPods static linking, BUILDLIBRARYFORDISTRIBUTION, XcodeProject MSBuild, @objc/[Export] selector crashes, async completion handlers. DO NOT USE FOR: Android bindings…

dotnet/maui-labs · 97 tokens