|
| 1 | +<p align="center"> |
| 2 | + <img src="https://img.shields.io/badge/Hermes%20Skill-local--inference--optimizer-7c3aed?style=for-the-badge" alt="Hermes Skill" /> |
| 3 | + <img src="https://img.shields.io/badge/LLM-Inference-0ea5e9?style=for-the-badge" alt="LLM Inference" /> |
| 4 | + <img src="https://img.shields.io/badge/License-MIT-10b981?style=for-the-badge" alt="MIT" /> |
| 5 | +</p> |
| 6 | + |
| 7 | +# Local Inference Optimizer Skill |
| 8 | + |
| 9 | +**Agent skill for choosing, installing, and tuning the right LLM inference stack for real hardware.** |
| 10 | + |
| 11 | +It teaches Hermes / Claude Code / Codex-style agents to inspect your machine, choose an inference engine, create a `uv` + `.venv` project, tune kernels/quantization/batching/KV cache, and verify the server with a real smoke test. |
| 12 | + |
| 13 | +> Inspired by Ahmad Osman's LLM inference engine decision guide: https://x.com/TheAhmadOsman/status/2057183854444843202 |
| 14 | +
|
| 15 | +## What it does |
| 16 | + |
| 17 | +- **Detects hardware:** Mac/Apple Silicon, NVIDIA CUDA, AMD ROCm, Intel, CPU-only. |
| 18 | +- **Chooses an engine:** MLX, llama.cpp, ExLlama, vLLM, SGLang, TensorRT-LLM, OpenVINO/ONNX Runtime. |
| 19 | +- **Sets up the project:** `uv`, `.venv`, configs, launch scripts, smoke tests, benchmark stubs. |
| 20 | +- **Tunes inference:** context, batching, prefix cache, KV cache, tensor parallel, memory utilization, quantization. |
| 21 | +- **Forces verification:** health check + OpenAI-compatible chat completion before claiming success. |
| 22 | + |
| 23 | +## Decision map |
| 24 | + |
| 25 | +| Hardware / workload | Primary engine | |
| 26 | +|---|---| |
| 27 | +| MacBook / Mac Studio | MLX first, llama.cpp fallback | |
| 28 | +| Laptop / edge / GGUF / odd hardware | llama.cpp | |
| 29 | +| Single consumer RTX | ExLlamaV2 or llama.cpp/vLLM | |
| 30 | +| 2–4 NVIDIA GPUs | ExLlamaV3, vLLM, or SGLang | |
| 31 | +| Production OpenAI-compatible API | vLLM | |
| 32 | +| Long context / MoE / structured output | SGLang | |
| 33 | +| NVIDIA H100/B200 max perf | TensorRT-LLM benchmark path | |
| 34 | +| AMD ROCm | vLLM or SGLang | |
| 35 | +| Intel CPU/GPU | OpenVINO or ONNX Runtime GenAI | |
| 36 | + |
| 37 | +## Install in Hermes |
| 38 | + |
| 39 | +### One-liner |
| 40 | + |
| 41 | +```bash |
| 42 | +curl -fsSL https://raw.githubusercontent.com/ForgetMeAI/local-inference-optimizer-skill/main/install.sh | bash |
| 43 | +``` |
| 44 | + |
| 45 | +### Manual |
| 46 | + |
| 47 | +```bash |
| 48 | +git clone https://github.com/ForgetMeAI/local-inference-optimizer-skill.git |
| 49 | +cd local-inference-optimizer-skill |
| 50 | +./install.sh |
| 51 | +``` |
| 52 | + |
| 53 | +Then start a fresh Hermes session: |
| 54 | + |
| 55 | +```bash |
| 56 | +hermes -s local-inference-optimizer |
| 57 | +``` |
| 58 | + |
| 59 | +or load it in chat: |
| 60 | + |
| 61 | +```text |
| 62 | +/skill local-inference-optimizer |
| 63 | +``` |
| 64 | + |
| 65 | +## Use with Claude Code / Codex |
| 66 | + |
| 67 | +Generate agent instruction files from the skill: |
| 68 | + |
| 69 | +```bash |
| 70 | +./scripts/export-agent-instructions.sh |
| 71 | +``` |
| 72 | + |
| 73 | +This creates: |
| 74 | + |
| 75 | +- `AGENTS.md` for Codex-style agents |
| 76 | +- `CLAUDE.md` for Claude Code |
| 77 | + |
| 78 | +You can also copy `SKILL.md` directly into any project instruction system. |
| 79 | + |
| 80 | +## Prompt to use |
| 81 | + |
| 82 | +```text |
| 83 | +Use the local-inference-optimizer skill. |
| 84 | +Determine the best inference engine for my hardware, set up the project with uv + venv, choose kernels/quantization, tune flags, batching, KV cache, and optimize launch for my model and machine. |
| 85 | +
|
| 86 | +Model: <HF repo or local path> |
| 87 | +Goal: <local chat / OpenAI API / production / long context / throughput / latency> |
| 88 | +``` |
| 89 | + |
| 90 | +## Repo contents |
| 91 | + |
| 92 | +```text |
| 93 | +. |
| 94 | +├── SKILL.md # Main Hermes skill |
| 95 | +├── install.sh # Installs the skill into ~/.hermes/skills/mlops/ |
| 96 | +├── scripts/ |
| 97 | +│ ├── validate-skill.py # Frontmatter/content sanity checks |
| 98 | +│ └── export-agent-instructions.sh # Generates AGENTS.md + CLAUDE.md |
| 99 | +├── templates/ |
| 100 | +│ ├── AGENTS.md # Codex/agent integration template |
| 101 | +│ └── CLAUDE.md # Claude Code integration template |
| 102 | +└── README.md |
| 103 | +``` |
| 104 | + |
| 105 | +## Validate |
| 106 | + |
| 107 | +```bash |
| 108 | +python3 scripts/validate-skill.py |
| 109 | +``` |
| 110 | + |
| 111 | +Expected result: |
| 112 | + |
| 113 | +```text |
| 114 | +OK local-inference-optimizer skill is valid |
| 115 | +``` |
| 116 | + |
| 117 | +## License |
| 118 | + |
| 119 | +MIT. Use it, fork it, improve it. |
0 commit comments