nuwa-skill
alchaincyf
你想蒸馏的下一个员工,何必是同事。蒸馏任何人的思维方式——心智模型、决策启发式、表达DNA。Distill how anyone thinks.
ShirohaChan/dsh-session-artifacts
Delete a DSH session together with the workspace artifacts that session produced - the file list is reconstructed from the session log and previewed with its total size. The artifacts can also be deleted on their own, keeping the conversation.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:ShirohaChan/dsh-session-artifacts
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
This package is built by DeepSeek-v4.1 flash!
English · 中文
Clean up what a session left in your workspace — and, when you want it, delete the session record too. Opt-in, previewed, and verified before anything is removed.
A session's scripts, reports and generated files stay behind after the conversation is gone. Nothing in DSH records which files those were, so this plugin reconstructs that from the session log and shows you the exact list — with the total size — before anything is deleted.
Three things it can do, chosen by two checkboxes in one dialog:
It is self-contained: it removes the session record itself and does not call
dsh-chat-manager's /plugins/dsh-session-delete route, so it keeps working
when that plugin is disabled or absent.
The artifacts-only mode needs no session deletion at all: the Host holds the previewed list behind a nonce, so the files are removable while the session and its log stay exactly where they are.
The persistence seam deliberately has no deletion API — its own contract states that logs accumulate under the session root until removed externally. So this plugin performs the removal itself, against the fixed layout:
<sessionRoot>/<project>/<sessionId>/session[.vN].jsonl[.zstd]
The location is resolved through the persistence backend
(resolveCurrentLog), then every component is re-checked before anything is
touched:
An open session is live in the host registries even when nothing is running
in it, so its log writer is still attached and its row would reappear in the
sidebar. It has to be torn down before its storage can go — and the registry
exposes no dispose.
The only supported teardown is the AgentHandle returned to whoever created
the Agent, so this plugin keeps its own handle tracker: it observes Agent
creation on the shared agents service and retains each handle. Deletion then:
The tracker is this plugin's own rather than another plugin's, so the capability does not go away when that plugin does.
One case cannot be handled: an Agent that was already live before the plugin loaded has no captured handle (the handle was only ever given to its creator). That deletion is refused with a message telling you to restart DSH — after a restart the plugin sees every Agent from the start. It is refused rather than deleted underneath its writer, because reporting a deletion that did not happen is worse than not deleting.
The durable session log is the only authoritative record of what a session touched, so attribution is read from it:
| Evidence | Meaning | Deletable |
|---|---|---|
write result with meta.operation: "create" |
the session materialized the file | yes |
| shell command window + file creation time | the file was created while a command ran | yes, if unique |
present call |
the session delivered the file | no (reported only) |
write result with meta.operation: "update" |
the session rewrote a file that already existed | no |
edit call |
the session only rewrote an existing file | no |
Rewriting a file you already owned never makes it disposable, so update and
edit results are reported but never offered. A failed tool call
(FS_SANDBOX_DENIED, FS_NOT_OBSERVED, FS_STALE_VERSION, …) contributes
nothing, because the tool never materialized anything.
present is delivery, not authorship: a session asked to hand you a paper
you already had would otherwise make that paper deletable. Delivered-only files
are counted in the dialog and left alone. Set includeDelivered: true to opt
into the older, more aggressive behavior.
File-tool writes are recorded explicitly. Shell commands are not: a pwsh call
records only its command text, and its tool/result carries no meta at all,
so nothing durable names the files a python foo.py run produced. In practice
this is the dominant source of leftovers — a session that writes twenty
scripts through the shell produces twenty artifacts that a file-tool-only
reader never sees.
The remaining evidence is creation time. On NTFS birthtime is a real
creation timestamp, distinct from mtime, and it survives later edits — so it
answers "was this file created while this command was running?". Pairing each
shell tool/call with its tool/result gives a tight window per command.
Three rules keep this safe:
Only creation is claimed. A file that merely changed during a window was not
produced by the session and is left alone. Inferred files are labelled
命令行 / shell in the list, since they rest on weaker evidence than a
recorded write.
~/.dsh is ever an artifact, whatever the
session's working directory is. The workspace fence alone is relative to
cwd, so a session opened at ~ or C:\ could otherwise reach the
installed plugins, the built skills, the profiles, and the credential store.
A genuine workspace nested inside the home (e.g. ~/.dsh/scratch) still owns
its own files, but cannot reach its neighbours.SKILL.md, cordis.patch.yml, cordis.yml, or a package.json with a
dsh/cordis block — is not offered, so a plugin or skill the session built
inside its own workspace survives. Set protectPackages: false to disable.report.md means the file the session actually wrote.All fields are optional; the defaults are the safe ones.
| Field | Default | Meaning |
|---|---|---|
dshHome |
derived | Overrides the DSH home used by the home fence. Otherwise DSH_HOME, otherwise the parent of a <home>/sessions store. |
extraExcludes |
[] |
Extra absolute paths that must never be offered. |
protectPackages |
true |
Refuse files inside a DSH plugin/skill package. |
includeDelivered |
false |
Also offer files the session merely delivered. |
includeShell |
true |
Run the shell creation-window pass. |
shellSlackMs |
5000 |
Slack around a command window, absorbing the gap between the event clock and the filesystem clock. |
deleteSession |
true |
Whether the Host offers session-record deletion. false makes the plugin artifacts-only: the record checkbox is hidden and the flow never touches the log. |
lifecycleTimeoutMs |
20000 |
How long to wait for a stopped session to leave the live registries. |
sessionPersistence),
which every shipped composition mounts.agents), provided by @deepseek-ai/dsh-agent. It
is a declared dependency, because the handle tracker must be installed
before any Agent is created — a tracker installed later captures nothing.0.2.x for the session-menu and overlay slots it extends.No other plugin is required.
sessions is used when present, to stop a running turn before teardown.
birthtime. On a filesystem that does not record
a true creation time, the shell pass finds nothing rather than guessing.agents service, so it only sees
Agents created through it. A composition that creates Agents some other way
behaves like the pre-existing case above.dsh plugin --profile <profile> add dsh-session-artifacts
Or from a checkout:
dsh plugin --profile <profile> add <path-to-this-directory>
Then restart DSH for the Host and client halves to compose.
dsh plugin --profile <profile> remove dsh-session-artifacts
Uninstalling removes only this plugin. It never deletes sessions or artifacts on its own.
npm test
The suites cover attribution rules, the shell creation-window pass (including
the fail-closed path and the two-session ambiguity rule), the workspace / DSH
home / package fences, cross-drive paths, symlink escapes, identity
re-verification, relative-path resolution, empty-directory pruning, nonce
single-use, the retry nonce, the request fence, and the real apply() wiring
end to end.
MIT
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: session。