Directory sync writes a small marker file to detect whether a folder was previously synced
Directory sync now reads and writes a small JSON marker file inside a synced directory, recording a version number and the time it was written. It's created exclusively so it can't silently overwrite an existing one, and failures to read or write it are logged. A companion piece of logic also maps the various reasons directory sync can detach from a folder (commit not held, not in history, on another branch, branch switched, switched off, diverged, machine stopped) to explanations shown to the user.
The marker file lets directory sync detect whether a folder was already under sync before, which helps it behave correctly across restarts, while the clearer detach-reason mapping means users get a specific explanation instead of a generic one when sync stops.