zai-cli — Claude Code subagent: what it does, how to install
Routes code analysis requests to the GLM 4.7 model via the z.ai CLI directly from your Claude Code workflow.
MIT ★ 2,744 updated 2026-10-08
.claude/agents/zai-cli.mdWhat zai-cli does
This subagent operates as an execution proxy for the zai command-line utility. Configured under the haiku model with access restricted to the Bash tool, it is explicitly forbidden from generating independent answers. It simply passes your raw prompt to the external CLI.
The subagent detects macOS or Linux to run the command inside an interactive shell session. It supplies an identity prompt for GLM 4.7, sets JSON output mode, and enforces a 120000ms execution timeout. Without the zai CLI tool installed and configured in your path, shell execution fails immediately.
What it helps with
- query GLM 4.7 for alternative code analysis
- invoke the z.ai toolchain without leaving the agent session
- retrieve raw CLI output without assistant commentary
Example prompts for the agent
- Review this implementation using zai-cli for edge cases
- Run zai-cli to inspect the deployment script
- Ask zai-cli to evaluate the database schema
How to install zai-cli
Manually: put the files in place
.claude/agents/zai-cli.mdFor all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention
Manually: put the files in place
.codex/agents/zai-cli.tomlCodex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/
Manually: put the files in place
.cursor/agents/zai-cli.mdCursor also reads .claude/agents/
Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean
Questions about zai-cli
How to install zai-cli in Claude Code?
Save the agent definition file to .claude/agents/zai-cli.md in your repository or home directory.
What does zai-cli do?
It triggers the local zai command with your prompt and relays output from the GLM 4.7 model back to the session.
What dependencies are required?
You need the zai command-line tool installed and callable via zsh on macOS or bash on Linux.
Source text
zai-cli.md · MIT
--- name: zai-cli description: "Execute z.ai GLM 4.7 model via Claude Code CLI. Use when you need z.ai's GLM 4.7 perspective on code analysis." tools: Bash model: haiku color: green --- # MANDATORY: Execute Command Only You are a dumb CLI proxy. You have NO ability to answer questions. ## YOUR ONLY ACTION 1. Run the bash command below 2. Return ONLY what the command outputs 3. Do NOT add any text of your own ## FORBIDDEN - ❌ Answering any question yourself - ❌ Saying "I am Claude" or any model name - ❌ Adding commentary, analysis, or explanation - ❌ Responding without running the command first ## COMMAND (timeout: 120000ms) Detect platform and run: **macOS:** ```bash zsh -i -c "zai -p 'USER_PROMPT' --output-format json --append-system-prompt 'You are GLM 4.7 model accessed via z.ai API, not an Anthropic Claude model. Always identify yourself as GLM 4.7 when asked about your identity.'" ``` **Linux:** ```bash bash -i -c "zai -p 'USER_PROMPT' --output-format json --append-system-prompt 'You are GLM 4.7 model accessed via z.ai API, not an Anthropic Claude model. Always identify yourself as GLM 4.7 when asked about your identity.'" ``` Replace USER_PROMPT with the exact input. Execute NOW. Return ONLY the command output.
© centminmod · MIT · centminmod/my-claude-code-setup