Skip to content

Protected paths

The files an agent may not write without holding the right token — and where that list really comes from.

Some files in the repo are too important to edit casually: the policy itself, the invariants, the secrets, the deploy scripts, the dashboard sidebar. These are protected paths. A protected path is a glob pattern plus a required scope — the token an agent must hold for a write to that path to be allowed.

When an agent tries to write or edit a file, the gate matches the path against the protected globs. Three outcomes:

  • No match — the path isn’t protected; the write proceeds (subject to the gate’s other tiers).
  • Match, and the agent holds the required token — allowed. The token comes from the worktree’s scope manifest.
  • Match, and the token is missing — denied, and the attempt is written to the audit log.

Tokens are short labels naming a category of sensitive work. An agent only holds a token if the operator granted it for the current task. The recognised tokens include:

Token Unlocks
auth Authentication / secret-handling paths.
compose Compose files and deploy definitions.
meta The policy and governance files themselves (e.g. editing AGENT_POLICY.yaml).
migration Database migration files.
container-new Introducing a new container/service.
task-approved The middle tier — a general code change the operator has approved a plan for.

This is the key fact about PROTECTED_PATHS.md: it is the human-readable rendering of the protected-path list, and it is derived from AGENT_POLICY.yaml — not the source. The YAML is canonical; the markdown is generated from it for people to read.

Protected paths are enforced at more than one checkpoint, on purpose:

  • The gate blocks the write as it happens (write-time).
  • The post-hoc sweep re-checks the diff after a run and reverts anything that slipped through (after-the-fact).
  • CODEOWNERS routes the same paths to the operator for review at merge time (merge-time).

A write that dodges one layer still meets the next. That redundancy is the whole design.