Document the operational routine + ship automation templates
Until opencode session-stopping hooks land upstream, mempalace-session
is the entire mechanism that gets opencode conversations into the
palace — skip it and session history stays trapped in a local SQLite
DB, invisible to semantic search. Previous docs covered setup well
but were thin on when and how often to run it.
- ARCHITECTURE.md §5: replace the one-line 'When to re-mine' note with
a full Operational Routine section — triggers, cadence, relationship
to the session lifecycle, automation pointers, verification.
- SKILL.md: add an Operational Routine section aimed at agents —
when to suggest invoking the tool, cadence guidance, how to
distinguish this producer-side tool from the consumer-side
mempalace skill's in-session habits.
- README.md: add 'Keeping it fresh' subsection pointing at contrib/
and the full docs.
contrib/ ships three ready-to-use templates:
- systemd/mempalace-session.{service,timer} — user units with weekly
Mon 03:00 schedule, Persistent=true catch-up, RandomizedDelaySec for
fleet-wide jitter, ConditionPathExists guard for opencode-less boxes,
Nice+IOSchedulingClass=idle so it never fights interactive work.
- cron/mempalace-session.cron — sample crontab entry with log
redirection and clear USER-substitution instructions.
- README.md with install/verify/uninstall recipes for both, a chooser
table (systemd vs cron), container/devbox caveats, and tuning notes
(daily vs weekly vs monthly trade-offs).
The user's LATER-list item 'wrap mempalace-session in cron/systemd
timer for true auto-save coverage' is now actionable: a single
systemctl --user enable --now command stands it up.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
[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
|
||||
@@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description=Weekly opencode → MemPalace session mine
|
||||
Documentation=https://gitea.jordbo.se/joakimp/mempalace-toolkit
|
||||
|
||||
[Timer]
|
||||
# Every Monday at 03:00 local time. Adjust to taste.
|
||||
# Use `systemctl --user list-timers mempalace-session.timer` to see next run.
|
||||
OnCalendar=Mon 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