greenbelay

A guard that reads a shell command before Claude Code runs it, and can observe it, advise against it, or refuse it.

It exists because of a class of mistake no git hook can see, since the mistake is in the command string and never reaches a hook at all:

git push origin main 2>&1 | tail -5

A pipeline's exit status is the status of its last command. tail succeeds at tailing an error message, so a rejected push, a push killed by a timeout, and a push that never left the machine all report success — and the trimming discards the error text too, so the failure is silent in both channels.

greenbelay (formerly amont-agent) is a PreToolUse hook. It is a single binary, it is opt-in, and it phones nothing home.

The shape of it

Three stances, and the middle one is the point:

stanceeffect
observerecords the firing and says nothing at all
adviseputs the reason into the model's context; refuses nothing
denyrefuses the tool call, with the reason and the remedy

Of the 40 rules, three ship as deny, twenty-four as advise and thirteen as observe. A rule is promoted only once your own transcripts say it should be — see measuring and graduating — and greenbelay rules shows the stance in force on your machine.

Start here

greenbelay install          # prints the settings block, writes nothing
greenbelay install --write  # merges it into ~/.claude/settings.json
greenbelay doctor           # is it installed, runnable, and actually firing?
greenbelay status           # every rule, its stance, and what it has seen
                            # (last 4 weeks + this week once the roll-up covers them)
greenbelay rollup           # firings per week and rule, kept past the journal

The inbox read contract

At a session start with source startup or clear, greenbelay's session notice reads <git-common-dir>/greenharness/inbox.md and every inbox.*.filing file beside it (an abandoned take), and moves nothing. Documentation version token: inbox-read/1 (lines carry no token).

Each line is <YYYY-MM-DD> <session8> [due=YYYY-MM-DD] <text>. An orphan is a line dated two or more local calendar days before today, or any line of a take whose modification time is more than 24 hours old. The filer moves the inbox to inbox.<id>.filing and then touches the take, so its modification time is the time of the move: a take moved without that touch keeps the time of the inbox's last append, and may be read as abandoned too early. A younger take is counted as lines being filed and not shown. Only orphan and fresh lines count as unfiled. Other lines, malformed ones included (session ?), are fresh. The block follows the clear-at-boundary stance: observe journals the counts and prints nothing.

When the session's directory is not inside a git repository (neither it nor any ancestor holds a .git entry), the notice looks instead at the directories directly under it whose .git is a real directory (symlinked children and linked worktrees are skipped) holding .git/greenharness/. Each match is journalled under the child's name. At most three children with unfiled lines (orphans or fresh; a child with only lines being filed is neither shown nor counted) are printed in name order, each notice preceded by in <name>: cd <path>, followed by one line, greenbelay/inbox: N more repositories hold unfiled lines: a, b, c, …; start a session in one to see them (1 more repository holds when N is 1), for the rest. A child whose name is not valid UTF-8 or contains a control character is skipped. Inside a repository, or below a .git entry, nothing changes.

Relationship to amont

amont is a git-hook manager by the same author. The two are independent: neither needs the other, they share no code, and cargo tree here shows serde and serde_json and nothing else.

They meet in exactly one place, and it is optional. If amont is installed and this repository carries its generated AGENTS.md block, a session opening on a stale block is told so — see the session notice. With no amont on PATH, that check says nothing.

Relationship to greensummit

greensummit is the CI end of the same story: amont signs a note at pre-push naming the gates that really ran, and greensummit verifies it so CI can skip them. It has no connection to this guard beyond the author and the conviction all three share — trust what was verified, never what was reported. The masked push at the top of this page is what that looks like when it fails.