The others use `jj status`, but if I were to do this, I'd use `jj log -n0`, which has no output. All you really need is any read-only jj command.
You could also turn on watchman and have this property on every save of a file and not even need to worry about hooks.