Skip to content

Guardrails and limits

Agents in a Trazo repo work freely on branches. A few actions stay with the owner. This page says which actions those are, why, how GitHub and the hooks enforce the limits, and where that enforcement can fail.

In short: agents may change anything a pull request can undo. GitHub holds the limits that a pull request cannot undo.

What agents do freely

Agents do reversible repository work without asking:

  • Make a branch in their own worktree, commit, push that branch, and open a pull request.
  • Edit source, tests and documentation. These files are not on the stop list.
  • Run the tests and the repository checks.
  • Close and reopen issues, and edit labels. The PM may do this, but it may not remove needs-decision or drive-halt (pm_bash_guard.py).
  • Use ordinary shell constructs. The engineer guard judges the verbs a command runs, not its shape (ADR 0032).

A bad change is undone with a new pull request that reverts it. The rules say that anything not done through a pull request is never reversible (rules.md).

What stays human-only, and why

The stop list in .trazo/rules.md names what an agent must not decide. The main items:

  • Secrets. Agents never read, print, log or commit a secret. The owner enters secrets with scripts/put_secret.sh, which the settings deny to agents.
  • Production and deploys. Agents have no production access unless the owner asks for it. Deploy commands are denied to every role (hooks README, section 3).
  • Spend. The unattended drive has caps. By default it runs 4 agent runs and 5 merges per UTC day, and each run is capped at $2 (drive.yml).
  • Merges. No agent runs gh pr merge. The owner dispatches owner-merge.yml, or the front door does it for the owner (ADR 0029).
  • Governance and safety paths. Changes to CODEOWNERS paths, workflows, the charter, agent rules, role files, CLAUDE.md, AGENTS.md, .claude/, and .trazo/ outside .trazo/project/ need the owner's review. So do ARCHITECTURE_CONTRACT.md and SKEPTIC_BAR.md, the build and CI configuration, permissions, dependencies, repository settings, and external systems.
  • Scope. The PM decides scope, priority, sequencing and acceptance criteria.
  • Tags. A release is a git tag. A tag is never moved or deleted (rules.md).

Why these stay human-only: a pull request cannot take back a leaked secret, a spent budget, a deploy, a changed ruleset, or a moved tag. The rules keep these with the owner. Changing a limit is also a human-only act: "automation may tighten a limit, never loosen one" (rules.md).

How it is enforced

The rules say to put each gate at the strongest layer that can enforce it. There are four layers, strongest first.

  1. GitHub rulesets. The saved copy is scripts/rulesets/main-ruleset.saved.json.
  2. protect main covers the default branch. It blocks deletion and non-fast-forward pushes and requires a pull request. It requires four checks: secrets-scan, docker, test and docs-updated. It has no bypass actors. It requires zero approving reviews and does not require code owner review.
  3. The tag ruleset v blocks deletion, force-move and update of tags, with no bypass.
  4. The tag ruleset v-create controls who may create tags. Its bypass is the repository Admin role (protect_release_tags.py).
  5. CODEOWNERS. .github/CODEOWNERS names the paths that need the owner's review. The ruleset does not enforce it, because require_code_owner_review is false. The owner-merge gate and the classifier use the same list instead (report_verdict.py).
  6. The owner-merge gate. owner-merge.yml runs only when the owner dispatches it from the default branch. It refuses unless the pull request is open, not a draft, not from a fork, and targets the default branch, and every check is green on the head commit. A pull request that changes a risky path also needs trazo/verdict and trazo/security to be success on that head (ADR 0031). It merges with --match-head-commit, so a push after the check cannot slip in. A scheduled job, merge-audit.yml, re-applies the same gate to recent merges and opens an issue for any that failed it. It detects only and reverts nothing.
  7. Four hooks. They run before tool calls in the session they are registered in. Each one binds a different set of tools. Their source is in src/overlay/hooks/.
  8. agent_role_guard.py lets the Agent tool start only the pinned roles.
  9. front_door_guard.py stops the main session from editing files outside .trazo/project/ and from writing pull request bodies or empty commits (ADR 0029).
  10. pm_bash_guard.py is an allowlist of exact command shapes for the PM.
  11. engineer_bash_guard.py is a blocklist for the main session and the engineer subagents. It denies merges, status writes to other roles, secrets and protected paths.

The hooks fail closed: unreadable input or a missing script blocks the call. They are speed bumps, not boundaries (see the next section).

The unattended drive adds its own limits: a kill switch (DRIVE_ENABLED), a drive-halt label that stops work, one open drive pull request at a time, and the daily caps above. A halt clears itself once after a fix merges and CI is green (ADR 0030). That is a loosening of a limit, so the owner reviews it.

Where each layer can fail

Rulesets. - The live protect main ruleset, read with gh api on 2026-11-28, lists four required checks. It does not list trazo/verdict, but the saved copy does. The two differ. Which one is intended is UNVERIFIED. Drift is tracked in #282. - CODEOWNERS is not enforced by the ruleset (see above). - The reviewer's commit status is not pinned to a GitHub App. #366 tracks this.

