Claude Code
Claude Code is the default agent. zt start writes a Claude Code plugin into the session’s worktree and starts claude with it. The plugin claims each file before Claude edits it, checks what shell commands changed, and passes on notices from other sessions.
Set it up
Section titled “Set it up”- Install Claude Code 2.1.295 or later. Zentri was checked against 2.1.332.
- Sign in to Claude Code with your own account, through Claude Code’s own sign-in. Zentri never reads or stores that sign-in. See Bring your own credentials.
- Run
zt doctorto check thatclaudeis on yourPATH. - Start a task from your repository.
claudeis the default, so--agentis optional.
zt start "add CSV export to the reports page"zt start checks claude --version before it launches the agent. An older version stops the launch with this error, and the session is marked failed:
claude <version> is too old for Zentri; update Claude Code to 2.1.295 or laterThe launcher then runs Claude Code in the session’s tmux session:
claude --plugin-dir <worktree>/.zentri/claude-code \ --settings <worktree>/.zentri/claude-code/settings.json "<prompt>"Attach to it with zt attach. Interactive Claude Code asks you to trust each new worktree before its hooks run. Trust it, or the hooks do not run.
What the kit holds
Section titled “What the kit holds”The plugin is embedded in the zentri binary. zt start writes it to <worktree>/.zentri/claude-code/. The only value it fills in is the path of the zentri binary.
| File | What it does |
|---|---|
.claude-plugin/plugin.json |
Names the plugin zentri. |
.mcp.json |
Runs zentri mcp, the stdio bridge to the coordinator’s /mcp, and forwards the session’s ZENTRI_* variables. |
hooks/hooks.json |
The four hooks below. |
settings.json |
Allows the plugin’s MCP tools, mcp__plugin_zentri_zentri__*. |
skills/zentri/SKILL.md |
Tells the model what claims, denials, and notices mean. |
skills/zentri-prd/SKILL.md |
The PRD skill, /zentri:zentri-prd. |
skills/zentri-adr/SKILL.md |
The ADR skill, /zentri:zentri-adr. |
No kit file holds the session token. zentri reads it from the file that ZENTRI_SESSION_TOKEN_FILE names.
What Zentri enforces
Section titled “What Zentri enforces”| Hook | Runs on | What it does |
|---|---|---|
PreToolUse |
Edit, Write, NotebookEdit |
Runs zentri hook claude-code pre-edit, which claims the file. A denial blocks the edit. "onFailure": "block" blocks it too when the hook itself fails. |
PostToolUse |
Bash |
Runs post-shell. It claims the files the command changed and tells Claude to revert any that another session holds. |
SessionStart |
The session’s start | Passes on notices from other sessions. |
UserPromptSubmit |
Each prompt | Passes on new notices. |
Each hook has a 30 second timeout. The pre-edit hook retries an unreachable coordinator for 8 seconds, then denies the edit. A held file is denied with a message that names the holder:
Zentri: another session holds a file this edit would change.Claude also gets the 13 MCP tools, such as zentri_claim_file, zentri_check_inbox, and zentri_submit_plan.
In an OpenShell sandbox
Section titled “In an OpenShell sandbox”Build the image once, then start the session with the openshell launcher. See Sandboxing and OpenShell policies.
make sandbox-image AGENT=claude-codezt start --launcher openshell "add CSV export to the reports page"Inside the sandbox the kit is managed config under /etc, which the policy makes read-only:
/etc/claude-code/managed-settings.jsonholds the hooks,allowManagedHooksOnly, the permissionmcp__zentri__*, andCLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1andDISABLE_AUTOUPDATER=1.managed-mcp.jsonleaves the Zentri server as the only MCP server.- The PRD and ADR skills are enterprise skills in
/etc/claude-code/.claude/skills/.
The policy lets /usr/local/bin/claude reach api.anthropic.com, claude.ai, claude.com, and platform.claude.com on port 443. You sign in inside the sandbox through Claude Code’s own sign-in, or attach an OpenShell provider that holds your API key. See Bring your own credentials.
What Zentri cannot enforce
Section titled “What Zentri cannot enforce”- With
local-dev, Claude runs as you, with no sandbox. ABashcommand can write a held file. The post-shell hook catches it afterwards. It does not stop it. - Your own Claude Code settings still load next to the plugin. Zentri does not stop you from adding other hooks or tools on your machine. In the sandbox,
allowManagedHooksOnlylimits hooks to Zentri’s. - The git pre-commit hook only warns, and
git commit --no-verifyskips it. Require the merge check for a hard gate.
Limitations
Section titled “Limitations”- No test runs Claude Code with a model, because tests never use anyone’s credentials. The written kit passes
claude plugin validate --strict, and the hooks run in tests through the realzentribinary. - Claude Code has not run inside an OpenShell sandbox yet. The image builds and prints the pinned version.
Related pages
Section titled “Related pages”- Agents
- File claims
- Connecting your editor
- Model routing. The router passes
--modelto Claude Code for a session started with--credential api-key. - CLI reference and Environment variables