reply-guard
Checks the agent's final reply for dashes, filler and labels, and the tree for new comments.
skills hook stop runs on Stop. It reads the final reply from last_assistant_message and blocks on the tells a regex can catch, outside code fences, inline code and URLs:
- an em dash, an en dash, or a hyphen used as a dash with a space on each side,
- chatbot filler ("Let me know if", "It's worth noting"),
- a bold label followed by a colon.
It also diffs the tree and lists added comment lines, up to eight per stop. This is what catches a Codex delegate's edits, since those never pass through a Write or Edit tool. On a feature branch the diff runs from the merge base with the branch's recorded base (branch.<name>.skills-base), so commits already on the branch count. With no recorded base it runs from where the branch joins any other local or remote branch, so a branch cut from staging skips what staging already holds. When that point is ambiguous it falls back to the merge base with origin's default branch. The branch's own copy on a remote is ignored only under the same name, so a copy pushed under another name, or a backup branch at its tip, narrows the sweep to the commits past it. On the default branch, without origin/HEAD, or with no base to find, it diffs against HEAD. The block names the base it diffed from. Untracked files count whole. The lines come from the shared detector.
Each comment line is reported once per session, and a line the comment guard or the commit guard already showed counts as reported. The state lives in scratchpad_dir (or /tmp without one), keyed by the session id. The reply written in answer to a block is checked again, so the guard blocks at most twice in a row and lets the second rewrite through unchecked. A clean reply resets the count. When the state cannot be saved, a rewrite passes rather than looping.
A block asks for the whole reply again, fixed and updated for anything that changed, with nothing about the check or what it flagged. The answer to a block is the last message of the turn, the one a host such as T3 Code shows when it folds the turn away, so it has to stand on its own.
In OpenCode the plugin runs it after each successful execution of a top level session and sends a block's reason back as a follow up prompt, so the model rewrites the reply. Failed or interrupted executions and subagent sessions are not checked.
Drafted Replies
A reply drafted for a PR thread gets checks of its own. The draft goes in a fenced text block with the thread URL on the line above the fence, not in a blockquote under the link. It has no backtick. It names no path, since the chat renders a path as a local file link; cite a commit sha instead. It names no plan id, such as "plan 090", since plans exist only on your machine; say what the code does and cite a commit sha or a linked issue. The text inside the block is still scanned for dashes, filler and labels.
When It Stays Silent
- The reply has no tell and the tree has no new comment line.
- It has already blocked twice in a row, or the payload is not a JSON object.
- The state cannot be saved while checking a rewrite.
AGENT_HOOKS=0is set.
Outside a git repository there is no sweep. Files with no marker table in the detector, paths
matching AGENT_HOOKS_SKIP, and lines already reported this session are skipped. The reply
checks run regardless, and a tell in the reply is reported every time it appears.