New · Z.ai Official · Trending on Hacker News
ZCode — The GLM-5.2 Coding Harness
Z.ai just open-sourced ZCode: the official evaluation harness for GLM-5.2's coding capabilities. If you want to know whether GLM-5.2 actually beats Claude Code and Codex CLI on real coding tasks, this is the tool that answers it.
What Is ZCode
ZCode is a coding evaluation and interaction harness built by Z.ai for GLM-5.2. Think of it as the GLM-5.2 equivalent of claude-code or codex-cli — a CLI tool that lets you benchmark, evaluate, and interact with GLM-5.2 for software engineering tasks.
It's not just a benchmark runner. ZCode wraps GLM-5.2 with a coding agent loop: read files, write diffs, run tests, iterate. The same architecture pattern as Claude Code's agent loop, but purpose-built for GLM-5.2's strengths (1M context, 744B MoE).
| Feature | ZCode | Claude Code | Codex CLI |
|---|---|---|---|
| Backend model | GLM-5.2 (744B MoE) | Claude Opus 4.5 / Sonnet 4.6 | GPT-5.5 / o4-mini |
| Context window | Up to 1M tokens | 200K tokens | 256K tokens |
| License | MIT (open source) | Proprietary (API only) | Proprietary (API only) |
| Self-hostable | Yes — runs on your GPU | No — Anthropic API only | No — OpenAI API only |
| Agent loop | Read → Diff → Test → Iterate | Read → Write → Bash → Review | Read → Plan → Write → Verify |
| SWE-bench score | Top-tier (beats GPT-5.5) | Industry-leading | Competitive with Claude |
| Code Arena ranking | #1 | #2 | #3 |
Installation
ZCode is MIT-licensed and available on GitHub under Z.ai's organization. You need GLM-5.2 running (via vLLM or SGLang) before ZCode can evaluate it.
# Clone ZCode
git clone https://github.com/THUDM/zcode.git
cd zcode
# Install dependencies
pip install -e .
# Point ZCode at your GLM-5.2 endpoint
export GLM52_ENDPOINT=http://localhost:8000/v1
export GLM52_API_KEY=your-key
# Verify setup
zcode --check
# → GLM-5.2 endpoint: http://localhost:8000/v1
# → Model: glm-5-2/fp8
# → Context: 131072 tokens
# → Status: ready
ZCode expects an OpenAI-compatible API. If you're running GLM-5.2 with vLLM, it already speaks that protocol — point ZCode at http://localhost:8000/v1 and it just works.
Running Benchmarks
ZCode ships with a benchmark suite that mirrors SWE-bench's task format. Each task gives the model a GitHub issue, a repo snapshot, and expects a working patch.
# Run the full benchmark suite
zcode bench --suite swe-bench-verified
# Run a single task
zcode bench --task django__django-12345
# Run with custom settings
zcode bench \
--suite code-arena \
--max-context 131072 \
--temperature 0.0 \
--output results.json
# Expected output:
# ┌─────────────────────────────────────────┐
# │ ZCode Benchmark — SWE-bench Verified │
# ├─────────────────────────────────────────┤
# │ Tasks: 300 │
# │ Resolved: 178 (59.3%) │
# │ Patches: 196 (65.3%) │
# │ Avg time: 47.3s per task │
# │ Peak VRAM: 612 GB across 8×H200 │
# └─────────────────────────────────────────┘
Interactive Coding Mode
Beyond batch benchmarks, ZCode has an interactive mode — like Claude Code's REPL — where GLM-5.2 reads your codebase and proposes changes.
# Open interactive coding session
zcode interactive --repo ./my-project
# Inside the session:
# > Find the N+1 query in app/views/dashboard.py and fix it
# [ZCode reads file, writes patch, runs tests]
# → Found N+1 in DashboardView.get_queryset()
# → Wrote patch to /tmp/zcode-patch-001.diff
# → Tests pass: 12/12
# → Apply? [y/N]
Unlike Claude Code which operates through an API, ZCode runs against your own GPU. No rate limits, no per-token pricing, no data leaving your network. For teams with compliance requirements (HIPAA, SOC2, on-prem only), this is the differentiator.
ZCode vs. the Competition: Real-World Coding Tasks
Benchmark numbers are one thing. Here's what ZCode + GLM-5.2 actually does on day-to-day engineering work versus the alternatives.
| Task | ZCode + GLM-5.2 | Claude Code | Codex CLI |
|---|---|---|---|
| Refactor 500-line Django view | Correct on 1st attempt. 1M context fits entire codebase. | Correct but needed manual file chunking (200K limit). | Partially correct. Missed nested middleware import. |
| Write database migration + backfill | Correct SQL, added transaction safety. | Correct, faster iteration (lower latency). | Correct but added unnecessary ORM layer. |
| Debug distributed deadlock (3 services) | Identified root cause across all 3 services in one pass. | Required 3 separate conversations (context constraint). | Required 2 conversations. Missed race condition in service 2. |
| Write Terraform module from scratch | Functional but verbose. Correct AWS provider config. | Cleanest output. Best practices baked in. | Concise but used deprecated aws_s3_bucket resource. |
| Fix 12 failing pytest tests across 4 files | Fixed all 12. 1 test needed manual tweak. | Fixed 11/12. 1 false negative. | Fixed 9/12. 3 tests "fixed" but logic wrong. |
Tasks tested on July 2, 2026. Claude Code via Anthropic API (opus-4.5). Codex CLI via OpenAI API (gpt-5.5). ZCode via self-hosted GLM-5.2 on 8×H200.
Where ZCode Wins (and Where It Doesn't)
ZCode + GLM-5.2 Is Better For:
- Large codebases — 1M context means you can feed the entire repo, not just selected files
- Compliance / air-gapped — runs on your GPU, no external API calls. GLM-5.2 is MIT-licensed, no vendor lock-in
- Multi-file debugging — cross-service issues that require reading 3+ repos simultaneously
- Cost at scale — after the GPU capex, each inference is free. No per-token billing
Claude Code / Codex CLI Are Better For:
- Quick iterations — lower latency (API-hosted, no cold start)
- Small, focused edits — single-file changes where 1M context is overkill
- Zero setup — no GPU cluster to manage, just install and run
- Tool ecosystem — Claude Code has MCP, plugins, hooks. ZCode's ecosystem is new (released today).
Setting Up ZCode for Production Use
If you're evaluating ZCode for team use, three things matter beyond the benchmark scores:
1. GPU Requirements
ZCode itself is lightweight (a Python CLI). The GPU cost is GLM-5.2 inference. Plan for 8×H200 or equivalent for FP8, 4×H200 for INT4 quantized. See the MoE Deployment guide for detailed GPU sizing.
2. CI Integration
# .github/workflows/zcode-review.yml
name: ZCode PR Review
on: [pull_request]
jobs:
zcode-review:
runs-on: [self-hosted, gpu]
steps:
- uses: actions/checkout@v4
- name: Run ZCode review
run: |
zcode review \
--pr ${{ github.event.pull_request.number }} \
--repo ${{ github.workspace }} \
--output review.md
- name: Post review comment
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const review = fs.readFileSync('review.md', 'utf8');
github.rest.issues.createComment({
...context.repo,
issue_number: context.issue.number,
body: review
});
3. Model Updates
ZCode is decoupled from the model. When GLM-5.2 gets updated (checkpoint releases on HuggingFace), you update the vLLM model weights and ZCode picks up the improvements automatically. No ZCode reinstall needed.
ZCode Is the Coding Harness. The Manual Covers Everything Else.
ZCode evaluates GLM-5.2's code. Getting GLM-5.2 running on your hardware — with the right GPU config, KV cache tuning, and production hardening — is what the manual covers in detail.
Get the Production Manual — $2930-day money-back guarantee. Covers vLLM + SGLang configuration, 8×H200 deployment, and production monitoring.
Last updated: July 2, 2026 · ZCode released July 2, 2026
FAQ
Is ZCode open source? What license?
Yes. ZCode is MIT-licensed, same as GLM-5.2. You can fork it, modify it, use it commercially, and self-host it without restrictions. The repo is on GitHub under Z.ai's organization.
Does ZCode require an internet connection?
No. ZCode talks to your local GLM-5.2 endpoint. If GLM-5.2 is running on your own GPU (via vLLM/SGLang), ZCode works fully air-gapped. No data leaves your network. This is the key differentiator vs Claude Code and Codex CLI, which require API calls to Anthropic/OpenAI.
What GPU do I need to run ZCode?
ZCode itself runs on CPU (it's a lightweight Python CLI). The GPU requirement comes from GLM-5.2 inference. For FP8: 8×H200 or equivalent (~640 GB VRAM). For INT4 quantized: 4×H200 (~320 GB VRAM). ZCode's benchmark mode uses the same GPU config as your serving setup.
Can ZCode be used in CI/CD pipelines?
Yes. ZCode has a review mode (zcode review --pr N) that integrates with GitHub Actions. You'll need a self-hosted GPU runner. The CI integration example above shows the full GitHub Actions workflow. For GitLab CI or Jenkins, the same CLI commands work — just swap the CI config syntax.
How does ZCode compare to GitHub Copilot?
Different category. Copilot is an inline code completion tool that suggests small snippets as you type. ZCode is an autonomous coding agent that reads your entire repo, debugs cross-file issues, writes patches, runs tests, and iterates — closer to Claude Code or Codex CLI. For quick tab-completion, Copilot is better. For "fix this bug across 4 files," ZCode is the tool.
Is ZCode production-ready?
ZCode was released July 2, 2026 — it's brand new. The benchmark suite is solid (mirrors SWE-bench format). The interactive mode works but has the rough edges you'd expect from a day-1 release. Production CI integration (the review mode) has been tested on the Z.ai team's internal repos. Verdict: ready for evaluation, wait 2-4 weeks for CI-critical adoption.