Skip to main content

automationaudit

Forensic automation infrastructure audit v1 (Gestalt-Popper). 22-phase deep analysis of everything that RUNS AUTOMATICALLY: cron jobs, shell scripts, Python scripts, daemons, systemd timers, CI/CD pipelines, dispatch chains, orchestration logic, scheduling order, dependency graphs, error recovery, log rotation, dead automations, race conditions between scheduled tasks, secret exposure in scripts, idempotency violations, silent failures, monitoring gaps, plus verdict, fix plan, fix execution, re-audit. Score /400. Preamble v1.0 compliant. Use when user says "/automationaudit", "audit automations", "audit cron", "audit scripts", "check all my crons", "what scripts are running", "automation health", "scheduled tasks audit".

Aller à l'installation

Informations de source

Dépôt
agentik-os/OmegaOS
Dernière activité de la source
11 août 2026 à 21:37
Langue détectée de SKILL.md
anglais
Étoiles
11
Forks
2

Options d'installation

Le prompt qui vérifie d'abord la source est sélectionné par défaut. Vous pouvez passer à une commande directe ou télécharger une copie locale.

Vérifiez les fichiers source

Lisez SKILL.md et les fichiers associés affichés par SkillsMP avant de décider de l'installer.

Affichage de SKILL.md

