From claude-commands
Audits automation job runs by parsing logs for PR discovery, skip, and action metrics, and checks GitHub for AI-authored remote commits with attribution verification.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-commands:automation-auditThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Usage**: `/automation-audit [hours]`
Usage: /automation-audit [hours]
Purpose: Comprehensive audit of all automation job runs - analyze logs, check PR processing metrics, and verify remote commits with attribution.
discovering open PRs or Total recent PRs discovered)Skipping PR or already processed messages)Processing PR messages)Monitoring cycle complete: X actionable, Y skipped# Primary job logs (in /tmp or $HOME/Library/Logs/)
FIXPR_LOG="/tmp/fixpr.log"
FIXCOMMENT_LOG="/tmp/fix-comment.log"
COMMENT_VAL_LOG="/tmp/comment-validation.log"
# Or from home directory
HOME_LOGS="$HOME/Library/Logs/worldarchitect-automation/"
Extract key metrics from each log:
# Count PRs discovered
grep -c "Total recent PRs discovered" "$LOG" || echo "0"
# Count PRs skipped
grep -c "Skipping PR" "$LOG" || echo "0"
# Count PRs processed (actioned)
grep -c "Processing PR" "$LOG" || echo "0"
# Count actionable results
grep -oE "Monitoring cycle complete: [0-9]+ actionable" "$LOG"
Query GitHub API for automation-authored commits:
# Time range (default: last 6 hours)
SINCE="${1:-6}"
SINCE_DATE=$(date -v-${SINCE}H +%Y-%m-%dT%H:%M:%SZ)
# Search for automation-authored commits
gh api repos/$GITHUB_REPOSITORY/commits \
--since "$SINCE_DATE" \
--jq '.[] | select(.commit.author.name |
contains("claude") or
contains("Claude") or
contains("MiniMax") or
contains("codex") or
contains("Codex") or
contains("automation") or
contains("Copilot")
) | {sha: .sha[0:8], author: .commit.author.name, date: .commit.author.date}'
For each commit found:
# Check commit details
gh api repos/$GITHUB_REPOSITORY/commits/{sha} \
--jq '.commit.message, .commit.author.name, .authors'
=== Automation Audit Report (Last 6 hours) ===
| Job | PRs Discovered | PRs Skipped | PRs Actioned | Commits Made |
|--------------|---------------|-------------|--------------|--------------|
| fix-comment | 12 | 10 | 2 | 1 |
| fixpr | 12 | 12 | 0 | 0 |
| comment-val | 8 | 8 | 0 | 0 |
=== CLI Preflight Results ===
- MiniMax: ✅ PASSED
- Gemini: ❌ FAILED (quota)
- Cursor: ❌ FAILED (auth)
=== Skip Decision Verification ===
⚠️ CRITICAL: 7 PRs incorrectly skipped - NEW COMMITS found!
| PR | Processed Commit | Current HEAD | Status |
|-----|-----------------|---------------|--------|
| #5642 | c9270a4c | e815d36a | ❌ NEW COMMIT |
| #5641 | 88d4163d | 0609ae09 | ❌ NEW COMMIT |
=== Commits Made ===
- SHA abc1234: [copilot] fix: ... (PR #5584)
- Attribution: Claude Opus 4.6 <[email protected]>
/tmp/fixpr.log - fixpr job runs/tmp/fix-comment.log - fix-comment job runs/tmp/comment-validation.log - comment-validation job runs$HOME/Library/Logs/worldarchitect-automation/ - persistent logs| Pattern | Meaning |
|---|---|
Skipping PR ... - already processed | PR already handled, no action needed |
Processing PR | Work was attempted on this PR |
Monitoring cycle complete: X actionable, Y skipped | Summary of cycle |
✅ Preflight: X passed | CLI validation passed |
❌ Preflight: X failed | CLI validation failed |
For each skipped PR, verify the "already processed" commit matches current HEAD:
# Extract PR numbers and processed commits from logs
grep "Skipping PR" "$LOG" | grep -oE "#[0-9]+" | tr -d '#' | head -10
# For each PR, compare processed commit to current HEAD
# Processed: look for "already processed commit XXXXXXX"
# Current: gh api repos/owner/repo/pulls/{number} --jq '.head.sha'
# If they differ, this is a BUG - PR should have been reprocessed!
Known Issues:
The automation filters by cutoff_hours (default 24):
gh api "search/issues?q=repo:owner/repo+is:pr+is:open+updated:>YYYY-MM-DD"npx claudepluginhub jleechanorg/claude-commands --plugin claude-commandsDaily review of the previous night's CI runs — identifies problems and improves repo-local skills and workflows.
Reference for four distinct PR automation cron workflows: comment-only, comment-validation, fixpr, and fix-comment modes, each with separate scopes and schedules.
Collects agent usage metrics from git history and generates health reports or dashboards. Use for measuring adoption rates, system health, or periodic reviews via Python script.