/coreai-zoo-skills:port-a-model-to-the-zoofrom coreai-zoo-skills
Guides porting a new model to Core AI's zoo using the oracle-first method, covering gates, compression, device tier, and PR requirements. Use when converting HF models to .aimodel or adding models to the zoo.
Ships in coreai-zoo-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Porting is not format conversion. It is: re-author the network in plain PyTorch, export it, and prove numerically that the export matches the original at every stage.
One rule governs the whole walk: the oracle comes first, and every stage gates against it. A port without gates is a guess with extra steps.
Read PORTING.md — it is the full walk with two worked examples.
This skill is the map of it, plus the parts an agent gets wrong.
Related: Skill("coreai-skills:working-with-coreai") and
Skill("coreai-skills:model-authoring") (Apple's own skills — the toolchain and the authoring
patterns) | reproduce-a-zoo-model (rebuild something already published).
The most expensive porting mistake is made before the first line of code. From
PORTING.md §2:
Say in one sentence what the port does that stock Apple + MLX do not. If you cannot, say so instead of porting.
| Stage | What | Where it is written down |
|---|---|---|
| 1 | Oracle: run the original HF model on fixed inputs, save every tensor | PORTING.md §3 |
| 2 | Re-author in plain PyTorch from model.safetensors (not the HF modeling file) | §4 |
| 3 | Export → .aimodel (static shapes; state via slice_update + remove_functionalization) | §4, knowledge/conversion-guide.md |
| 4 | Gate A — graph parity vs the oracle (cos ≥ 0.999; LLMs also token-exact) | §5 |
| 5 | Gate B — host processing (resize, mel, detokenize) in NumPy first, gated, then Swift | §5 |
| 6 | Compress, then re-run Gate A on the compressed bundle | §6, knowledge/compression.md |
| 7 | Mac run, timed with SpecializationOptions.default() | §7 |
| 8 | Device: AOT-compile ≥1 GB graphs, sideload, measure with a self-test entrypoint | §8 |
| 9 | Publish: HF weights + export/gate scripts + a card + a MODELS.md row | §9 |
Existing exporters are the templates — read the closest one before writing a new one.
conversion/export_da3.py is the stateless archetype; conversion/export_qwen3_5_decode_pipelined.py
is the stateful-LLM archetype.
cpu_only(). That is the parity option, not a performance option.--architecture h18p for iPhone 17 Pro).A zoo port is not done when the bundle exists. It ships four things together:
conversion/ — self-contained, no hardcoded home
directories (resolve paths through conversion/_paths.py).models/<model>/README.md, structured like an existing one, with measured,
device-attributed numbers and a "lessons" section.models/<model>/recipe.toml recording the configuration that produced the
published bundle — script + args + hf_repo + bundle, plus overlay / needs /
runtime_patches / runtime_env prerequisites. If a flag changed the artifact but is not
recoverable later, say so in open_questions and mark status = "unverified" rather than
guessing.Then check your own work the way the catalog will:
python3 conversion/zoo_verify.py <your-hf-repo> must not report FAIL — most commonly it
catches a bundle shipped without its chat template, or a tokenizer that silently disagrees with
the source model.
Publishing to Hugging Face, posting, and PRs against apple/* are the owner's calls, not
yours.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
2 skills in this plugin
npx claudepluginhub john-rocky/coreai-model-zoo --plugin coreai-zoo-skillsOther plugins' skills for the same job