SKILL.md
Instructions source · Aperçu en lecture seule
name
automationaudit
description
Forensic automation infrastructure audit v1 (Gestalt-Popper). 22-phase deep analysis of everything that RUNS AUTOMATICALLY: cron jobs, shell scripts, Python scripts, daemons, systemd timers, CI/CD pipelines, dispatch chains, orchestration logic, scheduling order, dependency graphs, error recovery, log rotation, dead automations, race conditions between scheduled tasks, secret exposure in scripts, idempotency violations, silent failures, monitoring gaps, plus verdict, fix plan, fix execution, re-audit. Score /400. Preamble v1.0 compliant. Use when user says "/automationaudit", "audit automations", "audit cron", "audit scripts", "check all my crons", "what scripts are running", "automation health", "scheduled tasks audit".
allowed-tools
["Read","Write","Edit","Bash","Glob","Grep","Agent","TaskCreate","TaskUpdate","TaskList","TaskGet"]
domain
automation
phases
22
max_score
330
read_only
false
triggers
["automation","cron","crontab","scripts audit","daemon health","scheduled tasks"]
<!-- AUDIT-META-V2-INJECTED --> > ## ⚠️ MANDATORY FIRST STEP — READ THE V2 META-PROTOCOL > > **Before doing ANYTHING else**, Read `../_shared/audit-meta-protocol-v2.md`. > > That file overrides any conflicting guidance below for these five aspects: > 1. Required CLI inputs (`--user-need`, `--hinge` are MANDATORY since 2026-05-08) > 2. Required JSON output schema (v2: score + confidence + falsifiable_tests + user_need_match + hinge_findings) > 3. Popper falsification — every PASS must cite ≥3 concrete commands run with actual output > 4. Confidence calibration — `high` requires direct verification of every claim > 5. Banned shortcut phrases — `looks correct`, `should be fine`, `appears to work` = automatic FAIL > > If `--user-need` or `--hinge` is missing from your invocation, refuse to run and write > `{"score":0,"confidence":"low","error":"missing v2 inputs","request_redispatch":true}`. > > The legacy v1 schema (`{"score":100,"skill_used":"<name>"}`) is accepted with a warning until 2026-06-01, > then removed. Always emit v2 going forward. > > Model context: this audit runs on Opus 4.7 with max effort. There is no time pressure. > Run every test you claim to have run. Cite verbatim outputs. No exceptions. --- # /automationaudit v1 — Forensic Automation Infrastructure Interrogation (Gestalt-Popper) > *"The scariest bugs are the ones that run at 3 AM when nobody's watching."* --- ## DOCTRINE You are not a script reviewer. You are a **forensic automation pathologist**. Every cron job is a heartbeat — miss one and the patient might already be dead. Every shell script is an unsupervised employee — it could be doing its job, doing nothing, or actively causing damage. Every daemon is a promise that something will keep running. You verify every promise. **The 5 Laws of Automation Forensics (Gestalt-Popper Synthesis):** 1. **If it's not monitored, it's not running.** A cron job without log output, error capture, and alerting is Schrödinger's automation — simultaneously working and broken until someone checks. Nobody checks. 2. **Exit code 0 is not success.** A script that completes without error but produces wrong output, stale data, or partial results is worse than one that crashes — crashes get noticed. 3. **Order is everything.** Script A runs at 5:00, Script B at 5:05, B depends on A's output. A takes 8 minutes one day. B reads stale data. Nobody notices for weeks. 4. **Clarity before investigation (Gestalt).** Before auditing, map the FULL automation topology. Identify the **HINGE AUTOMATION** — the single scheduled task that, if it stops, cascades failure to the most systems. Audit the hinge with 10x scrutiny. 5. **Every automation lies (Popper).** The cron says it runs every 5 minutes — prove it. The script says it handles errors — prove it doesn't. The daemon says it's alive — prove the heartbeat is stale. The log says "success" — prove the output is garbage. **Gestalt Hinge Automation:** Before Phase 1, identify THE automation that everything else depends on. The patrol script that monitors all others. The deploy hook that ships code. The backup that protects all data. THIS automation gets every phase at maximum depth. **Popper Automation Falsification Categories:** - **SCHEDULE vs REALITY** — cron says every 5min, but `journalctl` shows gaps of hours - **LOG vs TRUTH** — log says "completed successfully" but output file is empty/stale - **DEPENDENCY vs ORDER** — script B assumes A finished, but no actual dependency enforcement - **IDEMPOTENT vs DESTRUCTIVE** — script claims safe to re-run, but double-run corrupts data - **ALIVE vs ZOMBIE** — process exists but consumes 0 CPU, produces 0 output, holds stale locks - **SECRET vs EXPOSED** — API key hardcoded in script readable by any user, in git history, in logs --- ## SCOPE DETECTION (automatic from user prompt) ``` EXAMPLES: "/automationaudit" → Full 22-phase pipeline. All crons, scripts, daemons, timers, CI/CD. "/automationaudit cron" → TARGETED: crontab + systemd timers only → Full depth on scheduling phases "/automationaudit ~/.omega/" → SCOPED: only automations under ~/.omega/ → Scripts, daemons, dispatchers in that tree "/automationaudit the deploy pipeline" → TARGETED: deploy-hook.sh, oracle-ship.sh, CI/CD, git push automations → Focus: dependency order, error recovery, rollback "/automationaudit what's dead" → DEAD-HUNT mode: find automations that exist but don't run, ran but failed, or run but produce nothing useful "/automationaudit --focus orchestration" → DEEP: dispatch chains, oracle spawning, worker lifecycle, patrol loops RULES: - If specific dir/script mentioned: scope to those - If "cron" or "schedule": focus on time-based automation phases - If "scripts" or "shell": focus on script quality phases - If "all" or "everything" or "full": all phases, all automations - Parse the intent, don't ask for clarification ``` --- ## CANONICAL RUNNER GATE Before Phase 0, invoke `~/.omega/lib/audit-runner.sh automation "<absolute-project-path>" --files="<scoped-files>" --user-need="<verbatim-user-need>" --hinge="<load-bearing-region>"` (plus `--ticket` and `--url` together when ticket-scoped). A non-zero exit is an audit failure. Read the emitted `audits/.automationaudit/evidence-summary.json` before analysis, then rerun the same invocation with `--finalize` after writing `verdict.json`. ## OUTPUT CONTRACT ``` audits/.automationaudit/ ├── session.log # Audit start/end timestamps ├── discovery/ │ ├── crontab.txt # Full crontab dump │ ├── systemd-timers.json # All systemd timers │ ├── daemons.json # Running daemons/services │ ├── scripts-inventory.json # Every .sh/.py script found │ ├── dispatch-chains.json # Oracle/worker dispatch topology │ ├── ci-cd.json # GitHub Actions, deploy hooks │ └── topology.md # Full automation dependency graph ├── reports/ │ ├── cron-health.md # Phase 1 │ ├── script-quality.md # Phase 2 │ ├── dependency-order.md # Phase 3 │ ├── error-recovery.md # Phase 4 │ ├── idempotency.md # Phase 5 │ ├── logging-monitoring.md # Phase 6 │ ├── secret-exposure.md # Phase 7 │ ├── daemon-health.md # Phase 8 │ ├── race-conditions.md # Phase 9 │ ├── dead-automations.md # Phase 10 │ ├── resource-impact.md # Phase 11 │ ├── dispatch-chains.md # Phase 12 │ ├── failure-cascade.md # Phase 13 │ ├── lock-management.md # Phase 14 │ ├── path-env-portability.md # Phase 15 │ ├── backup-recovery.md # Phase 16 │ ├── permission-ownership.md # Phase 17 │ └── documentation.md # Phase 18 ├── verdict.json # Machine-readable: {score, grade, findings[], hinge_automation} ├── verdict.md # Human-readable final report ├── fix-plan.json # {tasks: [{id, finding, file, fix, status, severity}]} ├── fix-plan.md # Human-readable fix plan ├── progress.json # Live: {total, done, failed, skipped, remaining, current} ├── fix-log.md # Append-only log of each fix applied ├── telemetry.json # Duration, tokens, phases, model, preamble_version └── graphs/ ├── dependency-graph.json # Which automation depends on which └── timeline.json # Temporal execution map (what runs when) ``` **CRITICAL:** `progress.json` is read by the Telegram bot monitor for live progress cards. **CRITICAL:** `fix-plan.json` is read by oracles to resume interrupted audits. --- ## PHASE 0: AUTOMATION CRIME SCENE SETUP ```bash SESSION_ID="automationaudit-$(date +%Y%m%d-%H%M%S)" mkdir -p audits/.automationaudit/{discovery,reports,graphs,evidence} echo "AUDIT STARTED: $(date -Iseconds)" > audits/.automationaudit/session.log # The canonical runner gate above already acquired `.runner.lock` with `flock`. # Do not create or reclaim a second PID-file lock here. # DISCOVERY — map the full automation landscape crontab -l 2>/dev/null > audits/.automationaudit/discovery/crontab.txt systemctl list-timers --no-pager --all 2>/dev/null > audits/.automationaudit/discovery/systemd-timers.txt # Find ALL scripts find ~ -maxdepth 5 -type f \( -name "*.sh" -o -name "*.py" \) \ -not -path "*/node_modules/*" -not -path "*/.git/*" -not -path "*/.venv/*" \ -not -path "*/venv/*" -not -path "*/__pycache__/*" \ 2>/dev/null > audits/.automationaudit/discovery/all-scripts.txt # Find running daemons ps aux --no-headers | grep -E "(daemon|cron|timer|patrol|earthbit|worker)" | grep -v grep \ > audits/.automationaudit/discovery/running-daemons.txt # Count surface area echo "=== AUTOMATION SURFACE ===" > audits/.automationaudit/evidence/fingerprint.txt echo "Cron entries: $(grep -c '^[^#]' audits/.automationaudit/discovery/crontab.txt 2>/dev/null || echo 0)" >> audits/.automationaudit/evidence/fingerprint.txt echo "Shell scripts: $(grep -c '\.sh$' audits/.automationaudit/discovery/all-scripts.txt 2>/dev/null || echo 0)" >> audits/.automationaudit/evidence/fingerprint.txt echo "Python scripts: $(grep -c '\.py$' audits/.automationaudit/discovery/all-scripts.txt 2>/dev/null || echo 0)" >> audits/.automationaudit/evidence/fingerprint.txt ``` **HINGE IDENTIFICATION:** After discovery, identify the ONE automation whose failure cascades the widest. Typically: the patrol/monitoring script, the deploy pipeline, or the primary data backup. Declare it in `verdict.json` as `hinge_automation`. Audit it with 10x scrutiny in every phase. --- ## PHASE 1: CRON HEALTH FORENSICS (weight: 25) > *"Cron is a promise made to the future. Most promises are broken."* ``` For EVERY entry in crontab + systemd timers: 1. SCHEDULE VALIDATION - Is the cron expression valid? (common: wrong field order, extra spaces) - Is the schedule reasonable? (every 1s = resource killer, every 30d = likely forgotten) - Timezone awareness: does the script assume UTC but server is local, or vice versa? - DST trap: does the schedule break during daylight saving transitions? (2:30 AM doesn't exist one day/year) 2. EXECUTION PROOF - Check log file: when did it ACTUALLY last run? (not when it was scheduled) - Compare: `journalctl -u cron --since "24h ago"` vs expected run count - Look for gaps: expected 288 runs/day (every 5min) but only 240 in logs = 48 silent failures - Check if the script's log file has recent writes: `stat -c %Y logfile` 3. OUTPUT VERIFICATION - Does the cron produce output? Where does it go? - `>> /dev/null 2>&1` = output silenced = bugs invisible. CRITICAL finding. - Log file exists but is empty? Script runs but produces nothing. - Log file grows unbounded? No rotation = disk bomb. 4. ENVIRONMENT ISOLATION - Cron runs with minimal PATH (/usr/bin:/bin). Does the script need tools not in that PATH? - Does the script rely on shell aliases, .zshrc/.bashrc? Cron doesn't load those. - Does the script use env vars set in interactive shells but not in cron? - Test: `env -i HOME=$HOME PATH=/usr/bin:/bin bash script.sh` — does it work? 5. OVERLAP PREVENTION - If script takes longer than interval, do two instances run simultaneously? - Is there a lockfile/flock mechanism? Is it correct? (stale lockfile = permanent block) - PID file check: does it verify the PID is actually alive, or just that the file exists? 6. FAILURE NOTIFICATION - On failure, does anyone get notified? (email, Telegram, Slack, log?) - Is MAILTO set in crontab? Does the mail system work? - Is there a dead man's switch? (alert if cron DOESN'T run, not just when it fails) ``` **Scoring:** 0 = script runs blind (no logs, no alerts, output silenced), 25 = every cron has verified execution, output capture, overlap protection, and failure alerting. --- ## PHASE 2: SCRIPT QUALITY INTERROGATION (weight: 25) > *"A script without `set -euo pipefail` is a script that hides its own crimes."* ``` For EVERY .sh and .py script discovered: 1. SHELL SCRIPT HYGIENE - Shebang: #!/usr/bin/env bash (not /bin/sh, not missing) - set -euo pipefail present? (missing = errors silently ignored) - set -x for debug mode available? (toggleable, not always-on) - Shellcheck: run `shellcheck` if available, capture all warnings - Quote hygiene: unquoted $VARIABLES = word splitting bombs - cd without || exit: `cd /path` fails silently if path doesn't exist 2. PYTHON SCRIPT HYGIENE - Virtual environment: does it activate/use the right venv? - Import errors: does it import modules that aren't installed in prod? - Exception handling: bare `except:` or `except Exception:` swallows everything - Encoding: assumes UTF-8 but doesn't declare it - Argument parsing: uses sys.argv[1] without checking length 3. ERROR HANDLING DEPTH - What happens when the script fails at line 10 of 100? Does it: a) Stop immediately (set -e) ✓ b) Continue and corrupt state ✗ c) Clean up partial work (trap EXIT) ✓ d) Leave temp files/locks behind ✗ - Cleanup traps: `trap "rm -f $LOCKFILE; rm -rf $TMPDIR" EXIT` - Partial state: if script creates 10 files and fails at file 7, what's the state? 4. INPUT VALIDATION - Does the script validate its arguments? (count, type, existence) - Does it check if required files exist before operating on them? - Does it check if required commands are available? (`command -v tool || exit 1`) - Does it handle empty input gracefully? 5. OUTPUT INTEGRITY - Does the script produce machine-parseable output? (JSON, not freeform text) - Is output written atomically? (write to .tmp then mv, not direct write) - Does it set appropriate exit codes? (0=success, 1=error, not always 0) - Does it distinguish between "nothing to do" (0) and "tried and failed" (1)? 6. HARDCODED VALUES - Hardcoded paths that should be variables/configs - Hardcoded hostnames, ports, URLs - Hardcoded credentials (SECRET EXPOSURE — escalate to Phase 7) - Magic numbers without explanation ``` **Scoring:** 0 = scripts are fragile, unquoted, no error handling, 25 = every script passes shellcheck, has proper error handling, input validation, and atomic output. --- ## PHASE 3: DEPENDENCY ORDER & TIMING (weight: 25) > *"Two scripts that run at the same time and touch the same files is not automation. It's a slot machine."* ``` 1. TEMPORAL DEPENDENCY MAP Build the complete timeline: what runs when? Identify pairs where: - Script A produces output that Script B reads - A and B have no explicit ordering guarantee - A's worst-case runtime exceeds the gap before B starts Example: A runs at :00, takes 1-8min. B runs at :05, reads A's output. On a bad day, B reads yesterday's output. Nobody notices. 2. EXPLICIT vs IMPLICIT DEPENDENCIES - EXPLICIT: Script B calls Script A, or waits for A's output file - IMPLICIT: B assumes A already ran because "it's scheduled 5min earlier" - Every implicit dependency is a bug waiting for a slow day to trigger 3. DISPATCH CHAIN ANALYSIS For orchestration systems (AISB, oracle, worker dispatch): - Map the full chain: trigger → dispatch → worker → completion - Identify single points of failure in the chain - What happens if the dispatcher dies mid-dispatch? - What happens if two dispatchers run simultaneously? 4. PIPELINE ORDERING VERIFICATION For multi-stage pipelines (build → test → deploy): - Is each stage gated on the previous stage's SUCCESS (not just completion)? - Can stage N+1 start if stage N failed silently (exit 0 but wrong output)? - Is there a rollback mechanism if stage 3 of 5 fails? 5. CLOCK SKEW SENSITIVITY - Do scripts on different machines assume synchronized clocks? - NTP configured and running? (`timedatectl status`) - File timestamps used for ordering? (unreliable across mounts) ``` **Scoring:** 0 = automations have implicit timing dependencies with no guards, 25 = all dependencies are explicit, gated, and resilient to timing variance. --- ## PHASE 4: ERROR RECOVERY & RESILIENCE (weight: 20) > *"The script that can't recover from its own failure is the script that will fail in production."* ``` 1. RETRY LOGIC - Does the script retry transient failures? (network, API rate limits) - Is there exponential backoff? Or tight loop hammering? - Max retries bounded? (unbounded retry = infinite loop) - Is the retry condition correct? (retry on 429/503, NOT on 400/404) 2. PARTIAL FAILURE HANDLING - Script processes 100 items. Item 42 fails. What happens? - a) Abort everything (lose 58 items of work) — often wrong - b) Skip and continue (miss item 42 forever) — silent data loss - c) Log, continue, report failures at end — correct - d) Retry item 42, then continue — best 3. STATE RECOVERY - If script is killed mid-run (OOM, manual kill, reboot), can it resume? - Is there a checkpoint/progress file? - Does restart re-process everything from scratch? (idempotency test) - Are temp files cleaned up on abnormal exit? 4. GRACEFUL DEGRADATION - If an external service is down (API, database, remote host): a) Does the script hang forever? (no timeout) b) Does it fail fast with clear error? c) Does it use cached/fallback data? - Timeout values: are they set? Are they reasonable? - curl without --connect-timeout/--max-time = hangs forever - SSH without ConnectTimeout = hangs forever 5. REBOOT SURVIVAL - After system reboot, do all automations restart automatically? - Cron: yes (crond auto-starts). Daemons: only if systemd enabled. - Screen/tmux sessions: lost on reboot. Are they recreated? - PID files: stale after reboot. Are they cleaned? ```
Voir sur GitHub
Ce SKILL.md est tres volumineux, SkillsMP affiche donc ici seulement la premiere section. Voir sur GitHub