Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add tensormux/kernel-skills --skill write-triton-kv-cache-append-kernelgit clone --depth 1 https://github.com/tensormux/kernel-skillsWrote 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.
[](https://agentmods.dev/skills/tensormux/kernel-skills/write-triton-kv-cache-append-kernel)<a href="https://agentmods.dev/skills/tensormux/kernel-skills/write-triton-kv-cache-append-kernel"><img src="https://agentmods.dev/badge/skills/tensormux/kernel-skills/write-triton-kv-cache-append-kernel/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.
<a href="https://agentmods.dev/skills/tensormux/kernel-skills/write-triton-kv-cache-append-kernel"><img src="https://agentmods.dev/badge/skills/tensormux/kernel-skills/write-triton-kv-cache-append-kernel.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.04869 |
| Opus 5.5 | $0.00000 | $0.01948 |
| Sonnet 5.5 | $0.00000 | $0.00974 |
| Haiku 4.5 | $0.00000 | $0.00487 |
Grade A, and why
write-triton-kv-cache-append-kernel 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 1mo 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.
How it starts
The opening of the file, as written. The whole thing — 214 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Skill: Write a Triton KV Cache Append Kernel
Purpose
Guide the agent through implementing a Triton kernel that writes newly computed K and V tensors into a pre-allocated KV cache during LLM inference. This covers two cache layouts (contiguous and paged / vLLM-style PagedAttention), unified prefill and decode handling via a slot_mapping tensor, GQA/MQA where the cache stores fewer heads than Q, optional fp8/int8 quantized KV cache with scaling, coalesced versus scattered write patterns, and the boundary checks required to avoid corrupting other requests' cache regions. The kernel runs once per layer per forward step; correctness is the dominant concern, throughput is secondary because the data volume per call is small.
Use this when
- You are building a custom serving stack and need a KV cache append step that is not provided by vLLM or FlashInfer.
- You need a paged KV cache layout (block_table indirection) with a non-standard block_size, an exotic block layout, or a sharding scheme like RingAttention that the existing libraries do not support.
- You need fp8 or int8 quantized KV cache with per-block or per-tensor scales, and the in-tree kernels do not match your scaling convention.
- You want a unified kernel that handles prefill (many new tokens per request) and decode (one new token per request) through the same
slot_mappinginterface. - You are fusing the append into a custom QKV epilogue and need a reference standalone kernel to verify against.
Do not use this when
- You are inside vLLM and the existing
reshape_and_cache_flash(orreshape_and_cache) kernel already covers your layout. It is heavily tuned and maintained. - You are using FlashInfer — its
append_paged_kv_cacheis well optimized and integrates with the rest of the FlashInfer attention API. - You only need a contiguous cache and a simple PyTorch indexing assignment is fast enough. For small batch sizes the launch overhead of a custom kernel can exceed
cache[:, :, pos, :] = new_k. - You are tempted to fuse the append into the QKV projection in your first iteration. The projection's tile shape constraints and the cache's scatter pattern rarely align cleanly. Write the standalone kernel first, profile, then consider fusion if the launch overhead actually matters.
- You need a backward pass. KV cache append is inference-only; there is no autograd-relevant version of this kernel.
What ships with it
1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 1mo ago First seen · 214 lines · 0 tokens per session scan A 3d562a4ad60e
write-triton-kv-cache-append-kernel is a skill published in the GitHub repository tensormux/kernel-skills (82 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 4,869 tokens. 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.
Other skills, from other repositories
claude-api
Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.
ring:adopting-lib-commons-huma-wrapper
Adopting the lib-commons/v5 shared Huma (OAS 3.1) OpenAPI wrapper + RFC 9457 problem model (commons/net/http/{openapi,problem}) in a Lerian Go service: wire openapi.New/ServeSpec + problem.Install (central >=500 scrub) on BOTH runtime and spec-gen paths, the per-rail problem.MapError flex seam, and rename-only spec…
cutedsl_megamoe
Skill "cutedsl_megamoe" from flashinfer-ai/flashinfer, covering updating the cutedsl megamoe kernel src, layout, when the kernel team drops a new version of src/ and what not to update here.
ai-ml-development
AI and machine learning development with PyTorch, TensorFlow, and LLM integration. Use when building ML models, training pipelines, fine-tuning LLMs, or implementing AI features.
deep-learning-python
Guidelines for deep learning development with PyTorch, Transformers, Diffusers, and Gradio for LLM and diffusion model work.
machine-learning
Machine learning development with JAX, functional programming patterns, and high-performance computing.