--hook when a host hook should block on submitted annotations and pass when the user approves or closes the session. Use --json when your own wrapper needs to distinguish approved, dismissed, and annotated decisions.
--hook implies --gate, so the review UI includes an Approve action.
Output contracts
The contracts apply toannotate and annotate-last.
Hook-native output
This contract works directly with Claude Code and Codex
PostToolUse or Stop command-hook protocols that treat a block decision as feedback for the agent. If --hook and --json are both present, the hook-native contract wins.
Structured JSON
--json does not add the Approve action by itself. Add --gate if approval is part of your wrapper’s contract.
Plain text
Without--json or --hook, submitted annotations are printed as feedback. Approval prints the exact line The user approved. and closing prints nothing.
Completed user decisions exit with status 0. Invalid input and startup failures can exit nonzero, so wrappers should check both the process status and standard output.
Pass input safely
The path to review must come from the hook event or from a trusted wrapper argument. Quote it as one shell argument:annotate-last --stdin:
Installed plan hooks
The full installer and agent plugins configure plan review for supported hosts. For example, the Claude Code plugin ships:- a
PreToolUsehook onEnterPlanModethat callsplannotator improve-context - a
PermissionRequesthook onExitPlanModethat callsplannotatorand waits for the review decision
Stop hook on macOS, Linux, and WSL. Copilot CLI uses its plugin’s pre-tool hook for exit_plan_mode. Those plan hooks use host-specific event schemas and should normally be managed by the installer or plugin.
Restart the agent after changing hook configuration. Desktop applications may not inherit your shell PATH; use the absolute path to the Plannotator binary if a hook reports that the command is missing.
