Skip to content

sealad886/mlx-optimizer

v0.2.5MIT

Python-first MLX optimization skills, references, and audit scripts for Apple Silicon.

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.

SkillWhat it helps withStarter request
MLX OptimizerChoose the right MLX optimization workflowAssess this MLX project and choose the right optimization workflow.
MLX Performance AuditFind MLX bottlenecks and build a benchmark planAudit this repository for MLX performance issues.
MLX Training OptimizerOptimize MLX training loops with measured evidenceOptimize this MLX training loop and verify the result.
MLX Inference OptimizerOptimize MLX inference and generation loopsOptimize this MLX inference loop and measure latency.
MLX Metal KernelsProfile and optimize MLX kernels on Apple SiliconInvestigate whether this MLX bottleneck needs a Metal kernel.
MLX Portability BridgesPlan MLX integration across language boundariesPlan 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

SkillPurpose
mlx-optimizerRoute MLX audit, optimization, profiling, benchmark, and explanation work.
mlx-performance-auditReview a repository for unknown MLX bottlenecks and invalid measurements.
mlx-training-optimizerImprove training loops, optimizer state, accumulation, checkpointing, dtype policy, and validation cadence.
mlx-inference-optimizerImprove generation, batching, caches, quantization, streaming, latency, and throughput.
mlx-metal-kernelsEscalate to Metal capture, mx.fast, custom kernels, or C++ extensions when profiling justifies it.
mlx-portability-bridgesDesign 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.py scans 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 as read-error candidates.
  • scripts/mlx_env_probe.py reports repository-local Python, MLX, Metal, device, and memory-API evidence.
  • scripts/mlx_benchmark_template.py supplies 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.