Payload/cursor/hooks/reviewer-stop.ps1
|
# Reviewer subagent stop hook - reminds orchestrator to parse YAML verdict and branch. # stdin: JSON from Cursor subagentStop event # stdout: JSON with optional followup_message $ErrorActionPreference = 'Stop' $inputRaw = [Console]::In.ReadToEnd() if ([string]::IsNullOrWhiteSpace($inputRaw)) { Write-Output '{}' exit 0 } try { $payload = $inputRaw | ConvertFrom-Json } catch { Write-Output '{}' exit 0 } $subagentType = $payload.subagent_type if (-not $subagentType) { $subagentType = $payload.agent_name } if ($subagentType -notmatch 'reviewer') { Write-Output '{}' exit 0 } $followup = @{ followup_message = @( "Paired reviewer ($subagentType) finished. Parse the SACP verdict (verdict: APPROVED | NEEDS_REVISION | REJECTED)." "Confirm the verdict file follows the canonical name .reviews/<reviewer>-<scope>-iter<N>.yaml (sub-agent-communication-protocol)." "If NEEDS_REVISION: apply the review-reconcile loop in feature-orchestrator (escape_hatch, iteration ceiling, oscillation check)." "Append the cycle to docs/harness/features/<slug>/.review-loop.json per review-loop-contract (schema 1.1); never overwrite prior cycles." "Do not advance the pipeline on REJECTED or unparseable verdict." ) -join ' ' } | ConvertTo-Json -Compress Write-Output $followup exit 0 |