claude-glm52-supervisor 0.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- claude_glm52_supervisor-0.0.2/LICENSE +11 -0
- claude_glm52_supervisor-0.0.2/PKG-INFO +308 -0
- claude_glm52_supervisor-0.0.2/README.md +284 -0
- claude_glm52_supervisor-0.0.2/pyproject.toml +49 -0
- claude_glm52_supervisor-0.0.2/setup.cfg +4 -0
- claude_glm52_supervisor-0.0.2/src/claude_glm52_supervisor/__init__.py +3 -0
- claude_glm52_supervisor-0.0.2/src/claude_glm52_supervisor/_runtime.py +49 -0
- claude_glm52_supervisor-0.0.2/src/claude_glm52_supervisor/batch.py +515 -0
- claude_glm52_supervisor-0.0.2/src/claude_glm52_supervisor/cli.py +362 -0
- claude_glm52_supervisor-0.0.2/src/claude_glm52_supervisor/delegate.py +661 -0
- claude_glm52_supervisor-0.0.2/src/claude_glm52_supervisor/glm52_delegate_accounting.py +131 -0
- claude_glm52_supervisor-0.0.2/src/claude_glm52_supervisor/glm52_usage.py +610 -0
- claude_glm52_supervisor-0.0.2/src/claude_glm52_supervisor/glm52_usage_snapshots.py +523 -0
- claude_glm52_supervisor-0.0.2/src/claude_glm52_supervisor/glm52_vision.py +508 -0
- claude_glm52_supervisor-0.0.2/src/claude_glm52_supervisor/resources/claude-glm52-reviewer.sh +8 -0
- claude_glm52_supervisor-0.0.2/src/claude_glm52_supervisor/resources/claude-glm52-subagent.sh +209 -0
- claude_glm52_supervisor-0.0.2/src/claude_glm52_supervisor/reviewer.py +20 -0
- claude_glm52_supervisor-0.0.2/src/claude_glm52_supervisor/subagent.py +19 -0
- claude_glm52_supervisor-0.0.2/src/claude_glm52_supervisor.egg-info/PKG-INFO +308 -0
- claude_glm52_supervisor-0.0.2/src/claude_glm52_supervisor.egg-info/SOURCES.txt +25 -0
- claude_glm52_supervisor-0.0.2/src/claude_glm52_supervisor.egg-info/dependency_links.txt +1 -0
- claude_glm52_supervisor-0.0.2/src/claude_glm52_supervisor.egg-info/entry_points.txt +6 -0
- claude_glm52_supervisor-0.0.2/src/claude_glm52_supervisor.egg-info/top_level.txt +1 -0
- claude_glm52_supervisor-0.0.2/tests/test_claude_glm52_cli.py +893 -0
- claude_glm52_supervisor-0.0.2/tests/test_glm52_usage.py +629 -0
- claude_glm52_supervisor-0.0.2/tests/test_glm52_vision.py +419 -0
- claude_glm52_supervisor-0.0.2/tests/test_process_cleanup.py +197 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Copyright (c) 2026 AkiGarage
|
|
2
|
+
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
This repository is published for inspection and installation, but no
|
|
6
|
+
open-source license has been selected yet. Unless a later LICENSE file or a
|
|
7
|
+
separate written agreement grants additional rights, you may not copy, modify,
|
|
8
|
+
redistribute, sublicense, or sell this software or associated documentation.
|
|
9
|
+
|
|
10
|
+
This notice is intentionally conservative so a public repository or package
|
|
11
|
+
publication does not accidentally grant broader reuse rights than intended.
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: claude-glm52-supervisor
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: Codex-safe Claude Code GLM-5.2 delegation wrappers.
|
|
5
|
+
Author: AkiGarage
|
|
6
|
+
Project-URL: Homepage, https://github.com/AkiGarage/ClaudeCodeGLM-supervisor
|
|
7
|
+
Project-URL: Repository, https://github.com/AkiGarage/ClaudeCodeGLM-supervisor
|
|
8
|
+
Project-URL: Documentation, https://github.com/AkiGarage/ClaudeCodeGLM-supervisor#readme
|
|
9
|
+
Keywords: codex,claude-code,glm,delegation,cli
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Topic :: Software Development
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+