Owner-merge gate. - The reviewer and security statuses are set by the same account that dispatches the run. The gate cannot tell the two apart (#366). - The gate's token may or may not squash-merge a pull request that edits .github/workflows/. GitHub restricts that write. UNVERIFIED on a live run. If the merge is refused, the owner merges that one pull request by hand.

Hooks. The hook README lists what still gets through (hooks README, "What still gets through"):

  • Any HTTP client that holds GH_TOKEN, such as curl. It needs no gh call and no .env word.
  • A refspec or endpoint built from a shell variable. The ruleset rejects a push to the default branch, but a variable-built endpoint is not judged.
  • The working directory is not tracked. cd .claude && echo x > y writes into .claude/.
  • Interpreters and scripts: python -c, node -e, and a script the agent writes and then runs.
  • Shell variables, globs, eval $(...), aliases and functions.
  • gh api -X DELETE on an object outside the blocklist passes.
  • The Read, Edit and Write tools are not bound by the Bash hooks.
  • Symlinks inside the repository that point outside it are not resolved. UNVERIFIED.

How far to trust it today

Trazo is about two months old, and it was built from one project, this one. Its first commit is from 2026-09-27. The repository records no use by anyone other than its author.

  • One shared account. Every interactive agent acts through one GitHub account, so the review status is only as trustworthy as that account (#366, #44). It closes when the reviewer's own GitHub App writes the verdicts and the status is pinned to it.
  • The drive is unproven. It is on in this repository and off by default in yours. It was triggered on a schedule from 2026-10-31 but only ran for real from 2026-11-23, when it was switched on here, and it opened one pull request, #312, which was closed unmerged. A watched run on 2026-11-28 made no change: the stuck job could not label the issue needs-pm because it ran git outside a repository (#399). Issue #247 stays open until a run merges a pull request.
  • The hooks are a backstop. They block the commands they recognize, and their known gaps are listed above under where each layer can fail.
  • Not tried. The charter's goal, that a new VS Code user ships a feature with no manual coding, has not been tried. Token cost has not been measured.

Shipped and UNVERIFIED

Each row names its source. A row marked UNVERIFIED has not been run live.

Item Status Source
Owner-merge gate logic Shipped on main. Covered by its test file; not a live run. owner-merge.yml, test_owner_merge_workflow.py
Drive, end to end UNVERIFIED. A watched run on 2026-11-28 did not produce a change. The open defect is #399, and its fix is in progress. No full unattended run has merged. drive.yml, #247
release.yml UNVERIFIED. Never run live. release.yml
merge-audit.yml UNVERIFIED. Never run live. merge-audit.yml
Release App bypass on v-create UNVERIFIED. The live v-create ruleset, read on 2026-11-28, has one bypass actor (the Admin role) and no App entry. The App bypass shape is not confirmed. allow_release_app.py
Front-door hook payload shape: the main session has neither agent_id nor agent_type UNVERIFIED live. Taken from the hooks documentation, not a recorded payload. hooks README, front door section
Agent-role hook input shape (subagent_type) UNVERIFIED live. hooks README, agent role section
Reviewer App pin on trazo/verdict Not shipped. #366
Live protect main requires trazo/verdict UNVERIFIED which is intended. Live and saved copies differ. main-ruleset.saved.json, #282

Decisions

  • ADR 0029: the front door is the main session, and it acts.
  • ADR 0030: a drive halt clears itself once.
  • ADR 0031: review by path, not every pull request.
  • ADR 0032: agents are permissive by default; GitHub holds the irreversible limits.

The status lines of these four ADR files still read "proposed" on main, although rules.md already applies the rules they describe. This page does not change their status. Other pages cite these ADRs the same way.

A real pull request, as proof

This is #329, which limited the agents the main chat session may start to six named ones. The excerpts are real and shortened.

  1. The body carries test evidence on lines that CI reads:

    Review rounds: 0
    Defects found and fixed: none
    Fail-first output:
    New tests/test_agent_role_guard.py run against unchanged origin/main (38 errors, the guard script does not exist there):
    
  2. The security agent read the first commit in its own session and passed it. One suggestion became a follow-up issue.

  3. The reviewer returned merge after fixes with Reviewed-Head: 6126ffb, because the block message named four of the six allowed agents.
  4. The author pushed 0dd084a with a test that fails on the old message, and the reviewer wrote merge.
  5. On 0dd084a the statuses trazo/verdict and trazo/security were success and CI was green. It was merged through the owner account on 2026-11-25, before the merge workflow existed (added later that day in #331).

Today the merge workflow, owner-merge.yml, merges with --match-head-commit, so a later push cannot slip in. When a check is missing it stops with it changes risky paths and trazo/verdict is missing on this head; not merging. (the workflow's wording, not output from #329).

Why these rules exist

Each rule above answers something that went wrong in this project.

  • An agent did the wrong role's job. In a host repository, the main chat session edited pull requests and pushed empty commits itself, and said nothing stopped it (#319). A hook that blocks those edits now ships; its behavior on every live input is UNVERIFIED.
  • One account could set the approval. Every interactive agent acts through one GitHub account, so any of them can set the status that says a review passed. Of the 22 merged pull requests #316 to #358, the reviewer's own GitHub App wrote a status on 14, and every one was a failure (a placeholder asking a person to set the status). Every success on all 22 came from the shared account (#366, #44, both open).
  • Guards missed a route, then blocked the wrong agent. An engineer agent could still merge and read .env through gh api and cat (#330). The guard added for that then blocked the reviewer and security agents from posting their own status (#347, #364).
  • How it works: the loop, the roles, the merge gate and the drive workflow these limits apply to.
  • Use it: what to do when a limit stops you.
  • Install and upgrade: the owner-only setup that creates the GitHub-side limits.