Skip to content

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.

  1. Install Claude Code 2.1.295 or later. Zentri was checked against 2.1.332.
  2. 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.
  3. Run zt doctor to check that claude is on your PATH.
  4. Start a task from your repository. claude is the default, so --agent is optional.
Terminal window
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 later

The launcher then runs Claude Code in the session’s tmux session:

Terminal window
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.

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.

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.

Build the image once, then start the session with the openshell launcher. See Sandboxing and OpenShell policies.

Terminal window
make sandbox-image AGENT=claude-code
zt 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.json holds the hooks, allowManagedHooksOnly, the permission mcp__zentri__*, and CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 and DISABLE_AUTOUPDATER=1.
  • managed-mcp.json leaves 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.

  • With local-dev, Claude runs as you, with no sandbox. A Bash command 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, allowManagedHooksOnly limits hooks to Zentri’s.
  • The git pre-commit hook only warns, and git commit --no-verify skips it. Require the merge check for a hard gate.
  • 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 real zentri binary.
  • Claude Code has not run inside an OpenShell sandbox yet. The image builds and prints the pinned version.