Magnetar AGENTS.md

Project instructions for Magnetar, a tool that converts machine-learning models into packages for AXERA chips and verifies them on target hardware.

In plain words
What is it for?
Acquiring models, exporting them to ONNX, compiling them with Pulsar2, creating AXMODEL files, testing them, and preparing Python or C++ delivery packages.
Why use it?
It explains the required conversion stages, available helper modules, error handling, and board operations so agents can follow the delivery process.

Instructions file for CodexOpenCode

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 instructions/axera-tech/magnetar/agents-md
Clone the repo
git clone --depth 1 https://github.com/AXERA-TECH/Magnetar

Made for: Codex, OpenCode.

Per session 4,812 This file is loaded in full into every session.
When invoked 4,812 The same file — it is already loaded in full.
Security scan C 2 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.04812 $0.04812
Opus 5 $0.02406 $0.02406
Sonnet 5 $0.00962 $0.00962
Haiku 4.5 $0.00481 $0.00481

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

Security

Grade C, and why

Magnetar AGENTS.md scanned grade C with 2 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 3d 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.

Downloads and executes remote codehighSupply chain

curl | sh runs whatever the server returns today, which is not necessarily what it returned when this was reviewed.

`curl -fsSL https://raw.githubusercontent.com/AXERA-TECH/ax-llm/axllm/install.sh | bash`。

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

`curl -fsSL https://raw.githubusercontent.com/AXERA-TECH/ax-llm/axllm/install.sh | bash`。
AGENTS.md · 232 lines

How it starts

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

AGENTS.md

本仓库包含 Magnetar 模型部署工具。所有 Agent 回复默认使用中文。

项目目标

将远程或本地浮点模型转换为 AX 芯片客户交付包:

模型 → ONNX → Pulsar2 编译 → AXMODEL → 仿真验证 → Python/C++ SDK → 交付包 → 发布

工具库

Agent 负责编排和决策。magnetar/stages/*.py 提供确定性执行函数:

模块 函数 用途
magnetar.config load_config() 读取 .magnetarrc + 环境变量
magnetar.errors MagnetarError/classify_error() 类型化错误码注册表(与 magnetar.yaml retry_on 对齐,测试强制)
magnetar.stages.events log_event()/log_error() 追加式事件日志 .magnetar-events.jsonl(可回放审计流,mark_stage 自动写)
magnetar.docker_util latest_pulsar2_image(), docker_pulsar2() Docker/Pulsar2 封装
magnetar.board_util select_board(), ssh(), scp_to(), scp_from(), ensure_remote_infer(), port_open() AX 板端操作(上板前确保 ax-remote-infer 已装,18500 端口可发现板子)
magnetar.stages.init run(config)task_dir 创建 TASK_DIR 结构
magnetar.stages.acquire run(task_dir, source)write_model_flow(task_dir, flow) 获取模型到 origin/ 并记录运行流程
magnetar.stages.export run_mobilenet(task_dir)samplerun_generic(task_dir, ...)result MobileNet 专用 / 任意模型通用导出(先简后繁自动降级)
magnetar.stages.toolchain run()pulsar_image 验证 Pulsar2 Docker 可用
magnetar.stages.compile run(task_dir, target_hw, image) Pulsar2 编译 AXMODEL
magnetar.stages.simulate run(task_dir, sample, image, board=board, target_hw=...)metrics 精度对分(有板优先上板 ax_run_model,无板才回退 pulsar2 run)
magnetar.stages.sdk_gen run_mobilenet_python(), run_mobilenet_cpp()run_generic_python(task_dir), run_generic_cpp(task_dir) 生成 Python/C++ SDK(通用版基于 model_meta + model_flow)
magnetar.stages.runonboard run(task_dir, sample, hw, pwd)metrics 板端部署验证
magnetar.stages.package assemble(task_dir, metrics, image)pkg, self_test(pkg)result 组装面向小白的交付包,含一键脚本 + README + 自测
magnetar.stages.publish publish(pkg, target, name, token, org, model)result 发布到 GitHub(源码)或 HuggingFace(预编译)
magnetar.stages.llm classify(origin, ...) → 路由;llm_build(task_dir, input, chip, image, ...)model_dirinstall_axllm(board) / serve_axllm(board, model_dir) / validate_chat(api_url, ...) LLM/自回归模型路由与 ax-llm 部署(llm_build2 编译 + axllm 板端 serve/验证)

Read the full file on GitHub · 232 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. 3d ago First seen · 232 lines · 4,812 tokens per session scan C 0be6ba321fea

Subscribe to this mod's changes

Magnetar AGENTS.md is an instructions file published in the GitHub repository AXERA-TECH/Magnetar (22 stars, last pushed 20d ago), licensed MIT. It adds 4,812 tokens to every session, about $0.0241 per session on Opus 5. A static security scan graded it C with 2 findings (downloads and executes remote code, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.