Loading...
Loading...
AFK adversarial code-review loop: Cursor agent CLI critic (grug + thermo-nuclear) produces structured findings; Codex validator confirms or pushbacks on regression risk; parent adjudicates and commits fixes per finding until clean. Config at ~/.config/adversarial-review/config.toml. Use for adversarial review, clean code loop, or unattended branch hardening.
npx skill4agent add vnord/skills adversarial-reviewagentcodex exec~/.agents/skills/| Role | Harness | Default | Mode |
|---|---|---|---|
| Critic | Cursor | | Read-only ( |
| Validator | | | Read-only sandbox |
| Fixer | Parent | configurable | Writes + commits |
| Parent | This session | — | Orchestrates, adjudicates |
~/.config/adversarial-review/config.toml[critic]
command = "agent"
model = "composer-2.5"
args = ["--print", "--trust", "--mode", "plan"]
[validator]
command = "codex"
model = "gpt-5.5-medium"
args = ["exec", "--sandbox", "read-only"]
timeout_seconds = 600
[review]
skills = ["grug-review", "thermo-nuclear-code-quality-review"]
[session]
max_rounds = 10
push_on_complete = false
base_ref = "auto"
dir = ".adversarial-review/sessions"SKILLS_REPOskillsadversarial-review/grug-review/[review].skillsSKILL.md$SKILLS_REPO/<name>/SKILL.md~/.agents/skills/<name>/SKILL.md~/.cursor/skills/<name>/SKILL.md.cursor/skills/<name>/SKILL.md<repo>/.adversarial-review/sessions/<run-id>/
session.json
round-NN/
branch.diff
fixes-since-last.diff # round > 1 only
findings.json
validator-prompt.txt
validator-last.txt
validated.json
adjudication.json
summary.md<run-id>20260531-214539-codex-implement-8--workspacecd.adversarial-review/.gitignore[session] mirror_to_config = true~/.config/adversarial-review/sessions/<run-id>/~/.config/...agent/tmp/base_refbase_ref = "auto"mainmastergit diff <base_ref>...HEADfixes-since-last.diffgit diff <last_review_sha>..HEADlast_review_shaHEADfixes-since-last.diffadjudication.json{ "id": "F8", "action": "skip", "reason": "user-intent" }Progress:
- [ ] Config loaded (or defaults written)
- [ ] Session initialized under <repo>/.adversarial-review/..., base_ref pinned, branch.diff saved
- [ ] Round N: critic → validator → adjudicate → fix → advance sha
- [ ] Close-outREPO="$(git rev-parse --show-toplevel)"
BASE_REF="$(git merge-base HEAD @{upstream} 2>/dev/null || git merge-base HEAD main 2>/dev/null || git merge-base HEAD master)"
HEAD_SHA="$(git rev-parse HEAD)"
RUN_ID="$(date +%Y%m%d-%H%M%S)-$(git branch --show-current | tr '/' '-')"
SESSION="$REPO/.adversarial-review/sessions/$RUN_ID"
ROUND="$SESSION/round-$(printf '%02d' "$ROUND_NUM")"
mkdir -p "$ROUND"
git diff "${BASE_REF}...HEAD" > "$ROUND/branch.diff"
# round > 1: git diff "${LAST_REVIEW_SHA}..HEAD" > "$ROUND/fixes-since-last.diff"
# Write session.json: base_ref, head_sha, last_review_sha, roundrequired_permissions: ["all"]agentSKILL.mdbranch.difffixes-since-last.diffadjudication.jsonfindings.json/tmp/findings-*.json$ROUND/findings.json"round": N"head_sha": "<current HEAD>"agent --print --trust --mode plan --model "<critic.model>" --workspace "$REPO" \
"<prompt as above>"HEAD_SHA="$(git rev-parse HEAD)"
test -f "$ROUND/findings.json" || cp /tmp/findings-round-*.json "$ROUND/findings.json" 2>/dev/null || true
test -f "$ROUND/findings.json" || { echo "critic produced no findings.json"; exit 1; }
# Reject stale critic output (common in round 2+):
jq -e --arg h "$HEAD_SHA" --argjson r "$ROUND_NUM" '.head_sha == $h and .round == $r' "$ROUND/findings.json" \
|| { echo "findings.json stale (head_sha or round mismatch) — re-run critic or parent-normalize to []"; exit 1; }codexregression_risk$(cat <<'EOF' ...)Reading additional input from stdin...~/.config/$ROUND/validator-prompt.txtfindings.jsontimeoutvalidator-prompt.txtregression_risklowmediumhighSKILL_DIR="<absolute path to adversarial-review skill>"
timeout "${VALIDATOR_TIMEOUT:-600}" codex exec \
-C "$REPO" \
-s read-only \
-m "<validator.model>" \
--output-schema "$SKILL_DIR/schemas/validated-findings.schema.json" \
-o "$ROUND/validator-last.txt" \
- < "$ROUND/validator-prompt.txt"timeout "${VALIDATOR_TIMEOUT:-600}" codex exec \
-C "$REPO" -s read-only -m "<validator.model>" \
--output-schema "$SKILL_DIR/schemas/validated-findings.schema.json" \
-o "$ROUND/validator-last.txt" \
"$(cat "$ROUND/validator-prompt.txt")" < /dev/nullvalidator-last.txt$ROUND/validated.jsonfindings.jsonvalidated.jsonadjudication.json"validator": "parent-fallback"adjudication.json| Validator | Risk | Parent action |
|---|---|---|
| low / medium | Address — fixer |
| high | Ask user |
| any | Skip |
| any | Ask user |
| user-intent (prior round) | — | Skip — do not re-raise |
regression_riskTasksubagent_type = "generalPurpose"AGENTS.mdAGENTS.local.mdgit add -Agit add <paths>
git commit -m "$(cat <<'EOF'
refactor: <short topic> (adversarial F<N>)
<One sentence: what changed and why.>
EOF
)"findings.jsonidround >= session.max_roundslast_review_shaHEADgit pushpush_on_complete = truesummary.md~/.config/adversarial-review/sessions/base_refeval~/.config/codex exectimeoutfindings.json/tmpfindings.jsonhead_shagit rev-parse HEAD| Symptom | Likely cause | Fix |
|---|---|---|
| Critic wrote findings but file missing | Path outside workspace | Repo-local |
| Round 2 findings duplicate round 1 | Stale critic cache | |
| Stdin never closed | |
| Validator >10 min, no output | Hung / wrong cwd | Kill; parent fallback; |