Mariomarquezt/multi-flow-skills / skills/sliced-review
sliced-review
FlaggedReview a whole codebase with several models by cutting it into small file-listed slices ordered by blast radius, then triage every finding with three judges, and optionally fix. Use when the user asks to review or audit a whole project or repo with other models, wants a second opinion on a codebase, wants a review split into slices or tiers, has a whole-repo review that died on credits, or wants a check before a launch or handover. Modes (`3`, `5`, `8`, `fast`, `fix …`, `fix fast …`, `fix only`, `report`, `no wrap`) are in the body. Not for a plan before code exists (/grill-me-codex, /codex-review) or a single diff, branch or PR (/code-review).
references/templates/chain.sh
View on GitHub#!/bin/bash
# Work the whole slice queue unattended, one slice at a time.
#
# Behaviour:
# - runs ONE slice, saves its report, records its cost, THEN moves on
# - quota window full -> waits and retries the SAME slice (never skips it)
# - a slice that dies mid-run on a 429 is retried, not skipped, and its partial
# output is discarded so a broken report is never recorded as done
# - a slice that fails for any other reason is logged and skipped, so one bad
# slice cannot stall the whole night
# - stops on: queue empty, quota spent, MAX_HOURS elapsed, or STALL_MAX in a row
#
# Everything already finished stays on disk. Killing this script loses nothing.
set -uo pipefail
R="$(cd "$(dirname "$0")" && pwd)"
[ -f "$R/runner.env" ] && { set -a; . "$R/runner.env"; set +a; }
MAX_HOURS="${MAX_HOURS:-20}"
WAIT="${WAIT:-900}"
STOP_PCT="${STOP_PCT:-99}"
# STALL_MAX x WAIT must EXCEED one full quota window, or simply waiting for a reset
# trips it and the chain quits before the budget ever comes back.
STALL_MAX="${STALL_MAX:-26}"
STALL=0
LOG="$R/chain.log"; DONE="$R/done.txt"
touch "$DONE"; mkdir -p "$R/out"
DEADLINE=$(( $(date +%s) + MAX_HOURS*3600 ))
TOTAL=$(grep -c . "$R/queue.txt")
say() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*" | tee -a "$LOG"; }
pct() { [ -n "${QUOTA_PCT_CMD:-}" ] && eval "$QUOTA_PCT_CMD" 2>/dev/null; }
say "chain start — $TOTAL slices queued, deadline in ${MAX_HOURS}h"
[ -z "${QUOTA_PCT_CMD:-}" ] && say "note: backend cannot report remaining quota — a 429 is the only signal"
while read -r SLICE; do
[ -n "$SLICE" ] || continue
grep -qx "$SLICE" "$DONE" && { say "skip $SLICE (already done)"; continue; }
while :; do
if [ "$(date +%s)" -ge "$DEADLINE" ]; then say "STOP: ${MAX_HOURS}h deadline reached"; exit 0; fi
P=$(pct)
if [ -n "$P" ] && [ "$P" -ge "$STOP_PCT" ]; then say "STOP: quota spent at ${P}%"; exit 0; fi
"$R/run-slice.sh" "$SLICE" >> "$LOG" 2>&1
RC=$?
if [ "$RC" -eq 0 ]; then
STALL=0; echo "$SLICE" >> "$DONE"
say "DONE $SLICE ($(grep -c . "$DONE") of $TOTAL)"
break
elif [ "$RC" -eq 2 ]; then
STALL=$((STALL+1))
[ "$STALL" -ge "$STALL_MAX" ] && { say "STOP: quota blocked ${STALL} attempts in a row"; exit 0; }
say "quota full (stall ${STALL}/${STALL_MAX}) — waiting ${WAIT}s, retrying $SLICE"
sleep "$WAIT"
elif grep -qEi '\(429\)|usage limit|quota exceeded|insufficient (credit|quota)' "$R/out/$SLICE.txt" 2>/dev/null; then
STALL=$((STALL+1))
# Discard BEFORE the stop check: a quota-error file left on disk reads like a report.
rm -f "$R/out/$SLICE.txt"
[ "$STALL" -ge "$STALL_MAX" ] && { say "STOP: 429 on ${STALL} attempts in a row (partial output discarded)"; exit 0; }
say "$SLICE hit a 429 mid-run (stall ${STALL}/${STALL_MAX}) — discarded partial output, retrying after ${WAIT}s"
sleep "$WAIT"
else
STALL=0; echo "$SLICE" >> "$DONE"
say "$SLICE FAILED (rc=$RC), non-quota reason — skipping, output kept for inspection"
break
fi
done
done < "$R/queue.txt"
say "chain finished — $(grep -c . "$DONE") of $TOTAL slices attempted"
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |