operator-migration

A guide for moving CUDA, Triton or custom high-performance code operations into the cache-dit project. It covers the low-level code, Python wrappers, registration, optional compiled extensions and checks needed to confirm the move works.

In plain words
What is it for?
Use it when porting kernels from another repository, adding operator wrappers or registrations, changing native-extension builds, packaging optional code, or reviewing such a migration.
Why use it?
It helps preserve the operation's behavior while fitting cache-dit's conventions and remaining usable when optional native code is unavailable. It also encourages testing at several levels instead of relying on one quick check.

Skill for Claude CodeCodex

Install

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.

agentmods
npx agentmods add skills/vipshop/cache-dit/operator-migration
Any agent
npx skills add vipshop/cache-dit --skill operator-migration
Clone the repo
git clone --depth 1 https://github.com/vipshop/cache-dit

Made for: Claude Code, Codex.

Per session 94 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,171 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00094 $0.03171
Opus 5 $0.00047 $0.01586
Sonnet 5 $0.00019 $0.00634
Haiku 4.5 $0.00009 $0.00317

Measured 2d ago against content hash 184f70f5d1d2, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

operator-migration 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 2d 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.

.copilot/skills/operator-migration/SKILL.md · 411 lines

How it starts

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

Operator Migration for cache-dit

Goal

Migrate one operator or kernel family into cache-dit in a way that is:

  • semantically correct
  • aligned with cache-dit repository conventions
  • safe to import when optional native extensions are absent
  • validated at multiple layers instead of by one smoke test

This skill is for migration work that touches native code, Python wrappers, operator registration, build packaging, or quantized module integration.

When to Use

Use this skill when you need to:

  • migrate a CUDA or Triton operator from another repo into cache-dit
  • port a nunchaku operator or kernel family into cache-dit
  • decide what native files are actually required for a migration
  • design cache-dit public wrappers for a newly migrated operator
  • register low-level ops through cache-dit's CUDA registry layer
  • add optional-extension build logic, submodule checks, or packaging guards
  • design layered validation for a migrated operator
  • review whether an operator migration plan is thoughtful or mechanical

Do not use this skill for:

  • generic model integration with no operator or kernel work
  • pure Python feature work unrelated to kernels or extensions
  • blind "copy upstream into csrc" execution

Core Rule

Do not mechanically replay upstream structure.

Treat the source repository as the reference for semantics, not as the required layout.

Before writing code, answer these questions:

  1. What behavior is essential to preserve?
  2. What is the smallest native and Python closure needed to preserve that behavior?
  3. Which names should remain source-compatible, and which should be renamed to match cache-dit conventions?
  4. What must be public, and what should remain private implementation detail?
  5. Which tests prove the migration works, instead of merely compiling?

If those questions are not answered yet, do not start copying files.

Reference Style Rule

Use portable references only.

  • For cache-dit files, use repo-relative paths such as src/cache_dit/kernels/ops.py or tests/kernels/test_svdquant_runtime.py.
  • For sibling or external repos, use repository-relative or GitHub-searchable paths such as nunchaku/nunchaku/models/linear.py or deepcompressor/deepcompressor/backend/nunchaku/utils.py.
  • Do not write machine-local absolute paths such as /abs/path/to/workspace/... into the skill or its supporting documentation.

Read the full file on GitHub · 411 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. 2d ago First seen · 411 lines · 94 tokens per session scan A 184f70f5d1d2

Subscribe to this mod's changes

operator-migration is a skill published in the GitHub repository vipshop/cache-dit (1,262 stars, last pushed 5d ago), licensed Apache-2.0. It adds 94 tokens to every session and 3,171 once invoked, about $0.0005 per session on Opus 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

Other skills, from other repositories