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¶
- Automatic cleanup of physical archive piles
- Automatic cleanup of page archive session records
- Automatic cleanup of orphaned child agents
- Retention period configuration (supports days/hours)
- Scheduled cleanup via Cron
- Generates audit manifests
- 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.
-
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. -
Configure cleanup schedule
Set the interval for checking and cleaning. By default, it checks once per hour, with a minimum interval of 15 minutes. -
Configure cleanup scope
Use toggles to independently control cleanup behavior for physical archive piles, page archive session records, and orphaned child agents. -
Verify cleanup
Temporarily set the retention period to 1 hour, wait for the cleanup cycle to run, then observe theretention-*.jsonaudit manifests generated in thesessions-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.1or higher. - Environment requirement: Requires the
webprofile (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.