Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/Nexisato/SwanLab-MCPnpx agentmods add skills/nexisato/swanlab-mcp/swanlab-api-skillWrote 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.
[](https://agentmods.dev/skills/nexisato/swanlab-mcp/swanlab-api-skill)<a href="https://agentmods.dev/skills/nexisato/swanlab-mcp/swanlab-api-skill"><img src="https://agentmods.dev/badge/skills/nexisato/swanlab-mcp/swanlab-api-skill/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.
<a href="https://agentmods.dev/skills/nexisato/swanlab-mcp/swanlab-api-skill"><img src="https://agentmods.dev/badge/skills/nexisato/swanlab-mcp/swanlab-api-skill.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00040 | $0.03265 |
| Opus 5 | $0.00020 | $0.01632 |
| Sonnet 5 | $0.00008 | $0.00653 |
| Haiku 4.5 | $0.00004 | $0.00327 |
Grade B, and why
swanlab-api-skill scanned grade B with 1 finding 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 10d 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.
Asks for rootmediumPrivilege escalation
A mod that escalates privileges can change anything on the machine, not only the project.
chmod 600 ~/.swanlab/netrc How it starts
The opening of the file, as written. The whole thing — 415 lines — stays where its author put it; the contents beside it link to each section on GitHub.
triggers:
- 当用户需要获取 SwanLab 实验数据时
- 当用户需要导出 metrics 到 JSON 时
- 当用户需要获取 workspace、project、run 信息时
- 当用户需要获取实验的 metadata、config、requirements 时
环境要求
- Python >= 3.8
- swanlab >= 0.7.8
- pandas (用于 metrics 数据处理)
环境变量
| 变量名 | 必需 | 说明 |
|---|---|---|
SWANLAB_API_KEY |
条件必需* | SwanLab API 密钥 |
SWANLAB_HOST |
否 | SwanLab 主机地址,默认 https://swanlab.cn |
获取 API 密钥:https://swanlab.cn/space/~/settings
API Key 获取优先级 【最先执行】
- 环境变量
SWANLAB_API_KEY(优先) - Netrc 文件
~/.swanlab/netrc中的password字段
Netrc 文件配置示例:
# 创建 netrc 文件
mkdir -p ~/.swanlab
cat > ~/.swanlab/netrc << 'EOF'
machine https://api.swanlab.cn
login https://swanlab.cn
password your_api_key_here
EOF
chmod 600 ~/.swanlab/netrc
注:环境变量优先级高于 netrc 文件。如果设置了
SWANLAB_API_KEY,将忽略 netrc 中的配置。
核心规则
-
Username 默认规则:
- 未指定
username时,自动调用api.workspaces()获取PERSON类型的 workspace 作为默认 - Path 支持简写:
project_name/exp_id会自动补全为username/project_name/exp_id
- 未指定
-
输出规则:
- 只有
runs metrics命令会保存 JSON 文件 - 其他所有命令都只输出到控制台(stdout)
- 只有
-
Metrics 输出:
- 使用
-o指定文件名,默认保存到./.cache/目录(自动创建) - 超过 8192 条记录时自动分片保存,命名格式
[name]-[chunk_idx:04d].json - 不分片时文件名为
[name].json
- 使用
-
实验分析前置规则(重要):
- 在获取实验指标 Metrics 之前,必须先获取实验元信息(runs get、runs config)
- 元信息包括:实验名称、状态、超参数配置等
- 禁止直接获取 metrics 而不了解实验的基本信息和配置
意图识别
当用户需要进行实验分析、实验对比或实验总结时,按以下步骤获取实验元信息:
-
获取实验基础信息(必需):
python -m scripts.swanlab_cli runs get RUN_PATH- 了解实验名称、状态、创建时间、运行时长
- 获取实验标签和分组信息
-
获取实验配置 Config(必需):
python -m scripts.swanlab_cli runs config RUN_PATH- 获取超参数配置(学习率、批次大小、模型架构等)
- 理解实验的目的和设置
-
获取实验环境 Metadata(建议):
python -m scripts.swanlab_cli runs metadata RUN_PATH- 获取 Python 版本、操作系统、硬件信息(GPU/CPU)
- 获取 Git 提交信息(代码版本)
- 用于复现实验环境和排查环境问题
-
获取 Python 依赖 Requirements(可选):
python -m scripts.swanlab_cli runs requirements RUN_PATH- 了解实验使用的库版本
- 用于环境复现
What ships with it
7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 10d ago First seen · 415 lines · 40 tokens per session scan B ab645e82914e
swanlab-api-skill is a skill published in the GitHub repository Nexisato/SwanLab-MCP (10 stars, last pushed 21d ago), licensed MIT. It adds 40 tokens to every session and 3,265 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it B with 1 finding (asks for root). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
systematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.
local-ai-agents
Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…
next-cache-components-adoption
Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…
insight-error-page
Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…
next-cache-components-optimizer
Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…
next-partial-prefetching-adoption
Turn on Partial Prefetching in a Next.js app and work through the insights it surfaces. Use when the user wants to enable or adopt Partial Prefetching, flip the partialPrefetching flag, opt routes in with export const prefetch = 'partial', audit Link prefetch={true} behavior, preserve existing prefetched UI with…