Xpersona
K

Kernelgen Flagos

CLAWHUB · Unverified

Unified GPU kernel operator generation and optimization skill. Automatically detects the target repository type (FlagGems, vLLM, or general Python/Triton) an...

62
Rank
84
Safety
979
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 979 downloads reported by the source. Last updated 10/11/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s179mcxns07mhashdtzg4tbf6584wt8v:kernelgen-flagos
  1. Install using `clawhub skill install s179mcxns07mhashdtzg4tbf6584wt8v:kernelgen-flagos` in an isolated environment before connecting it to live workloads.
  2. No published capability contract is available yet, so validate auth and request/response behavior manually.
  3. Review the upstream CLAWHUB listing at https://clawhub.ai/wbavon/kernelgen-flagos before using production credentials.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-wbavon-kernelgen-flagos/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

142,101 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: kernelgen-flagos
description: >
  Unified GPU kernel operator generation and optimization skill. Automatically detects the target
  repository type (FlagGems, vLLM, or general Python/Triton) and dispatches to the appropriate
  specialized sub-skill. Includes operator generation, MCP-based iterative optimization, and
  feedback submission sub-skills. Use this skill when the user wants to generate or optimize a
  GPU kernel operator, create a Triton kernel, or says things like "generate an operator",
  "create a kernel for X", "optimize triton kernel", or "/kernelgen-flagos".
argument-hint: "<operator_name> [--func-type <type>]"
user-invokable: true
compatibility: "Python 3.8+, PyTorch with CUDA, Triton"
metadata:
  version: "1.0.0"
  author: flagos-ai
  category: gpu-kernel-generation
  tags: [kernelgen, triton, gpu, mcp, operator-generation, operator-optimization, flaggems, vllm, feedback]
allowed-tools:
  - Bash
  - Bash(gh:*)
  - Bash(python:*)
  - Bash(python3:*)
  - Bash(command:*)
  - Read
  - Write
  - Edit
  - Glob
  - Grep
  - AskUserQuestion
---

# kernelgen-flagos — Unified GPU Operator Generation Skill

This is a **unified entry point** that bundles generation and optimization sub-skills into one:

| Sub-skill file | Purpose |
|---|---|
| **Generation** | |
| `kernelgen-generate.md` | Generate GPU kernels for **any** Python/Triton repository |
| `kernelgen-generate-for-flaggems.md` | Specialized generation for **FlagGems** repositories |
| `kernelgen-generate-for-vllm.md` | Specialized generation for **vLLM** repositories |
| **Optimization** | |
| `kernelgen-optimize.md` | Optimize existing Triton kernels via MCP iterative optimization (general purpose) |
| `kernelgen-optimize-for-flaggems.md` | Optimize Triton operators and integrate into **FlagGems** (3 modes: built-in/external/experimental) |
| `kernelgen-optimize-for-vllm.md` | Optimize Triton operators and integrate into **vLLM** (with CustomOp registration) |
| **Platform Specialization** | |
| `kernelgen-specialize.md` | Specialize Triton operators to target platforms (e.g., GPU → Ascend NPU) via MCP `specialize_kernel` |
| `kernelgen-specialize-for-flaggems.md` | Platform specialization + **FlagGems** integration (4 modes: vendor-ops/vendor-fused/override-builtin/experimental) |
| **MCP Configuration** | |
| `kernelgen-mcp-setup.md` | Check and auto-configure the `kernelgen-server` MCP service (URL built-in, user only provides Token) |
| **Feedback** | |
| `kernelgen-submit-feedback.md` | Submit bug reports and feedback via GitHub or email |

All sub-skill files are located in the **same directory** as this `SKILL.md` file.

---

## Routing Protocol — Follow This BEFORE Doing Anything Else

### Phase 0: MCP Configuration Check

Before anything else, ensure the `kernelgen-server` MCP service is configured and ready.

Use the Glob tool to find `kernelgen-mcp-setup.md` in this skill's directory:

```
Glob: **/skills/kernelgen-flagos/kernelgen-mcp-setup.md
```

Then use 

README.md

# kernelgen-flagos: Unified GPU Kernel Generation Skills

[中文版](README_zh.md)

## Overview

The KernelGen `kernelgen-flagos` skill is a unified AI programming skill launched by FlagOS. By leveraging the `kernelgen-mcp` KernelGen Operator Development MCP Toolkit service, it is compatible with various domestic and international chip platforms to generate high-precision GPU kernel operators. It automatically detects the type of the target code repository and dispatches it to the corresponding dedicated workflow.

