Preface

DSH’s archiving mechanism is typically “in only, no out.” Over time, physical archive piles (sessions-archive/) and page archive session records continue to accumulate, leading to slower Web GUI responsiveness. This plugin mounts a scheduled cleanup task on the host side, automatically deleting archived data beyond the retention period and generating audit manifests, thereby keeping the system tidy and performant.

Plugin Overview

momojie-s/dsh-archive-retention is a periodic cleanup plugin for archived sessions, maintained by developer Momojie-S under the MIT license. It uses Cron scheduling to automatically clean up physical archive piles, page archive session records, and orphaned child agents.

Core Features

  1. Automatic cleanup of physical archive piles
  2. Automatic cleanup of page archive session records
  3. Automatic cleanup of orphaned child agents
  4. Retention period configuration (supports days/hours)
  5. Scheduled cleanup via Cron
  6. Generates audit manifests
  7. Direct configuration from the Web settings page

Installation and Enablement

After installation, DSH must be restarted for changes to take effect.

dsh plugin --profile web add github:Momojie-S/dsh-archive-retention

Configuration and Usage

The plugin supports visual configuration through the Web settings page without modifying configuration files.

  1. Configure retention period
    Go to the settings page and find the “Archive Auto-Cleanup” card in the plugin section. Set the retention value and unit (supports days or hours). The default retention period is 7 days.

  2. Configure cleanup schedule
    Set the interval for checking and cleaning. By default, it checks once per hour, with a minimum interval of 15 minutes.

  3. Configure cleanup scope
    Use toggles to independently control cleanup behavior for physical archive piles, page archive session records, and orphaned child agents.

  4. Verify cleanup
    Temporarily set the retention period to 1 hour, wait for the cleanup cycle to run, then observe the retention-*.json audit manifests generated in the sessions-archive/_manifests/ directory.

Cleanup Scope and Safety Boundaries

What is cleaned:
- Physical archive piles
- Page archive session records
- Orphaned child agents (child agents whose parent session directory no longer exists)

Safety boundaries:
- Never touches unarchived main sessions
- Never touches running or in-memory sessions
- Never touches the _manifests directory
- For directories whose parent-child relationship cannot be confirmed (due to header read failure), it chooses not to touch them

Notes

  • Version requirement: DSH version must be 0.1.5-rc.1 or higher.
  • Environment requirement: Requires the web profile (i.e., using the settings page UI).
  • Data nature: Archive ≠ permanent storage; the retention period is a “grace period,” and data is destroyed upon expiry.

Summary

This plugin provides visual configuration through the Web UI, avoiding manual management of archive files. It only physically deletes archived and expired data, ensuring a lightweight DSH runtime environment.

GitHub Repository
Plugin Directory