[Unit] Description=Mine opencode session history into MemPalace (inside opencode-devbox container) Documentation=https://gitea.jordbo.se/joakimp/mempalace-toolkit # Only run if docker is reachable AND the container is currently up. # The ExecCondition below gives us the "container running" check at fire # time; these unit-level conditions just skip pointless scheduling churn # on boxes where docker isn't even installed. ConditionPathExists=/usr/bin/docker [Service] Type=oneshot # Environment knobs — set these in # ~/.config/systemd/user/mempalace-session-devbox.service.d/override.conf # via `systemctl --user edit mempalace-session-devbox.service` # (or just edit this file in place before installing). Environment=CONTAINER=opencode-devbox Environment=CONTAINER_USER=developer # Skip cleanly if the container isn't running. ExecCondition failing # marks the unit as "condition failed" (success from systemd's POV, no # alert noise). If this Condition passes, ExecStart fires. ExecCondition=/bin/sh -c 'docker ps --filter "name=^/${CONTAINER}$" --filter "status=running" -q | grep -q .' ExecStart=/usr/bin/docker exec -u ${CONTAINER_USER} ${CONTAINER} mempalace-session # Host-side log (journalctl --user -u mempalace-session-devbox --since today) # captures the captured stdout/stderr from the `docker exec` above. # 2h runaway ceiling — matches the in-container service unit. Enough for # a cold-start mine on a large corpus plus post-mine repair. TimeoutStartSec=7200 # Low priority on the host side. The work actually happens inside the # container; the host-side dockerd call is negligible. Nice=5