AutoMegaKernel: Skill for Claude Code

.claude/skills/megakernel-optimization/SKILL.md

megakernel-optimization is a skill for Claude Code from RightNow-AI/AutoMegaKernel. It costs 57 tokens per session (2,026 once invoked), scanned A, original, MIT.

Guidance for tuning a single persistent CUDA program that runs a HuggingFace Llama-family model, using configuration changes rather than handwritten kernel code.

In plain words
What is it for?
Use it to test and keep schedule or kernel-setting changes for Llama-family model execution, checking each candidate against a CPU reference first.
Why use it?
It prevents speed changes from being accepted when they produce incorrect results, unsafe GPU work, or unreliable measurements.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

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/skills/megakernel-optimization/SKILL.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 megakernel-optimization

README.md
[![agentmods](https://agentmods.dev/badge/skills/rightnow-ai/automegakernel/megakernel-optimization/github.svg)](https://agentmods.dev/skills/rightnow-ai/automegakernel/megakernel-optimization)
Your own site
<a href="https://agentmods.dev/skills/rightnow-ai/automegakernel/megakernel-optimization"><img src="https://agentmods.dev/badge/skills/rightnow-ai/automegakernel/megakernel-optimization/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 megakernel-optimization

Your own site · 80×15
<a href="https://agentmods.dev/skills/rightnow-ai/automegakernel/megakernel-optimization"><img src="https://agentmods.dev/badge/skills/rightnow-ai/automegakernel/megakernel-optimization.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 57 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,026 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00057 $0.02026
Opus 5.5 $0.00023 $0.00810
Sonnet 5.5 $0.00011 $0.00405
Haiku 4.5 $0.00006 $0.00203

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

Security

Grade A, and why

megakernel-optimization 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/skills/megakernel-optimization/SKILL.md · 124 lines

How it starts

The opening of the file, as written. The whole thing — 124 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AutoMegaKernel (AMK), megakernel schedule optimization

AMK compiles a HuggingFace Llama-family model into ONE persistent CUDA megakernel and tunes it with an AutoKernel-style loop: read the edit surface -> propose ONE knob change -> eval -> keep/revert -> record -> repeat. This skill drives Loop 2 (schedule + kernel_knobs search). You never write kernel code; you only edit a structured ScheduleConfig (plus its reserved kernel_knobs sub-object). The frozen VM lowers your config deterministically and the CPU ReferenceVM judges correctness vs eager PyTorch.

HARD HONESTY RULES (state and obey these every time)

  • Correctness FIRST. A latency is NEVER reported 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 (a deadlock/race-free proof rejects it before launch), never a hung GPU.
  • The edit surface is ScheduleConfig + kernel_knobs ONLY, never raw kernel code, never vm/, never the frozen ABI.
  • Measured-gpu latency is drift-robust; physically-impossible sub-roofline latencies are withheld as artifacts.
  • All speedups are vs AMK's OWN baseline (default schedule), NOT a claim of beating cuBLAS/vLLM. AMK is currently within ~13% of cuBLAS at batch-1, behind it.

The edit surface (read it before proposing)

Read the surface programmatically, never guess knob names. Prefer the canonical MCP tool; fall back to the CLI if MCP is unavailable.

  • MCP: amk_propose(model, gpu="rtx5090") -> { schedule_config, schedule_id, search_space, ... }. search_space includes the kernel_knobs.* sub-surface.
  • CLI: amk propose <model> --gpu <arch> (or uv run python amk_cli.py propose <model> --gpu <arch>) prints the same surface as JSON on stdout.

The ScheduleConfig knobs (edit ONE per trial): tiling.gemv.N_tile, tiling.attention.kv_block, fusion_grouping, sm_assignment, pipelining_depth, page_allocation, threads_per_block, smem_bytes_per_block. The reserved kernel_knobs object holds GEMV build knobs: cols_per_warp, cpasync, cpa_stages, cpa_cols (these move MEASURED latency under device=cuda; the predicted/CPU path does not model them). A config WITHOUT kernel_knobs is byte-identical to the production incumbent.

Read the full file on GitHub · 124 lines

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 · 124 lines · 57 tokens per session scan A 88f899547ee6

Subscribe to this mod's changes

megakernel-optimization is a skill published in the GitHub repository RightNow-AI/AutoMegaKernel (161 stars, last pushed 1mo ago), licensed MIT. It adds 57 tokens to every session and 2,026 once invoked, about $0.0002 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

megakernel-optimization compared with skills from other repositories

megakernel-optimization next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
megakernel-optimizationRightNow-AI/AutoMegaKernelSkill1611mo agoMITA57Claude Code
cutedsl_megamoeflashinfer-ai/flashinferSkill6.9ktodayApache-2.0C0Claude Code, Codex
swapab_cutedsl_megakernelflashinfer-ai/flashinferSkill6.9ktodayApache-2.0C0Claude Code, Codex
next_cutedsl_megamoeflashinfer-ai/flashinferSkill6.9ktodayApache-2.0A0Claude Code, Codex
cuopt-developerNVIDIA/cuoptSkill1.1kyesterdayApache-2.0B47Cursor
ax-cpp-aiax-llm/axSkill3.0k3d agoApache-2.0A47Claude Code, Codex
ax-cpp-genax-llm/axSkill3.0k3d agoApache-2.0A48Claude Code, Codex