The open-source, GLM-native terminal coding agent.
Run GLM straight from your terminal — a headless one-shot for scripts and CI, or a full interactive TUI — on your own GLM Coding Plan.
English · 中文
npx zagent -p "Add a --json flag to cli.py and update the tests"Unofficial. Not affiliated with or endorsed by Z.ai. zagent ships no Z.ai binaries — it drives the ZCode runtime you already installed, on your own account.
zagent turns your GLM Coding Plan into a first-class terminal coding agent. It speaks the ZCode runtime's protocol directly, so you get the same GLM engine Z.ai ships in its desktop app — scriptable, headless, and in the terminal where you already work.
- 🚀 Headless or interactive —
zagent -p "…" --jsonfor scripts, CI and pipelines; or a full TUI. - 🔌 Your plan, your machine — runs on your own GLM Coding Plan and installed runtime. Nothing bundled, nothing phoned home.
- 🧰 Batteries included — quota, sessions, diffs, memory, scheduled prompts, and plugins, all from the CLI.
- 🖥️ Cross-platform — discovers your runtime on Linux, macOS, and Windows.
- 🪶 Tiny & honest — a thin protocol client; your prompts and credentials never leave your machine except to your own provider.
npm install -g zagent # or run ad-hoc: npx zagent
zagent doctor # checks your runtime + Coding Plan setup
zagent -p "Explain this repo" # headless one-shot
zagent # interactive TUI- Node.js ≥ 22.5
- A GLM Coding Plan and your own installed ZCode runtime — the third-party
zcode-app-cli(required for the interactive TUI) or the ZCode desktop bundle (headless).
zagent runs on your GLM Coding Plan subscription — not a metered pay-per-token API key.
Provide your Coding Plan credential once and zagent writes a local, 0600 config:
export ZAI_API_KEY=<your GLM Coding Plan credential> # or reuse ~/.config/ccz/.api_key
zagent doctor --fix # writes ~/.zcode/cli/config.jsonzagent doctor tells you exactly what's missing. Your credential stays on your machine and is
sent only to your own provider endpoint.
| Command | What it does |
|---|---|
zagent -p "…" [--json] |
Headless one-shot (retry-safe) |
zagent |
Interactive TUI |
zagent onboard |
First-run: checks + live smoke + guidance |
zagent doctor [--fix] |
Runtime / Coding-Plan / config diagnosis |
zagent models [query] |
Search the model catalog |
zagent quota [balance|preview|reset] |
Coding-Plan usage |
zagent sessions |
Your task store, in the terminal |
zagent diff [sessionId] |
Per-turn / per-file changes |
zagent memory show|index|append |
Runtime-compatible memory |
zagent cron add|list|tick |
Scheduled prompts |
zagent plugins |
Manage local plugins |
za is a short alias for zagent.
zagent is a thin, protocol-first client. It discovers a compatible runtime — ZCODE_RUNTIME
first, then zcode-app-cli, then the ZCode desktop bundle per OS — and drives it over its native
protocol. It ships no runtime binaries and uses your Coding Plan. Running it can make real
requests and execute tools with your permissions, so use trusted workspaces and review changes.
Not auto-discovered? Point at it explicitly:
export ZCODE_RUNTIME=/absolute/path/to/runtime-entry.cjsRuntime discovery covers Linux, macOS, and Windows (unit-tested across all three). Linux is fully validated; macOS and Windows are supported at the code level and being hardened against every GUI install layout.
Task, memory, diff, and quota output can contain private workspace, prompt, or account data. Redact before sharing logs, and never commit credentials or config files.
Issues and PRs are welcome — see CONTRIBUTING and SECURITY. Questions and ideas go in Discussions.
MIT — for non-commercial, personal interoperability and research. You are responsible for complying with Z.ai's terms for your own account. See NOTICE for the interoperability disclaimer.