feat(tools): add ZCode (Z.ai GLM agent harness) (#700)

* feat(tools): add ZCode (Z.ai GLM agent harness)

ZCode reads per-agent markdown from `.zcode/agents/{slug}.md` (project) and
`~/.config/zcode/agents/{slug}.md` (global), with `name` + `description` YAML
frontmatter and an optional `tools` list — the same plain-agent-markdown shape
as Qwen.

- tools.json: add the `zcode` entry (dual-scope, per-agent, format `zcode-md`).
- convert.sh: add `convert_zcode` (byte-identical to the qwen converter,
  output to integrations/zcode/agents/) + register in the dispatch, valid_tools,
  tools_to_run, and parallel_tools.
- install.sh: add `zcode` to ALL_TOOLS, `install_zcode`, `detect_zcode`, and the
  resolve_dest / bin / is_detected / display / label dispatches.

Directories + file format verified against ZCode's published docs. Renderer
contract: `zcode-md` output is byte-identical to `qwen-md`, verified by
diffing `convert.sh --tool zcode` against `--tool qwen` (243/243 files match).

check-tools.sh passes (16 tools consistent across tools.json, install.sh, and
convert.sh); bash -n clean on both scripts.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WdX6PvnCfRgYD11yVpXVor

* zcode: gitignore generated output + add integration README

Bring the ZCode integration in line with the other tools: the 243 generated
agent files (integrations/zcode/agents/*.md) are output of `convert.sh`, not
source — add a .gitignore rule so they can't be committed, and add
integrations/zcode/README.md documenting generate/install (matching the vibe
and qwen integration READMEs).

Verified: generated agents are now git-ignored, the README is tracked, and
check-tools.sh still passes at 16 tools.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WKnDRWM4izsB8WAXKszhsq

* zcode: fix user-scope install path to ~/.zcode/agents (per ZCode docs)

The user-scope dest was ~/.config/zcode/agents/, but the official ZCode docs
state subagents are read from ~/.zcode/agents/<name>.md — so user-scope
installs landed where ZCode never looks. (detect.agentsDir and project scope
were already correct at .zcode/agents, so this was an internal inconsistency.)

Point tools.json dest.user, install_zcode's default, the header comment, and
the list display at ~/.zcode/agents; drop the stale ~/.config/zcode detection
clause; update the integration README. Keep format `zcode-md` distinct — ZCode's
native format supports color/model/permissions, so it will diverge from gemini-md
as the converter matures rather than being a permanent alias.

Verified: a default user-scope install now writes to ~/.zcode/agents/<slug>.md
(not ~/.config/zcode); check-tools.sh passes at 16 tools; install.sh syntax and
tools.json JSON both valid.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WKnDRWM4izsB8WAXKszhsq

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Michael Sitarzewski
2026-07-12 11:29:16 -05:00
committed by GitHub
parent 134b4d08e6
commit 00fb28a4cf
5 changed files with 103 additions and 6 deletions
+42 -3
View File
@@ -18,6 +18,7 @@
# windsurf — Single .windsurfrules for Windsurf
# openclaw — OpenClaw workspaces (integrations/openclaw/<agent>/SOUL.md)
# qwen — Qwen Code SubAgent files (~/.qwen/agents/*.md)
# zcode — ZCode agent files (.zcode/agents/*.md · ~/.config/zcode/agents/*.md)
# kimi — Kimi Code CLI agent files (~/.config/kimi/agents/)
# codex — Codex custom agent TOML files (~/.codex/agents/*.toml)
# osaurus — Osaurus skill files (~/.osaurus/skills/<name>/SKILL.md)
@@ -425,6 +426,43 @@ HEREDOC
fi
}
convert_zcode() {
local file="$1"
local name description tools slug outfile body
name="$(get_field "name" "$file")"
description="$(get_field "description" "$file")"
tools="$(get_field "tools" "$file")"
slug="$(slugify "$name")"
body="$(get_body "$file")"
outfile="$OUT_DIR/zcode/agents/${slug}.md"
mkdir -p "$(dirname "$outfile")"
# ZCode agent format (Z.ai GLM harness): .md with YAML frontmatter in
# .zcode/agents/ (project) or ~/.config/zcode/agents/ (global). name and
# description required; tools optional (only if present in source). Byte-
# identical to the qwen-md shape, which the Agency Agents app renders natively.
if [[ -n "$tools" ]]; then
cat > "$outfile" <<HEREDOC
---
name: ${slug}
description: ${description}
tools: ${tools}
---
${body}
HEREDOC
else
cat > "$outfile" <<HEREDOC
---
name: ${slug}
description: ${description}
---
${body}
HEREDOC
fi
}
convert_kimi() {
local file="$1"
local name description slug outdir agent_file body
@@ -608,6 +646,7 @@ run_conversions() {
cursor) convert_cursor "$file" ;;
openclaw) convert_openclaw "$file" ;;
qwen) convert_qwen "$file" ;;
zcode) convert_zcode "$file" ;;
kimi) convert_kimi "$file" ;;
osaurus) convert_osaurus "$file" ;;
vibe) convert_vibe "$file" ;;
@@ -641,7 +680,7 @@ main() {
esac
done
local valid_tools=("antigravity" "gemini-cli" "opencode" "cursor" "aider" "windsurf" "openclaw" "qwen" "kimi" "codex" "osaurus" "hermes" "vibe" "all")
local valid_tools=("antigravity" "gemini-cli" "opencode" "cursor" "aider" "windsurf" "openclaw" "qwen" "zcode" "kimi" "codex" "osaurus" "hermes" "vibe" "all")
local valid=false
for t in "${valid_tools[@]}"; do [[ "$t" == "$tool" ]] && valid=true && break; done
if ! $valid; then
@@ -660,7 +699,7 @@ main() {
local tools_to_run=()
if [[ "$tool" == "all" ]]; then
tools_to_run=("antigravity" "gemini-cli" "opencode" "cursor" "aider" "windsurf" "openclaw" "qwen" "kimi" "codex" "osaurus" "hermes" "vibe")
tools_to_run=("antigravity" "gemini-cli" "opencode" "cursor" "aider" "windsurf" "openclaw" "qwen" "zcode" "kimi" "codex" "osaurus" "hermes" "vibe")
else
tools_to_run=("$tool")
fi
@@ -671,7 +710,7 @@ main() {
if $use_parallel && [[ "$tool" == "all" ]]; then
# Tools that write to separate dirs can run in parallel; buffer output so each tool's output stays together
local parallel_tools=(antigravity gemini-cli opencode cursor openclaw qwen codex osaurus hermes vibe)
local parallel_tools=(antigravity gemini-cli opencode cursor openclaw qwen zcode codex osaurus hermes vibe)
local parallel_out_dir
parallel_out_dir="$(mktemp -d)"
info "Converting: ${#parallel_tools[@]}/${n_tools} tools in parallel (output buffered per tool)..."