Symphony / Host cleanup timed job

Nightly host cleanup

A direct VPS hygiene timer that removes stale top-level /tmp debris, vacuums the systemd journal to a target size, and optionally cleans the apt package cache.

Cadence 08:00 host timeMode direct housekeepingScope /tmp, journal, apt cacheOutput journal summary
systemd timer->stale /tmp scan->journal vacuum->apt clean
00

Operating model

This timer reclaims transient host disk without touching Symphony-managed state. It leaves workspaces, npm and Playwright caches, Codex stores, Docker or containerd images, and the local Supabase stack to their own lifecycle.

08:00
Nightly start
systemd calendar
7d
Default /tmp TTL
top-level entries only
200M
Journal target
JOURNAL_MAX default
1
Dry-run flag
DRY_RUN=1 preview
KEYKeep managed state out of scope

The script is intentionally narrow. It does not touch Symphony workspaces, Codex databases, caches, Docker images, or the local staging stack.

01

System shape

Host cleanup is a root-level service with an explicit dry-run mode and three narrow cleanup phases.

systemd timer08:00 nightlysystemd serviceroot cleanup/tmp cleanuptop-level TTLJournal vacuumvacuum-sizeApt cacheoptional cleanOut of scopemanaged stateJournal outputsummary lines
02

Cadence design

Each timed job has a small set of modes that decide whether the run is healthy, degraded, or ready to create follow-up work. Use the controls to compare the operating contract.

/tmp

Remove stale top-level debris

The script only considers top-level entries older than TMP_TTL_DAYS and skips system socket or private directories.

  • TMP_ROOT exists
  • mtime older than TTL
  • system directories skipped
  • estimated freed size logged
Host cleanup confidence threshold82%

Run with DRY_RUN=1 and inspect stale paths before allowing deletion.

03

Execution tracks

The tracks make each run inspectable. They separate inputs, outputs, and failure modes so reports do not collapse into vague status updates.

Top-level /tmp only

Temporary files

Agent runs leave logs, locks, and throwaway directories in /tmp. The job removes only stale top-level entries.

Inputs
  • TMP_ROOT
  • TMP_TTL_DAYS
  • mtime
Outputs
  • removed entry count
  • estimated freed size
  • skipped system dirs
04

Host hygiene risk map

The job runs as root, so the safety boundary matters more than the cleanup amount.

TMP_ROOT and TTLwrong root or short TTL can delete active temp state
96
System directory skipssocket and private dirs must remain untouched
90
Dry-run modeoperators need a preview before changing defaults
84
Journal vacuum targettoo high is ineffective, too low can remove useful logs
76
Managed state boundaryworkspaces and caches have dedicated lifecycle
72
Root service visibilityjournal logs are the audit trail for root cleanup
64
If disk pressure comes from workspaces, Codex stores, Docker, or Supabase, create a targeted operational task. Do not expand host cleanup into a broad broom.
05

Output rubric

The run should create follow-up work only when the output is concrete. Use the rubric to keep reports, bug tickets, and operational follow-ups separated.

Cleaned

Stale /tmp entries, journal size, or apt cache were cleaned and each phase logged.

  • /tmp entries removed
  • journal vacuumed
  • apt cache cleaned
06

Run contract

The host cleanup contract is explicit phase logging, dry-run support, and a hard boundary around managed state.

Service

Root housekeeping

symphony-host-cleanup.timer starts host_cleanup.sh with narrow defaults for /tmp, journal, and apt cache cleanup.

Boundary

No Symphony state

The job does not touch workspaces, Codex databases, npm caches, Playwright caches, Docker images, or local Supabase state.

TMP_ROOT and TMP_TTL_DAYS
Stale /tmp entry count
Estimated /tmp freed size
Journal disk usage and target
APT_CLEAN setting
Dry-run status
Skipped phase reasons
Final host cleanup status
07

Command plan

Dry-run first when changing defaults, then use systemd for normal operation.

Dry-runsudo DRY_RUN=1 /opt/symphony/elixir/scripts/host_cleanup.sh
Manual runsudo /opt/symphony/elixir/scripts/host_cleanup.sh
Timer installsudo systemctl enable --now symphony-host-cleanup.timer
Read journaljournalctl -u symphony-host-cleanup.service -n 100 --no-pager
!Use a targeted lifecycle for other disk pressure

Docker images, Supabase data, workspaces, Codex stores, and caches should each have a dedicated cleanup path instead of being folded into this root job.

08

Rollout path

1

Dry-run current defaults preview

Inspect candidate /tmp entries and journal targets before changing host state.

2

Run manually once evidence

Confirm each phase logs a clear action or skip reason.

3

Enable nightly timer systemd

Install the service and timer units, daemon-reload, and enable the timer.

4

Track disk pressure source ops

When disk remains high, identify the subsystem and add a dedicated cleanup instead of widening this one.

AgencyCore / Symphony / Host cleanupDesign draft / 2026-06-12