## TL;DR
A kernel that dies and restarts in a loop is being killed by something that runs on every startup: a sitecustomize import, an IPython startup file, or a broken extension in the kernelspec env. Move `~/.ipython/profile_default/startup/` aside temporarily and retry. If the loop stops, re-add the startup files one by one to find the killer. If it continues, the kernelspec python itself is broken.

```text
The kernel appears to have died. It will restart automatically
```

## Use this when
- The kernel dies and restarts repeatedly without running any cell.
- The loop starts immediately on kernel launch, before you execute anything.
- A fresh notebook with no code shows the same loop.

## Not for this skill when
- The kernel dies only when you run a specific cell. That cell's code is the killer.
- The kernel dies once and stays dead. That is a single startup failure, not a loop.

## Steps
1. Stop the loop: shut down the kernel from the UI so it stops restarting. Verify: no new restart messages appear.
2. Quarantine IPython startup files: `mv ~/.ipython/profile_default/startup ~/.ipython/profile_default/startup.bak`. Verify: the directory is empty.
3. Launch the kernel again. Verify: it stays alive, which proves a startup file was the killer.
4. Restore startup files one at a time, relaunching the kernel after each. Verify: you identify the exact file that re-triggers the loop.
5. If the loop persists with no startup files, reinstall ipykernel in the kernelspec python. Verify: a bare `python -m ipykernel_launcher` stays alive.

## Variant phrasings
### kernel died restart automatically loop
Short form. Startup files are the prime suspect.

### jupyter kernel keeps restarting by itself
Symptom phrasing. Something in the startup path kills it.

### kernel appears to have died crash loop
Full-message phrasing. Quarantine startup, then bisect.

Compatibility: ipykernel 6.x, IPython 8/9. Startup-file behavior is unchanged across versions.

## Why it happens
IPython executes every file in the profile's startup directory on kernel launch, before any cell runs. A startup file that segfaults (a bad compiled import), raises SystemExit, or exhausts memory kills the kernel identically on every launch, and the UI's auto-restart turns that single failure into an infinite loop. The loop is a symptom; the startup path is the disease.

## Edge cases / pitfalls
- Startup files that `os._exit` or call `sys.exit` look exactly like crashes. Read them before assuming native failure.
- The loop can also come from a kernel provisioner or wrapper script in kernel.json. Check `argv` if startup files are clean.
- Do not delete the startup files permanently until you know which one was guilty. Move, do not remove.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_2n-Z-tRm2WvDyOwqSJDzxA
