Ryuu's Skills

commit-guard

Lets through only the commits, pushes and comments the delivery mode allows.

skills hook pre-tool-use runs before each shell command and enforces the delivery mode. It reads the mode and reviewer triggers in process, and its delivery checks ignore AGENT_HOOKS=0.

What Passes in PRs Mode

  • One -m, single line Conventional commit of 50 characters or fewer, through git commit, git -C <dir> commit, or gh stack add -m.
  • gh pr comment <n> --body "<trigger>", only when the body is an active reviewer's TRIGGER, such as @greptileai while greptile is active.
  • A typed push, only as git push [-u] [-q] origin <branch> or its refs/heads/<branch>:refs/heads/<branch> form, alone, to a local branch other than the one origin/HEAD names. git -C <dir> push resolves against <dir>.

Everything else touching a commit, a push or a PR comment is blocked, and a blocked push names the delivery command that does that job: skills publish for a branch or stack layer, skills fix-round for a fix round, skills lease-rebase and skills restack-layer for restacking. In hands-off mode every commit, push and PR comment is blocked.

In both modes a git config command naming a skills. key, in any letter case, is blocked. Those keys hold your reviewer settings.

What It Blocks

  • A commit with an extra flag, --amend, more than one message, a multi-line message, a message over 50 characters or one without a Conventional prefix.
  • A push that forces, deletes, mirrors, pushes --all, uses a wildcard or several refspecs, or goes through gh stack push, sync, submit or link.
  • A commit, push or PR comment that is chained with &&, ; or |, wrapped in $(...) or backticks, spread over several lines, or nested inside bash -c, sh, eval, ssh or su.
  • A command it cannot parse at all, when it looks like a commit, push or PR comment.

When It Passes

  • A command with no commit, push, PR comment or skills. config in it.
  • The delivery commands themselves, such as skills publish and skills fix-round, once the comment sweep has nothing new to show.
  • A tool call that is not a shell command.

Comments Before Shipping

After a commit passes its checks, and before skills publish or skills fix-round runs, the guard sweeps the tree for added comment lines the way the reply guard does and blocks once with any it has not shown this session. Delete or keep each, then run the command again: the lines it listed do not block it twice. This settles comments written by a shell command or a delegate before the code is pushed, so the reply guard has nothing left to raise after the final reply. The sweep runs where the command does: git -C <dir> commit sweeps <dir>, a cd chained before skills publish or skills fix-round moves it, and so does the workdir Codex passes. Only a command word counts, so echo skills publish sweeps nothing, and each shipping command in one call sweeps its own checkout. The sweep runs before the command does, so a comment the same command writes, as in printf ... > a.ts; skills publish, waits for the reply guard.

The sweep remembers what it showed by session id, so it does not run in OpenCode, whose tool events carry none, or with AGENT_HOOKS=0. When the sweep itself fails, the command goes through and the reply guard still sweeps at the end.

What It Cannot See

It fails closed. An unreadable payload is blocked, not passed. When Bun is missing, the wrapper denies the tool call and asks you to install Bun 1.4.0 or newer and put it on PATH or in ~/.bun/bin. When the guard itself exits with an error, the wrapper denies the call too. One gap remains: if the ~/.agents/skills/playbook link no longer reaches a checkout, the host cannot start the hook at all and treats that as a non blocking error, so rerun ./install.sh after moving the checkout.

It cannot see a commit or push inside a script the agent runs, or a gh api write, which is why it is paired with the deny rules.

On this page