Shipped · proven on Claude Code onlyThree layers

Each layer is there because the one above it can fail

A file can be ignored. A hook can be absent. A pull request cannot be either, but it arrives too late to stop anything. None of the three is sufficient, which is the entire reason there are three.

Stopped by the hook, before the file changed.

The hook enforces in Claude Code today, on macOS and Linux. The CI check runs only in CommitCycle's own repository, advisory there.

What each layer does, and where it gives out

One advises, one denies, one recomputes. Each catches the failure of the one above it.

Layer 1: context, which advises

The AGENTS.md block carries the zone map, the board, the hand-in note it expects and the deploy rule. The task itself, what is open and what is shut, is written at the gate to a gitignored CLAUDE.local.md, and its task block is removed at hand-in. Where nothing on the machine enforces, it says so in its own text: nothing is stopping you, so this one is on you.

The catch: Claude Code loads CLAUDE.local.md; whether other editors do has never been checked.

Agent context
CLAUDE.local.md
<!-- cc:begin -->### You are working on CC-326 — Seven Platform menu items still point at documentationBranch `task/CC-326-seven-platform-menu-items...`. Access expires in about 8 hours.**What it should do.** …the task's own Goal…**What it must NOT do.** …its non-goals, verbatim…**No protected zone is open to this task.** Everything below is closed.**Closed to this task.** You may not write there — nothing is stopping you, so this one is on you:- `schema` (deny): apps/api/migrations/**, apps/api/src/db/schema/**- `contracts` (deny): packages/contracts/**<!-- cc:end -->

Layer 2: the hook, which denies

A pre-tool-call hook answers before the write happens. Ours only narrows: it can deny, and since CC-1142 it never answers allow, so the harness's own permission prompts still apply.

Worth saying plainly: this mechanism is commodity. Claude Code, Codex, Cursor, Augment, Factory and Devin CLI all expose a hook that can return deny, and in the one you are probably using it is free. What is not commodity is the model it consults: owners, expiry, and permission scoped to a declared task.

  • The hot path never touches the network. The decision is local, so an outage cannot open a zone: the backend was never in the deny path to begin with
  • Bash is contained rather than allowlisted. Guessing what a shell command will do is a losing game, so commands run against a git snapshot and changes to protected paths the task does not hold are reverted byte for byte. The few effects a revert cannot undo (a push, network egress, a database client, sudo, a path outside the repository) are refused outright
Zones with owners
Claude Code · ~/commitcycle
> add members and invitations● Edit apps/api/migrations/0031_members.sql✗ Edit on apps/api/migrations/0031_members.sql was denied — zone "schema" (Database schema) is closed for writing. Owner: paulo@commitcycle.com.→ cycle request-access CC-79 --zone schema \ --mode write --reason "CC-79 needs a members table" \ --alternative "file the migration as its own task" REQ-156 is with the zone owner

The admission that makes the rest credible

We measured the harness against real sessions on 2026-08-03, and it is fail-open in all four failure modes: crash, timeout, malformed output, not installed. That is the reason the other two layers exist in the shape they do. A wrapper can close three of those modes by refusing on its own behalf when the hook cannot answer, but only where the repository's failure policy is set to closed, or to reads, which still lets Read, Glob and Grep through. The fourth, never installed at all, is invisible from inside the machine, so only CI can see it, and only where the check runs.

The catch: the default, since CC-1143, is open: calls continue and the session is told.

How the layers divide the work
.zones/state/failure-policy
  • The hook crashescall continues
  • The hook times outcall continues
  • The hook returns malformed outputcall continues
  • The hook was never installedcall continues

Open, the default: calls continue under your own permission settings, and the session is told.

Layer 3: CI, which recomputes

The CI check reads the zone map from the pull request's own checkout and recomputes which zones the diff actually touched, against what the task declared: the declaration, not the grant, so approvals and expiry go unchecked. It is the only layer that could see work produced where CommitCycle was never installed.

Its own limits, stated: it runs only in CommitCycle's own repository, and nothing installs it into yours. There, on a private personal free plan, branch protection answers 403, so it runs advisory, says so, and cannot stop a merge. A board that does not answer turns it into a skip that still passes, and on a same-repository pull request the branch can rewrite the workflow that checks it. An enforcing mode and a board-side check run are built and not switched on.

The CI check
github.com · checks
scopeIs this pull request inside what its task declared?
The diff touchesapps/api/migrations/0031_members.sqlDatabase schema
CC-79 declaredDatabase schema
inside the declarationadvisory

Branch protection answers 403 on this plan, so the check cannot stop a merge.

What we measured, and its limits

On our own repository. Every number comes with the condition it was measured under.

25/25 contained

Shell escape vectors

Changes to protected paths made from the terminal were reverted. Containment closes when the call returns, so what a command leaves running escapes it until the close checks the diff against the zones: a background command (the hook asks first), a foreground one that hits its timeout, a cmd & inside one.

The catch: on 2026-08-03, against a corpus we chose ourselves. Gitignored paths are not seen.

0/20 false positives

Ordinary commands wrongly blocked

The catch: on 2026-08-03, against a corpus we chose ourselves; the live false-positive eval has not run.

68–83 ms at p95

Against a 100 ms budget

The catch: measured 2026-08-03 on the first hook build, on an idle machine, and p99 touched 102 ms in one case. CC-1377 re-timed it in October 2026 on two cloud VMs: on the slower one wrapper and core reached 211–228 ms at p95 (load 0.74–1.04), and the hook's cost over a shell-launched node process was 84–111 ms there against 44–48 ms on the faster one, for the same code. Two hosts, not a survey.

Where the arrangement stops

What three layers still do not cover.

Layer 2 is proven on one harness

The zone model is agent-agnostic; the enforcement point is not. cycle init writes hook files for Claude Code and Codex, and for Cursor and Windsurf on request, only where a hook wrapper is already on disk, so on your machine it writes none and the plugin is the hook: in Claude Code only, so Codex, Cursor and Windsurf get none. Only Claude Code has been seen to deny on a real install. The others, where their files are written, are unexercised and are answered in Claude Code's reply format. Layer 1's task half is known to reach Claude Code only, and Layer 3 cannot be installed in your repository.

An enterprise can block the hook outright

Managed settings exist for exactly that, and a policy that locks hook sources locks ours out with everyone else's.

None of this arbitrates between agents

Each checkout is confined to its own task and branch, so two agents in one directory share both; two that disagree still disagree.

How the layers divide the work is in the docs, and the map all three read is the zone map.

Ask for an invite

Signup is closed while this is small, so everyone using it early gets answered personally.

Ask for an invite

Install the plugin

/plugin install commitcycle@commitcycle

The Claude Code plugin installs without an invite.