Skip to content

The three catches

Zentri stops duplicate and conflicting work at three points in a task’s life. The intent gateway runs before an agent starts. File claims run before each edit. The merge check runs on the pull request. Each catch covers gaps in the one before it, so no single catch has to be perfect.

zt start "task"
|
v
1. intent gateway compares the task with existing intents
|
v the agent runs and edits files
2. file claims compares each path with other sessions' claims
|
v the session opens a pull request
3. merge check compares the changed files with every claim,
the intent's match, and the session's decisions
Catch Runs Stops Can be skipped by
Intent gateway In zt start, before the agent A second agent on the same task A reworded task that matching does not catch
File claims In the kit’s hook, before each edit Two sessions editing one file An agent without a kit, or a change made outside the hook
Merge check On GitHub, on each pull request A merge of unclaimed, held, or duplicate work Nothing on the agent’s side, once branch protection requires it

zt start "ENG-101: add CSV export" registers the task as an intent before it starts an agent. The coordinator compares the task with the project’s active, queued, and done intents. It uses the ticket ID, the text’s similarity, and, if you set one up, an LLM judge. It then puts the task in one of four classes:

Class Meaning Choices
new No match None. The agent starts.
partial_overlap Related work is in progress run_anyway (default) or queue
already_done The same work is done run_anyway or escalate
active_duplicate The same work is in progress Your own work: merge, queue, run_anyway, or fork. Someone else’s: join_as_watcher (default) or escalate.

When only the LLM judge found the duplicate, you can also run anyway, and there is no default. No agent starts until you choose. On a terminal, zt start asks. Without one, it exits 2 unless you pass --resolution or --yes. A requester cannot run anyway or fork, so their task is queued.

Intents and dedup covers matching, thresholds, and each choice.

A claim says one session is editing one file. Only one session can hold a live claim on a path in a project. The coordinator’s database enforces that with a unique index, so a bug can refuse a claim wrongly but cannot grant one twice.

When the agent is claude, codex, or opencode, zt start writes a kit into the worktree. The kit runs a hook before every edit, and the hook claims the file first. If another session holds it, the edit is refused, and the agent reads who holds it. In Claude Code the refusal looks like this:

Zentri: another session holds a file this edit would change.
- src/report.go is held by @ana (session 6fce6c79, working on "eng 301 add csv export reports page")
Work on something else, or ask the holder to release it, then retry. Do not write the file another way.

Both sessions get a notice about the conflict. A claim expires 30 minutes after it was last renewed. The session’s heartbeat renews all its claims, and each edit of a file renews that claim. A session that sends no heartbeat for 10 minutes is abandoned, and its claims are freed. When the coordinator cannot be reached, edits are refused after 8 seconds, unless a lead sets the project’s edits_fail_open.

Two later checks back up the hook. A shell command that changes a held file is caught after it runs, and the agent is told to revert it. A commit runs the git pre-commit hook. It claims the staged files, warns about held ones, and sends the coordinator a snapshot of the session’s changes. It never stops the commit.

File claims covers claim modes, expiry, and release.

The merge check asks the coordinator about each pull request. It runs as a GitHub Action with the job’s GITHUB_TOKEN, or as a GitHub App that reports a check run named zentri/merge-check. It runs on GitHub, so git commit --no-verify and edits to the local hooks cannot skip it.

It reads the coordination state in one read-only snapshot and applies five rules:

Rule Fails when
session A zentri/ branch names no session of the project, or more than one
unclaimed The session never claimed a changed path. A live, released, or expired claim counts.
held Another session holds a live claim on a changed path
duplicate The session’s intent ran anyway over an active_duplicate match that is still active
decision The session has a high-risk decision that is proposed, or rejected with no accepted decision of the same session superseding it

A branch outside zentri/, such as one a person pushed, is checked for held only. A coordinator error fails the check. It never passes it.

The GitHub check covers setup. Questions and decisions covers the decision rule.

Each catch has a gap that a later one closes.

Gap Closed by
A reworded task gets past the intent gateway and starts a second agent. File claims refuse its edits to files the first session holds.
You chose run_anyway over an active duplicate. The duplicate rule fails the branch while the other work is active.
An agent has no kit, or changes a file outside the hook. The unclaimed and held rules fail the pull request.
Someone commits with --no-verify. The merge check runs on GitHub, not in the local hooks.
A person pushes a branch by hand. The held rule still runs on it.

You meet the first catch each time you run zt start. When a task matches someone else’s active work, you pick a choice on the terminal, or pass it as a flag:

Terminal window
zt start --resolution join_as_watcher "ENG-101: add CSV export to the reports page"

The quickstart shows this with two users.

The second catch needs no command. The kit claims files as the agent works. zt status shows your sessions and their notices.

Claims also work over HTTP, with the session’s token. A second session that asks for the same file is told who holds it:

Terminal window
API=http://127.0.0.1:8080
S=$(zt status --json | jq -r '.sessions[0].local.session_id')
F=$(zt status --json | jq -r '.sessions[0].local.token_file')
curl -s -H @<(printf 'Authorization: Bearer %s\n' "$(cat "$F")") -d '{"paths":["cmd/main.go"]}' $API/v1/sessions/$S/claims | jq

The third catch needs one-time setup in each repository: an integration token with the checks:read scope, the workflow or the App, and branch protection that requires the check. See the GitHub check.

  • Matching runs offline by default. It catches the same ticket and near-identical wording, but no paraphrase. The optional LLM judge catches some reworded duplicates. It is off until you set it up.
  • File claims run through the kits for claude, codex, and opencode. Any other agent gets only the git hooks, which warn at commit time.
  • The Codex and OpenCode kits pass their tests, but no real Codex or OpenCode has run them yet. Codex lets an edit through when the hook binary is missing.
  • A shell command that changes a held file is caught only after it runs.
  • The pre-commit hook only warns, and --no-verify skips it. The merge check is the gate.
  • The merge check supports GitHub only. Branch protection must require it, or a failing check does not block the merge.
  • A verdict is a snapshot. A pull request that passed stays green after another session claims one of its files, until the next push or a re-run.
  • The merge check reads at most 3000 changed files, and reports at most 100 findings.