How much disk dsh uses, and what is safe to delete
The dsh program itself is small; the space goes to caches, per-profile dependency trees, and the second install you forgot about. Measure each location before deciding what to delete.
Measure dsh space before deleting
Deleting without numbers usually takes sessions and credentials with it.
- List every possible location;
- Measure each one;
- Label each as deletable, rebuildable, or untouchable;
- Delete from the safest class first;
- Re-test startup after each deletion.
Use one ruler for all of them. Run du -sh <path> everywhere so units are comparable and the biggest consumer is obvious.
Where dsh space goes and how to measure it
Five locations cover almost everything.
| Location | How to find it | Typical size |
|---|---|---|
| npx cache | The _npx directory under the npm cache | Medium, grows per version |
| npm download cache | npm config get cache | Large, shared by all packages |
| Global node_modules | npm root -g | Medium |
| Profile dependency trees | $DSH_HOME/profiles/*/node_modules | Large, scales with profiles |
| Desktop runtime | The OS application directory | Large, separate from the CLI |
Desktop and CLI are two separate footprints. If both exist, you have two runtimes on disk; do not count them as one install.
Locations mean nothing without numbers. Run these in order and write the numbers down:
npm config get cachefor the cache root, thendu -shon it;du -shon the_npxsubdirectory;du -sh "$(npm root -g)";du -sh "${DSH_HOME:-$HOME/.dsh}";du -sh "${DSH_HOME:-$HOME/.dsh}"/profiles/*.
The last line is the one to watch. Each profile keeps an independent dependency tree, so three or four profiles often outweigh everything else.
Deletable dsh space and the safe cleanup order
The criterion is not size but recoverability.
| Content | Deletable | Effect |
|---|---|---|
| npx cache | Yes | Next npx run downloads again |
| npm download cache | Yes | Slower re-downloads |
| Old global install | Yes | Confirm PATH afterwards |
| Log directory | Yes | Startup diagnostics history is lost |
| One profile's dependencies | With care | That profile must be rebuilt |
| Sessions and credentials | No | History and login state are lost |
The last row is the red line. Clearing logs is fine, rebuilding a profile is fine, deleting DSH_HOME as if it were a cache is not.
Once the boundary is clear, order does the rest. From "re-downloadable" to "unrecoverable":
- Clear the npx runtime copies;
- Run
npm cache verify, then clean if still needed; - Remove old startup diagnosis logs, keeping the most recent;
- Uninstall global packages you no longer use;
- Remove dependency directories of abandoned profiles.
Start once after each step. The first start after a cache clean is slower by design; that is refilling, not breakage.
Prefer npm cache verify over a forced wipe. It validates integrity and reclaims unused entries, which is enough in most cases.
Duplicate dsh installs and verifying the cleanup
Duplicates usually come from different install methods, not repeated installs.
which -a dshlists every executable path;- Run
<path> --versionfor each; - Compare with
npm root -gto identify global installs; - Check other Node versions' prefixes for a third copy;
- Keep the one you actually use and uninstall the rest.
Uninstall instead of deleting files. Manually removing a directory leaves stale bin links that report "command exists but fails".
Keep exactly one primary install. For a temporary different version, use npx with a pinned version rather than a permanent second global install.
Then verify the result. The standard is "what should be there is there, and the numbers dropped":
dsh --versionstill prints;dsh webstarts and the page opens;- Historical sessions still list;
- A model call succeeds, proving credentials survived;
- Measure total size again and compare with the earlier number; without that comparison you cannot tell whether cleanup worked or merely moved things.
Keeping dsh usage under control
Prevent growth rather than scheduling spring cleanings: one primary install, one profile per purpose with unused ones deleted, logs kept by age, and a cache clean after upgrades. The most overlooked variable is profile count — every extra profile adds a full dependency tree.
dsh next steps
Measure, delete, then re-test. To avoid duplicates during a move, read migrating an old install. For recovery after a bad install, read rolling back a dsh install. For the smallest setup, read minimal dsh install. For a custom data directory, read custom DSH_HOME.
Sources: dsh CLI README, npm docs: npm cache, DeepSeek Harness docs
FAQ
No, your dsh install keeps working: a global install is unaffected, and the next npx run simply downloads again. The npx cache exists to speed up repeated runs, so the worst case is a slower first start, and DSH_HOME is not touched.
Deleting the whole dsh data directory is not advisable, because besides plugin dependencies it holds sessions, credentials, and settings, so deleting it clears history and login state together. To reduce size, delete logs or rebuild one profile rather than the root.
dsh --version only reports the copy your PATH resolves, so other copies can still sit in the npx cache, an old global directory, or another Node version's prefix. Compare which -a dsh with npm root -g to see what is really on disk.
No, you do not need to restore the cache for dsh: the first run refills it and later runs return to normal. If slowness persists, the cause is network or mirror configuration rather than the cleared cache.
Related Terms
- npx cache
- The npx cache is a local copy of packages npx has executed, kept under the npm cache directory to avoid repeated downloads.— npm docs
- global node_modules
- The global node_modules is npm's system-level dependency tree, whose path `npm root -g` reports and from which the dsh command usually resolves.— npm docs
- profile dependency tree
- A profile dependency tree is the plugin dependency set inside one profile at $DSH_HOME/profiles/<name>/node_modules, never shared between profiles.— dsh CLI README
- DSH_HOME
- DSH_HOME is the data root for DeepSeek Harness, defaulting to ~/.dsh, holding profiles, settings, sessions, logs, and credentials.— DeepSeek Harness docs
Sources
- dsh CLI README· deepseek-ai
- npm docs: npm cache· npm
- DeepSeek Harness docs· deepseek-harness