Introduction¶
As DeepSeek Harness (DSH) accumulates more sessions, navigating the sidebar becomes increasingly difficult. The existing archive function simply hides sessions without a dedicated trash bin. d-trash builds on this foundation by adding a global trash bin that supports moving sessions into the trash, restoring them, and moving local session logs to the system trash, while also leaving a persistent audit log of all operations.
What It Is¶
d-trash is a DeepSeek Harness plugin maintained by HLhhh. It adds a trash bin entry point to DSH sessions, allowing sessions to be archived while preserving their logs and workspace membership, and then restored or further cleaned up from the trash. It also provides a session Distill capability, enabling users to select a preset on a trashed conversation to run read-only tasks and export a Markdown document without modifying the source session.
Core Features¶
- Move to Trash: Triggered from the session right-click menu or the hover trash-can icon. Preserves logs and workspace membership.
- Restore Session: Restoring from the trash unarchives the session while maintaining its current workspace position; multiple restores execute the native unarchive logic.
- Move to System Trash: After confirmation, moves the local session log directory to the system trash. On macOS, this is accomplished via the native
renameatx_npoperation on the.Trashdirectory; on Windows, the system recycling mechanism does not support safely retaining the source file, so this feature remains disabled and only records the failure state. - Queue Pending Sessions: Busy sessions can be added to a queue for automatic retry of the system trash move after DSH restarts; restoring a session cancels its queue entry.
- Empty Trash: Empties by workspace, displaying counts of moved, pending, and failed items.
- Session Distill: Selects a host Agent preset to run read-only tasks on trashed conversations, exporting a Markdown file. The default save location is
<session cwd>/d-trash-distill/<date>-<short ID>-distill.md. Supports manual prompt export. - Audit Log: A local JSONL file records operation phases and failure reasons.
Installation & Activation¶
The plugin supports DSH 0.2.2-rc.2 and rc.5, requiring Node.js ^22.19.0 || >=24.0.0. The repository includes pre-built dist/ files.
After a local checkout, use directly:
git clone https://github.com/HLhhh/d-trash.git
cd d-trash
npm install
Then use the committed dist/. If you need to modify the source or rebuild, run first:
npm install && npm run build
In DSH, open Plugins → Add plugin and enter the absolute path of the checkout directory (run pwd in the checkout directory to get it). Once the repository is public, you can also use the git specification directly:
github:HLhhh/d-trash
The Agent can install via plugin_manager → install_bundle, setting target to the same absolute directory or git specification, selecting the target profile, and proceeding based on activation/restart results. Installation modifies all sessions under that profile.
Typical Usage¶
Trash bin entry points and their corresponding actions:
| Entry Point | Action |
|---|---|
| Session right-click menu → Move to Trash | Archives the session and adds a trash marker |
| Hover trash-can icon on session row | Moves the session to the trash |
| Sidebar → Trash | Opens the global trash panel |
| Panel → Restore | Restores the session to the normal session list |
| Panel → Move to system trash | After confirmation, moves the local log directory to the system trash |
| Panel → Empty Trash | After confirmation, moves all trashed sessions to the system trash |
| Panel → Distill | Selects a host Agent preset, runs read-only tasks, and displays the Markdown path |
| Panel → Refresh | Reloads the list and workspace projection |
Destructive operations require inline confirmation; press Cancel or Escape to abort. Queued sessions display “Pending move to system trash (automatically retries after restarting DSH)”. Restoring a session cancels its queue entry and retains the archived status; a subsequent restore executes the native unarchive logic. Once a system trash move has started and a cleanup receipt exists, restore is disabled.
Session Distill¶
Click Distill on a trashed row, select a host Agent preset, and start. DSH uses the preset’s default model to run in an independent task session with all tool execution disabled. The source session is read via a read-only persistent handle—it is not restored, write-locked, and retains its trash marker and archived status. The independent task has its own normal storage/lease, and logs are retained by DSH.
Output includes the source ID/title/timestamp, generation time, preset, type (experience/operations/skill draft/requirements), and structured Markdown. The default path is:
<source session cwd>/d-trash-distill/<date>-<short ID>-distill.md
Same-named files are automatically suffixed to preserve both. Click Show file path to copy the full path into your editor or file manager. Progress and staged failures are displayed inline; retries are selectable. Tasks time out after 5 minutes and are cancelled on Host unmount.
Host configuration options:
| Option | Default | Description |
|---|---|---|
distillDir |
"" |
When empty, uses the source session cwd plus d-trash-distill; otherwise uses an absolute directory. Must be set if the source session has no cwd. Rejects symlinks/non-canonical paths and output under DSH persistent directories. |
The output parent directory is re-validated after the Agent returns and before file creation, with a final directory check after creation. If the parent path is replaced by a symlink during the wait, it is rejected before creation; rejected directories are never guessed or deleted. These checks are not atomic filesystem transactions against arbitrary concurrent renames.
When the Agent/preset/default model service is unavailable, Export a prompt (manual) saves an annotated prompt with the session transcript for manual sending, without running the model. Agent failure does not silently fall back. Pending cleanup rows cannot be distilled. Empty or oversized session transcripts are rejected; provider context limits may be lower than the two-million-character input cap, and generated content requires human review.
How It Works¶
The Host service is the sole writer of trash state. The visible trash is marker ∩ archived: native archiving does not create a trash marker; native unarchiving removes the intersection, after which the Host list merges stale markers. Native archive and Pin behavior remain unchanged.
Moving to the system trash requires verifying that the JSONL session path matches the filesystem identity. The Host acquires backend-compatible write exclusivity: flock on the existing session.lock for POSIX, and a Koffi-backend-named kernel semaphore for Windows. It persists the source-only move intent, re-checks identity and archive/marker gating, moves the entire directory to the same-volume system trash, confirms the source no longer exists, releases the lease, then clears workspace membership, archive status, and markers, and attempts projection cache cleanup.
On macOS, the .Trash directory is opened and validated (O_DIRECTORY|O_NOFOLLOW), and an exclusive renameatx_np relative to the directory handle is used—no Finder/osascript or permission-request APIs. Parent path replacement cannot redirect the target; concurrent renames of the original directory may leave logs outside the held directory. Windows native move remains currently disabled: the official FOFX_RECYCLEONDELETE documentation does not clearly state how the source file is retained upon recycle failure; even if pre-checks pass, the operation is still rejected.
Use Cases & Cautions¶
- Users with long session histories and difficult sidebar navigation who need archive and restore mechanisms.
- Scenarios requiring local logs to be cleaned from DSH into the system trash.
- Cases requiring Markdown document extraction from archived conversations without modifying the source session.
Note: The plugin runs with the current DSH process permissions. It is recommended to review the source code and license before installation. The plugin is currently only compatible with DSH 0.2.2-rc.2 and rc.5, and the Windows system trash move feature remains disabled.
Summary¶
d-trash provides DeepSeek Harness with a complete session trash bin and system-level cleanup solution, supporting restore, queue retry, audit logging, and distill export. Without altering native archive and Pin behavior, it extends session management capabilities, making it suitable for developers who need to organize long-history sessions and safely clean up local logs in DSH.
- Plugin directory: https://www.skillhub.cn/plugins/HLhhh/d-trash
- GitHub repository: https://github.com/HLhhh/d-trash