Run the watcher as a launch agent
freehand watch notices new notebook pages, new marks and new commits in your repos, and acts on them. Run in a terminal, it stops when you close it. As a launch agent, macOS runs one check a minute in the background and starts it again when you log in.
Before you start
Section titled “Before you start”- A working watch config.
freehand initwrites one. Check yours withfreehand watch --status, which shows what it watches and what it has handled so far. The keys are in the watch config reference. - A Mac.
--installis for macOS. On Linux, runfreehand watch --oncefrom cron.
Install it
Section titled “Install it”freehand watch --installThis writes ~/Library/LaunchAgents/dev.freehand.watch.plist and loads it. The agent runs the same command with --once every minute, and logs to ~/.freehand/watch.log.
launchd starts programs with a bare PATH, which would miss uv, claude and anything else your then: command runs. So the agent keeps the PATH you installed it from. If you install a tool later, run freehand watch --install again.
Check it
Section titled “Check it”freehand watch --status # what it watches, and what it has handledtail -f ~/.freehand/watch.logChange it
Section titled “Change it”Edit ~/.freehand/config.yml. The agent reads it on every check, so there’s nothing to reload. To change where the config is, or to use folders and a command instead of a config, install again with the new arguments: freehand watch <folder>... --run "<command>" --install.
Remove it
Section titled “Remove it”freehand watch --uninstallHow it behaves
Section titled “How it behaves”- It polls. Sync apps lose file events, especially while a laptop sleeps, and listing a few folders costs nothing.
- It waits for quiet. Nothing is read until the folder has gone quiet for
quiet_minutes(3 by default), so a sync that’s still uploading isn’t read half done. - It never acts twice. The state file,
~/.freehand/watch.json, records what it has handled. - A failed command is tried again. If your
then:command exits with anything but 0, the same changes are tried again after five minutes, and the reason is in the log. - It hands off to the script. Give your config
alive: freehand/inboxand, while the watcher runs, the freehand script leaves reading new pages to your computer. Once the laptop sleeps or shuts for ten minutes, the script takes over again. - It stops cleanly. Ctrl-C or SIGTERM stops a running watcher, even in the middle of a check. It ends the command, removes its scratch folder of drawn pages, and saves no state, so the same changes are handled next time. It exits 130 after Ctrl-C and 143 after SIGTERM.