Codex
Zentri runs the Codex CLI with a profile named zentri. The profile adds the Zentri MCP server and hooks that claim each file before Codex patches it. Your Codex login and your own config.toml stay as they are.
Set it up
Section titled “Set it up”-
Install the Codex CLI. Zentri was checked against 0.172.0.
-
Sign in with your own account through Codex’s own sign-in, or with your own API key. Zentri never reads or stores either. See Bring your own credentials.
Terminal window codex loginOpenAI documents API key sign-in for programmatic use:
Terminal window printenv OPENAI_API_KEY | codex login --with-api-key -
Run
zt doctorto check thatcodexis on yourPATH. -
Start a task from your repository.
Terminal window zt start --agent codex "add CSV export to the reports page" -
Attach with
zt attach. The first time, Codex asks you to trust the new hooks. Trust the Zentri hooks once in/hooks. Zentri never passes--dangerously-bypass-hook-trust.
zt start writes the profile to $CODEX_HOME/zentri.config.toml. CODEX_HOME defaults to ~/.codex. Every session shares that one file, and zt start rewrites it only when its content changes. The launcher then runs:
codex --profile zentri \ -c 'sandbox_workspace_write.writable_roots=["<git dir>","<common dir>"]' "<prompt>"The writable roots let Codex commit from the worktree. They change per session, so they go on the command line, not in the profile.
What the profile holds
Section titled “What the profile holds”- The stdio bridge as
[mcp_servers.zentri], withenv_varsfor the session variables anddefault_tools_approval_mode = "approve". approval_policy = "on-request",sandbox_mode = "workspace-write", andnetwork_access = true, so the hooks can reach the coordinator.- The hooks below.
The profile holds no session token. zentri reads it from the file that ZENTRI_SESSION_TOKEN_FILE names.
What Zentri enforces
Section titled “What Zentri enforces”| Hook | Matcher | What it does |
|---|---|---|
PreToolUse |
^(apply_patch|Bash)$ |
Runs zentri hook codex pre-edit. It claims every file an apply_patch call names. A Bash call is checked only when it carries a patch. Any other command is left to the post-shell hook. |
PostToolUse |
^Bash$ |
Claims the files a command changed and tells Codex to revert any that another session holds. |
SessionStart |
Passes on notices from other sessions. | |
UserPromptSubmit |
Passes on new notices. |
Codex also gets the 13 MCP tools. The server’s instructions are under 512 characters, because Codex keeps only the first 512.
Skills
Section titled “Skills”On your machine, zt start installs no skills for Codex. Codex 0.172.0 has no skills folder that belongs to a profile, and every folder it reads reaches all your Codex sessions, not only Zentri’s. To use the PRD and ADR skills anyway, copy them once into your user skills folder from a Zentri checkout:
mkdir -p ~/.agents/skillscp -R adapters/skills/zentri-prd adapters/skills/zentri-adr ~/.agents/skills/Without a checkout, zentri kit render --target sandbox --agent codex --out <dir> writes the same two folders under <dir>/etc/codex/skills/. Codex then lists the skills in every session, also in ones Zentri did not start, where the Zentri tools do not exist.
adapters/codex/AGENTS.md is an opt-in snippet for your repository’s own AGENTS.md. The launcher never writes it.
In an OpenShell sandbox
Section titled “In an OpenShell sandbox”make sandbox-image AGENT=codexzt start --launcher openshell --agent codex "add CSV export to the reports page"The kit is managed config under read-only /etc. /etc/codex/requirements.toml holds the hooks with allow_managed_hooks_only = true. /etc/codex/config.toml holds the MCP server and turns off the update check, analytics, and feedback. The skills go to /etc/codex/skills/.
The policy lets /usr/local/bin/codex reach api.openai.com, chatgpt.com (only /backend-api/**), and auth.openai.com on port 443. A policy endpoint refuses a WebSocket upgrade, so Codex has to use its HTTP transport. See OpenShell policies.
What Zentri cannot enforce
Section titled “What Zentri cannot enforce”- A missing or crashing
zentribinary lets the edit through, as described above. - With
local-dev, Codex runs as you. A shell command that is not a patch can write a held file. The post-shell hook catches it afterwards. - The git pre-commit hook only warns, and
git commit --no-verifyskips it.
Limitations
Section titled “Limitations”Codex has not run with its kit. Tests never use anyone’s credentials, and no Codex binary ran in this project’s tests. These points are inferred from Codex’s docs and source, not seen in a run:
- that Codex loads hooks from a profile file;
- that Codex asks you to trust the Zentri hooks once per machine;
- that
writable_rootslets commits through from the worktree.
Codex has not run inside an OpenShell sandbox either. The image builds and prints the pinned version.
Related pages
Section titled “Related pages”- Agents
- File claims
- Model routing. The router passes
--modelto Codex for a session started with--credential api-key. - Vendor terms for OpenAI’s rules on sharing an account
- CLI reference and Environment variables