From minimax
Internal helper contract for calling the minimax-companion runtime from Claude Code. v0.1 — finalized after 13 Phase 0 probes against Mini-Agent 0.1.0.
How this skill is triggered — by the user, by Claude, or both
Slash command
/minimax:minimax-cli-runtimeThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Internal contract for code invoking `scripts/minimax-companion.mjs`. Not user-facing. Claude uses this when dispatched via `/minimax:*` commands or the `minimax-agent` subagent (Phase 4).
Internal contract for code invoking scripts/minimax-companion.mjs. Not user-facing. Claude uses this when dispatched via /minimax:* commands or the minimax-agent subagent (Phase 4).
mini-agent CLI ≥ 0.1.0 on PATH (installed via uv tool install --with socksio git+https://github.com/MiniMax-AI/Mini-Agent.git)~/.mini-agent/config/config.yaml present with valid api_key (not placeholder YOUR_API_KEY_HERE)| Subcommand | Purpose | JSON shape |
|---|---|---|
setup --json | Check availability + auth | {installed, version, authenticated, authReason, authDetail, model, apiBase, apiKeyMasked, configPath, installers} |
write-key --api-key <k> [--api-base <u>] [--json] | Atomic YAML api_key write | {ok, reason?, form?, lineNumber?} |
Phase 2+ subcommands: ask, review, task, status, result, cancel, task-resume-candidate, adversarial-review.
--task one-shot stabilitymini-agent --version returns mini-agent 0.1.0mini-agent -t "<prompt>" -w <cwd>;自然退出率 5/5Log file: <absolute>.log 出现在 stdout 前 30 行内(P0.1 实测约在 line 27)[0m 后缀等),使用前必 strip~/.mini-agent/log/agent_run_YYYYMMDD_HHMMSS.log(秒级 timestamp)^\[(\d+)\]\s+(REQUEST|RESPONSE|TOOL_RESULT)$;log_index 跨 kind 连续递增= × 80 / block 分隔 - × 80(parser 必须区分,不能用 ^[=-]{80}$){
"content": "<string, assistant text reply>",
"thinking": "<optional string>",
"tool_calls": [{"id": "...", "name": "...", "arguments": {...}}],
"finish_reason": "stop|length|tool_calls|tool_use|content_filter"
}
finish_reason ∈ {stop, length, tool_calls, tool_use, content_filter, max_tokens, stop_sequence} 或非空 content 字符串的 blocklog_response → 日志里 0 个 RESPONSE block(agent.py:371 行为)——这是预期行为fs.watch 实时订阅无效-t "<prompt>" 可达 210KB+(macOS ARG_MAX 1MB,Linux 128KB+)callMiniAgent 直接 argv 传,不做 tmpfile 备选"Please configure a valid API Key" — 仅当 api_key 是 placeholder / 空"Configuration file not found" — config.yaml 不存在"ImportError: Using SOCKS proxy" — httpx 缺 socksio extra"Retry failed" — LLM retry 耗尽(命中 8/16 场景:401 × 4 + invalid_model × 4)"Session Statistics:" — stdout 尾部总结(正常 + 401 失败都有)"Log file:" — 前 30 行内(含 emoji 前缀,匹配用 contains)authReason 合并归 llm-call-failedwithLockAsync 必要;MINI_AGENT_LOCK_PATH 支持 env 覆盖(测试用)mini-agent --workspace <path> 不改 config 搜索路径(只改 workspace_dir)cd <path> 后 cwd 命中 <cwd>/mini_agent/config/config.yaml 才读局部 configcwd/mini_agent/config/ → (2) ~/.mini-agent/config/ → (3) package 内置find_config_file 接受 workspace 注入,要么用 cd-into-workspace workaroundYOUR_API_KEY_HERE)Authorization: Bearer <key> header)eyJ...(JWT-like,MiniMax 平台主力) / sk-...(Anthropic-style)os.environ 调用MINIMAX_API_KEY=xxx 无效job-control.mjs 必须串行化 job 调度(一次只允许一个 mini-agent 在跑)mini-agent log <file> subcommandcat 原文件基本相同(仅头尾 ANSI 装饰行:前 3 行 + 后 2 行)~/.mini-agent/log/<filename>)doc/probe/fixtures/p12-antipatterns/ 含 7 个 fixture,用于 validateYamlForApiKeyWrite 单元测试:
multiline-block-scalar.yaml / duplicate-key.yaml / flow-style.yaml / anchor-alias.yaml / bom.yaml / plain-scalar.yamlupstream-placeholder.yaml(Mini-Agent 官方 config-example.yaml 形态:api_key: "YOUR_API_KEY_HERE" # comment)writeMiniAgentApiKey (Task 1.7) 实现:
fsync(fd) + fsync(dirFd) + renamewithLockAsync(MINI_AGENT_LOCK_PATH, fn) with stale-lock recovery(PID 校验 + mtime 60s + 损坏文件 auto-unlink + 3×100ms retry)P0.10 结论:snapshot-diff 归属不可靠。Phase 4 job-control 必须串行化。当前 v0.1 的 /minimax:setup + /minimax:ask 一次只起一个子进程,不受影响。Phase 4 /minimax:rescue --background 必须排队。
Secrets 不可出现在: argv, state.json, jobs/*/meta.json, CHANGELOG.md, probe 报告, Claude-visible diagnostic bundles。
redactSecrets regex(Task 1.7):
text.replace(/sk-[A-Za-z0-9_\-\.]{20,}/g, "sk-***REDACTED***")
.replace(/eyJ[A-Za-z0-9_\-\.]{20,}/g, "eyJ***REDACTED***")
/minimax:rescue --resume-last 等价于新建 session + 提示 "v0.1 no resumable session"--approval-mode(Mini-Agent 无此概念)~/.mini-agent/(唯二例外:config/.lock 和 config/config.yaml::api_key,都在 withLockAsync 保护下)mini-agent log <filename> fallback 作为主路径——它是 best-effort,失败只记录mini-agent -t spawn 能从 Log file: 行唯一定位(秒级 timestamp 会同名;Phase 4 必须串行)npx claudepluginhub bbingz/minimax-plugin-cc --plugin minimaxCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.