skills/cmux-markdown/references/live-reload.md
The markdown panel watches the file on disk and automatically re-renders when it changes. This enables real-time plan tracking as agents or editors update the file.
The panel uses a kernel-level file system watcher (DispatchSource with O_EVTONLY) that monitors the file for:
| Pattern | Supported | Notes |
|---|---|---|
Direct write (echo >>) | Yes | Triggers write/extend event |
| Editor save (vim, nano) | Yes | Most editors use atomic write (see below) |
| Atomic replace (write tmp + rename) | Yes | Handled via delete/rename recovery |
sed -i | Yes | Uses atomic replace internally |
| VS Code / IDE save | Yes | Uses atomic replace |
| Agent progressive writes | Yes | Each write triggers a re-render |
Many editors and tools write files atomically: write to a temporary file, then rename it over the original. This shows up as a delete event followed by a new file appearing at the same path.
The panel handles this by:
If the file is deleted and does not reappear within the retry window, the panel shows a "file unavailable" state with the original path. The panel does not close automatically -- the user must close it manually.
If the file later reappears at the same path (e.g., the user recreates it), the panel does NOT automatically reconnect. Close and reopen the panel to pick up the new file.