feat(annotate): replace --silent-approve with --hook#610
Merged
backnotprop merged 4 commits intomainfrom Apr 24, 2026
Merged
Conversation
…protocol
--silent-approve was designed for "naive hooks that treat any stdout as
a block signal" but neither Claude Code nor Codex hooks work that way.
Plain text stdout doesn't block in either system -- only the JSON
protocol {"decision":"block","reason":"..."} does.
--hook emits hook-native JSON directly:
Approve/Close → empty stdout (hook passes)
Annotate → {"decision":"block","reason":"<feedback>"} (hook blocks)
--hook implies --gate (always three-button UX) and supersedes --json
if both are passed. Works with Claude Code PostToolUse, Stop hooks,
and Codex equivalents without a wrapper script.
For provenance purposes, this commit was AI assisted.
This was referenced Apr 24, 2026
Restructures the guide around the --hook workflow, explains env vars like $CLAUDE_TOOL_INPUT_file_path, and shows how PostToolUse and Stop hooks combine for full turn-by-turn review. For provenance purposes, this commit was AI assisted.
Removes Claude Code-specific framing. Documents env var differences
across agents, positions --hook as working with any agent that uses
the {"decision":"block"} protocol.
For provenance purposes, this commit was AI assisted.
Moves the implication into parseAnnotateArgs so every consumer (OpenCode, Pi) gets gate mode automatically. Previously only the binary applied it. For provenance purposes, this commit was AI assisted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--silent-approvewith--hook, which emits hook-native JSON that works directly with Claude Code and Codex PostToolUse/Stop hook protocols--hookimplies--gate(always three-button UX) and supersedes--jsonif both are passedplannotator annotate "$FILE" --hookis a drop-in hook commandWhy
After shipping #606, we discovered that
--silent-approvesolves a problem that doesn't exist:{"decision":"block","reason":"..."}blocks.{"decision":"block","reason":"..."}prevents stopping.Stdout matrix
--gateThe user approved.--json{"decision":"dismissed"}{"decision":"annotated","feedback":"..."}--gate --json{"decision":"approved"}{"decision":"dismissed"}{"decision":"annotated","feedback":"..."}--hook{"decision":"block","reason":"..."}Hook recipe
{ "hooks": { "PostToolUse": [{ "matcher": "Write", "hooks": [{ "type": "command", "command": "plannotator annotate \"$CLAUDE_TOOL_INPUT_file_path\" --hook", "timeout": 345600 }] }] } }Follow-up to #606. Refs #570.
Test plan
bun test packages/shared/ apps/opencode-plugin/ apps/hook/server/— 205 passgrep -rn "silent.approve\|silentApprove" apps/ packages/— zero resultsplannotator annotate README.md --hook→ 3-button UX → Approve → empty stdout → Annotate →{"decision":"block","reason":"..."}on stdout