add-afm-model

add-afm-model is a skill for Claude Code from scouzi1966/maclocal-api. It costs 48 tokens per session (1,419 once invoked), scanned A, original, MIT.

A workflow for adding a new MLX model from Hugging Face to AFM, a server for running machine-learning models. MLX is Apple's machine-learning framework for Apple silicon, and Hugging Face is a platform that hosts models.

In plain words
What is it for?
Use it to check a Hugging Face model, determine whether AFM already supports it, or add support for a compatible model architecture.
Why use it?
It checks whether a requested model is in the required MLX format and identifies what implementation support it needs. This prevents starting work on models that are not compatible.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

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.

agentmods
npx agentmods add skills/scouzi1966/maclocal-api/add-afm-model
Any agent
npx skills add scouzi1966/maclocal-api --skill add-afm-model
Clone the repo
git clone --depth 1 https://github.com/scouzi1966/maclocal-api

Made for: Claude Code.

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 add-afm-model

README.md
[![agentmods](https://agentmods.dev/badge/skills/scouzi1966/maclocal-api/add-afm-model.svg)](https://agentmods.dev/skills/scouzi1966/maclocal-api/add-afm-model)
Your own site
<a href="https://agentmods.dev/skills/scouzi1966/maclocal-api/add-afm-model"><img src="https://agentmods.dev/badge/skills/scouzi1966/maclocal-api/add-afm-model.svg" alt="Measured on agentmods" height="20"></a>
Per session 48 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,419 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00048 $0.01419
Opus 5 $0.00024 $0.00709
Sonnet 5 $0.00010 $0.00284
Haiku 4.5 $0.00005 $0.00142

Measured 6d ago against content hash 822843a066dc, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

add-afm-model 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 6d 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.

.claude/skills/add-afm-model/SKILL.md · 124 lines

How it starts

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

Add AFM Model

Investigate and add support for a HuggingFace MLX model to the AFM server.

Usage

  • /add-afm-model <model-id> — e.g., /add-afm-model mlx-community/Qwen3-8B-4bit
  • /add-afm-model <url> — e.g., /add-afm-model https://huggingface.co/mlx-community/Qwen3-8B-4bit

Instructions

Step 1: Parse Input

Extract the HuggingFace model ID from the user's input:

  • Full URL: https://huggingface.co/org/modelorg/model
  • Model ID: org/model → use as-is
  • If ambiguous, ask the user.

Step 2: Fetch config.json

Fetch https://huggingface.co/<model-id>/resolve/main/config.json using WebFetch.

Not MLX check: If config.json has no quantization or quantization_config field, the model is not MLX-quantized. Inform the user:

"This model is not in MLX format. Look for an MLX-quantized version on huggingface.co/mlx-community, or quantize it yourself with mlx_lm.convert."

Stop here if not MLX.

Step 3: Extract model_type

Read the model_type field from config.json. This is the key that maps to a Swift model implementation.

Also note: architectures, num_experts/num_local_experts (MoE indicator), image_token_id/vision_config (VLM indicator).

Step 4: Check LLMTypeRegistry

Search Scripts/patches/LLMModelFactory.swift for the model_type string in the LLMTypeRegistry.shared dictionary (lines ~25-80).

If found → Already supported. Tell the user:

"This model is already supported! Run it with:

MACAFM_MLX_MODEL_CACHE=/Volumes/edata/models/vesta-test-cache afm mlx -m <model-id> --port 9999
```"

Suggest running /test-macafm for validation if this is a new model variant.

Stop here if already registered.

Step 5: Check Existing Architectures

The model_type is NOT in the registry. Now determine if an existing Swift implementation can handle it.

  1. List files in vendor/mlx-swift-lm/Libraries/MLXLLM/Models/
  2. Search for the model's base architecture name (e.g., if model_type is foo_moe, check for Foo.swift or similar)
  3. Read the model's config.json fields and compare against existing implementations — some architectures handle variants (e.g., DeepseekV3 handles kimi_k2, Qwen2 handles acereason)
  4. Check if an existing model has a dense fallback (e.g., numExperts == 0 path)

Read the full file on GitHub · 124 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 6d ago First seen · 124 lines · 48 tokens per session scan A 822843a066dc

Subscribe to this mod's changes

add-afm-model is a skill published in the GitHub repository scouzi1966/maclocal-api (337 stars, last pushed yesterday), licensed MIT. It adds 48 tokens to every session and 1,419 once invoked, about $0.0002 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.