compile

compile is a skill for Claude Code, Codex from AXERA-TECH/Magnetar. It costs 24 tokens per session (707 once invoked), scanned A, original, MIT.

A build step that converts static ONNX machine-learning models into AXMODEL files for Pulsar2 hardware. It can also prepare certain language models and record compilation results.

In plain words
What is it for?
Use it to compile fixed-shape ONNX models, build supported language models, prepare tokenizer and metadata files, and create compilation reports and cosine-similarity checks.
Why use it?
It turns model files into the format needed by the target hardware and records checks that help show whether the conversion worked. It also enforces required input and calibration settings.

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/axera-tech/magnetar/compile
Any agent
npx skills add AXERA-TECH/Magnetar --skill compile
Clone the repo
git clone --depth 1 https://github.com/AXERA-TECH/Magnetar

Made for: Claude Code, Codex.

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 compile

README.md
[![agentmods](https://agentmods.dev/badge/skills/axera-tech/magnetar/compile.svg)](https://agentmods.dev/skills/axera-tech/magnetar/compile)
Your own site
<a href="https://agentmods.dev/skills/axera-tech/magnetar/compile"><img src="https://agentmods.dev/badge/skills/axera-tech/magnetar/compile.svg" alt="Measured on agentmods" height="20"></a>
Per session 24 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 707 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.00024 $0.00707
Opus 5 $0.00012 $0.00353
Sonnet 5 $0.00005 $0.00141
Haiku 4.5 $0.00002 $0.00071

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

Security

Grade A, and why

compile 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 4d 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.

.codex/skills/magnetar/hidden/compile/SKILL.md · 49 lines

What it actually says

COMPILE

执行

magnetar.stages.compile.run(task_dir, target_hw, pulsar_image)

关键约束

  • highest_mix_precision 必须为 false
  • calibration_std 用 255(非 0.004)——Pulsar2 用 /std 公式
  • 编译前确认 ONNX 为静态 shape
  • 校准/输入格式先查 docs/input-format-cheatsheet.mdpython magnetar/pulsar2_ref.py --cases),不要试新格式

LLM 分支(model_route=llm)

model_dir = magnetar.stages.llm.llm_build(task_dir, input_path=origin/<model>, chip=TARGET_HARDWARE, pulsar_image=..., max_context=..., prefill_len=..., weight_type=s8|s4, hidden_state_type=bf16)

内部流程:

  1. pulsar2 llm_build2 直接编译 HuggingFace 权重 → compile/llm_out/: 逐层 *_l%d_*.axmodel + *post*.axmodel + model.embed_tokens.weight.bfloat16.bin, 自带逐层 decode/prefill cosine 校验(日志 cos_sim is: X);
  2. ensure_axllm_build_tools 克隆 ax-llm-build,embed_process.sh 处理 embedding;
  3. 组装 compile/llm_model_dir/:config.json(axllm 字段:tokenizer_type、 template_filename_axmodel、axmodel_num、filename_post_axmodel、 filename_tokens_embed、tokens_embed_num/size)+ tokenizer + axmodel + post_config.json + model_meta.json;
  4. 生成 export/model_meta.json(route=llm,compile_cosine 取逐层 cosine 统计: min/mean/all_ge_0_99)与 compile/compile_report.md

失败处理:llm_build2 报架构/head_dim/算子不支持 → 回退 EXPORT 调整参数或拆分, 仍失败 STOP 由用户决定是否回退通用 ONNX 路径;逐层 cosine < 0.99 → 回退 COMPILE 重试(weight_type s8→s4、bf16→fp16、调 max_context/prefill)。

验证

  • compile/model.axmodel 存在且非空
  • compile/compile_report.md 含 MACs、大小、压缩比、编译耗时
  • LLM 分支:compile/llm_model_dir/ 含 config.json + tokenizer + 逐层/post axmodel + embedding bin;export/model_meta.json compile_cosine.min ≥ 0.99

STOP

  • Pulsar2 编译失败且需改 ONNX → 退回 EXPORT
  • 输入预处理配置与导出验证不一致
  • LLM 分支:llm_build2 不可用(Pulsar2 < 6.0)→ blocked;不支持架构且用户未定回退方向
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. 4d ago First seen · 49 lines · 24 tokens per session scan A d2718486d77f

Subscribe to this mod's changes

compile is a skill published in the GitHub repository AXERA-TECH/Magnetar (22 stars, last pushed today), licensed MIT. It adds 24 tokens to every session and 707 once invoked, about $0.0001 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

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens

chat-perf

Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.

microsoft/vscode · 51 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens