dsh-session-files: Per-Session File Lineage Tracing and Reversible Cleanup

Preface

When running Agents in DSH (DeepSeek Harness), the working directory is often piled high with probe scripts, debug logs, intermediate screenshots, and backup files. These contents rarely go into git but are mixed in the same layer as final deliverables; just looking at the folder, it is hard to answer “who generated it in which round”, “which are temporary artifacts”, or “if you deleted by mistake, can you recover it”. dsh-session-files (maintainer Xzl21) aggregates session-level file activity into a timeline tree, four lifecycle categories, and a cleanup process with dryRun and a recycle bin, targeting developers who collaborate with Agents in a local workspace for a long time.

What is this

dsh-session-files is a DSH plugin (half Host + half Web Client, pure ESM, no external dependencies). It maintains a file lineage manifest for each session: which paths have been read, written, generated, or deleted, expanded round by round from left to right, and categorized by Deliverables / Process / Input / Temporary. Temporary files can be moved to the plugin’s recycle bin with one click instead of being deleted directly from the disk. The community directory classification is admin-security, current version 0.1.4, license MIT. The number of stars on GitHub is 0 (based on the directory page display).

Core Features

Timeline Tree and Four Categories

  • Columns: Input (files existing before the session started) → Each dialogue round → Deliverables (final artifact list).
  • Rows: Four tracks: Deliverables / Process / Input / Temporary.
  • By default, files are automatically classified based on rules like extension, directory name, whether pre-existing, etc.; any entry can be manually overridden by writing to $DSH_HOME/session-files/overrides/<sessionId>.json and persisting.

Cards and Preview

Each card displays the action (read / write / edit / exec / present / delete), size, round, determination reason (e.g., temp-ext, one-day-script), notes, and badges such as Deleted / Final / Manual. Clicking a card opens a preview drawer on the right (text/binary determination), allows changing the classification, or writing notes. Lines between cards indicate relationships like derivation, delivery (present), and source (read/referenced).

Unexpanded and Cleanup Scope

The tree only draws files touched by the current session; historical files scanned but not touched are summarized as “There are N other unexpanded items”, and this part is overwritten when cleaning temporary files (example in README: dryRun may display a large number of temporary items not in the tree).

One-Click Cleanup and Recycle Bin

  1. Click “Clean” → First dryRun shows the authoritative count, confirmation is required before execution.
  2. Files are moved to $DSH_HOME/session-files/trash/<sessionId>/<epochMs>/<relative-path>, not deleted directly.
  3. Directories like .git, node_modules, .venv are skipped entirely; symbolic links are not followed.
  4. The recycle bin panel lists time, source session, file count, and volume in batches; supports restoring a batch (copy back to workspace, skip if same name exists, original remains in trash) and deleting a batch (the only truly disk-deleting operation inside the plugin, requires secondary confirmation).
  5. Auto-cleanup (default off): Select 7 / 30 / 90 days; expired batches are permanently deleted when the plugin starts, the recycle bin is opened, or settings are changed; if off, batches in the recycle bin can be kept indefinitely.

Agent-Side Tools

The Host registers a session_files tool (list / classify / cleanup) and injects 4 lines starting with [session-files] into the system prompt, making it easy for the Agent to list items, change classifications, or dryRun before cleaning when wrapping up tasks. See docs/USAGE.md in the repo for detailed parameters.

UI and Others

A “File Tree” icon is provided on the right side of the Composer input box (requires page refresh after installation); the full-screen canvas displays the tree, and Esc exits layer by layer. The theme color uses --dsw-alias-* tokens, supporting dark/light modes.

Installation and Enablement

Requirements: DSH Desktop (with Web GUI), capable of opening the plugin manager. After placing the repo in any local path, ask the Agent in the session to execute (where plugin_manager is a built-in DSH tool):

plugin_manager action=install_bundle target=<本仓库绝对路径>

Some DSH versions support CLI equivalent commands:

dsh plugin install <path>

Successful installation should satisfy all three:

  1. The 4 lines starting with [session-files] appear in the system prompt;
  2. session_files appears in the tools table;
  3. include:session-files appears in the plugin list with status active.

After installation, refresh the page (F5); the tree icon should appear on the right side of the input box. If the Host-side code was modified, you need to restart the DSH process (Node ESM caches loaded modules); the Client-side updates with page refresh or HMR.

Typical Usage

Operating in the UI

  1. Click the “File Tree” icon to open the full-screen canvas.
  2. Read the top status: distinguish file-level statistics (total workspace scan count and four-category counts) from visual graph node count; when they are not equal, the difference is mostly the “unexpanded” part.
  3. Click a card to change classification or notes.
  4. Click “Clean” → Confirm dryRun count → Temporary files go to the recycle bin.
  5. Click the “Recycle Bin” in the top right to restore or delete a batch, or configure auto-cleanup days in settings.

Letting the Agent Wrap Up (Optional)

session_files { action: "list" }
session_files { action: "classify", paths: ["_probe.py"], cls: "temp" }
session_files { action: "cleanup", dryRun: true }
session_files { action: "cleanup" }

When you don’t want to enter the UI, you can operate the directories under $DSH_HOME/session-files/trash/ directly as described in the README: restore by copying the original relative path; delete the batch directory for thorough cleanup.

Suitable Scenarios and Notes

Suitable for: DSH users who have multi-round conversations in the same workspace and leave behind many temporary scripts and process artifacts; scenarios where you need to distinguish deliverables from trash but also want the cleanup to be reversible.

Known Limitations (from official README):

  • UI rendering in a real browser has not been fully verified in the author’s development environment; style issues can be reported via issue.
  • For files deleted using only shell commands, exists might be inaccurate.
  • The recycle bin is not automatically emptied by default; if it occupies disk space, enable auto-cleanup or manually delete batches.
  • Only tracks paths related to sessions and the workspace; reading/writing outside the workspace will come with an outside-workspace warning.

Security and Trust: The plugin reads and writes workspace and $DSH_HOME data with the current DSH process permissions; please review the GitHub source code and the MIT license yourself before installing. The DSH ecosystem emphasizes “everything is a plugin”; the SkillHub directory page is a community site and has no official affiliation with DeepSeek / HF.

Ending

dsh-session-files compresses “no lineage, no lifecycle, fear of cleaning” into: a tree expanded by rounds + four categories + dryRun confirmation + recycle bin. If you are already using DSH Desktop, you can get the repo from the directory page or GitHub, install it with install_bundle, and open the file tree in the current session to try it out.

  • Directory page: https://www.skillhub.cn/plugins/Xzl21/dsh-session-files
  • Repository: https://github.com/Xzl21/dsh-session-files
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye