hardware-affinity-gate

Validates hardware-model affinity before dispatching local models on Mac and Windows backends.

Updated Mar 22, 2026
One-click install
npx skills add https://github.com/diazMelgarejo/orama-system --skill hardware-affinity-gate-diazmelgarejo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hardware-affinity-gate
Source: https://github.com/diazMelgarejo/orama-system/tree/main/bin/orama-system/skills/hardware-affinity-gate
Command: npx skills add https://github.com/diazMelgarejo/orama-system --skill hardware-affinity-gate-diazmelgarejo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Dispatching a local model to the wrong hardware tier (e.g., an MLX model on a Windows CUDA host) causes crashes, OOM errors, and driver resets. This Skill enforces fail-closed pre-dispatch validation so incompatible model-hardware combinations raise explicit errors instead of failing silently. ## Core Features & Use Cases - Fail-Closed Affinity Gate: Returns PREFER, ALLOW, or NEVER verdicts for any model/tier pair and raises a HardwareAffinityError on NEVER with no silent fallback. - Live Model Inventory Verification: Queries LM Studio /v1/models and Ollama /api/tags (plus ollama ps for GPU residency) at dispatch time instead of relying on hardcoded model IDs. - Canonical Routing Rules: Encodes Mac (MLX-only) and Windows (GGUF-only) tier policies sourced from Perpetua-Tools, with readiness canary thresholds for LM Studio endpoints. - Use Case: Before spawning an agent that loads a local model, run check_affinity(model_id, tier) to confirm the model is allowed on that host, or use resolve_model() to pick the correct default model per task type. ## Quick Start Ask the agent to check whether a given model ID is allowed on the Mac or Windows tier before dispatching it to LM Studio or Ollama.

Frequently Asked Questions about hardware-affinity-gate

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate a model before dispatching to LM Studio or Ollama?

Call check_affinity(model_id, tier) before any agent spawn or dispatch. It returns a PREFER, ALLOW, or NEVER verdict, and raises HardwareAffinityError on NEVER so incompatible models never reach the backend.

What is the difference between MLX and GGUF model routing?

MLX models run only on Apple Silicon Macs via LM Studio Metal, while GGUF models run on Windows CUDA hosts or CPU fallback tiers. Routing an MLX model to Windows or a GGUF-only model to Mac triggers a NEVER verdict and a hard failure.

Can I hardcode model IDs in my application config?

No. Query the live /v1/models endpoint for LM Studio or /api/tags for Ollama at dispatch time, since cached inventories go stale when models unload. For Ollama GPU residency, use ollama ps or GET /api/ps and filter entries with size_vram > 0.

Why does my LM Studio reasoning model return empty responses?

Reasoning models return empty content with finish_reason=length when max_tokens is below the internal chain-of-thought buffer. Always set max_tokens to 4096 or higher for 27B reasoning variants.

When should I skip the hardware affinity check?

Skip it for cloud-only API tasks (OpenAI, Anthropic, Perplexity), tasks routed with cloud_enabled and remaining budget, discovery or probe tools that degrade gracefully, and tests that intentionally mock hardware fallback paths.