Daemon
hometree daemon (watch)
How to run the watcher in the foreground or as a systemd user service. The watcher is event-driven (notify + debounce) and never scans your full home directory.
Prerequisites
watch.enabled = trueinconfig.toml.- At least one managed root or extra file. Patterns with glob meta are skipped for watching; use concrete directories.
- Optional auto-add: set
watch.auto_add_new = trueand provide a non-emptywatch.auto_add_allow_patterns. Allowlist entries are validated (max 50; broad patterns like*or absolute paths are rejected). - Secrets: if enabled, you must have valid age recipients (encrypt) and identity files (decrypt). Plaintext secrets are never staged.
Foreground mode
RUST_LOG=info hometree daemon run
# alias
RUST_LOG=info hometree watch foregroundhometree daemon --foregroundis a compatibility alias for foreground mode.- Debounces filesystem events (
watch.debounce_ms, minimum 50ms).watch.auto_stage_tracked_only=trueby default, so only managed files are staged. - Auto-adds new files only when they are (a) under the managed set, (b) allowed by ignore/denylist, and (c) match the allowlist. Skipped auto-adds log a reason at
debuglevel. - Secrets: plaintext edits trigger sidecar regeneration and staging when secrets are enabled.
- Use
--home-root/--xdg-rootif you need a temporary HOME/XDG for testing the daemon.
IPC commands
These commands talk to the running daemon via a Unix socket under $HOMETREE_RUNTIME_DIR/hometree (or $XDG_RUNTIME_DIR/hometree when not set).
hometree daemon status
hometree daemon reload
hometree daemon pause --ttl-ms 300000 --reason deploy
hometree daemon resume
hometree daemon flushNotes:
pausewrites an inhibit marker and stops staging for the TTL (defaults:ttl_ms=300000,reason=manual).resumeclears it.reloadre-reads config and watch roots.flushimmediately stages queued changes.- IPC commands require a runtime dir; if neither
HOMETREE_RUNTIME_DIRnorXDG_RUNTIME_DIRis set, they will fail.
Systemd user service
Systemd integration is user-session only.
Install the unit:
hometree daemon install-systemd
systemctl --user daemon-reloadStart/stop/status:
hometree daemon start
hometree daemon stop
hometree daemon restart
hometree daemon status
hometree daemon uninstall-systemdDetails:
- Unit path:
~/.config/systemd/user/hometree.service(XDG-aware). ExecStart:hometree daemon run. Restart policy:on-failure. - Uses the hometree binary found when you run
install-systemd; re-run the install step after upgrading the binary or changing HOME/XDG overrides. - Logs:
journalctl --user -u hometree.service(add-fto follow). To change log level, setRUST_LOGin the service environment (edit the unit file) and restart.
Safety notes
- Watch scope is limited to managed roots/extra files; ignored/denylisted paths are not staged. Secrets ciphertext files are also skipped for watch-triggered staging.
- Auto-add is allowlist-only and remains off when the allowlist is empty. Patterns are validated to prevent accidental full-home ingestion.
- Symlink targets are not followed by the watcher. Deploy/rollback continues to enforce symlink target staying under
$HOME.
Updating config
- The watcher reads config on start. After editing
config.toml(e.g., toggling auto-add), restart the foreground process orsystemctl --user restart hometree.service.