ai-hypercomputer/accelerator-agents/skill
Claude Code and agent skill by ai-hypercomputer/accelerator-agents
- community
Checking that the SKILL.md file is still in the repository.
Orchestrates Pallas TPU kernel development and optimization. Converts JAX, PyTorch or GPU kernel code (CUDA, Triton, cuTile, CuTe DSL) into a Pallas TPU kernel and runs a self-refinement loop (plan -> implement -> compile -> test -> autotune -> profile) by dispatching the maxkernel-worker subagent once per iteration. Accepts an optional reference kernel (a GPU implementation of the same computation, in any of those languages or another) that the planner mines for design ideas. Use this skill whenever asked to write, optimize, autotune, or profile a Pallas/JAX TPU kernel, or to speed up code by turning it into a Pallas kernel.
Install
npx vskill@latest install ai-hypercomputer/accelerator-agents/skillSKILL.md
MaxKernel
You are strictly an orchestrator. You manage the workflow of kernel optimization by dispatching worker agents. Under no circumstances should you act as an engineer directly. You should never read or write any code or debug any error yourself.
Project root: {{MAXKERNEL_ROOT}} (referred to below as $MK). Workspace root: $MK/workspace.
External state, isolated iterations & run directories
- **The state of the kernel optimization task, including the input language, the TPU version, iteration count
and artifact paths, lives in <run_dir>/state.json (where <run_dir> is a unique run directory under $MK/workspace/<run_id>/), not in your memory.** You re-read that file at every decision point, and you branch on what you just read — never on what you remember reading earlier.
- Absolute Paths in `state.json`:
<run_dir>/state.jsonstores full absolute paths forrun_dir,source_path,source_context_path,best_code_path, and all history entries (kernel_plan,optimized_kernel,profile_summary,autotune_summary) to eliminate any path ambiguity across agents and tool calls. - Each iteration's heavy work runs in an isolated worker agent. Your own context
only ever holds one state read + one worker dispatch + one short return summary per iteration — not five iterations' worth of plan/implement/compile/test/autotune/profile transcripts.
- Strict Run Isolation: Every optimization run is isolated inside its own directory
$MK/workspace/<run_id>/. Each conversation operates strictly inside its assignedrun_dirand does NOT read or modify other experiment directories.
Project File & Tool Location Rules
All project resources must be referenced by absolute path:
- Python interpreter:
{{VENV_PYTHON}}(never systempython3) - Registered subagents:
{{CLAUDE_DIR}}/agents/maxkernel-*.md - TPU client CLI:
{{VENV_PYTHON}} {{MAXKERNEL_ROOT}}/tools/tpu_client.py - TPU server:
{{MAXKERNEL_ROOT}}/server/tpu_server.py - TPU config:
{{MAXKERNEL_ROOT}}/tpu_config.json - Setup guide:
{{MAXKERNEL_ROOT}}/README.md, Install section (run before Claude Code
starts; the loop never installs anything)
- TPU knowledge base (read by the planning/implementation agents):
{{MAXKERNEL_ROOT}}/reference/tpu_memory_overlapping.md, {{MAXKERNEL_ROOT}}/reference/tpu_mxu_and_register_optimization.md, {{MAXKERNEL_ROOT}}/reference/tpu_profiling_and_diagnostics.md, {{MAXKERNEL_ROOT}}/reference/pallas_xla_interaction.md
- Job file format — the declaration a run starts from, and the seven
contradictions the validator rejects: {{MAXKERNEL_ROOT}}/docs/job-spec.md, {{MAXKERNEL_ROOT}}/examples/jobs/ (one per supported shape), {{MAXKERNEL_ROOT}}/tools/validate_job.py
- Conversion pipeline reference, including the torch/torchax version pin and
the two opposing argument-order conventions: {{MAXKERNEL_ROOT}}/docs/torchax-oracle-pipeline.md
- External evaluation harness — times the user's real PyTorch against the
generated kernel on the TPU, which the internal loop cannot do: {{MAXKERNEL_ROOT}}/evaluation/compare_kernel.py, {{MAXKERNEL_ROOT}}/evaluation/adapt_maxkernel.py, {{MAXKERNEL_ROOT}}/evaluation/README.md
- Reference-material and oracle tools (dispatched by the worker, not by you):
{{MAXKERNEL_ROOT}}/tools/torchax_oracle.py, {{MAXKERNEL_ROOT}}/tools/jaxpr_export.py, {{MAXKERNEL_ROOT}}/tools/jaxpr_compare.py
TPU Machine & Configuration Protocol
When creating, updating, or adding TPU machines to tpu_config.json:
- Thread-Safe CLI Addition (`--add_tpu`):
- Do NOT perform raw file edits on
tpu_config.json. Use thetpu_client.pyCLI to safely register TPU machines:
``bash {{VENV_PYTHON}} {{MAXKERNEL_ROOT}}/tools/tpu_client.py \ --add_tpu '{"tpu_name": "<tpu_name>", "zone": "<zone>", "project": "<project>"}' ``
tpu_client.pyuses advisory file locking (fcntl.flock) and atomic file replacement (os.replace) to prevent file corruption or lost update race conditions between parallel agents.
- De-duplication & Auto-Cached Hardware Specs (`tpu_spec`):
tpu_client.pyautomatically checks iftpu_nameis already intpu_config.json(skips duplicates), lazily boots the server daemon/SSH tunnel, queries hardware specs ONCE, and populates"tpu_spec": {"device_kind": "...", "device_count": ...}plus"tpu_spec_verified": trueintotpu_config.json. Atpu_specwithout that flag (e.g. hand-written) is re-checked against the hardware on first contact and replaced if it differs.- Planners and worker agents read
tpu_specdirectly fromtpu_config.jsonwithout running remote spec query scripts on every run.
How to dispatch the worker agent
The worker is registered as the maxkernel-worker subagent type. Every dispatch gets its own fresh context, has no memory of your conversation, and exits after doing one iteration's work.
Dispatch it with the Agent tool:
The dispatch instruction is the same every iteration — only <run_dir> varies. The Agent call returns when the worker finishes; its final report arrives as the tool result. There is no polling timer and no subagent-management tool in this harness — do not invent one. What you trust is <run_dir>/state.json on disk, not the worker's prose.
The other registered subagents (maxkernel-analyze-torch-source, maxkernel-write-jnp-reference, maxkernel-synthesize-baseline, maxkernel-analyze-source, maxkernel-analyze-gpu-reference, maxkernel-reconcile-reference, maxkernel-fix-port, maxkernel-plan-kernel, maxkernel-implement-kernel, maxkernel-fix-kernel-compilation, maxkernel-compilation-summary, maxkernel-generate-test-file, maxkernel-fix-test-script, maxkernel-test-script-validation-summary, maxkernel-summarize-test-results, maxkernel-autotune-planner, maxkernel-autotune-summary, maxkernel-generate-profile-script, maxkernel-summarize-profile) are dispatched by the worker, not by you. You only ever dispatch maxkernel-worker.
The conversion pipeline
Every run walks the same path. Knowing its shape is what lets you read state.json and tell where a run is.
Three things about this shape are worth holding onto.
"Pure JAX" and "Pallas" are both JAX. pl.pallas_call is a JAX primitive and a kernel body is jnp over Refs, so there is no step that leaves JAX. What the pipeline produces first is idiomatic JAX — what a competent engineer writes without a custom kernel — and what it produces last is Pallas-flavoured JAX. The first is the thing the second has to beat.
The oracle is hidden from the agent on purpose, and it is not about secrecy. The agent has the PyTorch source and could reconstruct the oracle. Hiding it prevents anchoring: an agent shown a working implementation transcribes it, and a transcription of idiomatic JAX is not a TPU-native kernel.
Every arrow that changes representation has a gate under it. torchax is checked against eager PyTorch; the jnp reference is checked against the oracle by value and against the jaxpr by structure; the Pallas kernel is checked against the oracle by value. A run that skips a gate is a run whose numbers mean nothing, which is why a failed gate stops the run instead of degrading it.
Setup
- Determine or Generate `run_id` and `run_dir`:
- Generate a unique run ID:
python3 -c "import uuid; print('run_' + uuid.uuid4().hex[:8])". - Set
run_dirto the full absolute path:{{MAXKERNEL_ROOT}}/workspace/<run_id>. - Create directory
<run_dir>.
1b. If the user supplied a job file, start there and skip the guessing.
A job file declares everything the run needs: which file is being converted, whether a reference exists, whether a JAX reference is needed and how it should be produced. Prefer it over inference whenever one is given — the user naming their entry point is worth more than any classifier.
``bash {{VENV_PYTHON}} {{MAXKERNEL_ROOT}}/tools/validate_job.py <job.json> \ --json <run_dir>/job_validation.json ``
| exit | meaning | what you do | |
|---|---|---|---|
| 0 | valid | Copy the job to <run_dir>/job.json, take every field from it, and skip steps 2 and 3 entirely. The plan it printed is what you are about to run. | |
| 1 | contradictory or incomplete | STOP and show the user the errors verbatim. Each one names a real failure mode and says how to fix it. Do not repair the job yourself — a guessed entry_point is the thing job files exist to prevent. | |
| 2 | valid, but a declared path is missing | STOP and name the missing paths. |
The validator prints the plan the job implies — the oracle, who writes base.py, whether the internal harness can run, the phase sequence. Show that to the user before dispatching anything. It is the cheapest moment to catch a job that says something other than what they meant.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingmaxkernel/claude-code/skill/SKILL.md
Popularity
- Repository stars
- 98
- Repository forks
- 21
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ai-hypercomputer/accelerator-agents/skill)