|
|
26
|
+
|
|
27
|
+
<p align="center">
|
|
28
|
+
<a href="./README.md"><img alt="Language English" src="https://img.shields.io/badge/Language-English-2f6feb?style=for-the-badge"></a>
|
|
29
|
+
<a href="./README.ja.md"><img alt="Read in Japanese" src="https://img.shields.io/badge/Read%20in-%E6%97%A5%E6%9C%AC%E8%AA%9E-f97316?style=for-the-badge"></a>
|
|
30
|
+
<img alt="Version v0.0.2" src="https://img.shields.io/badge/Version-v0.0.2-111827?style=for-the-badge">
|
|
31
|
+
</p>
|
|
32
|
+
|
|
33
|
+
# ClaudeCodeGLM Supervisor
|
|
34
|
+
|
|
35
|
+
ClaudeCodeGLM Supervisor lets Codex delegate bounded implementation and review work to Claude Code while routing Claude Code to Z.AI GLM-5.2.
|
|
36
|
+
|
|
37
|
+
Codex stays responsible for planning, task design, risk control, validation, and final acceptance. Claude Code GLM-5.2 acts as a constrained worker that edits only the requested files, runs the requested checks, and returns a compact machine-readable result for Codex to audit.
|
|
38
|
+
|
|
39
|
+
This repository is useful when you want the lower-cost GLM execution path for longer coding work without giving up Codex as the operator and final reviewer.
|
|
40
|
+
|
|
41
|
+
## Current Status
|
|
42
|
+
|
|
43
|
+
| Layer | Current route |
|
|
44
|
+
| --- | --- |
|
|
45
|
+
| Orchestrator | Codex |
|
|
46
|
+
| Worker runtime | Claude Code |
|
|
47
|
+
| Provider gateway | CLIProxyAPI |
|
|
48
|
+
| Upstream model | Z.AI GLM-5.2 |
|
|
49
|
+
| Claude Code-visible model | `claude-opus-4-6[1m]` alias |
|
|
50
|
+
| Verified context window | 1,000,000 tokens |
|
|
51
|
+
| Verified Claude Code output ceiling | 64,000 tokens |
|
|
52
|
+
| Vision handling | Separate Z.AI Vision MCP/OCR preflight, then text context injection |
|
|
53
|
+
|
|
54
|
+
GLM-5.2 can support larger outputs at the model/API layer, but this Claude Code worker route is currently verified to a 64K Claude Code output ceiling. For true 128K single-response output, use a separately verified direct GLM-5.2 route instead of assuming Claude Code will expose it safely.
|
|
55
|
+
|
|
56
|
+
## How It Is Meant To Be Used
|
|
57
|
+
|
|
58
|
+
The intended workflow is:
|
|
59
|
+
|
|
60
|
+
1. Codex reads the repo, creates the plan, and decides whether delegation is worthwhile.
|
|
61
|
+
2. Codex writes a precise task packet with allowed files, constraints, acceptance criteria, and validation commands.
|
|
62
|
+
3. ClaudeCodeGLM Supervisor sends that packet to Claude Code GLM-5.2.
|
|
63
|
+
4. Claude Code edits or reviews within the requested scope.
|
|
64
|
+
5. Codex inspects the wrapper JSON, checks the diff, reruns validation, and either accepts, fixes, or sends a narrower retry.
|
|
65
|
+
|
|
66
|
+
Short trigger phrases are fine. In day-to-day use, requests such as `implement with CCG`, `use CCG for implementation`, or `delegate implementation to ClaudeCodeGLM` should mean:
|
|
67
|
+
|
|
68
|
+
- Codex plans first.
|
|
69
|
+
- CCG does bounded implementation.
|
|
70
|
+
- Codex audits and reports the final result.
|
|
71
|
+
|
|
72
|
+
Do not treat CCG as a blind autopilot. Planning, product judgment, high-risk decisions, and final acceptance stay with Codex.
|
|
73
|
+
|
|
74
|
+
## Why CLIProxyAPI Is Used
|
|
75
|
+
|
|
76
|
+
This route uses CLIProxyAPI between Claude Code and Z.AI because it provides the practical glue that makes the worker route stable:
|
|
77
|
+
|
|
78
|
+
- It exposes Claude Code-compatible model names while routing upstream to GLM-5.2.
|
|
79
|
+
- It lets Claude Code see a model metadata shape that currently gives the verified 1M context and 64K output ceiling.
|
|
80
|
+
- It supports local routing, aliases, retries, and multi-key/provider setups in one place.
|
|
81
|
+
- It keeps Claude Code configuration cleaner than repeatedly patching ad hoc endpoint settings.
|
|
82
|
+
|
|
83
|
+
Thanks to the CLIProxyAPI author and maintainers. This project depends on that gateway layer for the current recommended setup.
|
|
84
|
+
|
|
85
|
+
Can this work without CLIProxyAPI? Not as the recommended route. A direct Claude Code to Z.AI Anthropic-compatible endpoint may be possible in some environments, but this repository's verified worker path relies on CLIProxyAPI aliases and metadata behavior. Without CLIProxyAPI you should expect extra setup work and reduced/untested guarantees around model aliases, output ceiling, retries, quota capture, and provider routing.
|
|
86
|
+
|
|
87
|
+
## Install
|
|
88
|
+
|
|
89
|
+
This project is moving away from custom Homebrew taps as the normal user
|
|
90
|
+
install path. The intended public path is:
|
|
91
|
+
|
|
92
|
+
1. a checksum-verified GitHub Release installer for the first public release
|
|
93
|
+
2. a PyPI package that works with `uvx` and `uv tool install`
|
|
94
|
+
|
|
95
|
+
Target PyPI/uv commands:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
uvx --from claude-glm52-supervisor claude-glm52 doctor --offline
|
|
99
|
+
uv tool install claude-glm52-supervisor
|
|
100
|
+
|
|
101
|
+
claude-glm52 setup --print
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
This repo now has a Python package layout. Until the package is published to
|
|
105
|
+
PyPI, run the wrappers directly from a clean source checkout or build a local
|
|
106
|
+
wheel:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
python3 outputs/claude-glm52.py --version
|
|
110
|
+
python3 outputs/claude-glm52.py doctor --offline
|
|
111
|
+
python3 outputs/claude-glm52-delegate.py --help
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Full rationale and release-channel tradeoffs live in
|
|
115
|
+
[`docs/install.md`](docs/install.md) and
|
|
116
|
+
[`docs/distribution-strategy.md`](docs/distribution-strategy.md). The
|
|
117
|
+
Homebrew tap skeleton remains in [`packaging/homebrew-tap/`](packaging/homebrew-tap/)
|
|
118
|
+
for maintainer validation only.
|
|
119
|
+
|
|
120
|
+
## Requirements
|
|
121
|
+
|
|
122
|
+
Required:
|
|
123
|
+
|
|
124
|
+
- macOS or Linux shell environment.
|
|
125
|
+
- Python 3.11 or newer.
|
|
126
|
+
- Bash.
|
|
127
|
+
- Claude Code CLI installed and authenticated.
|
|
128
|
+
- CLIProxyAPI installed and running locally.
|
|
129
|
+
- A Z.AI account/API key with GLM-5.2 access.
|
|
130
|
+
- `npx` available if you use the default Vision MCP backend.
|
|
131
|
+
|
|
132
|
+
Recommended:
|
|
133
|
+
|
|
134
|
+
- `timeout` from GNU coreutils or Homebrew coreutils for process guard enforcement.
|
|
135
|
+
- `git`, `rg`, and a normal test runner for the target repo.
|
|
136
|
+
- A dedicated Claude Code worker config directory, defaulting to `~/.claude-glm52-worker`.
|
|
137
|
+
|
|
138
|
+
Sensitive values are read from environment/config at runtime. Do not commit API keys, `.env` files, auth tokens, provider configs, or local LaunchAgent files.
|
|
139
|
+
|
|
140
|
+
## Setup Overview
|
|
141
|
+
|
|
142
|
+
1. Install and configure CLIProxyAPI for a local Anthropic-compatible endpoint such as:
|
|
143
|
+
|
|
144
|
+
```text
|
|
145
|
+
http://127.0.0.1:8317
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
2. Configure CLIProxyAPI so Claude Code-visible aliases such as `claude-opus-4-6[1m]` route upstream to `glm-5.2`.
|
|
149
|
+
|
|
150
|
+
3. Configure a lean Claude Code worker profile, usually:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
export CLAUDE_GLM52_WORKER_CONFIG_DIR="$HOME/.claude-glm52-worker"
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
4. Put the wrapper scripts on `PATH`, or call them directly from this repository:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
python3 outputs/claude-glm52-delegate.py --help
|
|
160
|
+
python3 outputs/claude-glm52-batch.py --help
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
5. Run a lightweight smoke test before longer delegation:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
python3 outputs/claude-glm52-delegate.py \
|
|
167
|
+
--role review \
|
|
168
|
+
--cwd . \
|
|
169
|
+
--timeout 120 \
|
|
170
|
+
--retries 0 \
|
|
171
|
+
--no-usage-log \
|
|
172
|
+
--no-quota-snapshot \
|
|
173
|
+
"Return exactly: ok. Do not edit files."
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Core Commands
|
|
177
|
+
|
|
178
|
+
Single task:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
claude-glm52-delegate \
|
|
182
|
+
--cwd /path/to/repo \
|
|
183
|
+
--timeout 900 \
|
|
184
|
+
--retries 1 \
|
|
185
|
+
--prompt-file task-packet.md \
|
|
186
|
+
--result-file delegate-result.json
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Read-only review:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
claude-glm52-delegate \
|
|
193
|
+
--role review \
|
|
194
|
+
--cwd /path/to/repo \
|
|
195
|
+
--timeout 300 \
|
|
196
|
+
--prompt-file review-packet.md \
|
|
197
|
+
--result-file review-result.json
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Independent batch work:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
claude-glm52-batch \
|
|
204
|
+
--plan-file batch-plan.json \
|
|
205
|
+
--concurrency 2 \
|
|
206
|
+
--result-file batch-result.json
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Image-aware task:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
claude-glm52-delegate \
|
|
213
|
+
--cwd /path/to/repo \
|
|
214
|
+
--image screenshots/error.png \
|
|
215
|
+
--vision-backend mcp \
|
|
216
|
+
--vision-mode auto \
|
|
217
|
+
--prompt-file task-packet.md \
|
|
218
|
+
--result-file delegate-result.json
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
The GLM-5.2 coding worker is treated as text-only. Image files are analyzed first through a lightweight Z.AI Vision MCP/OCR preflight. The extracted evidence text is injected into the task packet, while raw image summaries are not persisted in result JSON or usage logs.
|
|
222
|
+
|
|
223
|
+
## Task Packet Shape
|
|
224
|
+
|
|
225
|
+
Use concise English packets unless the task itself is about Japanese text.
|
|
226
|
+
|
|
227
|
+
```text
|
|
228
|
+
Role: implementation worker
|
|
229
|
+
Goal:
|
|
230
|
+
Repo/CWD:
|
|
231
|
+
Files likely relevant:
|
|
232
|
+
Constraints:
|
|
233
|
+
Acceptance criteria:
|
|
234
|
+
Validation commands:
|
|
235
|
+
Do not:
|
|
236
|
+
Return:
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Important constraints:
|
|
240
|
+
|
|
241
|
+
- List the files the worker may modify.
|
|
242
|
+
- Forbid broad searches from `/` or `~`.
|
|
243
|
+
- Forbid deleting files, editing secrets, committing, pushing, and changing auth/config.
|
|
244
|
+
- Include the exact validation command when possible.
|
|
245
|
+
- Keep final worker output short; large deliverables should be written to files.
|
|
246
|
+
|
|
247
|
+
## Usage And Quota Accounting
|
|
248
|
+
|
|
249
|
+
Delegate results include:
|
|
250
|
+
|
|
251
|
+
- `usageSummary`: Claude Code model token and cost totals.
|
|
252
|
+
- `usage_snapshots.before` and `usage_snapshots.after`: before/after provider usage snapshots.
|
|
253
|
+
- `usage_accounting.tokens_*`: ZCode-compatible token fields.
|
|
254
|
+
- `usage_accounting.quota_percent_*`: quota percent fields when a delta-safe source exists.
|
|
255
|
+
|
|
256
|
+
Quota percentage is deliberately conservative. If the provider only returns a percentage without usable usage/remaining counts, the result is marked `unavailable` with a reason instead of pretending the task used `0%`.
|
|
257
|
+
|
|
258
|
+
## Token Savings Evidence
|
|
259
|
+
|
|
260
|
+
In one eight-task benchmark covering a website, mini-game, backend reconciliation, policy routing, and four vision/OCR tasks, all three routes passed validation with average quality 10/10:
|
|
261
|
+
|
|
262
|
+
| Route | Reported tokens | Wall time | Strong passes |
|
|
263
|
+
| --- | ---: | ---: | ---: |
|
|
264
|
+
| ClaudeCodeGLM | 1,000,148 | 1984.2s | 8/8 |
|
|
265
|
+
| ZCode | 1,037,882 | 2236.4s | 8/8 |
|
|
266
|
+
| Codex self | 5,020,951 | 1877.8s | 8/8 |
|
|
267
|
+
|
|
268
|
+
This does not mean work is free. It shifts the execution burden from Codex/GPT tokens to GLM tokens. The result does suggest that, for longer scoped tasks, detailed delegation can preserve quality while substantially reducing Codex-side token use. Treat this as benchmark evidence, not a universal guarantee.
|
|
269
|
+
|
|
270
|
+
## Key Files
|
|
271
|
+
|
|
272
|
+
| Path | Purpose |
|
|
273
|
+
| --- | --- |
|
|
274
|
+
| `pyproject.toml` | PyPI/uv package metadata and console scripts |
|
|
275
|
+
| `src/claude_glm52_supervisor/` | Importable package implementation |
|
|
276
|
+
| `outputs/claude-glm52-delegate.py` | Source-checkout compatibility shim |
|
|
277
|
+
| `outputs/claude-glm52-batch.py` | Source-checkout compatibility shim |
|
|
278
|
+
| `outputs/claude-glm52-subagent.sh` | Raw Claude Code worker runner |
|
|
279
|
+
| `packaging/install/claude-glm52-installer.sh` | Checksum-verifying GitHub Release installer |
|
|
280
|
+
| `.github/workflows/release.yml` | Trusted Publishing and draft release asset workflow |
|
|
281
|
+
| `scripts/build_public_snapshot.py` | Clean public snapshot builder for repo handoff |
|
|
282
|
+
| `scripts/stage_public_repo.py` | Local public repo commit/tag/release-asset staging |
|
|
283
|
+
| `tests/` | Unit tests for install CLI, usage, vision, and process cleanup helpers |
|
|
284
|
+
|
|
285
|
+
## Validation
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
bash -n outputs/claude-glm52-subagent.sh
|
|
289
|
+
bash -n packaging/install/claude-glm52-installer.sh packaging/release/build-release-assets.sh
|
|
290
|
+
python3 -m py_compile src/claude_glm52_supervisor/*.py outputs/*.py
|
|
291
|
+
python3 -m unittest discover -s tests -v
|
|
292
|
+
uv build --out-dir /tmp/claude-glm52-dist
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
## Security Notes
|
|
296
|
+
|
|
297
|
+
- Never commit `.env`, API keys, auth tokens, private keys, local provider configs, or shell history.
|
|
298
|
+
- Do not log prompt text when it may contain secrets.
|
|
299
|
+
- Treat worker output as evidence, not truth.
|
|
300
|
+
- Keep Codex as final auditor.
|
|
301
|
+
- Keep image/OCR context sanitized and do not persist raw extracted text unless explicitly needed.
|
|
302
|
+
|
|
303
|
+
## License
|
|
304
|
+
|
|
305
|
+
See [`LICENSE`](LICENSE). The current notice is intentionally conservative and
|
|
306
|
+
does not grant open-source reuse or redistribution rights. If a standard public
|
|
307
|
+
license is selected later, this section and package metadata should be updated
|
|
308
|
+
together.
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="./README.md"><img alt="Language English" src="https://img.shields.io/badge/Language-English-2f6feb?style=for-the-badge"></a>
|
|
5
|
+
<a href="./README.ja.md"><img alt="Read in Japanese" src="https://img.shields.io/badge/Read%20in-%E6%97%A5%E6%9C%AC%E8%AA%9E-f97316?style=for-the-badge"></a>
|
|
6
|
+
<img alt="Version v0.0.2" src="https://img.shields.io/badge/Version-v0.0.2-111827?style=for-the-badge">
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
# ClaudeCodeGLM Supervisor
|
|
10
|
+
|
|
11
|
+
ClaudeCodeGLM Supervisor lets Codex delegate bounded implementation and review work to Claude Code while routing Claude Code to Z.AI GLM-5.2.
|
|
12
|
+
|
|
13
|
+
Codex stays responsible for planning, task design, risk control, validation, and final acceptance. Claude Code GLM-5.2 acts as a constrained worker that edits only the requested files, runs the requested checks, and returns a compact machine-readable result for Codex to audit.
|
|
14
|
+
|
|
15
|
+
This repository is useful when you want the lower-cost GLM execution path for longer coding work without giving up Codex as the operator and final reviewer.
|
|
16
|
+
|
|
17
|
+
## Current Status
|
|
18
|
+
|
|
19
|
+
| Layer | Current route |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| Orchestrator | Codex |
|
|
22
|
+
| Worker runtime | Claude Code |
|
|
23
|
+
| Provider gateway | CLIProxyAPI |
|
|
24
|
+
| Upstream model | Z.AI GLM-5.2 |
|
|
25
|
+
| Claude Code-visible model | `claude-opus-4-6[1m]` alias |
|
|
26
|
+
| Verified context window | 1,000,000 tokens |
|
|
27
|
+
| Verified Claude Code output ceiling | 64,000 tokens |
|
|
28
|
+
| Vision handling | Separate Z.AI Vision MCP/OCR preflight, then text context injection |
|
|
29
|
+
|
|
30
|
+
GLM-5.2 can support larger outputs at the model/API layer, but this Claude Code worker route is currently verified to a 64K Claude Code output ceiling. For true 128K single-response output, use a separately verified direct GLM-5.2 route instead of assuming Claude Code will expose it safely.
|
|
31
|
+
|
|
32
|
+
## How It Is Meant To Be Used
|
|
33
|
+
|
|
34
|
+
The intended workflow is:
|
|
35
|
+
|
|
36
|
+
1. Codex reads the repo, creates the plan, and decides whether delegation is worthwhile.
|
|
37
|
+
2. Codex writes a precise task packet with allowed files, constraints, acceptance criteria, and validation commands.
|
|
38
|
+
3. ClaudeCodeGLM Supervisor sends that packet to Claude Code GLM-5.2.
|
|
39
|
+
4. Claude Code edits or reviews within the requested scope.
|
|
40
|
+
5. Codex inspects the wrapper JSON, checks the diff, reruns validation, and either accepts, fixes, or sends a narrower retry.
|
|
41
|
+
|
|
42
|
+
Short trigger phrases are fine. In day-to-day use, requests such as `implement with CCG`, `use CCG for implementation`, or `delegate implementation to ClaudeCodeGLM` should mean:
|
|
43
|
+
|
|
44
|
+
- Codex plans first.
|
|
45
|
+
- CCG does bounded implementation.
|
|
46
|
+
- Codex audits and reports the final result.
|
|
47
|
+
|
|
48
|
+
Do not treat CCG as a blind autopilot. Planning, product judgment, high-risk decisions, and final acceptance stay with Codex.
|
|
49
|
+
|
|
50
|
+
## Why CLIProxyAPI Is Used
|
|
51
|
+
|
|
52
|
+
This route uses CLIProxyAPI between Claude Code and Z.AI because it provides the practical glue that makes the worker route stable:
|
|
53
|
+
|
|
54
|
+
- It exposes Claude Code-compatible model names while routing upstream to GLM-5.2.
|
|
55
|
+
- It lets Claude Code see a model metadata shape that currently gives the verified 1M context and 64K output ceiling.
|
|
56
|
+
- It supports local routing, aliases, retries, and multi-key/provider setups in one place.
|
|
57
|
+
- It keeps Claude Code configuration cleaner than repeatedly patching ad hoc endpoint settings.
|
|
58
|
+
|
|
59
|
+
Thanks to the CLIProxyAPI author and maintainers. This project depends on that gateway layer for the current recommended setup.
|
|
60
|
+
|
|
61
|
+
Can this work without CLIProxyAPI? Not as the recommended route. A direct Claude Code to Z.AI Anthropic-compatible endpoint may be possible in some environments, but this repository's verified worker path relies on CLIProxyAPI aliases and metadata behavior. Without CLIProxyAPI you should expect extra setup work and reduced/untested guarantees around model aliases, output ceiling, retries, quota capture, and provider routing.
|
|
62
|
+
|
|
63
|
+
## Install
|
|
64
|
+
|
|
65
|
+
This project is moving away from custom Homebrew taps as the normal user
|
|
66
|
+
install path. The intended public path is:
|
|
67
|
+
|
|
68
|
+
1. a checksum-verified GitHub Release installer for the first public release
|
|
69
|
+
2. a PyPI package that works with `uvx` and `uv tool install`
|
|
70
|
+
|
|
71
|
+
Target PyPI/uv commands:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
uvx --from claude-glm52-supervisor claude-glm52 doctor --offline
|
|
75
|
+
uv tool install claude-glm52-supervisor
|
|
76
|
+
|
|
77
|
+
claude-glm52 setup --print
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
This repo now has a Python package layout. Until the package is published to
|
|
81
|
+
PyPI, run the wrappers directly from a clean source checkout or build a local
|
|
82
|
+
wheel:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
python3 outputs/claude-glm52.py --version
|
|
86
|
+
python3 outputs/claude-glm52.py doctor --offline
|
|
87
|
+
python3 outputs/claude-glm52-delegate.py --help
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Full rationale and release-channel tradeoffs live in
|
|
91
|
+
[`docs/install.md`](docs/install.md) and
|
|
92
|
+
[`docs/distribution-strategy.md`](docs/distribution-strategy.md). The
|
|
93
|
+
Homebrew tap skeleton remains in [`packaging/homebrew-tap/`](packaging/homebrew-tap/)
|
|
94
|
+
for maintainer validation only.
|
|
95
|
+
|
|
96
|
+
## Requirements
|
|
97
|
+
|
|
98
|
+
Required:
|
|
99
|
+
|
|
100
|
+
- macOS or Linux shell environment.
|
|
101
|
+
- Python 3.11 or newer.
|
|
102
|
+
- Bash.
|
|
103
|
+
- Claude Code CLI installed and authenticated.
|
|
104
|
+
- CLIProxyAPI installed and running locally.
|
|
105
|
+
- A Z.AI account/API key with GLM-5.2 access.
|
|
106
|
+
- `npx` available if you use the default Vision MCP backend.
|
|
107
|
+
|
|
108
|
+
Recommended:
|
|
109
|
+
|
|
110
|
+
- `timeout` from GNU coreutils or Homebrew coreutils for process guard enforcement.
|
|
111
|
+
- `git`, `rg`, and a normal test runner for the target repo.
|
|
112
|
+
- A dedicated Claude Code worker config directory, defaulting to `~/.claude-glm52-worker`.
|
|
113
|
+
|
|
114
|
+
Sensitive values are read from environment/config at runtime. Do not commit API keys, `.env` files, auth tokens, provider configs, or local LaunchAgent files.
|
|
115
|
+
|
|
116
|
+
## Setup Overview
|
|
117
|
+
|
|
118
|
+
1. Install and configure CLIProxyAPI for a local Anthropic-compatible endpoint such as:
|
|
119
|
+
|
|
120
|
+
```text
|
|
121
|
+
http://127.0.0.1:8317
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
2. Configure CLIProxyAPI so Claude Code-visible aliases such as `claude-opus-4-6[1m]` route upstream to `glm-5.2`.
|
|
125
|
+
|
|
126
|
+
3. Configure a lean Claude Code worker profile, usually:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
export CLAUDE_GLM52_WORKER_CONFIG_DIR="$HOME/.claude-glm52-worker"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
4. Put the wrapper scripts on `PATH`, or call them directly from this repository:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
python3 outputs/claude-glm52-delegate.py --help
|
|
136
|
+
python3 outputs/claude-glm52-batch.py --help
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
5. Run a lightweight smoke test before longer delegation:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
python3 outputs/claude-glm52-delegate.py \
|
|
143
|
+
--role review \
|
|
144
|
+
--cwd . \
|
|
145
|
+
--timeout 120 \
|
|
146
|
+
--retries 0 \
|
|
147
|
+
--no-usage-log \
|
|
148
|
+
--no-quota-snapshot \
|
|
149
|
+
"Return exactly: ok. Do not edit files."
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Core Commands
|
|
153
|
+
|
|
154
|
+
Single task:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
claude-glm52-delegate \
|
|
158
|
+
--cwd /path/to/repo \
|
|
159
|
+
--timeout 900 \
|
|
160
|
+
--retries 1 \
|
|
161
|
+
--prompt-file task-packet.md \
|
|
162
|
+
--result-file delegate-result.json
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Read-only review:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
claude-glm52-delegate \
|
|
169
|
+
--role review \
|
|
170
|
+
--cwd /path/to/repo \
|
|
171
|
+
--timeout 300 \
|
|
172
|
+
--prompt-file review-packet.md \
|
|
173
|
+
--result-file review-result.json
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Independent batch work:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
claude-glm52-batch \
|
|
180
|
+
--plan-file batch-plan.json \
|
|
181
|
+
--concurrency 2 \
|
|
182
|
+
--result-file batch-result.json
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Image-aware task:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
claude-glm52-delegate \
|
|
189
|
+
--cwd /path/to/repo \
|
|
190
|
+
--image screenshots/error.png \
|
|
191
|
+
--vision-backend mcp \
|
|
192
|
+
--vision-mode auto \
|
|
193
|
+
--prompt-file task-packet.md \
|
|
194
|
+
--result-file delegate-result.json
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
The GLM-5.2 coding worker is treated as text-only. Image files are analyzed first through a lightweight Z.AI Vision MCP/OCR preflight. The extracted evidence text is injected into the task packet, while raw image summaries are not persisted in result JSON or usage logs.
|
|
198
|
+
|
|
199
|
+
## Task Packet Shape
|
|
200
|
+
|
|
201
|
+
Use concise English packets unless the task itself is about Japanese text.
|
|
202
|
+
|
|
203
|
+
```text
|
|
204
|
+
Role: implementation worker
|
|
205
|
+
Goal:
|
|
206
|
+
Repo/CWD:
|
|
207
|
+
Files likely relevant:
|
|
208
|
+
Constraints:
|
|
209
|
+
Acceptance criteria:
|
|
210
|
+
Validation commands:
|
|
211
|
+
Do not:
|
|
212
|
+
Return:
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Important constraints:
|
|
216
|
+
|
|
217
|
+
- List the files the worker may modify.
|
|
218
|
+
- Forbid broad searches from `/` or `~`.
|
|
219
|
+
- Forbid deleting files, editing secrets, committing, pushing, and changing auth/config.
|
|
220
|
+
- Include the exact validation command when possible.
|
|
221
|
+
- Keep final worker output short; large deliverables should be written to files.
|
|
222
|
+
|
|
223
|
+
## Usage And Quota Accounting
|
|
224
|
+
|
|
225
|
+
Delegate results include:
|
|
226
|
+
|
|
227
|
+
- `usageSummary`: Claude Code model token and cost totals.
|
|
228
|
+
- `usage_snapshots.before` and `usage_snapshots.after`: before/after provider usage snapshots.
|
|
229
|
+
- `usage_accounting.tokens_*`: ZCode-compatible token fields.
|
|
230
|
+
- `usage_accounting.quota_percent_*`: quota percent fields when a delta-safe source exists.
|
|
231
|
+
|
|
232
|
+
Quota percentage is deliberately conservative. If the provider only returns a percentage without usable usage/remaining counts, the result is marked `unavailable` with a reason instead of pretending the task used `0%`.
|
|
233
|
+
|
|
234
|
+
## Token Savings Evidence
|
|
235
|
+
|
|
236
|
+
In one eight-task benchmark covering a website, mini-game, backend reconciliation, policy routing, and four vision/OCR tasks, all three routes passed validation with average quality 10/10:
|
|
237
|
+
|
|
238
|
+
| Route | Reported tokens | Wall time | Strong passes |
|
|
239
|
+
| --- | ---: | ---: | ---: |
|
|
240
|
+
| ClaudeCodeGLM | 1,000,148 | 1984.2s | 8/8 |
|
|
241
|
+
| ZCode | 1,037,882 | 2236.4s | 8/8 |
|
|
242
|
+
| Codex self | 5,020,951 | 1877.8s | 8/8 |
|
|
243
|
+
|
|
244
|
+
This does not mean work is free. It shifts the execution burden from Codex/GPT tokens to GLM tokens. The result does suggest that, for longer scoped tasks, detailed delegation can preserve quality while substantially reducing Codex-side token use. Treat this as benchmark evidence, not a universal guarantee.
|
|
245
|
+
|
|
246
|
+
## Key Files
|
|
247
|
+
|
|
248
|
+
| Path | Purpose |
|
|
249
|
+
| --- | --- |
|
|
250
|
+
| `pyproject.toml` | PyPI/uv package metadata and console scripts |
|
|
251
|
+
| `src/claude_glm52_supervisor/` | Importable package implementation |
|
|
252
|
+
| `outputs/claude-glm52-delegate.py` | Source-checkout compatibility shim |
|
|
253
|
+
| `outputs/claude-glm52-batch.py` | Source-checkout compatibility shim |
|
|
254
|
+
| `outputs/claude-glm52-subagent.sh` | Raw Claude Code worker runner |
|
|
255
|
+
| `packaging/install/claude-glm52-installer.sh` | Checksum-verifying GitHub Release installer |
|
|
256
|
+
| `.github/workflows/release.yml` | Trusted Publishing and draft release asset workflow |
|
|
257
|
+
| `scripts/build_public_snapshot.py` | Clean public snapshot builder for repo handoff |
|
|
258
|
+
| `scripts/stage_public_repo.py` | Local public repo commit/tag/release-asset staging |
|
|
259
|
+
| `tests/` | Unit tests for install CLI, usage, vision, and process cleanup helpers |
|
|
260
|
+
|
|
261
|
+
## Validation
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
bash -n outputs/claude-glm52-subagent.sh
|
|
265
|
+
bash -n packaging/install/claude-glm52-installer.sh packaging/release/build-release-assets.sh
|
|
266
|
+
python3 -m py_compile src/claude_glm52_supervisor/*.py outputs/*.py
|
|
267
|
+
python3 -m unittest discover -s tests -v
|
|
268
|
+
uv build --out-dir /tmp/claude-glm52-dist
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Security Notes
|
|
272
|
+
|
|
273
|
+
- Never commit `.env`, API keys, auth tokens, private keys, local provider configs, or shell history.
|
|
274
|
+
- Do not log prompt text when it may contain secrets.
|
|
275
|
+
- Treat worker output as evidence, not truth.
|
|
276
|
+
- Keep Codex as final auditor.
|
|
277
|
+
- Keep image/OCR context sanitized and do not persist raw extracted text unless explicitly needed.
|
|
278
|
+
|
|
279
|
+
## License
|
|
280
|
+
|
|
281
|
+
See [`LICENSE`](LICENSE). The current notice is intentionally conservative and
|
|
282
|
+
does not grant open-source reuse or redistribution rights. If a standard public
|
|
283
|
+
license is selected later, this section and package metadata should be updated
|
|
284
|
+
together.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=69", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "claude-glm52-supervisor"
|
|
7
|
+
version = "0.0.2"
|
|
8
|
+
description = "Codex-safe Claude Code GLM-5.2 delegation wrappers."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "AkiGarage" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["codex", "claude-code", "glm", "delegation", "cli"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Environment :: Console",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Programming Language :: Python :: 3.14",
|
|
26
|
+
"Topic :: Software Development",
|
|
27
|
+
]
|
|
28
|
+
dependencies = []
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://github.com/AkiGarage/ClaudeCodeGLM-supervisor"
|
|
32
|
+
Repository = "https://github.com/AkiGarage/ClaudeCodeGLM-supervisor"
|
|
33
|
+
Documentation = "https://github.com/AkiGarage/ClaudeCodeGLM-supervisor#readme"
|
|
34
|
+
|
|
35
|
+
[project.scripts]
|
|
36
|
+
claude-glm52 = "claude_glm52_supervisor.cli:main"
|
|
37
|
+
claude-glm52-delegate = "claude_glm52_supervisor.delegate:main"
|
|
38
|
+
claude-glm52-batch = "claude_glm52_supervisor.batch:main"
|
|
39
|
+
claude-glm52-subagent = "claude_glm52_supervisor.subagent:main"
|
|
40
|
+
claude-glm52-reviewer = "claude_glm52_supervisor.reviewer:main"
|
|
41
|
+
|
|
42
|
+
[tool.setuptools]
|
|
43
|
+
package-dir = {"" = "src"}
|
|
44
|
+
|
|
45
|
+
[tool.setuptools.packages.find]
|
|
46
|
+
where = ["src"]
|
|
47
|
+
|
|
48
|
+
[tool.setuptools.package-data]
|
|
49
|
+
claude_glm52_supervisor = ["resources/*.sh"]
|