An unofficial Codex plugin that delegates software engineering tasks to the locally installed ZCode CLI with explicit provider and model selection.
This integration invokes ZCode's full coding-agent harness, not a plain chat endpoint. Within the permissions you choose, ZCode can explore repositories, read and edit files, run commands and tests, use skills/plugins/MCP, and continue or resume sessions. Codex remains responsible for reviewing the diff and independently validating the result.
- Discover providers, models, URLs, and credential availability from the ZCode desktop configuration.
- Select a provider/model for each task and maintain a private local preference order.
- Support
plan,edit,build, and explicitly authorizedyolomodes. - Support working directories, attachments, denied tools, session resume/continue, and headless targets.
- Keep API keys out of command arguments, logs, and ZCode child-process environments.
- Serialize CLI configuration changes with a global file lock to prevent provider-selection races.
- Never automatically rerun a failed task with another provider after partial repository changes.
- Include a detailed ZCode CLI configuration and troubleshooting reference.
- macOS.
- ZCode installed at
/Applications/ZCode.app. - Tested with ZCode CLI
0.15.2; run a minimal read-only check after upgrading to another version. - Python 3.
nodeavailable inPATH.- A ZCode provider configured as
anthropic/ Anthropic-compatible.
Windows, Linux, custom ZCode installation paths, and OpenAI-compatible providers have not yet been validated end to end. Contributions are welcome.
- Install and open the ZCode desktop application.
- Configure at least one provider in ZCode settings.
- Confirm that the provider has:
- an API key;
- a base URL;
- at least one model;
- an Anthropic-compatible protocol.
- Install a Codex CLI version that supports plugins and marketplaces.
This plugin does not provide accounts, credentials, model access, quotas, subscriptions, or any mechanism for bypassing platform controls.
Add the GitHub marketplace:
codex plugin marketplace add sjduan/codex-w-zcodecliInstall the plugin:
codex plugin add zcode-bridge@codex-w-zcodecliStart a new Codex task after installation so Codex can load the delegate-to-zcode skill.
Ask Codex:
Use
$delegate-to-zcodeto check my ZCode CLI, providers, and model configuration.
Use
$delegate-to-zcodeto list the providers and models configured in ZCode without displaying API keys.
Use
$delegate-to-zcodeto set this default order: Provider A / Model X, then Provider B / Model Y, then Provider B / Model Z.
Preferences are stored locally at:
~/.config/zcode-bridge/config.json
This private file is outside the plugin repository and is never uploaded by the plugin.
Use
$delegate-to-zcodeto ask ZCode to analyze the authentication flow in this repository with Provider A / Model X in plan mode. Do not modify files. Summarize the findings and independently verify them afterward.
Use
$delegate-to-zcodeto ask ZCode to fix this bug with Provider A / Model X in build mode and run the relevant tests. Review the git diff and independently validate the result afterward.
Files inside the workspace can be named directly in the prompt:
Ask ZCode to read
src/parser.tsand its adjacent tests, then fix the empty-input behavior.
Files outside the workspace should be attached:
Attach
/absolute/path/spec.mdto ZCode and ask it to update the current repository to match the specification.
Use
$delegate-to-zcodeto continue the latest ZCode session for this repository and fix the remaining failing tests.
You can also provide a sess_... session ID to resume a specific session.
| Mode | Intended use |
|---|---|
plan |
Read, analyze, and design a solution without intended file writes |
edit |
Make focused file edits |
build |
Implement changes, run commands, and execute tests; recommended for normal development tasks |
yolo |
Broadest permissions; use only with explicit user authorization |
The bridge does not rely on the native default mode for zcode --prompt, because that default may be broader than intended. Codex should always choose a mode explicitly.
You can also run the bridge without Codex:
git clone https://github.com/sjduan/codex-w-zcodecli.git
cd codex-w-zcodecli
BRIDGE="plugins/zcode-bridge/skills/delegate-to-zcode/scripts/zcode_bridge.py"Check the environment:
python3 "$BRIDGE" doctorList providers and models without displaying API keys:
python3 "$BRIDGE" providers --jsonSet a private preference order:
python3 "$BRIDGE" configure \
--prefer "Provider A" "Model X" \
--prefer "Provider B" "Model Y"Preview provider resolution without calling a model:
python3 "$BRIDGE" run \
--provider "Provider A" \
--model "Model X" \
--cwd /absolute/path/to/repo \
--mode plan \
--prompt "Analyze this repository" \
--dry-runRun a complete development task:
python3 "$BRIDGE" run \
--provider "Provider A" \
--model "Model X" \
--cwd /absolute/path/to/repo \
--mode build \
--prompt "Implement the requested change and run focused tests" \
--print-selection \
--no-colorView all bridge options:
python3 "$BRIDGE" --help
python3 "$BRIDGE" run --helpThe ZCode desktop application and CLI use different configuration locations:
Desktop: ~/.zcode/v2/config.json
CLI: ~/.zcode/cli/config.json
The bridge performs the following sequence:
- Read provider metadata from the desktop configuration.
- Synchronize only the selected provider into the CLI configuration.
- Write the CLI configuration atomically with mode
0600. - Keep API keys out of argv, stdout/stderr, and ZCode child-process environments.
- Hold a configuration lock for the lifetime of the ZCode process.
- Require Codex to inspect
git status, the diff, and relevant tests after delegation.
To make a desktop provider available to the CLI, the bridge copies its API key into the local ~/.zcode/cli/config.json. The file is set to mode 0600, but users remain responsible for protecting their account, device, disk, and backups.
Before the first synchronization, the bridge preserves:
~/.zcode/cli/config.json.pre-zcode-bridge.bak
The plugin source and public repository contain no real API keys, private provider UUIDs, custom service URLs, or user-specific absolute paths.
Refresh the marketplace:
codex plugin marketplace upgrade codex-w-zcodecliReinstall the latest plugin version:
codex plugin add zcode-bridge@codex-w-zcodecliThen start a new Codex task to load the updated skill.
Do not call native zcode --prompt directly. Run through the bridge so it can synchronize the provider and model configuration.
The selected desktop provider is incomplete or changed after the previous synchronization. Run:
python3 "$BRIDGE" providers --json
python3 "$BRIDGE" doctorCheck the API key, model entitlement, and provider service status.
The account reached a rate or usage limit. Respect the reset time in the error and do not attempt to bypass platform restrictions.
Add --verbose only while diagnosing the failure to reveal the cause, HTTP status, provider code, and trace ID.
Do not automatically switch providers and rerun the task. Inspect the current diff and tests first, then decide whether to continue the same session, repair the partial change, or begin a new task.
See ZCODE_CLI.md for the complete CLI reference.
This project is an unofficial interoperability tool. It is not affiliated with, authorized by, endorsed by, or sponsored by OpenAI, Codex, Z.AI, ZCode, or Zhipu AI.
Users must comply with every applicable current agreement, policy, and technical restriction, including:
- OpenAI Terms of Use
- Z.AI Terms
- all applicable API, model, subscription, Coding Plan, rate-limit, quota, automation-access, and content policies
This plugin does not provide, imply, or grant any right to unlimited platform usage, quota/rate-limit/payment/access-control bypass, credential sharing, or credential abuse. Do not use it to evade platform restrictions, make unauthorized bulk calls, or engage in conduct that violates applicable agreements or laws.
This project is intended only for personal learning, research, evaluation, and non-commercial development workflows. Without explicit written permission from the applicable platforms and project rights holders, do not use it for resale, paid hosted services, commercial SaaS offerings, invocation-as-a-service, revenue-generating bulk automation, or other direct commercial purposes.
Users are solely responsible for their prompts, code, data, credentials, model charges, tool calls, file modifications, generated content, and final use of any result. Do not upload source code, secrets, personal data, or protected material to a third-party provider unless you are authorized to process it there.
This project is provided "as is," without express or implied warranties. The authors are not liable for data loss, code damage, account restrictions, charges, service outages, compliance issues, or other direct or indirect losses. This section is not legal advice. Consult qualified counsel when necessary and always defer to the latest official platform terms.