Introduction¶
Running agents in DeepSeek Harness (DSH) leaves two types of footprints: conversation records in the sidebar, and scripts, reports, and generated files in the workspace. Closing a conversation or deleting a session row often only removes the record itself; DSH does not maintain an index of “which files were created by this session” by default, and manually digging through directories is slow and prone to accidental deletions.
The community plugin dsh-session-artifacts (maintained by ShirohaChan, category admin-security) reverse-engineers an artifact manifest from persistent session logs. It displays a complete list and total size before deletion, allowing you to select items for removal. Below is an introduction to its positioning, capabilities, and installation usage.
What is this¶
dsh-session-artifacts is a DSH npm plugin package (current version 0.7.2, MIT license). Its core value is: optionally delete session records, and optionally delete the artifacts left by that session in the workspace. By default, it does not assume you want to delete artifacts; the entire process involves previewing and item-by-item review.
It is unrelated to the /plugins/dsh-session-delete route in dsh-chat-manager and handles session storage deletion independently. Therefore, it still works when chat-manager is not installed or disabled.
- Directory Page: skillhub.cn/plugins/ShirohaChan/dsh-session-artifacts
- Source Code: github.com/ShirohaChan/dsh-session-artifacts
Core Features¶
Three Combinations in the Dialog Box¶
The session ⋯ menu provides Delete Session & Artifacts…. The dialog box uses two checkboxes to combine actual behaviors:
- Delete Artifacts Only, Keep Conversation — Clean up leftover files while keeping the session and logs untouched.
- Delete Session Records — Optionally check to also delete the previewed artifacts.
- Default: The “delete artifacts” item is unchecked to avoid accidental operations.
After confirmation, if “delete records” is checked, it will first remove the session storage and then delete the previewed files. If any file deletion fails, you can use Retry Undeleted Files, which only retries the failed paths and does not re-execute the entire preview.
When deleting artifacts only, the Host uses a one-time nonce to store the preview list (valid for about 10 minutes), requiring no modification to the session logs.
How Artifacts are Attributed from Logs¶
Attribution uses the session JSONL log as the sole authoritative source. The rule summary is as follows:
| Evidence | Deletable |
|---|---|
write with meta.operation: "create" |
Yes |
| Shell command time window + file creation time (must be unique) | Yes (listed as Command Line / Shell) |
present, update, edit |
No (Reported or ignored only) |
present implies delivery rather than creation and is not included in the deletable list by default; setting includeDelivered: true changes this to a more aggressive behavior. When shell output has no meta record, the plugin infers using the command start/end time window and the file’s birthtime; the window must be tight and unique under concurrent sessions. If sibling sessions cannot be enumerated, it fails closed and explains in the dialog box.
Safe Demolition When Deleting Session Records¶
The persistence layer does not provide a deletion API, so the plugin deletes files itself according to a fixed layout:
<sessionRoot>/<project>/<sessionId>/session[.vN].jsonl[.zstd]
The path is resolved via resolveCurrentLog, validating the three-segment structure, prohibiting symbolic links, and preventing directory traversal. It adopts a two-step isolation process: “rename to temp directory → re-validate → delete”; failures will be restored.
If the session is still in the host registry, it must first cancel running turns and dispose of the Agent via the self-maintained AgentHandle tracker. Storage deletion occurs only after the registry is cleared. For Agents existing before the plugin was loaded, record deletion is refused if there is no handle, prompting a DSH restart; artifact deletion remains available.
Security Fences (Excerpts)¶
- Only proposes files within the session record’s working directory; paths under
~/.dshare never treated as artifacts. - Protects DSH package directories (including
SKILL.md,cordis.yml, etc.) by default;protectPackages: falsecan disable this. - The client does not submit paths directly; the deletion set is bound to the Host’s nonce. Retries pin the device + inode to prevent path replacement.
Installation and Activation¶
Replace <profile> with the name of the DSH profile you are using. The installation commands come from the project’s Chinese README:
dsh plugin --profile <profile> add dsh-session-artifacts
Install from a local directory:
dsh plugin --profile <profile> add <path-to-this-directory>
Restart DSH after installation so that the Host and Client can complete the composition loading.
Uninstallation:
dsh plugin --profile <profile> remove dsh-session-artifacts
Uninstallation only removes the plugin itself and does not automatically delete any sessions or files.
Dependency highlights: Per-session JSONL persistence (sessionPersistence), agents registry provided by @deepseek-ai/dsh-agent (handle tracker must be installed before Agent creation), and DSH core 0.2.x session menu and overlay slots. The sessions service is used to stop running turns if present.
Typical Usage¶
- Open the ⋯ menu of the target session in the sidebar and select Delete Session & Artifacts….
- Review the file list and total size; entries marked as “delivery only” or “update only” are displayed distinctly according to rules.
- Check “Delete Artifacts” and/or “Delete Session Records”; at least one must be checked.
- Confirm execution; use Retry Undeleted Files for failed items if necessary.
Optional Configuration (all in plugin config, all fields optional):
| Field | Default | Meaning |
|---|---|---|
deleteSession |
true |
When false, hides record deletion, only artifact flow |
includeShell |
true |
Whether to run shell time window attribution |
shellSlackMs |
5000 |
Clock slack on both sides of the command window (ms) |
protectPackages |
true |
Protect DSH package directories within the workspace |
includeDelivered |
false |
Whether to include files with only present as deletable |
lifecycleTimeoutMs |
20000 |
Timeout for waiting for the session to leave the active registry |
Applicable Scenarios and Notes¶
Suitable for scenarios requiring regular cleanup of leftover scripts and reports from experimental sessions, or archiving and deleting session logs along with files. Shell attribution depends on the filesystem birthtime; on filesystems that do not record real creation times, the shell attribution path may be empty. Deleting a parent session does not automatically clean up artifacts from sub-agent sessions; the preview is a snapshot, and files created after confirmation are not in the list.
The plugin reads and writes to the workspace and session storage with the permissions of the current DSH process. Deletion is an ordinary unlink and does not involve secure erasure or cloud backups. It is recommended to read the source code and the MIT license before installation to ensure the fence policies match your environment. The community directory SkillHub is maintained by the ecosystem and has no official affiliation with DeepSeek / High-Flyer.
Conclusion¶
dsh-session-artifacts reconstructs the artifact list from session logs, deletes them only after selection and preview, and handles session record demolition in a self-contained manner. For further details on version changes and testing notes, please refer to the repository’s README and CHANGELOG.