mimiry-softlaunch

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Mimiry Softlaunch — GPU Compute (Early Beta)

Mimiry 软发布 — GPU 计算(早期测试版)

Softlaunch notice: This skill targets the Mimiry softlaunch environment (
softlaunch.mimiry.com
). It is an early beta — APIs, pricing, and features may change without notice. Report issues to the Mimiry team.
软发布说明: 本技能适配Mimiry软发布环境 (
softlaunch.mimiry.com
)。这是早期测试版本,API、定价和功能可能会在未通知的情况下发生变动。如有问题请反馈给Mimiry团队。

Locating Skill Scripts

查找技能脚本

This skill bundles helper scripts in its
scripts/
subdirectory. Before running any commands, locate the skill installation directory by checking these paths (in order):
  1. ~/.agents/skills/mimiry-softlaunch/
    (npx skills standard location)
  2. ~/.claude/skills/mimiry-softlaunch/
    (Claude Code symlink)
Use whichever exists. In all command examples below,
SKILL_DIR
is a placeholder for this resolved path — substitute the actual path when executing commands.

This skill covers two concerns:
  1. API operations (always available) — auth, list sessions, get status, logs, terminate, check balance/quota
  2. Job building (when creating something new) — choose an image strategy, pick an implementation language, generate the job script, and launch it

本技能的辅助脚本打包在
scripts/
子目录下。运行任何命令前,请按以下顺序检查路径,找到技能的安装目录:
  1. ~/.agents/skills/mimiry-softlaunch/
    (npx技能标准安装位置)
  2. ~/.claude/skills/mimiry-softlaunch/
    (Claude Code符号链接)
使用存在的路径即可。在下文所有命令示例中,**
SKILL_DIR
**是该解析路径的占位符,执行命令时请替换为实际路径。

本技能覆盖两类功能:
  1. API操作(始终可用)—— 身份验证、列出会话、获取状态、查看日志、终止会话、查询余额/配额
  2. 任务构建(创建新资源时使用)—— 选择镜像策略、选择实现语言、生成任务脚本并启动

Prerequisites

前置要求

