dsh-janitor: Providing Auditable Workspace Cleanup Plans for DeepSeek Harness

Preface

When running agent sessions in DeepSeek Harness (DSH), “session debris” such as planning documents, temporary scripts, and one-off fixtures often accumulates in the workspace. If cleanup is delegated to another agent, the rules and rationale are often opaque, making it difficult for humans to verify item by item. While existing community plugins focus on snapshots and rollbacks (e.g., @goodandready/dsh-time-machine answers “can it be undone”), a deterministic solution for the chain of “which files can be deleted under specific rules and what is the basis” is still missing in the described DSH ecosystem. Here, we introduce dsh-janitor, released by maintainer zhengqiuyang: it scans the workspace using deterministic rules to output a reviewable cleanup plan, and the janitor itself is not an agent.

What is this

dsh-janitor is a workflow-type plugin for DSH (Community Directory: zhengqiuyang/dsh-janitor). It registers the janitor_scan tool with the Harness, runs the agent-janitor engine on the workspace, and returns a reviewable cleanup plan: each candidate file carries a deterministic verdict under a fixed order, along with evidence supporting that conclusion (citation analysis, git metadata, age thresholds, etc.). The current 0.1.0 version does not delete any files; whether to execute deletions after review is decided by the upstream CLI or the developer.

The plugin belongs to the same capability line as read-guard, pr-gate, attest, and mcp-test: janitor manages what is left in the workspace after the session ends.

Core Functionality

janitor_scan and the “Non-Agent” Principle

Scanning and verdicts are entirely handled by deterministic rules, without introducing agent judgment. The README explicitly states: v0.1 only performs scanning and planning, not automatic deletion.

Verdict Types (Fixed order, first match takes precedence)

verdict Meaning
protected Exact file or directory prefix found in the protected list
keep Referenced by any code file
recent File age is less than minAgeDays (git commit time is prioritized)
needs-review Referenced by documentation etc., or the situation is ambiguous
safe-to-remove A plan related to a merged task with no references, or no references and sufficiently old

Relationship with time-machine

The materials compare the two: dsh-time-machine handles checkpointing and rollback (snapshot safety); dsh-janitor answers “what can be safely removed.” The two are complementary. The recommended workflow is: Deterministic Scan → Manual Plan Review → Apply using your own method, without handing over cleanup decisions to an agent in the middle.

Installation and Enablement

Before installing, please review the GitHub Repository source code and the MIT license yourself. The plugin accesses the workspace with the permissions of the current DSH process; you should confirm if this complies with your security policy before installing and enabling it.

The installation method provided by the official README is as follows (npm distribution, no build required, no allowBuilds authorization needed; the repository includes pre-built lib/):

dsh plugin --profile default add dsh-janitor

Compatibility Notes (from the original text): Verified on DSH 0.2.x line (source snapshot 0.2.1-alpha.2); Node >= 20 (CI matrix includes Node 20/22/24, Ubuntu and Windows). In disposable-profile testing, logs such as [dsh-janitor] active: … appear during boot after installation.

Configuration

Add a dsh-janitor entry in the profile plugin configuration, for example:

- id: dsh-janitor
  name: dsh-janitor
  config:
    minAgeDays: 14
    protectedPaths: ["plans", "docs/decisions"]   # exact file or directory prefix
  • minAgeDays: Age threshold (in days) related to recent / old file determination.
  • protectedPaths: Exact file path or directory prefix; if matched, the verdict is protected.

Typical Usage

The reproducible path in the materials is understood in three steps, rather than “one-click empty”:

  1. In a DSH session with the plugin enabled, call janitor_scan via the tools exposed by the Harness (specific calling methods depend on the profile and Cordis tool registration you are using).
  2. Read the returned plan: the verdict and evidence for each candidate path, understanding the priority according to the table above.
  3. 0.1 does not execute deletions; after review approval, remove safe-to-remove items via the upstream CLI or your local scripts/manual methods (the roadmap mentions that the future janitor_apply will remain deterministic, require explicit per-path confirmation, and still not be an agent verdict).

Developers testing the engine within the repository can run:

npm install
npm test   # syncs the vendored agent-janitor engine, builds, runs fixture tests

The scanning/verdict core comes from the sibling project agent-janitor, vendored into this repository via npm run sync.

Use Cases and Considerations

Who it is for: Teams or individuals who run agents in DSH long-term, accumulate plan/scratch files in the workspace, and want cleanup rationale to be auditable and reviewable item by item.

Notes:

  • Verdicts are rule-based; ambiguous files fall into needs-review and cannot replace human judgment.
  • When overlapping with official or third-party “workspace hygiene” capabilities, the maintainer has written kill criteria in the README: if DSH official or similar plugins provide deterministic removal planning, this plugin may freeze at the last available version; the engine is still maintained by the agent-janitor project.
  • The community plugin directory SkillHub is an independent site and has no official affiliation with DeepSeek / High-Flyer; stars and versions are subject to the repository (current package 0.1.0, GitHub stars 0).

Conclusion

dsh-janitor turns “session debris” into a reviewable deterministic cleanup plan, deliberately keeping deletion authority outside of the scan. To install or read the full instructions, see the community directory page and GitHub:

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

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

Xiaoye