Preface¶
After running agent tasks with DSH for a while, local sessions tend to accumulate: new and old sessions get mixed together in the list, making it hard to find the most recent conversation by scrolling down; and checking which sessions take up how much disk space requires manually looking through the record directory. These issues don’t involve the agent’s own capabilities but have a significant impact on daily usage.
The dsh-archived-sessions plugin introduced below addresses this: it adds an “Archived Sessions” entry in the DSH Web sidebar, tidies up old sessions, and provides capabilities for searching, batch operations, viewing details, and deleting local records.
What is it¶
dsh-archived-sessions is a DSH Web plugin by lwklbb, released under the MIT license, version 0.2.1 in package.json, with engines requiring Node >= 20.
It solves the problem of centrally managing archived and unarchived local sessions within DSH Web, supporting archiving, unarchiving, searching, batch operations, viewing details, opening record folders, and deleting local records. No page jumps are needed after installation; all operations are completed within the DSH Web interface.
Core Features¶
Sidebar Entry and Statistics¶
After installation, the DSH Web sidebar gains an “Archived Sessions” button, with the number of archived sessions displayed to the right. Clicking it opens the management panel in the middle area, with “Refresh” and “Close” options in the top right corner.
The panel has two tabs: “Archived Sessions” and “All Sessions”. The statistics area displays three things: the number of archived sessions, the number of unarchived sessions, and the disk space occupied by archived sessions.
List, Search, and Grouping¶
Each session in the list displays the title, record size, and last updated time. The search box supports filtering by title or session ID.
There are two views:
- Standard list view;
- Grouped by workspace (in the “All Sessions” page), sessions without a workspace belong to “Unassigned”.
Sub-agent sessions are indented under their parent sessions; if the parent session doesn’t exist, they are displayed as ordinary rows.
Batch Operations¶
Supports single selection, check all, and drag-to-select continuous items. In the “All Sessions” page, you can batch archive selected sessions; in the “Archived Sessions” page, you can batch unarchive selected sessions. It also supports batch deletion, with a confirmation box appearing before deletion.
Note the scale of batch operations: one request processes a maximum of 100 sessions, executed sequentially by the host.
Session Details¶
Clicking the arrow at the end of a row expands the details. The content includes:
- Disk usage and last update time of the record directory;
- Turns, Steps, User messages, Response messages, Tool calls, and attachment count;
- Tool usage statistics, such as
pwsh,grep,write,read; - Network fetch / download records;
- Files downloaded or produced;
- Parent session and child/fork relationships.
These statistics are very useful for judging “which old sessions can be cleaned up”: record size and activity are clear at a glance, eliminating the need to manually scroll through directories.
Opening Record Folder and Deleting Output Files¶
“Open Record Folder” invokes the system file manager to directly open the session’s record directory, making it convenient for manual backup or checking original records.
Output files in the details can be checked and deleted. When deleting, it checks two things: whether the file is in a registered workspace, and whether it belongs to the session’s output file list.
Deletion Rules¶
Deletion has clear protection boundaries:
- The currently opened session cannot be deleted.
- Running sessions cannot be deleted.
- Deletion is non-cascading: only the selected session records are deleted, and sub-agents, fork sessions, or output files are not deleted along with them.
- When deleting an invalid archived item, invalid IDs in the archive list are cleaned up.
Non-cascading means that to thoroughly clean a group of sessions, you need to select them individually before deleting; this step will not “inadvertently harm” related records.
Local Interfaces¶
The plugin host uses the /archived/api/* local interfaces, accepting only local origin POST requests. Archiving, unarchiving, deleting, opening folders, and other operations are all completed within the local DSH Web process, involving no external services.
Installation and Enablement¶
First, confirm that the local Node version meets Node >= 20, then execute the following command to install the plugin:
dsh plugin --profile web add https://codeload.github.com/lwklbb/dsh-archived-sessions/tar.gz/refs/heads/main
If pnpm intercepts build scripts, you can add --ignore-scripts:
dsh plugin --profile web add https://codeload.github.com/lwklbb/dsh-archived-sessions/tar.gz/refs/heads/main --ignore-scripts
For local development and debugging, install within the project directory:
dsh plugin --profile web add . --ignore-scripts
After installation, restart DSH Web, and you will see the “Archived Sessions” entry in the sidebar.
Typical Usage¶
After completing the steps above, the plugin is ready. The daily usage flow is as follows:
- Open “Archived Sessions” in the sidebar.
- Search and check the old sessions you want to hide in “All Sessions”, then click “Archive”.
- View archived content in “Archived Sessions”; click “Unarchive” to restore when needed.
- Expand a session to view record size, activity statistics, tool usage, and output files.
- Determine which sessions are no longer needed, check them, and delete.
Applicable Scenarios and Notes¶
This plugin is suitable for two types of users:
- Users who use DSH long-term, with a noticeable growth in local sessions, and want to tuck away old sessions without losing records;
- Users concerned about disk usage, who want to clearly see the record size, tool calls, and output files of each session, and decide whether to clean up.
A few points to note before use:
- The plugin runs with the permissions of the current dsh process; the host can read session records and disk status, and invoke the system file manager. It is recommended to check the repository source code and license before installing.
- Batch operations process a maximum of 100 sessions per request; extremely large cleaning tasks need to be performed in batches.
- Deletion is non-cascading; sub-agents, fork sessions, and output files will not be deleted along with the selected sessions; conversely, when trying to thoroughly clean, you must select them individually.
- Deletion operations have confirmation boxes, and currently opened and running sessions are protected, but it is still recommended to archive uncertain sessions first rather than deleting them directly.
Ending¶
dsh-archived-sessions is not complicated: it adds a layer of management capability for session archiving to DSH Web, with archiving, restoring, statistics, and deletion all completed locally. For users with many accumulated sessions, this is a small plugin that directly improves the user experience, and aligns with DSH’s “everything is a plugin” design philosophy.
DSH Plugins Directory Page: https://www.skillhub.cn/plugins/lwklbb/dsh-archived-sessions
GitHub Repository: https://github.com/lwklbb/dsh-archived-sessions