Magnetar: Skill for Codex

.codex/skills/magnetar/hidden/sdk-gen/SKILL.md

sdk-gen is a skill for Codex from AXERA-TECH/Magnetar. It costs 28 tokens per session (1,219 once invoked), scanned A, original, MIT.

A stage that creates Python and C++ software libraries for running converted AI models, using the model's recorded inputs, outputs, and processing steps.

In plain words
What is it for?
Use it to generate and test inference SDKs, including examples, build files, dependencies, preprocessing, and postprocessing for supported models.
Why use it?
It helps ensure the customer-facing examples match the original model interface and processing rather than silently changing how the model works.

Skill for Codex

Written for Codex: installed under .codex/.

This is AXERA-TECH/Magnetar's own configuration. It tells Codex how to work on Magnetar itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything Magnetar configures →

Reuse

Borrowing it

Nothing to install: this file belongs to AXERA-TECH/Magnetar. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/AXERA-TECH/Magnetar/main/.codex/skills/magnetar/hidden/sdk-gen/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/AXERA-TECH/Magnetar

Made for: 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 sdk-gen

README.md
[![agentmods](https://agentmods.dev/badge/skills/axera-tech/magnetar/sdk-gen.svg)](https://agentmods.dev/skills/axera-tech/magnetar/sdk-gen)
Your own site
<a href="https://agentmods.dev/skills/axera-tech/magnetar/sdk-gen"><img src="https://agentmods.dev/badge/skills/axera-tech/magnetar/sdk-gen.svg" alt="Measured on agentmods" height="20"></a>
Per session 28 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,219 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.1 $0.00028 $0.01219
Opus 5 $0.00014 $0.00609
Sonnet 5 $0.00006 $0.00244
Haiku 4.5 $0.00003 $0.00122

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

Security

Grade A, and why

sdk-gen 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 8d 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/sdk-gen/SKILL.md · 73 lines

How it starts

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

SDK-GEN

执行

MobileNet 直接调用:

  • magnetar.stages.sdk_gen.run_mobilenet_python(task_dir, labels)
  • magnetar.stages.sdk_gen.run_mobilenet_cpp(task_dir, target_hw)

其他模型 Agent 自行实现。关键要求:

  • Python:pyaxengine.AxEngineExecutionProvider 为默认 provider,import <sdk> 通过
  • C++:CMake 直接链接 ax_engine/ax_sys(不用 FetchContent),cmake configure 通过
  • YOLO 系列:集成 libdet.axera,requirements.txt 注明 git clone 获取方式
  • pyaxengine 等 GitHub 直链依赖默认经 GH_PROXYgh_proxy_url())写入 requirements.txt

通用 SDK 生成(非 MobileNet)

优先调用:

  • magnetar.stages.sdk_gen.run_generic_python(task_dir)sdk/python/<model>_sdk/
  • magnetar.stages.sdk_gen.run_generic_cpp(task_dir, target_hw)sdk/cpp/

一致性保障(自动):

  • 模型接口(输入输出名/shape/dtype)以 export/model_meta.json 为权威
  • 预处理/后处理与示例输入以 origin/model_flow.json(ACQUIRE 阶段记录)为准
  • 前后处理对齐原版:preprocess/postprocess 必须来自原版模型管线(ACQUIRE 验证过), 调用方式尽量对齐原版model_flow.sdk_interface 记录入口/入参顺序/输入格式/输出结构, example.py 镜像原版调用方式);禁止为省事改成直通/自定义
  • example_input 缺失、preprocess_code/postprocess_code 语法错误时抛错, 避免生成与真实运行流程不一致的 SDK
  • 生成后务必用 example.py --model ... --input <真实样本> 验证一次(板端或 ORT 回退)

需要自定义预处理/后处理时,在 model_flow.json 提供代码后重新调用生成函数。

发布版(NPU 专用,无 CPU 回退)

端到端 NPU 跑通后(RUNONBOARD 报告存在),发布包内 SDK 不再保留 onnxruntime 回退

  • package.assemble() 会自动把 package/python 下的通用 SDK 替换为 NPU-only 版 (inference.py 只 import axengine,非 AX 环境直接报错并提示在板端运行)
  • 交付 SDK 的依赖仅为 numpy + pyaxengine,不包含 onnxruntime/torch/transformers
  • 依赖最小化:交付包 Python/C++ 尽量减少依赖(C++ 只链 ax_engine/ax_sys; Python 只 numpy+pyaxengine),opencv/pillow 等仅当原版前处理确实需要时才进 requirements.txt
  • CPU fallback 尽量不做:能端到端 NPU 就端到端;仅 RUNONBOARD 未跑通时才允许保留开发版回退, 且交付说明中必须标注“未做端到端 NPU 验证”
  • 源目录 sdk/python/ 保留开发版(含 ORT 回退)供本机逻辑验证,不进交付包
  • 需要严格版时也可直接调用 run_generic_python(task_dir, strict_npu=True)

LLM 分支(model_route=llm)

模型是自回归/类 LLM 时,SDK 不再基于 pyaxengine,改为:

  • Python SDK:OpenAI 兼容 HTTP 客户端——类 LLMClient(api_url, model_name)chat(messages, **kwargs) / stream()/v1/chat/completions;依赖仅 requests (requirements.txt 只写 requests,不含 pyaxengine/onnxruntime/torch/transformers); 调用约定对齐原模型 chat 模板(model_flow.json 的 sdk_interface); example.py 启动/复用板端 axllm serve 后调用客户端打印回复;
  • C++ SDK:可选,OpenAI 兼容 HTTP 客户端(libcurl),cmake configure 通过即可, 不强求上板链接 AX runtime;
  • 板端运行前置:axllm serve <model_dir>(RUNONBOARD 负责安装与启动)。

Read the full file on GitHub · 73 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. 8d ago First seen · 73 lines · 28 tokens per session scan A ba5f10deceed

Subscribe to this mod's changes

sdk-gen is a skill published in the GitHub repository AXERA-TECH/Magnetar (22 stars, last pushed 5d ago), licensed MIT. It adds 28 tokens to every session and 1,219 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.