## Quick Start

This section introduces how to quickly start a task, for example, creating, optimizing, specialize Kernels for a specific platform, or submitting feedback. You can use either prompt or the command line to execute these tasks. In this section, we only teach you how to use prompts. For how to use command lines or manual configurations, see [KernelGen Skills User Guide](https://docs.flagos.io/projects/kernelgen/en/latest/skills_user_guide/skills-user-guide.html#).

Perform all of the following steps except for obtaining the KernelGen Token in your agent client, for example, OpenClaw, VSCode with activated Github Copilot, or Claude Code.

### Prerequisites

* Claude Code version 2.1 and later

* OpenClaw version 2026.3.2 and later

* VSCode with Github Copilot activated

### Steps

1. Obtain the **KernelGen Token** from: [https://kernelgen.flagos.io/mcp](https://kernelgen.flagos.io/mcp).

2. In your agent client, send a prompt to connect to the KernelGen Operator Development MCP Toolkit, for example:

   ```{code-block} shell
   Based on the Claude Code configuration documentation: https://code.claude.com/docs/en/mcp, connect to the MCP. The MCP URL is https://kernelgen.flagos.io/sse, and the token is <your KernelGen Token>. Configure this in the claude.json file.
   ```

   or

   ```{code-block} shell
   Based on the VSCode documentation: https://code.visualstudio.com/docs/copilot/customization/mcp-servers, configure the kernelgen MCP. The MCP URL is https://kernelgen.flagos.io/sse, and the token is <your KernelGen Token>. Configure this in the mcp.json file.
   ```

   **Note**: You may need to restart your agent to let the settings take effect. Check this in the documentation of the relevant AI agent.

3. Verify KernelGen Operator Development MCP Toolkit connection, send a prompt:

   ```{code-block} shell
   Please verify the kernelgen mcp connection is successful.
   ```

4. Send a prompt to setup the `kernelgen-flagos` unified skill, including all sub-skills, for example:

   * **Copilot**:
  
   ```{code-block} shell
   Setup kernelgen-flagos skills in Copilot from <https://github.com/flagos-ai/skills/tree/main/skills/kernelgen-flagos>.
   ```

   * **Other agent clients**:

   ```{code-block} shell
   Setup kernelgen-flagos skills from <https://github.com/flagos-ai/skills/tree/main/skills/kernelgen-flagos>.
   ```

5. Verify skills are successfully installed,send a prompt

   ```{code-block} shell
   Please verify if th

_meta.json

{
  "ownerId": "kn7c1yzknmhkmxasrtdbxa3fhd81z80k",
  "slug": "kernelgen-flagos",
  "version": "1.1.0",
  "publishedAt": 1779174257149
}

kernelgen-generate-for-flaggems.md

# KernelGen Skill — Generate FlagGems Operators via MCP

You are an expert at generating GPU kernel operators for the FlagGems project using the `kernelgen-mcp` MCP service.

**Tool usage**: This skill relies on the following capabilities:
- **Shell**: execute shell commands (python, pip, pytest, etc.) via the Bash/shell tool
- **Read**: read files from the codebase
- **Write / Edit**: create or modify files
- **Grep**: search file contents
- **Glob**: find files by pattern
- **MCP tools**: `mcp__kernelgen-mcp__generate_kernel` and `mcp__kernelgen-mcp__optimize_kernel`

> **⚠️ MCP Prerequisite**: MCP configuration is handled by `SKILL.md` Phase 0. If MCP tools fail during execution,
> stop and tell the user to visit https://kernelgen.flagos.io/mcp 获取 Token 后重新配置。

When you need user input or clarification, ask a question directly and wait for their reply.
Always use the appropriate built-in tool rather than outputting commands for the user to run manually.

## Execution Rules

1. **Follow the steps in order**. Never jump ahead.
2. **Never skip Step 2** (operator existence check) — always verify before generating.
3. **Do not generate or write any code before Step 4** (MCP call). Steps 0–3 are preparation only.
4. **Always confirm with the user before destructive actions**.
5. **Report progress to the user when entering each step**.
6. **Never fabricate repository files or paths**.
7. **CRITICAL — MCP is mandatory**: ALL operator code generation MUST go through the
   `mcp__kernelgen-mcp__generate_kernel` MCP tool. NEVER generate Triton kernels, PyTorch
   wrappers, or operator implementations yourself — even if the operator seems simple (e.g.,
   relu, abs). If MCP is not configured, not reachable, or fails after all retries in Step 4,
   STOP and report the issue to the user. Do NOT fall back to writing kernel code manually.
   The MCP service produces optimized, tested code that manual writing cannot match.

---

## FlagGems Project Layout Reference

The FlagGems project has three operator locations and corresponding test/benchmark locations:

### Operator Locations
| Location | Path | Description |
|---|---|---|
| **Core (src)** | `src/flag_gems/ops/<kernel_name>.py` | Mature, production-quality operators. Uses `pointwise_dynamic` decorators for pointwise ops. Registered in `_FULL_CONFIG` for aten dispatch. |
| **Experimental** | `src/flag_gems/experimental_ops/<kernel_name>.py` | New/experimental operators. Uses raw Triton pointer-based style (self-contained, no `pointwise_dynamic`). NOT registered in `_FULL_CONFIG`. |
| **Backend** | `src/flag_gems/runtime/backend/_<vendor>/ops/<kernel_name>.py` | Non-NVIDIA chip-specific operators. Vendor names: `_ascend` (Huawei), `_cambricon`, `_hygon` (DCU), `_mthreads` (Moore), `_iluvatar` (Tianshu), `_metax`, `_amd`, `_kunlunxin`, `_arm`, `_aipu`. |

### Test Locations
| Operator Location | Accuracy Tests | Performance Tests |
|---|---|---|
| **Core (src)** | `tests/test_<category>_ops.py` (append to e

kernelgen-generate-for-vllm.md

# KernelGen Skill — Generate vLLM Operators via MCP

You are an expert at generating GPU kernel operators for the vLLM project using the `kernelgen-mcp` MCP service.

> **⚠️ MCP Prerequisite**: MCP configuration is handled by `SKILL.md` Phase 0. If MCP tools fail during execution,
> stop and tell the user to visit https://kernelgen.flagos.io/mcp 获取 Token 后重新配置。

## Execution Rules

Follow these rules strictly to avoid getting lost in the multi-step workflow:

1. **Follow the steps in order**: Step 0 → Step 1 → Step 2 → ... → Step 8. Never jump ahead.
2. **Never skip Step 2** (operator existence check) — always verify before generating.
3. **Do not generate or write any code before Step 4** (MCP call). Steps 0–3 are preparation only.
4. **Always confirm with the user before destructive actions**: replacing files, installing packages,
   overwriting operators.
5. **If any step fails, stop and report the error** to the user. Do not silently skip or retry
   with different parameters.
6. **Report progress to the user when entering each step**. Print a short status line like
   `Entering Step 2 — checking whether the operator already exists...` so the user knows
   the workflow is progressing and not stuck.
7. **Never fabricate repository files or paths**. If a required file cannot be found using the
   Glob or Grep tools, report it to the user instead of guessing. Do not assume a file exists
   at a path without verifying it first.
8. **CRITICAL — MCP is mandatory**: ALL operator code generation MUST go through the
   `mcp__kernelgen-mcp__generate_kernel` MCP tool. NEVER generate Triton kernels, PyTorch
   wrappers, or operator implementations yourself — even if the operator seems simple (e.g.,
   relu, abs). If MCP is not configured, not reachable, or fails after all retries in Step 4,
   STOP and report the issue to the user. Do NOT fall back to writing kernel code manually.
   The MCP service produces optimized, tested code that manual writing cannot match.

## Step 0: Pre-flight — Environment & MCP Check

### 0a. Check Python Environment

Use the Bash tool to run a diagnostic that checks each package independently (so one failure
does not prevent checking the rest):

```bash
python - <<'PY'
import importlib

def check(pkg):
    try:
        m = importlib.import_module(pkg)
        print(pkg, getattr(m, "__version__", "installed"))
        return True
    except Exception:
        print(pkg, "NOT installed")
        return False

check("torch")
triton_ok = check("triton")

try:
    import torch
    print("cuda available", torch.cuda.is_available())
    if torch.cuda.is_available():
        print("torch.cuda version:", torch.version.cuda)
        n = torch.cuda.device_count()
        print("cuda devices:", n)
        for i in range(n):
            print(f"  cuda:{i}", torch.cuda.get_device_name(i))
except Exception:
    pass

if triton_ok:
    try:
        import triton.runtime
        print("triton runtime OK")
    except Exception as e:
        p

Sponsored

Ads related to Kernelgen Flagos and adjacent AI workflows.