mlx-optimizer helps Codex audit, benchmark, and optimize Python-first
MLX projects on Apple Silicon. It combines
six progressively disclosed skills with focused MLX references, conservative
static-analysis scripts, and before/after verification templates.
Its electrified compiled-flow mark turns three scheduled compute paths into one
verified fast lane: mint for computation, cyan for measurement, and amber for
the optimization decision. A reflected final stroke of the graphite M crosses
the lightning-white result rail to form a compact pseudo-x without borrowing
Apple or MLX product marks.
Static findings remain candidates until representative workload evidence proves them. The plugin never installs Python globally, treats lazy evaluation and synchronization as correctness concerns, and requires concrete timing, memory, and output evidence for optimization claims.
Try it in Codex
Choose a skill or use one of these starter requests.
| Skill | What it helps with | Starter request |
|---|---|---|
| MLX Optimizer | Choose the right MLX optimization workflow | Assess this MLX project and choose the right optimization workflow. |
| MLX Performance Audit | Find MLX bottlenecks and build a benchmark plan | Audit this repository for MLX performance issues. |
| MLX Training Optimizer | Optimize MLX training loops with measured evidence | Optimize this MLX training loop and verify the result. |
| MLX Inference Optimizer | Optimize MLX inference and generation loops | Optimize this MLX inference loop and measure latency. |
| MLX Metal Kernels | Profile and optimize MLX kernels on Apple Silicon | Investigate whether this MLX bottleneck needs a Metal kernel. |
| MLX Portability Bridges | Plan MLX integration across language boundaries | Plan an MLX integration across these language boundaries. |
Install
codex plugin marketplace add sealad886/sealad886-codex-marketplace --ref main
codex plugin add mlx-optimizer@sealad886-codex-marketplace
Start a fresh Codex task after installation so the current skill catalog loads.
Skills
| Skill | Purpose |
|---|---|
mlx-optimizer | Route MLX audit, optimization, profiling, benchmark, and explanation work. |
mlx-performance-audit | Review a repository for unknown MLX bottlenecks and invalid measurements. |
mlx-training-optimizer | Improve training loops, optimizer state, accumulation, checkpointing, dtype policy, and validation cadence. |
mlx-inference-optimizer | Improve generation, batching, caches, quantization, streaming, latency, and throughput. |
mlx-metal-kernels | Escalate to Metal capture, mx.fast, custom kernels, or C++ extensions when profiling justifies it. |
mlx-portability-bridges | Design Swift, C, C++, service, subprocess, C ABI, and Core ML boundaries. |
Example prompts:
Audit this repository for MLX performance issues.
Optimize this MLX training loop and verify it with a representative smoke run.
Check whether this benchmark times scheduled MLX work or completed work.
Decide whether this bottleneck justifies a custom Metal kernel.
Included tools
scripts/mlx_audit.pyscans Python sources for candidate synchronization, evaluation, and benchmark-boundary problems without modifying target code. It accepts regular source files up to 2 MiB each and reports unreadable, oversized, symlinked, or non-regular sources asread-errorcandidates.scripts/mlx_env_probe.pyreports repository-local Python, MLX, Metal, device, and memory-API evidence.scripts/mlx_benchmark_template.pysupplies warmup, synchronization, correctness, memory, repeated-run, JSON, and progress-reporting hooks.
Use a trusted Python interpreter for static inspection. The environment probe
executes the selected interpreter and imports its installed MLX package, so trust
that environment before probing it. Its child uses Python isolated mode, ignores
the caller's working directory and PYTHONPATH, and preserves the selected
virtual environment. For example:
python3 -I /path/to/mlx_audit.py . --format markdown
python3 -I /path/to/mlx_env_probe.py . --python .venv/bin/python --format json
.venv/bin/python /path/to/mlx_benchmark_template.py --runs 5 --warmup 2 --format json
The benchmark executes the selected workload; run it only in a trusted project environment. Static auditing does not import the inspected project.
Package boundary
mlx-optimizer/
├── .codex-plugin/plugin.json
├── .claude-plugin/plugin.json
├── .cursor-plugin/plugin.json
├── references/
├── scripts/
├── skills/
└── templates/
The Codex manifest is canonical for this marketplace. Claude Code and Cursor compatibility manifests remain packaged for consumers that materialize the same plugin subtree through those hosts; their marketplace registration is outside this repository's Codex publication contract.
Verification
From the marketplace repository root:
python3 scripts/check_plugin.py plugins/mlx-optimizer --layout source
python3 scripts/check_distribution_bundle.py plugins/mlx-optimizer
python3 -m unittest tests.test_mlx_optimizer -v
python3 /path/to/plugin-creator/scripts/validate_plugin.py plugins/mlx-optimizer
The script tests do not require MLX. Native MLX optimization claims still require an Apple Silicon host with the target project's actual MLX environment.
Security and support
The scripts inspect user-selected repositories and write only requested report outputs. Review generated advice before applying it, preserve unrelated work, and never expose secrets in reports. Report vulnerabilities through GitHub Security Advisories; see SECURITY.md. General support guidance is in the marketplace support guide.
License
MIT. See LICENSE.