magicciv/scripts/grok-review.sh

46 lines
2.1 KiB
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
#
# grok-review.sh — have Claude Opus independently review Grok's work.
#
# Grok invokes this to hand its work to a *different* model (Opus) for review:
# Opus runs the `grok-review` skill, which re-runs the verification gates Grok
# cited (verify-don't-trust, AGENTS.md §2.1), records a dated review log under
# .project/history/, updates objective status only when the evidence warrants,
# and TTS-announces a one-paragraph summary (ravdess02, local `say` fallback).
#
# Usage:
# scripts/grok-review.sh # review the current window, headless
# GROK_REVIEW_MODEL=opus scripts/grok-review.sh
# GROK_REVIEW_PERM=acceptEdits scripts/grok-review.sh # tighter permissions
#
# Env:
# GROK_REVIEW_MODEL claude --model value (default: opus)
# GROK_REVIEW_PERM claude --permission-mode (default: bypassPermissions —
# the review must run cargo/git/python/say + MCP unattended)
#
# Exit code is Claude's: non-zero means the review run itself failed (not that a
# defect was found — defects are reported in the log + spoken summary).
set -euo pipefail
MODEL="${GROK_REVIEW_MODEL:-opus}"
PERM="${GROK_REVIEW_PERM:-bypassPermissions}"
REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || true)"
if [[ -z "${REPO_ROOT}" ]]; then
echo "grok-review: not inside the magic-civilization git repo" >&2
exit 2
fi
cd "${REPO_ROOT}"
if ! command -v claude >/dev/null 2>&1; then
echo "grok-review: 'claude' CLI not found on PATH" >&2
exit 2
fi
PROMPT='Run the grok-review skill now: independently review the latest Grok-authored work in this repo (commits trailered "Co-Authored-By: Grok (xAI)" plus the uncommitted working tree). Re-run every verification gate Grok cited — do not trust the commit messages. Record a dated review log under .project/history/, update objective status only if the evidence warrants it, commit + push the log, then TTS-announce a one-paragraph spoken summary using personality ravdess02 (fall back to local `say` if the speech MCP is unreachable). Follow AGENTS.md §2 and the skill body exactly.'
exec claude \
--model "${MODEL}" \
--permission-mode "${PERM}" \
-p "${PROMPT}"