You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Session files accumulate without bound; ssync cleanup (--keep/--before, --unnamed, dry-run by default, --apply to delete) exists but is manual. Wanted: scheduled auto-cleanup, so old sessions get pruned automatically ("run every week", "every 2 days", ...).
Proposal
Scheduling belongs to systemd (timers), not a daemon-internal scheduler.
installs + enables a systemd timer/service pair running ssync --config <cfg> cleanup --keep <dur> --apply (user units when the daemon runs per-user, system units otherwise)
--every accepts 2d, 7d, weekly, or a raw OnCalendar= expression
--keep defaults to a conservative retention (e.g. 90d) when omitted
disable and status counterparts
non-systemd platforms: document a cron line as fallback (the cleanup command itself is already non-interactive)
generates ssync-cleanup.service (oneshot, same User/config/package as the daemon) + ssync-cleanup.timer
timer: OnCalendar=<schedule>, Persistent=true (machine slept through the window -> catch up), RandomizedDelaySec
ordering: After=ssync.service (propagation is nicest with the daemon up, though deletion-while-down is settled correctly on next start)
3. Home-manager module
Same option set on the user bus (systemd.user.timers).
Semantics to state loudly (docs)
Deletions propagate mesh-wide. Cleanup deletes local files; the daemon tombstones them and every peer deletes its copy. A timer on ONE machine prunes ALL machines - that is the feature, but it must be documented next to the option.
One machine with a timer is enough; enabling on several is harmless (selection is idempotent) but redundant.
The existing wipe guard (refuses deleting all of an agent's sessions, cleanup.rs plan()) stays - it also protects the timer from an empty/unmounted dir scenario.
Artifact-dir files (0.8.0, DECISIONS adapters: amp session sync #9 amendment) inherit their session's created_at, so a session and its artifacts are always selected together.
Non-goals
no daemon-internal scheduler
no per-project retention policies (later, if ever)
Motivation
Session files accumulate without bound;
ssync cleanup(--keep/--before,--unnamed, dry-run by default,--applyto delete) exists but is manual. Wanted: scheduled auto-cleanup, so old sessions get pruned automatically ("run every week", "every 2 days", ...).Proposal
Scheduling belongs to systemd (timers), not a daemon-internal scheduler.
1. CLI enablement
New subcommand (bikeshed):
ssync cleanup-timer enable --every <schedule> [--keep <dur>] [--unnamed] [--agent <name>]ssync --config <cfg> cleanup --keep <dur> --apply(user units when the daemon runs per-user, system units otherwise)--everyaccepts2d,7d,weekly, or a rawOnCalendar=expression--keepdefaults to a conservative retention (e.g.90d) when omitteddisableandstatuscounterparts2. NixOS module
services.ssync.autoCleanup = { enable, schedule, keep, unnamed }:ssync-cleanup.service(oneshot, sameUser/config/package as the daemon) +ssync-cleanup.timerOnCalendar=<schedule>,Persistent=true(machine slept through the window -> catch up),RandomizedDelaySecAfter=ssync.service(propagation is nicest with the daemon up, though deletion-while-down is settled correctly on next start)3. Home-manager module
Same option set on the user bus (
systemd.user.timers).Semantics to state loudly (docs)
plan()) stays - it also protects the timer from an empty/unmounted dir scenario.created_at, so a session and its artifacts are always selected together.Non-goals