AutoMegaKernel: Command for Claude Code

.claude/commands/amk-optimize.md

amk-optimize is a command for Claude Code from RightNow-AI/AutoMegaKernel. It costs 27 tokens per session (778 once invoked), scanned A, original, MIT.

A command for interactively testing and comparing different AutoMegaKernel schedules for a model and GPU. A schedule describes how the GPU work is arranged.

In plain words
What is it for?
It helps inspect the available tuning settings, measure a baseline, test proposed configurations, and retain only correct improvements. The comparison is against AutoMegaKernel's own default schedule.
Why use it?
It gives developers a controlled propose, evaluate, keep, or revert loop instead of changing settings without measured evidence. Candidates must pass correctness checks before their speed is considered.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution.

This is RightNow-AI/AutoMegaKernel's own configuration. It tells Claude Code how to work on AutoMegaKernel itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything AutoMegaKernel configures →

Reuse

Borrowing it

Nothing to install: this file belongs to RightNow-AI/AutoMegaKernel. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/RightNow-AI/AutoMegaKernel/main/.claude/commands/amk-optimize.md
Clone the repo
git clone --depth 1 https://github.com/RightNow-AI/AutoMegaKernel

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for amk-optimize

README.md
[![agentmods](https://agentmods.dev/badge/commands/rightnow-ai/automegakernel/amk-optimize/github.svg)](https://agentmods.dev/commands/rightnow-ai/automegakernel/amk-optimize)
Your own site
<a href="https://agentmods.dev/commands/rightnow-ai/automegakernel/amk-optimize"><img src="https://agentmods.dev/badge/commands/rightnow-ai/automegakernel/amk-optimize/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for amk-optimize

Your own site · 80×15
<a href="https://agentmods.dev/commands/rightnow-ai/automegakernel/amk-optimize"><img src="https://agentmods.dev/badge/commands/rightnow-ai/automegakernel/amk-optimize.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 27 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 778 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00027 $0.00778
Opus 5.5 $0.00011 $0.00311
Sonnet 5.5 $0.00005 $0.00156
Haiku 4.5 $0.00003 $0.00078

Measured 2mo ago against content hash d2bd5e528ca6, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

amk-optimize scanned grade A with 0 findings 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 2mo 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/amk-optimize.md · 42 lines

What it actually says

Drive an interactive AutoMegaKernel (AMK) schedule-optimization session on $ARGUMENTS (parse as model [gpu]; default gpu = rtx5090; default model = toy). Use the megakernel-optimization skill's loop and obey its HARD HONESTY RULES.

HARD HONESTY RULES (state them, obey them):

  • Correctness FIRST: NEVER report a latency without a correctness PASS vs the CPU ReferenceVM. Keep a candidate only if it is correct AND >= 1% faster than the incumbent.
  • validate-before-launch: an unsafe ScheduleConfig is a clean REJECTED, never a hung GPU.
  • Edit surface is ScheduleConfig + kernel_knobs ONLY, never kernel code, never vm/ or the ABI.
  • Measured-gpu latency is drift-robust; impossible sub-roofline latencies are withheld.
  • Speedups are vs AMK's OWN default schedule, NOT a claim of beating cuBLAS/vLLM.

Do this:

  1. Read the edit surface with amk_propose(model, gpu) (CLI fallback: amk propose <model> --gpu <gpu>). Report the incumbent schedule_config and the editable search_space (including the kernel_knobs.* sub-surface).
  2. Establish the baseline with amk_eval(model, gpu, <incumbent cfg>, device="auto") (CLI: write cfg.json, amk eval <model> --gpu <gpu> --config cfg.json). Require valid AND correct. Record its latency_us as the incumbent latency.
  3. Loop: propose ONE knob change off the current best (one ScheduleConfig knob OR one kernel_knobs field per trial), amk_eval it, and keep/revert, keep ONLY if valid AND correct AND latency_us < incumbent_latency_us * 0.99. After each trial call amk_orchestrate_record(status, latency_us=..., pct_roofline=..., kind=..., config=..., description=...) with status in kept/revert/failed/crash/timeout/rejected (revert is the canonical token for any correct-but-not-kept candidate).
  4. Between trials, consult amk_orchestrate_next() (continue-or-STOP) and amk_orchestrate_status() (baseline/best/speedup/plateau). Stop when next says STOP or the user asks. To run the full keep/revert loop in one shot instead, use amk_loop(model, gpu, budget=N) (CLI: amk loop <model> --gpu <gpu> --budget N).

Finish with a short report: best schedule_id, best latency_us + latency_kind, pct_of_roofline, and the speedup vs the incumbent baseline (clearly stated as vs AMK's own default, not vs cuBLAS/vLLM).

Use only the canonical names: MCP amk_propose/amk_eval/amk_loop/amk_orchestrate_record/ amk_orchestrate_next/amk_orchestrate_status; CLI amk propose|eval|loop and python amk_orchestrate.py record|next|status.

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. 2mo ago First seen · 42 lines · 27 tokens per session scan A d2bd5e528ca6

Subscribe to this mod's changes

amk-optimize is a command published in the GitHub repository RightNow-AI/AutoMegaKernel (161 stars, last pushed 1mo ago), licensed MIT. It adds 27 tokens to every session and 778 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

amk-optimize compared with commands from other repositories

amk-optimize next to 6 commands from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
amk-optimizeRightNow-AI/AutoMegaKernelCommand1611mo agoMITA27Claude Code
eol-reportWYRE-AI/msp-claude-pluginsCommand52yesterdayApache-2.0A28Claude Code
rvcsi-calibrateruvnet/rvcsiCommand2825d agoApache-2.0A20Claude Code
dev-plannerzxpmail/ReqForgeCommand181mo agoMITA16Claude Code
esp-hardenmathisk2095/jko-claude-pluginsCommand324d agoMITA17Claude Code
putdesplega-ai/ai-toolboxCommand379d agononeA13Claude Code
debugcaptainluzik/oh-my-embeddedCommand388mo agoMITA13Claude Code