swift-mlx

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

A Swift machine-learning framework for Apple Silicon, Apple’s processor family used in modern Macs and some other devices. It provides array operations, neural-network layers, automatic differentiation, optimizers, lazy evaluation, and custom Metal GPU kernels.

In plain words
What is it for?
Use it to manipulate model data, build and train neural networks, optimize computations with JIT compilation, run fast GPU operations, and write custom Metal kernels.
Why use it?
It gives Swift programs the building blocks for training and running machine-learning models while using the shared CPU and GPU memory of Apple Silicon. Lazy evaluation can defer calculations until their results are needed.

Skill for Claude CodeCodex

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

Good fit Use it to manipulate model data, build and train neural networks, optimize computations with JIT compilation, run fast GPU operations, and write custom Metal kernels.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kellyvv/phoneclaw/mlx-swift
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,237 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
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

README.md
[![agentmods](https://agentmods.dev/badge/skills/kellyvv/phoneclaw/mlx-swift/github.svg)](https://agentmods.dev/skills/kellyvv/phoneclaw/mlx-swift)
Your own site
<a href="https://agentmods.dev/skills/kellyvv/phoneclaw/mlx-swift"><img src="https://agentmods.dev/badge/skills/kellyvv/phoneclaw/mlx-swift/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

Your own site · 80×15
<a href="https://agentmods.dev/skills/kellyvv/phoneclaw/mlx-swift"><img src="https://agentmods.dev/badge/skills/kellyvv/phoneclaw/mlx-swift.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 25 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,118 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.00025 $0.03118
Opus 5 $0.00013 $0.01559
Sonnet 5 $0.00005 $0.00624
Haiku 4.5 $0.00003 $0.00312

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

Security

Grade A, and why

swift-mlx 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 10d 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

1 near-identical copy found in the catalogue:

  • swift-mlx — 100% identical, 0 lines differ
Packages/mlx-swift/skills/mlx-swift/SKILL.md · 395 lines

How it starts

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

MLX Swift Framework

MLX Swift is Apple's high-performance machine learning framework designed specifically for Apple Silicon. It provides NumPy-like array operations with lazy evaluation, automatic differentiation, and unified CPU/GPU memory.

When to Use This Skill

  • Array operations on Apple Silicon (MLXArray)
  • Building neural networks (MLXNN)
  • Training models with automatic differentiation
  • Custom Metal kernels via MLXFast
  • Performance optimization with JIT compilation

Architecture Overview

MLXOptimizers (Adam, AdamW, SGD, etc.)
       ↓
MLXNN (Layers, Modules, Losses)
       ↓
MLX (Arrays, Ops, Transforms, FFT, Linalg, Random)
       ↓
Cmlx (C/C++ bindings, Metal GPU)

Key File Reference

Purpose File Path
Core array Source/MLX/MLXArray.swift
Operations Source/MLX/Ops.swift
Transforms Source/MLX/Transforms.swift
Factory methods Source/MLX/Factory.swift
Neural layers Source/MLXNN/*.swift
Optimizers Source/MLXOptimizers/Optimizers.swift
Fast ops Source/MLX/MLXFast.swift
Custom kernels Source/MLX/MLXFastKernel.swift
Wired memory coordinator Source/MLX/WiredMemory.swift
GPU working-set helper Source/MLX/GPU+Metal.swift

Quick Start

Basic Array Creation

import MLX

// Create arrays
let a = MLXArray([1, 2, 3, 4])
let b = MLXArray(0 ..< 12, [3, 4])  // Shape [3, 4]
let c = MLXArray.zeros([2, 3])
let d = MLXArray.ones([4, 4], dtype: .float32)

// Random arrays (use MLXRandom namespace or free functions)
let uniform = MLXRandom.uniform(0.0 ..< 1.0, [3, 3])
let normal = MLXRandom.normal([100])

Array Properties

let array = MLXArray(0 ..< 12, [3, 4])
array.shape    // [3, 4]
array.ndim     // 2
array.size     // 12
array.dtype    // .int64
array.count    // 3 (first dimension)

Basic Operations

let a = MLXArray([1.0, 2.0, 3.0])
let b = MLXArray([4.0, 5.0, 6.0])

// Arithmetic (lazy - not computed until eval)
let sum = a + b
let product = a * b
let matmul = a.matmul(b.T)

// Force evaluation
eval(sum, product)
// or
sum.eval()

Read the full file on GitHub · 395 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. 10d ago First seen · 395 lines · 25 tokens per session scan A 06192f2638e4

Subscribe to this mod's changes

swift-mlx is a skill published in the GitHub repository kellyvv/PhoneClaw (1,237 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 25 tokens to every session and 3,118 once invoked, about $0.0001 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

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

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

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