zcode-subagent
БесплатноЗапускает вложенные скриптыНе проверенDelegate a coding task to a ZCode (GLM) subagent and get the result back. Use when the current agent should hand off or parallelize coding work. Keywords…
от itechmeat★ 24 звезды на GitHubОб этом скилле
ZCode Subagent
Lets the current agent call the ZCode (z.ai, GLM engine) desktop app as a coding subagent: hand it a task, then detect completion and read the result, all from the shell. The calling agent dispatches a prompt into the app, detects when the turn finishes, and reads a small structured digest of the result. It never screenshots or scrapes the full transcript, so the caller spends a fixed, tiny token cost per task regardless of how long ZCode worked.
When to use
- You (a parent agent) need to hand a coding task to ZCode and understand the outcome cheaply.
- You want ZCode automation without a standalone z.ai API key (the app's logged-in "coding plan" is enough).
- You need a follow-up prompt in the same ZCode conversation.
Why the desktop app, not the headless CLI
ZCode ships a headless CLI (ZCode.app/Contents/Resources/glm/zcode.cjs -p), and
it loads and reaches the API. But the "coding plan" endpoint (.../zcode-plan/...)
gates every model request behind an interactive Aliyun captcha that only the
app's webview solves, so headless prompts fail with code 3007 captcha verify failed. Driving the app reuses the already-solved captcha and needs no API key.
Non-model CLI commands (doctor, skills list --json, plugins list --json) do
work headless. Full internals: references/architecture.md.
Do not pre-check or pre-install anything
Just run the script. It resolves its own dependencies and fails with a clear, actionable message naming exactly what is missing. Only when a run actually fails that way do you diagnose - and even then, confirm the thing is really absent before installing (never install on a first negative signal). Pre-emptively "checking prerequisites" wastes turns and, worse, tends to reinstall software that is already present.
Dependencies (for reference when a run does fail): ZCode.app signed in;
agent-browser (drives the app over CDP); node; python3; curl (macOS
also uses open + osascript).
- agent-browser is the common false alarm: its PATH symlink is frequently
broken, so
command -v agent-browserprints nothing while the package is fully installed undernpm root -g- and the script resolves the real binary there. So a barecommand -vmiss is NOT proof it is absent. Only if the script itself dies with "agent-browser not found" do you checkls "$(npm root -g)/agent-browser/bin/agent-browser.js", and only if that is also missing recommendnpm i -g agent-browser && agent-browser install(do not install silently). Seereferences/installation.md. - ZCode.app missing/not signed in: download from https://zcode.z.ai and log in once (that solves the captcha in-app).
Only macOS auto-launch is implemented. On other platforms, start ZCode manually
with --remote-debugging-port=<port> and pass --port.
The recipe (three cheap layers)
- Dispatch a prompt into the app (new task or follow-up).
- Wait for free: block in the shell until the turn finishes; do not re-read
the screen. Completion is a DB fact (
message.finishis set) or the structured eventturn.completedin the JSONL log. - Digest: read one compact JSON record from the local session DB - model,
finish reason, tokens, one row per tool call, and the final text. Cross-check
file changes with
git -C <workspace> diff --stat(ground truth).
Escalate to expensive detail (a failing tool's stderr, git diff <file>) ONLY
when the digest flags a problem (error, destructive edit, unexpected diff).
Usage
One shot (dispatch + wait + digest):
python3 scripts/zcode_agent.py run "Refactor the parser and run the tests"
Follow-up in the same conversation:
python3 scripts/zcode_agent.py run --follow "Now add a test for empty input"
Split control (capture the session id, then wait/digest yourself):
SID=$(python3 scripts/zcode_agent.py send --new "Fix the flaky test")
python3 scripts/zcode_agent.py wait --session "$SID" --timeout 900
python3 scripts/zcode_agent.py digest --session "$SID"
Sample digest (bounded regardless of run length):
{"session":"sess_3de8a03","model":"GLM-5.2","mode":"build","finish":"stop",
"tokens":11048,"tools":[],"final":"PONG-PONG-PONG",
"wait":{"status":"done","finish":"stop"}}
Point ZCode at the right directory
Every task is bound to the workspace folder open at dispatch (ZCode derives a project from that directory; a new task inherits it). Check and, when possible, switch it:
python3 scripts/zcode_agent.py workspace # print the open dir
python3 scripts/zcode_agent.py workspace --set /abs/path # switch to a registered project
--set works only when that folder is an already-registered ZCode project
(previously opened) - it switches via the command palette. Opening a brand-new
folder is "Open workspace" (Cmd+O), which is a native OS picker the CDP layer
cannot drive; if the target has never been opene
Установить zcode-subagent в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл zcode-subagent?
Delegate a coding task to a ZCode (GLM) subagent and get the result back. Use when the current agent should hand off or parallelize coding work. Keywords: ZCode, GLM, subagent, delegate, offload.
Как установить скилл zcode-subagent?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл zcode-subagent запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic