Magnetar: Instructions file for Codex

AGENTS.md

Magnetar AGENTS.md is an instructions file for Codex, OpenCode from AXERA-TECH/Magnetar. It costs 4,966 tokens per session, scanned C, original, MIT.

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

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: reads ~/.codex paths; mentions AGENTS.md; mentions Codex.

This is AXERA-TECH/Magnetar's own configuration. It tells Codex and OpenCode 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/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/AXERA-TECH/Magnetar

Made for: Codex, OpenCode.

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 Magnetar AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/axera-tech/magnetar/agents-md/github.svg)](https://agentmods.dev/instructions/axera-tech/magnetar/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/axera-tech/magnetar/agents-md"><img src="https://agentmods.dev/badge/instructions/axera-tech/magnetar/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for Magnetar AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/axera-tech/magnetar/agents-md"><img src="https://agentmods.dev/badge/instructions/axera-tech/magnetar/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 4,966 This file is loaded in full into every session.
When invoked 4,966 The same file — it is already loaded in full.
Security scan C 2 findings. A grade says what 26 rules found in the file — not that it is safe.
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.04966 $0.04966
Opus 5.5 $0.01986 $0.01986
Sonnet 5.5 $0.00993 $0.00993
Haiku 4.5 $0.00497 $0.00497

Measured 1mo ago against content hash 6cfd31da898b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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 · 234 lines

How it starts

The opening of the file, as written. The whole thing — 234 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.pulsar2_util ensure_pulsar2_package(), resolve_backend(), run_pulsar2(), config_check() Pulsar2 独立包后端(自动获取 ModelScope/HF 最新 *_package.tar.gz,解压即完整运行环境,强制不用 Docker)
magnetar.proc_util run() 通用子进程执行(限长输出 + 日志落盘)
magnetar.recipes list_recipes(), load_recipe(name), match_recipe(...) 已验证模型配方(recipes/*.json);命中则按配方确定性执行,未命中且 ALLOW_EXPLORE=false 时 STOP
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) → sample;run_generic(task_dir, ...) → result MobileNet 专用 / 任意模型通用导出(先简后繁自动降级)
magnetar.stages.toolchain run() → pulsar_image 自动获取/验证 Pulsar2 独立包可用(无 PULSAR2_HOME 时自动下载最新 *_package.tar.gz)
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_dir;install_axllm(board) / serve_axllm(board, model_dir) / validate_chat(api_url, ...) LLM/自回归模型路由与 ax-llm 部署(llm_build2 编译 + axllm 板端 serve/验证)

Read the full file on GitHub · 234 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. 1mo ago Changed · +2 lines · +154 tokens per session 6cfd31da898b
  2. 1mo 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 1mo ago), licensed MIT. It adds 4,966 tokens to every session, about $0.0199 per session on Opus 5.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.

Related

Other instructions, from other repositories