[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