Skip to main content
subagent CX Codex

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

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/agents/zai-cli.md
Open on GitHub

What 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.md

For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

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

Similar subagents

All subagents for Agent setup: memory, context, orchestration →

From the same set35

The whole set →
get-current-datetime get-current-datetime — a subagent that runs the date command with a specified timezone and returns only the raw output. Use it when you need the current date and time in a prompt without extra commentary. CX Codex ★ 2,744repo stars 10_instruction_stress 10_instruction_stress is a Claude Code prompt that tests whether a model follows four simultaneous constraints while describing an imaginary coffee shop. GP ChatGPT ★ 2,744repo stars 05_tool_heavy_task The 05_tool_heavy_task prompt has Claude Code read three files one at a time, then sum up Meridian’s testing strategy in a single paragraph. It also tests whether the agent makes separate tool calls. GP ChatGPT ★ 2,744repo stars codex-cli Calls OpenAI Codex CLI from inside Claude Code. Handy when you want a GPT-5.2 take on code without switching tools. CX Codex ★ 2,744repo stars 09_typescript_refactor 09_typescript_refactor is a Claude Code prompt that makes TypeScript functions easier to read. It asks for a code block and a short explanation. GP ChatGPT ★ 2,744repo stars 02_english_prose 02_english_prose rewrites an English paragraph to remove every comma. You can restructure sentences and use other punctuation while preserving the meaning. GP ChatGPT ★ 2,744repo stars 08_csv_transform 08_csv_transform aggregates tabular order entries into customer spending totals and returns raw CSV without conversational filler. GP ChatGPT ★ 2,744repo stars 04_stack_trace_debug The 04_stack_trace_debug prompt asks Claude Code to find the cause of a Python stack trace, identify the failing call, and suggest a fix. Use it when you need a compact diagnosis. GP ChatGPT ★ 2,744repo stars

Project sponsors

Companies that keep this analytics open