Before any API operation, verify the user has a registered SSH key. Ask:
Do you have an SSH key registered on your Mimiry account?
If yes — ask for the path to the key (there is no default). The auth script accepts either the private key path or the
.pub
path — it normalizes automatically.
If no — walk them through setup:
  1. Generate a key (if they don't have one):
    bash
    ssh-keygen -t ed25519 -f ~/.ssh/mimiry -C "mimiry-softlaunch"
  2. Register it on Mimiry — the user must add the public key (
    ~/.ssh/mimiry.pub
    ) through the Mimiry portal. There is currently no API for key registration. Direct them to:
    https://softlaunch.mimiry.com
    → Profile → SSH Keys → Add Key
  3. Once the key is registered, proceed with the key path they chose.
The same SSH key serves two purposes: authenticating with the API (signature exchange) and SSH access into running sessions.
Other requirements:
curl
,
jq
,
ssh-keygen
, and
openssl
must be available on the user's system.

执行任何API操作前,请确认用户已注册SSH密钥。询问用户:
你是否已在Mimiry账户上注册了SSH密钥?
如果是——询问密钥的路径(无默认路径)。身份验证脚本同时支持私钥路径和
.pub
公钥路径,会自动做标准化处理。
如果否——引导用户完成设置:
  1. 生成密钥(如果用户还没有密钥):
    bash
    ssh-keygen -t ed25519 -f ~/.ssh/mimiry -C "mimiry-softlaunch"
  2. 在Mimiry上注册密钥——用户需要通过Mimiry门户添加公钥(
    ~/.ssh/mimiry.pub
    )。目前没有密钥注册的API,引导用户访问:
    https://softlaunch.mimiry.com
    → 个人资料 → SSH密钥 → 添加密钥
  3. 密钥注册完成后,使用用户选择的密钥路径继续操作。
同一个SSH密钥有两个用途:API身份验证(签名交换)和运行中会话的SSH访问。
其他要求: 用户系统上必须安装
curl
jq
ssh-keygen
openssl

Part 1: API Operations (Always Available)

第一部分:API操作(始终可用)

These are the building blocks used by everything else.
这些是所有功能的基础组件。

Authentication

身份验证

The auth algorithm uses SSH signature exchange (not a simple API key). Always use the bundled auth script — do not re-implement the signing logic inline. The algorithm has several non-obvious details (message format, namespace, file-based signing) that are easy to get wrong.
bash
source SKILL_DIR/scripts/mimiry-auth.sh <ssh_key_path>
身份验证算法使用SSH签名交换(不是简单的API密钥)。请始终使用打包的验证脚本,不要自行实现签名逻辑。该算法有多个容易出错的非显式细节(消息格式、命名空间、基于文件的签名)。
bash
source SKILL_DIR/scripts/mimiry-auth.sh <ssh_key_path>

Exports: MIMIRY_TOKEN, MIMIRY_API

Exports: MIMIRY_TOKEN, MIMIRY_API


Tokens expire after 1 hour — re-authenticate if you get 401s.

**API base:** `https://softlaunch.mimiry.com`
**Compute prefix:** `/api/compute/v1`

> **CRITICAL — All commands MUST be wrapped in `bash -c`.**
> The Bash tool loads the user's shell profile, which can interfere with
> command execution. Always wrap the entire command in `bash -c '...'` to
> run in a clean, non-interactive shell.
>
> Shell state does not persist between Bash tool calls. Each call spawns a
> **new shell**. You MUST include `source` in every `bash -c` invocation.
> Never run `source` in one Bash call and use `$MIMIRY_API` / `$MIMIRY_TOKEN`
> in a separate one.

令牌有效期为1小时,如果返回401错误请重新验证。

**API根地址:** `https://softlaunch.mimiry.com`
**计算服务前缀:** `/api/compute/v1`

> **重要提示:所有命令必须包裹在`bash -c`中。**
> Bash工具会加载用户的shell配置文件,可能会干扰命令执行。请始终将完整命令包裹在`bash -c '...'`中,在干净的非交互式shell中运行。
>
> 不同Bash工具调用之间的shell状态不会持久化,每次调用都会生成一个**新的shell**。你必须在每次`bash -c`调用中都包含`source`命令,不要在一次Bash调用中运行`source`,然后在另一次调用中使用`$MIMIRY_API` / `$MIMIRY_TOKEN`。

Common Operations

常用操作

These commands are for the agent's own shell. Always include the
source
line. Never copy these verbatim into user-facing output — the variables won't exist in the user's terminal. When printing commands for the user, follow the "After Session Creation" section.
Every API call must be wrapped in
bash -c
with
source
included.
Check GPU availability (public — no auth required):
bash
bash -c 'curl -s "https://softlaunch.mimiry.com/api/compute/v1/availability?gpu_types=T4,V100,A100" | jq .'
The
gpu_types
parameter is required (comma-separated). Returns per-type availability with provider/zone details. Use this as a pre-flight check before creating sessions.
Check balance (do this before creating sessions):
bash
bash -c 'source SKILL_DIR/scripts/mimiry-auth.sh <ssh_key_path> && curl -s "${MIMIRY_API}/balance" -H "Authorization: Bearer $MIMIRY_TOKEN" | jq .'
List sessions:
bash
bash -c 'source SKILL_DIR/scripts/mimiry-auth.sh <ssh_key_path> && curl -s "${MIMIRY_API}/sessions" -H "Authorization: Bearer $MIMIRY_TOKEN" | jq .'
Get session details:
bash
bash -c 'source SKILL_DIR/scripts/mimiry-auth.sh <ssh_key_path> && curl -s "${MIMIRY_API}/sessions/$SESSION_ID" -H "Authorization: Bearer $MIMIRY_TOKEN" | jq .'
Get logs (session must be
running
):
bash
bash -c 'source SKILL_DIR/scripts/mimiry-auth.sh <ssh_key_path> && curl -s "${MIMIRY_API}/sessions/$SESSION_ID/logs?tail=50" -H "Authorization: Bearer $MIMIRY_TOKEN" | jq -r .logs'
  • HTTP 503 → VM still setting up, retry after
    retry_after_seconds
  • HTTP 409 → session not running, check status first
Terminate session:
bash
bash -c 'source SKILL_DIR/scripts/mimiry-auth.sh <ssh_key_path> && curl -s -X DELETE "${MIMIRY_API}/sessions/$SESSION_ID" -H "Authorization: Bearer $MIMIRY_TOKEN" | jq .'
Check quota:
bash
bash -c 'source SKILL_DIR/scripts/mimiry-auth.sh <ssh_key_path> && curl -s "${MIMIRY_API}/quota" -H "Authorization: Bearer $MIMIRY_TOKEN" | jq .'
Transaction history:
bash
bash -c 'source SKILL_DIR/scripts/mimiry-auth.sh <ssh_key_path> && curl -s "${MIMIRY_API}/transactions" -H "Authorization: Bearer $MIMIRY_TOKEN" | jq .'

这些命令是供Agent内部shell使用的,始终需要包含
source
行。请不要直接复制这些命令到面向用户的输出中
,这些变量在用户的终端中不存在。为用户打印命令时,请参考「会话创建完成后」部分的说明。
每个API调用都必须用
bash -c
包裹,且包含
source
命令。
查询GPU可用性(公开接口,无需验证):
bash
bash -c 'curl -s "https://softlaunch.mimiry.com/api/compute/v1/availability?gpu_types=T4,V100,A100" | jq .'
gpu_types
参数为必填项(逗号分隔)。返回每种GPU类型的可用性,附带服务商/可用区详情。创建会话前请使用该接口做预检。
查询余额(创建会话前执行):
bash
bash -c 'source SKILL_DIR/scripts/mimiry-auth.sh <ssh_key_path> && curl -s "${MIMIRY_API}/balance" -H "Authorization: Bearer $MIMIRY_TOKEN" | jq .'
列出会话:
bash
bash -c 'source SKILL_DIR/scripts/mimiry-auth.sh <ssh_key_path> && curl -s "${MIMIRY_API}/sessions" -H "Authorization: Bearer $MIMIRY_TOKEN" | jq .'
获取会话详情:
bash
bash -c 'source SKILL_DIR/scripts/mimiry-auth.sh <ssh_key_path> && curl -s "${MIMIRY_API}/sessions/$SESSION_ID" -H "Authorization: Bearer $MIMIRY_TOKEN" | jq .'
获取日志(会话必须处于
running
状态):
bash
bash -c 'source SKILL_DIR/scripts/mimiry-auth.sh <ssh_key_path> && curl -s "${MIMIRY_API}/sessions/$SESSION_ID/logs?tail=50" -H "Authorization: Bearer $MIMIRY_TOKEN" | jq -r .logs'
  • HTTP 503 → 虚拟机仍在设置中,请等待
    retry_after_seconds
    后重试
  • HTTP 409 → 会话未运行,请先检查会话状态
终止会话:
bash
bash -c 'source SKILL_DIR/scripts/mimiry-auth.sh <ssh_key_path> && curl -s -X DELETE "${MIMIRY_API}/sessions/$SESSION_ID" -H "Authorization: Bearer $MIMIRY_TOKEN" | jq .'
查询配额:
bash
bash -c 'source SKILL_DIR/scripts/mimiry-auth.sh <ssh_key_path> && curl -s "${MIMIRY_API}/quota" -H "Authorization: Bearer $MIMIRY_TOKEN" | jq .'
交易历史:
bash
bash -c 'source SKILL_DIR/scripts/mimiry-auth.sh <ssh_key_path> && curl -s "${MIMIRY_API}/transactions" -H "Authorization: Bearer $MIMIRY_TOKEN" | jq .'

Part 2: Job Building (When Creating Something New)

第二部分:任务构建(创建新资源时使用)

When the user wants to create a new compute job, gather the required information through natural conversation. Do not use
AskUserQuestion
with fixed option lists
— instead, ask plain questions and let the user respond in their own words. This produces a better experience because users often provide multiple answers at once, clarify context, or ask follow-up questions that rigid option menus can't accommodate.
当用户想要创建新的计算任务时,通过自然对话收集所需信息。不要使用带固定选项列表的
AskUserQuestion
,而是提出直白的问题,让用户用自己的话回答。这样体验更好,因为用户通常会一次性提供多个答案、补充上下文,或者提出固定选项菜单无法容纳的后续问题。

What to gather

需要收集的信息

Work through these in conversation, adapting to what the user has already told you (they may have answered several in their initial request):
  1. SSH key path — needed for auth and session SSH access
  2. Image — what container to run. Suggest common options if they're unsure:
    • PyTorch:
      nvcr.io/nvidia/pytorch:24.01-py3
    • TensorFlow:
      nvcr.io/nvidia/tensorflow:24.01-tf2-py3
    • Plain CUDA:
      nvcr.io/nvidia/cuda:12.3.1-devel-ubuntu22.04
    • Or any public image URI / custom Dockerfile
  3. GPU type — available types are
    T4
    ,
    V100
    , and
    A100
    . Default to T4 (cheapest) unless the user needs more power. Check the
    /availability
    endpoint to confirm the requested type is available before creating a session
  4. What to run — a command/script, or interactive SSH access?
  5. Session name — suggest a sensible default based on the image/task
Optional (only ask if relevant to what the user described):
  • Environment variables
  • Auto-terminate behavior (default:
    true
    if command,
    false
    if interactive)
  • Billing account (only for org billing)
Once you have enough information, authenticate, create the session, poll until running, and print management commands per "After Session Creation".

在对话中逐步收集以下信息,可以根据用户已经提供的内容灵活调整(用户可能在初始请求中已经回答了多个问题):
  1. SSH密钥路径——用于身份验证和会话SSH访问
  2. 镜像——要运行的容器。如果用户不确定可以推荐常用选项:
    • PyTorch:
      nvcr.io/nvidia/pytorch:24.01-py3
    • TensorFlow:
      nvcr.io/nvidia/tensorflow:24.01-tf2-py3
    • 基础CUDA:
      nvcr.io/nvidia/cuda:12.3.1-devel-ubuntu22.04
    • 或者任意公共镜像URI / 自定义Dockerfile
  3. GPU类型——可用类型为
    T4
    V100
    A100
    。默认使用T4(最便宜),除非用户需要更高算力。创建会话前请调用
    /availability
    接口确认请求的类型有可用资源
  4. 运行内容——是命令/脚本,还是交互式SSH访问?
  5. 会话名称——根据镜像/任务推荐一个合理的默认名称
可选字段(仅当和用户描述的内容相关时询问):
  • 环境变量
  • 自动终止行为(默认:运行命令则为
    true
    ,交互式访问则为
    false
  • 计费账户(仅组织计费需要)
收集到足够信息后,完成身份验证、创建会话、轮询直到会话运行,然后按照「会话创建完成后」部分的说明打印管理命令。

Creating the Session

创建会话

Agent-internal code — do not print this block to the user. All commands MUST be wrapped in
bash -c '...'
.
Regardless of how decisions were made, the session creation call looks like:
bash
bash -c 'source SKILL_DIR/scripts/mimiry-auth.sh <ssh_key_path> && PUB_KEY=$(cat "<ssh_key_path>.pub") && curl -s -X POST "${MIMIRY_API}/sessions" -H "Authorization: Bearer $MIMIRY_TOKEN" -H "Content-Type: application/json" -d '"'"'{"name": "<session_name>", "image": {"uri": "<image_uri>"}, "gpu": {"types": ["<gpu_type>"], "count": 1}, "ssh_enabled": true, "ssh_public_key": "'"'"'"'"'"'"'"'"'$PUB_KEY'"'"'"'"'"'"'"'"'", "command": "<command_or_null>", "auto_terminate": <true|false>}'"'"' | jq .'
Tip: The JSON body quoting is complex. A cleaner approach is to build the JSON with jq:
bash
bash -c 'source SKILL_DIR/scripts/mimiry-auth.sh <ssh_key_path> && PUB_KEY=$(cat "<ssh_key_path>.pub") && JSON=$(jq -n --arg name "<session_name>" --arg image "<image_uri>" --arg gpu "<gpu_type>" --arg key "$PUB_KEY" --arg cmd "<command>" '"'"'{name: $name, image: {uri: $image}, gpu: {types: [$gpu], count: 1}, ssh_enabled: true, ssh_public_key: $key, command: $cmd, auto_terminate: false}'"'"') && curl -s -X POST "${MIMIRY_API}/sessions" -H "Authorization: Bearer $MIMIRY_TOKEN" -H "Content-Type: application/json" -d "$JSON" | jq .'
Field guide:
FieldWhenValue
command
User has a script to runThe command string
command
Interactive accessOmit entirely
auto_terminate
Has a command
true
or
{"mode":"on_complete"}
auto_terminate
Interactive / long-running
false
or
{"mode":"never"}
auto_terminate
Only terminate on success
{"mode":"on_success"}
ssh_public_key
Always requiredContents of
<key>.pub
gpu.types
User doesn't specify
["T4"]
(cheapest). Valid:
T4
,
V100
,
A100
environment_vars
User needs env config
{"KEY": "value", ...}
billing.account_type
Org billing
"org"
+
account_id
Agent内部代码——不要把这段代码打印给用户。所有命令必须包裹在
bash -c '...'
中。
无论决策过程如何,会话创建调用的格式如下:
bash
bash -c 'source SKILL_DIR/scripts/mimiry-auth.sh <ssh_key_path> && PUB_KEY=$(cat "<ssh_key_path>.pub") && curl -s -X POST "${MIMIRY_API}/sessions" -H "Authorization: Bearer $MIMIRY_TOKEN" -H "Content-Type: application/json" -d '"'"'{"name": "<session_name>", "image": {"uri": "<image_uri>"}, "gpu": {"types": ["<gpu_type>"], "count": 1}, "ssh_enabled": true, "ssh_public_key": "'"'"'"'"'"'"'"'"'$PUB_KEY'"'"'"'"'"'"'"'"'", "command": "<command_or_null>", "auto_terminate": <true|false>}'"'"' | jq .'
提示: JSON体的引号处理比较复杂,更简洁的方式是用jq构建JSON:
bash
bash -c 'source SKILL_DIR/scripts/mimiry-auth.sh <ssh_key_path> && PUB_KEY=$(cat "<ssh_key_path>.pub") && JSON=$(jq -n --arg name "<session_name>" --arg image "<image_uri>" --arg gpu "<gpu_type>" --arg key "$PUB_KEY" --arg cmd "<command>" '"'"'{name: $name, image: {uri: $image}, gpu: {types: [$gpu], count: 1}, ssh_enabled: true, ssh_public_key: $key, command: $cmd, auto_terminate: false}'"'"') && curl -s -X POST "${MIMIRY_API}/sessions" -H "Authorization: Bearer $MIMIRY_TOKEN" -H "Content-Type: application/json" -d "$JSON" | jq .'
字段说明:
字段场景
command
用户有要运行的脚本命令字符串
command
交互式访问完全省略该字段
auto_terminate
有运行命令
true
{"mode":"on_complete"}
auto_terminate
交互式/长期运行
false
{"mode":"never"}
auto_terminate
仅成功时终止
{"mode":"on_success"}
ssh_public_key
始终必填
<key>.pub
的内容
gpu.types
用户未指定
["T4"]
(最便宜)。有效值:
T4
,
V100
,
A100
environment_vars
用户需要环境配置
{"KEY": "value", ...}
billing.account_type
组织计费
"org"
+
account_id

Session Lifecycle

会话生命周期

Two dimensions:
  • state
    (durable milestone):
    submitted → provisioned → started → completed/failed/stopped → terminated
  • status
    (transient):
    provisioning
    ,
    pulling_image
    ,
    starting_container
    ,
    running
    ,
    stopping_container
    ,
    terminating
POST /sessions → state:submitted → state:provisioned                            → state:started → state:completed
                 status:provisioning  status:pulling_image  status:starting_container  status:running      ↓
                                                                                                     state:terminated
                                              DELETE /sessions/{id}
                                              state:stopped → state:terminated

On error at any stage → state:failed or state:provision_failed
Poll every 5 seconds until
started
(agent-internal, not user-facing). The entire loop MUST be in a single
bash -c
call:
bash
bash -c 'source SKILL_DIR/scripts/mimiry-auth.sh <ssh_key_path> && while true; do RESP=$(curl -s "${MIMIRY_API}/sessions/$SESSION_ID" -H "Authorization: Bearer $MIMIRY_TOKEN"); STATE=$(echo "$RESP" | jq -r .state); STATUS=$(echo "$RESP" | jq -r .status); echo "State: $STATE | Status: $STATUS"; case "$STATE" in started) break ;; failed|provision_failed) echo "FAILED: $(echo $RESP | jq -r .error)"; break ;; completed|terminated|stopped) echo "Session ended unexpectedly"; break ;; esac; sleep 5; done'
Once running, extract SSH details from
$RESP
(still in the same shell) and then print user-facing management commands per the "After Session Creation" section below. Include the SSH command with resolved values:
bash
undefined
包含两个维度:
  • state
    (持久化里程碑):
    submitted → provisioned → started → completed/failed/stopped → terminated
  • status
    (临时状态):
    provisioning
    ,
    pulling_image
    ,
    starting_container
    ,
    running
    ,
    stopping_container
    ,
    terminating
POST /sessions → state:submitted → state:provisioned                            → state:started → state:completed
                 status:provisioning  status:pulling_image  status:starting_container  status:running      ↓
                                                                                                     state:terminated
                                              DELETE /sessions/{id}
                                              state:stopped → state:terminated

任何阶段出错 → state:failed 或 state:provision_failed
每5秒轮询一次直到状态变为
started
(Agent内部操作,不对用户展示)。整个轮询循环必须放在单个
bash -c
调用中:
bash
bash -c 'source SKILL_DIR/scripts/mimiry-auth.sh <ssh_key_path> && while true; do RESP=$(curl -s "${MIMIRY_API}/sessions/$SESSION_ID" -H "Authorization: Bearer $MIMIRY_TOKEN"); STATE=$(echo "$RESP" | jq -r .state); STATUS=$(echo "$RESP" | jq -r .status); echo "State: $STATE | Status: $STATUS"; case "$STATE" in started) break ;; failed|provision_failed) echo "FAILED: $(echo $RESP | jq -r .error)"; break ;; completed|terminated|stopped) echo "Session ended unexpectedly"; break ;; esac; sleep 5; done'
会话运行后,从
$RESP
中提取SSH详情(仍在同一个shell中),然后按照下文「会话创建完成后」部分的说明打印面向用户的管理命令。包含替换了实际值的SSH命令:
bash
undefined

Extract from $RESP (in the same bash -c call as the polling loop above):

从$RESP中提取(在和上述轮询循环同一个bash -c调用中):

SSH_HOST=$(echo "$RESP" | jq -r '.ssh.host')
SSH_HOST=$(echo "$RESP" | jq -r '.ssh.host')

Then print for the user (with actual values substituted):

然后打印给用户(替换为实际值):

ssh -i <key_path> -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null <host>

ssh -i <key_path> -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null <host>

Plus the mirc helper commands — see "After Session Creation"

加上mirc辅助命令——参考「会话创建完成后」部分


> **Note:** SSH sessions connect through the ssh-proxy on port 22 (the
> default SSH port), which lands users directly inside their container.
> No special port or username is needed — just `ssh -i <key> <host>`.

---

> **注意:** SSH会话通过22端口的ssh-proxy连接(默认SSH端口),用户会直接进入自己的容器。不需要特殊端口或用户名,只需执行`ssh -i <key> <host>`即可。

---

After Session Creation

会话创建完成后

Once a session is running, print management commands the user can copy-paste into their terminal. There is a critical rule: never print commands that contain unresolved shell variables like
${MIMIRY_API}
or
$MIMIRY_TOKEN
— those only exist inside the agent's shell, not in the user's terminal. Either use the
mirc
helper (which handles auth internally) or print fully resolved URLs with the auth source command included.
会话运行后,打印用户可以复制粘贴到终端的管理命令。有一条核心规则:永远不要打印包含未解析shell变量(如
${MIMIRY_API}
$MIMIRY_TOKEN
)的命令,这些变量仅存在于Agent的shell中,用户终端里没有。可以使用
mirc
辅助工具(内部处理身份验证),或者打印完全解析的URL,包含身份验证的source命令。

Default: Quick Commands (mirc helper)

默认:快速命令(mirc辅助工具)

Print these by default. Replace
<session_id>
and
<key_path>
with the actual values from the session that was just created:
undefined
默认打印这些命令,将
<session_id>
<key_path>
替换为刚创建会话的实际值:
undefined

Manage your session (run in any terminal):

管理你的会话(可在任意终端运行):

mirc status <session_id> --key <key_path> mirc logs <session_id> mirc ssh <session_id> mirc terminate <session_id>

The `--key` flag is only needed on the first command — the path is cached
for subsequent calls. If the user has already run a `mirc` command in this
terminal session, `--key` can be omitted entirely.

The helper script lives at:
`SKILL_DIR/scripts/mirc.sh`

If the user hasn't added it to their PATH, print the full path on first use.
For convenience, suggest:
```bash
alias mirc='SKILL_DIR/scripts/mirc.sh'
mirc status <session_id> --key <key_path> mirc logs <session_id> mirc ssh <session_id> mirc terminate <session_id>

`--key`参数仅在第一个命令中需要,后续调用会缓存路径。如果用户已经在当前终端会话中运行过`mirc`命令,可以完全省略`--key`。

辅助脚本的路径为:`SKILL_DIR/scripts/mirc.sh`

如果用户没有将它添加到PATH中,第一次使用时打印完整路径。为了方便,可以建议:
```bash
alias mirc='SKILL_DIR/scripts/mirc.sh'

Alternative: Raw API Commands

替代方案:原生API命令

Print these when the user asks about automation, pipelines, CI/CD, or wants to understand what's happening under the hood. Always include the auth source command so the variables are defined:
bash
undefined
当用户询问自动化、流水线、CI/CD,或者想了解底层实现时打印这些命令。始终包含身份验证的source命令,这样变量会被定义:
bash
undefined

Authenticate (sets $MIMIRY_TOKEN for 1 hour, re-run to refresh):

身份验证(设置$MIMIRY_TOKEN,有效期1小时,重新运行即可刷新):

source SKILL_DIR/scripts/mimiry-auth.sh <key_path>
source SKILL_DIR/scripts/mimiry-auth.sh <key_path>

Check status:

查看状态:

curl -s "https://softlaunch.mimiry.com/api/compute/v1/sessions/<session_id>"
-H "Authorization: Bearer $MIMIRY_TOKEN" | jq .
curl -s "https://softlaunch.mimiry.com/api/compute/v1/sessions/<session_id>"
-H "Authorization: Bearer $MIMIRY_TOKEN" | jq .

Get logs:

获取日志:

curl -s "https://softlaunch.mimiry.com/api/compute/v1/sessions/<session_id>/logs?tail=50"
-H "Authorization: Bearer $MIMIRY_TOKEN" | jq -r '.logs'
curl -s "https://softlaunch.mimiry.com/api/compute/v1/sessions/<session_id>/logs?tail=50"
-H "Authorization: Bearer $MIMIRY_TOKEN" | jq -r '.logs'

Terminate:

终止会话:

curl -s -X DELETE "https://softlaunch.mimiry.com/api/compute/v1/sessions/<session_id>"
-H "Authorization: Bearer $MIMIRY_TOKEN" | jq .

Note: in raw commands, always use the fully resolved URL
(`https://softlaunch.mimiry.com/api/compute/v1/...`), never `${MIMIRY_API}`.
The only variable that's acceptable is `$MIMIRY_TOKEN` because the `source`
command on the line above defines it.
curl -s -X DELETE "https://softlaunch.mimiry.com/api/compute/v1/sessions/<session_id>"
-H "Authorization: Bearer $MIMIRY_TOKEN" | jq .

注意:在原生命令中,始终使用完全解析的URL(`https://softlaunch.mimiry.com/api/compute/v1/...`),不要使用`${MIMIRY_API}`。唯一可以接受的变量是`$MIMIRY_TOKEN`,因为上一行的`source`命令已经定义了它。

Token Expiry Guidance

令牌过期指引

Tokens last 1 hour. When printing post-session commands, mention:
  • The
    mirc
    helper auto-refreshes tokens (no action needed)
  • For raw API commands, re-run the
    source
    command to get a fresh token
  • If a command returns HTTP 401, the token has expired

令牌有效期为1小时。打印会话后命令时,说明:
  • mirc
    辅助工具会自动刷新令牌(无需用户操作)
  • 对于原生API命令,重新运行
    source
    命令获取新令牌
  • 如果命令返回HTTP 401,说明令牌已过期

Error Reference

错误参考

ErrorMeaningFix
Invalid SSH signature
Auth algorithm wrongEnsure the bundled auth script is being used
Timestamp expired
Clock drift > 5 minSync system clock
SSH key not registered
Key not on accountRegister key in Mimiry portal
insufficient_balance
No creditsAsk admin to add credits
no_balance
No billing accountAsk admin to create one
vm_setup_in_progress
(503)
VM bootingRetry after
retry_after_seconds
invalid_state
(409)
Wrong session state for operationCheck session status
错误含义解决方案
Invalid SSH signature
身份验证算法错误确保使用了打包的身份验证脚本
Timestamp expired
时钟偏差超过5分钟同步系统时钟
SSH key not registered
密钥未在账户中注册在Mimiry门户注册密钥
insufficient_balance
额度不足请管理员添加额度
no_balance
没有计费账户请管理员创建计费账户
vm_setup_in_progress
(503)
虚拟机正在启动等待
retry_after_seconds
后重试
invalid_state
(409)
会话状态不支持当前操作检查会话状态

Tips

提示

  • ALWAYS wrap commands in
    bash -c '...'
    — the Bash tool's default shell loads user profile scripts that can interfere with command execution.
    bash -c
    runs in a clean non-interactive shell, avoiding these issues.
  • The same SSH key authenticates with the API and provides session SSH access
  • Billing runs from provisioning to termination — remind users to terminate idle sessions
  • Available GPUs:
    T4
    (cheapest),
    V100
    ,
    A100
    . Only suggest these three — no other GPU types are enabled on the softlaunch platform
  • When generating scripts for the user, include error handling for common failure modes (402 insufficient balance, 429 quota exceeded)
  • Exploration vs. automation: Default to
    mirc
    helper commands for interactive use. Switch to raw curl commands when the user mentions pipelines, CI/CD, scripting, or automation — and always include the full auth
    source
    command so the commands are self-contained
  • Never print unresolved variables in user-facing commands.
    ${MIMIRY_API}
    and
    $MIMIRY_TOKEN
    only exist inside the agent's shell session. See the "After Session Creation" section for the correct patterns
  • 始终将命令包裹在
    bash -c '...'
    ——Bash工具的默认shell会加载用户配置脚本,可能干扰命令执行。
    bash -c
    在干净的非交互式shell中运行,可以避免这些问题。
  • 同一个SSH密钥同时用于API身份验证和会话SSH访问
  • 计费从资源分配开始到会话终止结束——提醒用户终止空闲会话
  • 可用GPU:
    T4
    (最便宜)、
    V100
    A100
    。仅推荐这三种,软发布平台没有启用其他GPU类型
  • 为用户生成脚本时,包含常见故障模式的错误处理(402余额不足、429配额超出)
  • 探索使用 vs 自动化使用:交互式使用默认推荐
    mirc
    辅助命令。当用户提及流水线、CI/CD、脚本或自动化时,切换到原生curl命令,并且始终包含完整的身份验证
    source
    命令,保证命令可以独立运行
  • 永远不要在面向用户的命令中打印未解析的变量
    ${MIMIRY_API}
    $MIMIRY_TOKEN
    仅存在于Agent的shell会话中,正确的写法参考「会话创建完成后」部分