docs(contrib): scheduling templates for mempalace-pi-session
Drop-in equivalents of the opencode templates for each scheduler
mechanism:
systemd/mempalace-pi-session.{service,timer}
launchd/se.jordbo.mempalace-pi-session.plist
cron/mempalace-pi-session.cron
Schedule is staggered from the opencode jobs (Mon 03:00 -> Tue 03:00)
so machines running both don't race each other on the post-mine HNSW
repair step. Service unit uses ConditionPathExists=%h/.pi/agent/sessions
to no-op silently on machines that haven't used pi, matching the
opencode template's guard on ~/.local/share/opencode/opencode.db.
contrib/README.md grows a 'Templates at a glance' table so the set is
discoverable without reading the whole doc.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
[Unit]
|
||||
Description=Mine pi coding-agent session history into MemPalace
|
||||
Documentation=https://gitea.jordbo.se/joakimp/mempalace-toolkit
|
||||
# Only run if pi has actually been used (avoids noise on idle machines)
|
||||
ConditionPathExists=%h/.pi/agent/sessions
|
||||
# Don't start if a previous run is still going
|
||||
ConditionPathExists=!%t/mempalace-pi-session.lock
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
# The wrapper writes to ~/.cache/mempalace-pi-session/ and the palace.
|
||||
# Keep stdout/stderr in the journal — inspect with:
|
||||
# journalctl --user -u mempalace-pi-session --since today
|
||||
ExecStart=%h/.local/bin/mempalace-pi-session
|
||||
# Belt-and-braces lock so two overlapping runs can't corrupt staging
|
||||
ExecStartPre=/bin/sh -c 'touch %t/mempalace-pi-session.lock'
|
||||
ExecStopPost=/bin/sh -c 'rm -f %t/mempalace-pi-session.lock'
|
||||
# Protect against runaway runs. Pi sessions tend to be short/tactical so the
|
||||
# corpus is much smaller than opencode's; 2h is generous headroom.
|
||||
TimeoutStartSec=7200
|
||||
# Low priority — this is background maintenance
|
||||
Nice=10
|
||||
IOSchedulingClass=idle
|
||||
@@ -0,0 +1,18 @@
|
||||
[Unit]
|
||||
Description=Weekly pi → MemPalace session mine
|
||||
Documentation=https://gitea.jordbo.se/joakimp/mempalace-toolkit
|
||||
|
||||
[Timer]
|
||||
# Every Tuesday at 03:00 local time. Staggered from mempalace-session.timer
|
||||
# (Mon 03:00) so if both are installed, the HNSW repair step in one doesn't
|
||||
# race the repair step in the other.
|
||||
# Use `systemctl --user list-timers mempalace-pi-session.timer` to see next run.
|
||||
OnCalendar=Tue 03:00
|
||||
# If the machine was off at the scheduled time, run at next boot.
|
||||
Persistent=true
|
||||
# Randomize up to 30 minutes to avoid thundering-herd across machines.
|
||||
RandomizedDelaySec=30m
|
||||
AccuracySec=1m
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
Reference in New Issue
Block a user