[Unit] Description=Mine opencode session history into MemPalace Documentation=https://gitea.jordbo.se/joakimp/mempalace-toolkit # Only run if opencode has actually been used (avoids noise on idle machines) ConditionPathExists=%h/.local/share/opencode/opencode.db # Don't start if a previous run is still going ConditionPathExists=!%t/mempalace-session.lock [Service] Type=oneshot # The wrapper writes to ~/.cache/mempalace-session/ and the palace. # Keep stdout/stderr in the journal — inspect with: # journalctl --user -u mempalace-session --since today ExecStart=%h/.local/bin/mempalace-session # Belt-and-braces lock so two overlapping runs can't corrupt staging ExecStartPre=/bin/sh -c 'touch %t/mempalace-session.lock' ExecStopPost=/bin/sh -c 'rm -f %t/mempalace-session.lock' # Protect against runaway runs (the 60-session reference mine takes ~21 min; # give 2h of headroom for larger corpora and slow disks) TimeoutStartSec=7200 # Low priority — this is background maintenance Nice=10 IOSchedulingClass=idle