test-afm-binary

A testing workflow for an already-built AFM program, including safety checks and selectable tests such as unit tests, assertions, analysis, compatibility checks, and performance checks.

In plain words
What is it for?
It is for validating a compiled AFM binary after building it, checking installation behavior, running selected test suites, and profiling GPU use.
Why use it?
It catches problems that could make the program fail after installation, relocation, code changes, or before release.

Skill for Claude CodeCodex

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/test-afm-binary
Any agent
npx skills add scouzi1966/maclocal-api --skill test-afm-binary
Clone the repo
git clone --depth 1 https://github.com/scouzi1966/maclocal-api

Made for: Claude Code, Codex.

Per session 69 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,085 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. 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 $0.00069 $0.04085
Opus 5 $0.00034 $0.02042
Sonnet 5 $0.00014 $0.00817
Haiku 4.5 $0.00007 $0.00409

Measured 2d ago against content hash 8335e4144277, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

test-afm-binary scanned grade C with 1 finding 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 2d 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf "$TMPDIR"
.claude/skills/test-afm-binary/SKILL.md · 295 lines

How it starts

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

Test AFM Binary

Test any pre-built afm binary with a menu of test suites. Validates the binary won't crash when relocated (pip/Homebrew install), then runs the selected tests.

Usage

  • /test-afm-binary — interactive: asks for binary path, model, and test selection
  • /test-afm-binary /path/to/afm — test the binary at the given path
  • /test-afm-binary .build/arm64-apple-macosx/release/afm — test the current build

Instructions

Step 1: Resolve Binary Path

Ask for the binary path if not provided as an argument. Default: .build/arm64-apple-macosx/release/afm.

BIN="${1:-.build/arm64-apple-macosx/release/afm}"
[ -x "$BIN" ] || BIN=".build/release/afm"
BIN_ABS="$(cd "$(dirname "$BIN")" && pwd)/$(basename "$BIN")"
echo "Binary: $BIN_ABS"

If the binary doesn't exist or isn't executable, STOP and tell the user.

Step 2: Pre-Flight Safety Checks (MANDATORY — always run)

These checks run before any test suite. They catch fatal distribution bugs that would crash every pip/Homebrew user. If any check fails, STOP — do not proceed to testing.

Check A: Binary version
REPORTED=$($BIN_ABS --version 2>&1)
echo "Version: $REPORTED"

If the version shows only a base version without a SHA suffix (e.g., v0.9.8 instead of v0.9.8-62395ab), warn the user: this likely means the binary was built with an incremental swift build instead of ./Scripts/build-from-scratch.sh. The SHA injection only happens in the build script. This is a warning, not a blocker — the binary may still be valid for testing.

Check B: Metallib present
BIN_DIR="$(dirname "$BIN_ABS")"

# Check for metallib in either location (SPM bundle or loose file)
if [ -f "$BIN_DIR/AFMKit_AFMKitMLX.bundle/default.metallib" ]; then
  echo "PASS: Metallib in SPM bundle ($(du -h "$BIN_DIR/AFMKit_AFMKitMLX.bundle/default.metallib" | cut -f1))"
elif [ -f "$BIN_DIR/default.metallib" ]; then
  echo "PASS: Loose metallib ($(du -h "$BIN_DIR/default.metallib" | cut -f1))"
else
  echo "FAIL: No metallib found next to binary"
  echo "The binary will crash on first inference without default.metallib"
fi

Read the full file on GitHub · 295 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. 2d ago First seen · 295 lines · 69 tokens per session scan C 8335e4144277

Subscribe to this mod's changes

test-afm-binary is a skill published in the GitHub repository scouzi1966/maclocal-api (334 stars, last pushed 2d ago), licensed MIT. It adds 69 tokens to every session and 4,085 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.