Preface¶
When developing agents in DeepSeek Harness (DSH), sessions accumulate over time: conversation logs, projection caches, session bookkeeping in the workspace, and attachment copies stored by content hash. Archiving or regular deletion often only touches part of this, leaving directories and objects on disk that take up space and make it hard to “clean up completely” in test environments or sensitive scenarios.
Manually deleting directories, editing workspace JSON, and guessing which attachments can still be deleted is prone to omissions, and worse, may accidentally delete shared attachments still referenced by other sessions (for example, child sessions forked from a parent session inherit the same batch of image objects). The dsh-deep-purge described below, published by maintainer HunLongBaiZe and categorized as admin-security, aims to safely reclaim session-exclusive data based on reference relationships after a single confirmation, and provide a per-item summary.
What Is This¶
dsh-deep-purge is a DSH plugin: it adds a “Deep Purge…” entry to the “…” menu on sidebar session rows, shows a risk confirmation dialog before deletion, and displays how many log directories, attachment references/deletions/retentions, and disk space were freed after deletion. It does not replace DSH’s built-in archiving; instead, it targets the administrative need to “wrap up everything at once” — from logs, caches, and bookkeeping to safely deletable attachments.
Repository: https://github.com/HunLongBaiZe/dsh-deep-purge
Community directory page: https://www.skillhub.cn/plugins/HunLongBaiZe/dsh-deep-purge (an independent site, with no official affiliation with DeepSeek / High-Flyer).
Core Features¶
UI and Confirmation Flow¶
- Adds a “Deep Purge…” entry to the “…” menu on sidebar session rows, styled in danger colors and placed after the archive entry.
- Uses
RiskConfirmation: the confirmation button is only enabled after checking “I understand this action is irreversible”. - UI integration does not rely on DOM injection: menu items are registered into
sidebar.workspaces.session.menu.item, dialogs intoshell.overlay, using primitives’RiskConfirmationandModal.
Deletion Scope¶
A single operation processes (subject to passing safety checks):
- Session log directories: supports both
uuidandsession-prefixed id spellings; if this leaves an empty workspace directory, it is cleaned up as well. - Projection cache: the
sessionstable ofsession_projcache, via the activestorageDomain, ensuring memory and disk consistency. - Workspace bookkeeping:
workspaces.sessionIdsand globalarchivedSessionIds. - Attachment objects: only deletes objects that are “referenced by this session and not referenced by any other session”; does not delete attachments still referenced by other sessions. Attachments are stored by content hash; forked sessions inherit their parent session’s images and share objects. Deleting a shared object would corrupt image references in other sessions, so they are always retained.
- Request image transcoding cache: pure cache, rebuildable.
After deletion completes, a summary pops up: number of log directories, attachment reference/deletion/retention counts, and freed disk space.
Safety Measures (Key Points from the README)¶
- Before reclaiming attachments, scans the logs of all surviving sessions; if any log read fails, attachment reclamation is skipped entirely.
- Reference collection favors over-collection: any
attachmentIdof the formsha256:<64hex>is counted as a reference; a false positive only keeps an object a bit longer, while a false negative would destroy data. - Sessions with an active agent are rejected for deletion, returning 409.
- The host endpoint requires the
confirmfield in the request body to exactly matchsessionId, preventing accidental triggers and scripted misuse. - Before deleting attachment objects, the path must be validated to fall under
objects/, and the filename must be a 64-character hexadecimal string.
Compatibility¶
Requires DSH ≥ 0.1.6. The client slots, sessionPersistence read handles, and storageDomain domain services used are already available in that version; the maintainer has verified this on 0.1.6-alpha.2 and 0.1.7-rc.2. The plugin’s current version is v0.1.0 (first release, 2026-09-25), licensed under MIT.
Installation and Activation¶
The plugin reads and writes local data with the permissions of the current DSH process. Before installing, it is recommended to browse the repository’s source code and LICENSE to confirm it meets your environment policies.
Install from GitHub:
dsh plugin --profile <profile> add github:HunLongBaiZe/dsh-deep-purge
Or use a local directory (e.g., your own fork or an offline package):
dsh plugin --profile <profile> add file:/path/to/dsh-deep-purge
Replace <profile> with the DSH profile name you actually use. After installation, restart that profile for it to take effect.
Typical Usage¶
- Find the session to clean up in the DSH sidebar and click the “…” menu on that row.
- Select “Deep Purge…” (located after the archive entry).
- In the risk confirmation dialog, check “I understand this action is irreversible”, then confirm.
- If the session still has an active agent, the operation will be rejected (409); otherwise, cleanup executes and a summary dialog is shown.
No additional configuration files: behavior is determined by the plugin and DSH’s built-in storage layout. Do not force deletion while the session is still occupied by an agent.
Use Cases and Notes¶
Who It’s For
- Developers who repeatedly create sessions in test or local environments and want consistent cleanup of disk and bookkeeping.
- Administrators working with conversations containing attachments who understand that “shared attachments must be retained due to forking and other reasons”.
- Operational cleanup categorized as admin-security, not routine in-conversation deletion.
Important Notes
- The operation is irreversible; before deleting, confirm the correct session is selected and there are no unsaved dependencies.
- The plugin runs with the same process permissions as DSH; installing it constitutes trusting it to read and write session and object storage. Installing from sources you have never verified is risky.
- Attachment reclamation is skipped entirely if log scanning fails; some objects may remain on disk, but this avoids accidentally deleting shared data.
The maintainer provides 26 offline tests (node test/run-tests.mjs), covering reference counting (shared retention / exclusive deletion), fail-safe skipping, rejection during execution, confirm validation, and both id spellings. If you fork or change behavior, run them locally before enabling.
Conclusion¶
dsh-deep-purge consolidates “logs + projection cache + workspace bookkeeping + reference-counted attachment reclamation” into a single “Deep Purge…” action in the sidebar, using confirmation dialogs and risk policies to reduce the probability of accidental deletion and shared attachment corruption. The DSH ecosystem emphasizes “everything is a plugin”; if you need more thorough session cleanup than archiving provides, install it using the commands above and use it on DSH ≥ 0.1.6.