macos-incident-postmortem
БесплатноЗапускает вложенные скриптыНе проверенReconstruct macOS freeze, panic, or reboot from DiagnosticReports and shell history. Use when investigating hangs, panics, watchdog timeouts, jetsam, or…
от laurigates★ 61 звезда на GitHubОб этом скилле
macOS Incident Postmortem
When to Use This Skill
| Use this skill when... | Use something else when... |
|---|---|
| GUI froze and you're not sure if the machine rebooted | Live-debugging a hung process — use sample / spindump |
| Investigating recent kernel panics or watchdog timeouts | Application crashes — open the per-app .crash / .ips directly |
| Cross-referencing "what was I doing at time T?" against logs | Active CPU diagnosis — see launchservices-health |
| Auditing whether the system is "due for a reboot" | Pre-incident hardening — wrong skill, this is forensics |
Platform Guard
This skill is macOS-only. /Library/Logs/DiagnosticReports/, kern.boottime, pmset -g log, and the log command are Darwin-specific. Refuse to act if uname -s is not Darwin.
test "$(uname -s)" = "Darwin" || { echo "macos-plugin: not Darwin, refusing"; exit 1; }
Core Expertise
A macOS "incident" can mean any of:
- A kernel panic (system reset by the kernel)
- A WindowServer userspace watchdog timeout (the GUI froze and the user power-cycled)
- A LaunchServices / coreaudiod / mds-stores XPC stall (one daemon dragged the GUI down)
- A jetsam memory-pressure event (the kernel killed apps to reclaim RAM)
- A thermal throttle (CPU clamped to base frequency for minutes)
- A user-initiated force-reboot after a hang (no panic; just lost state)
The first job in a postmortem is distinguishing between actual reboots and GUI hangs. The 2026-04-22 incident that motivated this plugin looked like a crash to the user but last reboot showed no reboot — the kernel was fine, only the GUI stack hung.
The second job is timeline reconstruction: cross-reference Diagnostic Reports, kern.boottime, last reboot, last shutdown, and shell history to answer "what happened around time T?".
Gather the deterministic signals
Run the bundled script to gather every mechanical signal in one pass — reboot-vs-hang detection, per-category DiagnosticReports counts, the CPU-event offender histogram, the jetsam victim list, and the fixed reboot/hang classifier:
bash "${CLAUDE_SKILL_DIR}/scripts/macos-incident-postmortem.sh" --home-dir "$HOME"
Parse STATUS= and ISSUES: from the output. The script emits
CLASSIFICATION= (REBOOT_PANIC / REBOOT_CLEAN / HANG_UI / HANG_CPU /
HANG_JETSAM / HANG_OR_POWERCYCLE / UNKNOWN) with a CLASSIFICATION_REASON=,
plus PANIC_COUNT= / HANG_COUNT= / JETSAM_COUNT= / CPU_RESOURCE_COUNT=
etc., LATEST_PANIC= / LATEST_HANG= paths, and CPU_OFFENDERS: /
JETSAM_VICTIMS: histograms.
Pass the incident time T as an epoch to enable the classifier
(MACOS_PM_INCIDENT_EPOCH=<epoch> bash …), or supply an alternate report
source with --reports-dir <path>. With no incident time the classifier
reports UNKNOWN rather than guessing — feed it T once you know it.
The reboot/hang decision tree the script encodes:
| Pattern | Interpretation |
|---|---|
Boot at/after T with a .panic report |
True reboot from a kernel panic |
| Boot at/after T, no panic | Clean restart (user-initiated or watchdog) |
Boot before T with a .hang/.spindump.txt |
GUI hang — machine did not reboot |
Boot before T with a .cpu_resource.diag |
Daemon CPU storm |
Boot before T with a JetsamEvent-* |
Memory-pressure kill |
| Boot before T, none of the above | Power loss or hard power-cycle |
When a report filename or category is unfamiliar, or last reboot comes back empty because wtmp rotated past T, open references/diagnostic-reports.md for the suffix → category → severity table and the unified-log boot/shutdown query.
Timeline Reconstruction (judgment)
With the deterministic classification and counts in hand, the remaining steps are the agent's job: read the panic backtrace, name suspect kexts, correlate with logs and shell activity, and write the narrative.
Step 1: Inspect the unified log around T
# Adjust the time window to bracket T
log show --start "2026-04-22 08:15:00" --end "2026-04-22 08:25:00" \
--predicate 'subsystem == "com.apple.WindowServer" OR process == "launchservicesd" OR process == "coreaudiod"' \
--style syslog \
| head -500
Common signatures to grep for:
| Signature | Meaning |
|---|---|
WindowServer: watchdog |
UI froze long enough to trip the watchdog |
posix_spawn failures |
Fork/exec storm — usually shell loops or runaway scripts |
Jetsam Killing |
Kernel killing processes for memory |
_dispatch_*_timeout |
Daemon stuck on a synchronous IPC call |
Thermal pressure |
CPU thermal-throttled |
Step 2: Inspect the panic / hang report
The script's LATEST_PANIC= / LATEST_HANG= lines give you the file to read.
Key fields in a panic report:
| Field | Meaning |
|---|---|
panic(cpu N caller ...) |
The instruction that panicked; first line says why |
Установить macos-incident-postmortem в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Bash(bash *)Bash(uname *)Bash(sysctl *)Bash(uptime *)Bash(last *)Bash(log *)Bash(pmset *)ReadGrepGlobTodoWriteВложенные файлы
FAQ
Что делает скилл macos-incident-postmortem?
Reconstruct macOS freeze, panic, or reboot from DiagnosticReports and shell history. Use when investigating hangs, panics, watchdog timeouts, jetsam, or thermal throttling.
Как установить скилл macos-incident-postmortem?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл macos-incident-postmortem запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic