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 prs mode a blocked git cherry-pick names skills takeover <pr>, which carries another author's commits from their PR onto your branch with each author line and message unchanged, and stops on a conflict for skills takeover --continue or skills takeover --abort. 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 git merge or git pull that can create a commit, the way git cherry-pick, git revert and git am can. In prs mode a blocked merge names git merge --no-commit then a shaped git commit -m, and a blocked pull names git pull --ff-only. In both modes git merge passes, typed alone, when --ff-only, --no-commit or --squash comes first with no later long option, or with --abort or --quit alone, and git pull passes the same way with --ff-only.
  • A push that forces, deletes, mirrors, pushes --all, uses a wildcard or several refspecs, spells its refspec so the shell could rewrite it, with an unquoted { or # or a leading =, 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 piped to a shell or given to it as a here string counts as nested too, and so do git words an echo or printf, or a group of only those, pipes to xargs git, or a here string or heredoc hands it. So does each command GNU parallel builds from its ::: arguments or piped lines, judged the way it runs them, replacement strings such as {} and {1} filled in. Each word is read the way the shell runs it, so a git verb spelled with $'...' escapes, as a locale string such as $"push", or from pieces such as g$'it' that a producer prints as one word counts the same.
  • 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, git words xargs or parallel reads from a file, from the output of another command, or from a group, loop or if holding any command other than echo or printf, parallel inputs read from a file with :::: or -a, or a gh api write, which is why it is paired with the deny rules. It blocks a parallel command outright, without guessing, when a replacement string computes its value, such as {= ... =} or one --rpl defines, or when there are more than 1024 commands to judge.

On this page