Add macOS launchd template, bringing automation parity to macOS
Ship a launchd user agent plist alongside the existing systemd and
cron templates so macOS users can schedule mempalace-session without
falling back to cron. launchd is the macOS-native equivalent of a
systemd user timer: same scheduling model, same log conventions, same
single-instance guarantees.
- contrib/launchd/se.jordbo.mempalace-session.plist:
- Label uses reverse-DNS from the jordbo.se domain for consistency
with other user-installed launchd jobs; fork the prefix if reusing
this template in a different org.
- ProgramArguments points at /Users/USER/.local/bin/mempalace-session
(USER is substituted at install time, same pattern as
contrib/cron/).
- EnvironmentVariables.PATH covers ~/.local/bin, Apple Silicon
Homebrew, Intel Homebrew, and system defaults — launchd agents
get a minimal PATH by default and the wrapper needs to find
mempalace + python3.
- StartCalendarInterval matches systemd unit's schedule: Monday
03:00 local.
- RunAtLoad=false — load shouldn't trigger a run; schedule does.
- ProcessType=Background + LowPriorityIO=true + Nice=10 mirror
the systemd unit's Nice=10 + IOSchedulingClass=idle. macOS's
automatic App Nap and resource throttling for Background jobs
yields to interactive work cleanly.
- ExitTimeOut=7200 matches systemd's TimeoutStartSec=7200.
- StandardOut/ErrorPath under ~/Library/Logs/ so Console.app
surfaces them.
- contrib/README.md gains a full launchd section:
- Caveat table comparing to systemd (Persistent=true isn't quite
matched; RandomizedDelaySec has no equivalent; overlap prevention
is automatic).
- Install recipe using launchctl bootstrap (modern) with a fallback
note for legacy launchctl load -w on older macOS.
- Verify section shows launchctl list, launchctl print, log tails,
and launchctl kickstart for manual testing.
- Uninstall via launchctl bootout.
- Chooser table updated: macOS now explicitly points at launchd,
not cron.
- ARCHITECTURE.md §5, SKILL.md Quick automation pitch, and README.md
Keeping it fresh section all updated to mention the three scheduler
options and give per-platform quick-starts.
Plist XML validated with plistlib.
This commit is contained in:
@@ -141,10 +141,11 @@ A machine running only one of these has half a memory. Agents loading the `mempa
|
||||
|
||||
### Quick automation pitch
|
||||
|
||||
If the user has a devbox and hasn't set up automation, offer it:
|
||||
If the user has a devbox and hasn't set up automation, offer it. Pick the scheduler that matches the OS:
|
||||
|
||||
**Linux (systemd user timer):**
|
||||
|
||||
```bash
|
||||
# One-time setup (modern Linux, systemd user timer)
|
||||
cd ~/mempalace-toolkit
|
||||
mkdir -p ~/.config/systemd/user
|
||||
cp contrib/systemd/*.{service,timer} ~/.config/systemd/user/
|
||||
@@ -153,7 +154,20 @@ systemctl --user enable --now mempalace-session.timer
|
||||
sudo loginctl enable-linger "$USER" # optional, for headless boxes
|
||||
```
|
||||
|
||||
Full install/verify/uninstall recipes for both systemd and cron are in [`contrib/README.md`](../../contrib/README.md). The quick-start above defaults to weekly runs on Monday 03:00 local time with a ≤30 min randomized delay.
|
||||
**macOS (launchd user agent):**
|
||||
|
||||
```bash
|
||||
cd ~/mempalace-toolkit
|
||||
sed "s|USER|$USER|g" contrib/launchd/se.jordbo.mempalace-session.plist \
|
||||
> ~/Library/LaunchAgents/se.jordbo.mempalace-session.plist
|
||||
mkdir -p ~/Library/Logs
|
||||
launchctl bootstrap "gui/$(id -u)" ~/Library/LaunchAgents/se.jordbo.mempalace-session.plist
|
||||
launchctl enable "gui/$(id -u)/se.jordbo.mempalace-session"
|
||||
```
|
||||
|
||||
**BSD or systemd-less Linux (cron):** see [`contrib/cron/`](../../contrib/cron/).
|
||||
|
||||
Full install/verify/uninstall recipes for all three are in [`contrib/README.md`](../../contrib/README.md). All three default to weekly runs on Monday 03:00 local time.
|
||||
|
||||
## Failure Modes & Fixes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user