dsh-plugin-tool-management 0.22.5 → 0.22.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/CHANGELOG.md +1624 -1415
  2. package/README.md +194 -177
  3. package/README_EN.md +194 -177
  4. package/docs/ARCHITECTURE.md +137 -134
  5. package/docs/COMPATIBILITY.md +12 -7
  6. package/docs/TROUBLESHOOTING.md +287 -285
  7. package/lib/client.js +14975 -12277
  8. package/lib/compat/capability-specs.js +66 -16
  9. package/lib/compat/host-contracts.js +11 -2
  10. package/lib/compat/host-roots.js +1 -1
  11. package/lib/compat/manual-review.js +1 -1
  12. package/lib/compat/preset-reach.js +1 -1
  13. package/lib/compat/probe.js +96 -11
  14. package/lib/confirm-gate.js +40 -6
  15. package/lib/context-inject-contract.js +31 -14
  16. package/lib/context-inject-delta.js +146 -0
  17. package/lib/context-inject-frame.js +38 -19
  18. package/lib/context-inject-select.js +33 -4
  19. package/lib/context-inject-surface.js +30 -10
  20. package/lib/context-inject.js +106 -14
  21. package/lib/evolution/cold.js +389 -0
  22. package/lib/evolution/config.js +507 -0
  23. package/lib/evolution/digest.js +48 -0
  24. package/lib/evolution/episodes.js +287 -0
  25. package/lib/evolution/evidence.js +167 -0
  26. package/lib/evolution/gates.js +874 -0
  27. package/lib/evolution/limits.js +21 -0
  28. package/lib/evolution/maintenance.js +516 -0
  29. package/lib/evolution/notes.js +328 -0
  30. package/lib/evolution/organize.js +118 -0
  31. package/lib/evolution/review.js +524 -0
  32. package/lib/evolution/route.js +91 -0
  33. package/lib/evolution/runtime.js +179 -0
  34. package/lib/evolution/scope-card.js +144 -0
  35. package/lib/evolution/state.js +514 -0
  36. package/lib/evolution/write.js +1773 -0
  37. package/lib/index.js +1328 -58
  38. package/lib/legacy-tool-names.js +19 -4
  39. package/lib/mcp/tool-visibility.js +127 -10
  40. package/lib/memories/catalog.js +215 -0
  41. package/lib/memories/constants.js +115 -7
  42. package/lib/memories/discovery.js +59 -25
  43. package/lib/memories/projection.js +116 -31
  44. package/lib/memories/render-auto.js +198 -0
  45. package/lib/memories/search.js +3 -5
  46. package/lib/memories/service.js +158 -14
  47. package/lib/memories/snapshot.js +174 -23
  48. package/lib/op-registry.js +59 -0
  49. package/lib/ops/compat.js +2 -0
  50. package/lib/ops/evolution.js +887 -0
  51. package/lib/ops/memory.js +95 -72
  52. package/lib/ops/trash.js +14 -2
  53. package/lib/prompts/service.js +4 -1
  54. package/lib/scope/workspace-key.js +39 -0
  55. package/lib/settings-sidecars.js +2 -2
  56. package/lib/skills/official.js +180 -36
  57. package/lib/subagents/run-provider.js +35 -22
  58. package/lib/text-width.js +59 -0
  59. package/lib/tool-table-switch.js +104 -16
  60. package/lib/tools/control.js +45 -12
  61. package/lib/tools/deps.js +2 -2
  62. package/lib/tools/mcp.js +6 -4
  63. package/lib/tools/memory.js +1045 -267
  64. package/lib/tools/note-ref.js +20 -0
  65. package/lib/tools/remove.js +1 -1
  66. package/lib/tools/scene.js +3 -3
  67. package/lib/tools/table.js +76 -20
  68. package/package.json +155 -156
  69. package/docs/UPDATE.md +0 -50
package/README_EN.md CHANGED
@@ -1,177 +1,194 @@
1
- <p align="center">
2
- <img src="docs/images/banner-en.png" alt="Tool Management — one click swaps the entire environment" width="100%">
3
- </p>
4
-
5
- <p align="center">
6
- <a href="https://www.npmjs.com/package/dsh-plugin-tool-management"><img src="https://img.shields.io/npm/v/dsh-plugin-tool-management?logo=npm&color=cb3837&style=flat-square" alt="npm"></a>
7
- <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" alt="MIT"></a>
8
- <img src="https://img.shields.io/badge/DSH-0.2.2-4f7cf7?style=flat-square" alt="DSH 0.2.2">
9
- <a href="https://github.com/ouli-1242/dsh-plugin-tool-management"><img src="https://img.shields.io/badge/GitHub-ouli--1242-181717?logo=github&style=flat-square" alt="GitHub"></a>
10
- </p>
11
-
12
- <p align="center">
13
- <a href="https://dsh.market/"><img src="https://raw.githubusercontent.com/2BingLing/dsh-market/master/assets/readme/badge-listed-en.svg" height="20" alt="DSH Market"></a>
14
- <a href="https://awesome-dsh-plugin.com"><img src="https://img.shields.io/badge/awesome--dsh--plugin-listed-3fb950?style=flat-square" alt="awesome-dsh-plugin"></a>
15
- <a href="https://dshfind.com/en/plugins/ouli-1242/dsh-plugin-tool-management"><img src="https://dshfind.com/api/badge/ouli-1242/dsh-plugin-tool-management?lang=en" alt="dshfind"></a>
16
- <a href="https://github.com/0xsline/awesome-deepseek-harness"><img src="https://img.shields.io/badge/0xsline-listed-3fb950?style=flat-square" alt="0xsline"></a>
17
- </p>
18
-
19
- <p align="center">
20
- <a href="README.md">简体中文</a> · <b>English</b> · <a href="CHANGELOG.md">Changelog</a> · <a href="docs/UPDATE.md">Release overview</a>
21
- </p>
22
-
23
- MCP servers, skills, subagents, prompts, memories and archived sessions for DeepSeek Harness — all in one panel. Bundle them into a **scene**, swap the whole environment with one click, and roll back to the pre-entry snapshot when you leave.
24
-
25
- ```sh
26
- dsh plugin --profile web add dsh-plugin-tool-management@latest # web
27
- dsh plugin --profile desktop add dsh-plugin-tool-management@latest # desktop
28
- ```
29
-
30
- Hard-refresh the browser after installing for web (Cmd/Ctrl+Shift+R), or restart the desktop app — then open **Settings → Tools Management**. For desktop, open the app once and quit it completely before running the command. An older version usually means registry lag or pnpm's `minimumReleaseAge` — install an exact version (`@0.X.X`) instead.
31
-
32
- ---
33
-
34
- ## Highlights
35
-
36
- <table>
37
- <tr>
38
- <td width="33%" valign="top"><b>One-click scene switch</b><br>Each scene stores a full profile: MCP, skills, subagents, memories, quick prompts, a prompt preset and a model-tool table. Enter it and the whole stack switches; leave it and the pre-entry snapshot comes back.</td>
39
- <td width="33%" valign="top"><b>Control from the chat</b><br>Type <code>/</code> for a “Tools” section: enter or leave a scene, toggle any of the six domains. The menu stays open and leaves no command text in the composer.</td>
40
- <td width="34%" valign="top"><b>Three scopes</b><br>All global / per workspace / per conversation. By default every conversation has its own settings — two conversations in the same project can run two different environments at once.</td>
41
- </tr>
42
- <tr>
43
- <td valign="top"><b>The agent can drive it</b><br>24 model tools across six domains: list, read, create, update, delete, toggle, enter scenes, apply prompts, run personas. Writes ask for confirmation (except in a full-permission session, where the card is skipped and only a log line is written); disabled tools are not in the schema at all.</td>
44
- <td valign="top"><b>The Host page is a control center</b><br>Version and capability checks, access token, scope mode, per-domain injection switches, the model-tool table and the sidebar entry — all on one page.</td>
45
- <td valign="top"><b>One panel, eight tabs</b><br>Scenes / MCP / Skills / Subagents / Prompts / Memories / Sessions / Host — no more hunting through six different settings pages.</td>
46
- </tr>
47
- </table>
48
-
49
- ## Demo
50
-
51
- <video controls width="100%" src="https://github.com/user-attachments/assets/ff3111c3-4228-45b7-9e28-b85dc60fb6b3"></video>
52
-
53
- Player refuses to start (browsers with a stricter CSP sometimes block the inline embed)? [Watch the same file directly](https://github.com/user-attachments/assets/ff3111c3-4228-45b7-9e28-b85dc60fb6b3).
54
-
55
- Every interface shown is a real screenshot of the running product.
56
-
57
- Music: Kevin MacLeod「Limit 70」, [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
58
-
59
- ## Screenshots
60
-
61
- | | |
62
- |:----------------------------------------------------------------------------:|:------------------------------------------------------------------------------:|
63
- | <img src="docs/images/1-EN.png" alt="Scenes" width="100%"><br>**Scenes** | <img src="docs/images/2-EN.png" alt="MCP" width="100%"><br>**MCP** |
64
- | <img src="docs/images/3-EN.png" alt="Skills" width="100%"><br>**Skills** | <img src="docs/images/4-EN.png" alt="Subagents" width="100%"><br>**Subagents** |
65
- | <img src="docs/images/5-EN.png" alt="Prompts" width="100%"><br>**Prompts** | <img src="docs/images/6-EN.png" alt="Memories" width="100%"><br>**Memories** |
66
- | <img src="docs/images/7-EN.png" alt="Sessions" width="100%"><br>**Sessions** | <img src="docs/images/8-EN.png" alt="Host" width="100%"><br>**Host** |
67
-
68
- ## Three scopes
69
-
70
- Every conversation gets its own settings by default. Switch once on the **Host page → Scope**, and the whole panel plus every model tool follows that layer:
71
-
72
- | | All global | Per workspace | Per conversation (default) |
73
- |:------------------------ |:---------------------------------------------- |:------------------------------------------ |:------------------------------------------ |
74
- | **Who shares one set** | Every conversation | Conversations in the same workspace | Each conversation separately |
75
- | **Best for** | One person, one machine, consistent everywhere | One project, one environment | Parallel tasks in one project |
76
- | **Lost when switching?** | — | Nothing is deleted; switch back to restore | Nothing is deleted; switch back to restore |
77
-
78
- The selector at the top of the panel jumps to a specific conversation or workspace and shows its own copy; when that layer is locked, the unlock button sits on the same row. Within a layer, every switch resolves top-down: **this layer's edit > entered scene > creation snapshot > global**.
79
-
80
- Scenes work in all three scopes. Under per-conversation, conversation A can sit in “Coding” while B stays in “Writing”, each with its own MCP servers, skills and personas.
81
-
82
- ## What each tab does
83
-
84
- <table>
85
- <tr><th width="15%" align="left">Tab</th><th align="left">What it does</th></tr>
86
- <tr><td><b>Scenes</b></td><td>Save the whole environment as a profile; enter and leave with one click; lock it against edits; bind a prompt preset and a model-tool table; deleting it sends its memories to the recycle bin too.</td></tr>
87
- <tr><td><b>MCP</b></td><td>Add, edit and remove servers; toggle individual tools; write a note the model sees; inspect the last-known tool list while a server is stopped; import/export with automatic backups.</td></tr>
88
- <tr><td><b>Skills</b></td><td>Grouped by source; enable, remove, import, edit; same-name skills show which copy is in effect; external directories stay read-only.</td></tr>
89
- <tr><td><b>Subagents</b></td><td>One <code>.md</code> per persona; delegate work, limit tools, pick a model; only the result comes back, never into your History.</td></tr>
90
- <tr><td><b>Prompts</b></td><td>Multiple <code>AGENTS.md</code> baselines with one-click apply/undo and five generations of backups; quick prompts paste into the composer from <code>/</code>.</td></tr>
91
- <tr><td><b>Memories</b></td><td>A scene is the folder; <code>.md</code> bodies are injected automatically; import/export, recycle bin, injection budget.</td></tr>
92
- <tr><td><b>Sessions</b></td><td>Archived by project, searchable, batch restore; import Claude Code / Cursor / Codex transcripts; export Markdown / JSONL.</td></tr>
93
- <tr><td><b>Host</b></td><td>Version and capability checks, access token, scope mode, injection switches, model-tool table, sidebar entry, backup cleanup.</td></tr>
94
- </table>
95
-
96
- ## Let the agent drive it
97
-
98
- Six domains, **24 model tools**: list, read, create, update, delete, toggle, enter or leave a scene, apply a prompt, run a persona.
99
-
100
- - **Only 6 ship enabled** (~1.5k tokens/turn); the other 18 stay off. Off means **not in the schema at all** — the model cannot see them, let alone call them.
101
- - **Scoped writes**: the model writes to the current layer by default and the receipt says which one; `scope: "global"` is required to touch everything.
102
- - **Confirmation cards**: stopping servers, deleting, machine-wide toggles and similar writes ask first; recovery actions (restart, restore, undo apply) go straight through.
103
- - **Per-tool control**: the model-tool table on the Host page adjusts visibility per layer. All 24 on is ~6.1k tokens/turn; profiles can be saved per task and switched together with a scene.
104
- - **The model can switch tools back on**: the always-on `tool_manager_tools` lists the tools that are off in this conversation (name, purpose, ≈tokens) and turns them on as needed — when the user asks for a scene whose tools happen to be off, the model has a way forward instead of bouncing back to the user.
105
-
106
- ## The Host page
107
-
108
- More than a version number:
109
-
110
- - **Checks**: host version, the plugin build actually loaded this run, and whether each action is native / adapted / unavailable, with reasons. Items whose names can be checked but whose timing or rendering cannot are listed under “not automatically verifiable”. If an upgrade quietly breaks something, it shows up here; the “Re-check” button re-runs the probe in place.
111
- - **Upgrade diff**: per-package versions for cordis, the 11 peers and 15 runtime-only official packages against the verified baseline (out-of-range peers become blockers), plus canaries for event names, session-directory layout, patch dialect, MCP config keys and tool argument schemas, prompt section ordering, client UI slots and official skill assets.
112
- - **Access token**: set / disable / change / delete; writes and plaintext secrets go through it.
113
- - **Scope**: all global / per workspace / per conversation.
114
- - **Injection**: per-domain switches, minimal-preset fallback, catalog caps for skills / MCP / subagents (overflow folds into a one-line count; per-entry description length is configurable too), the two slash-menu entries, sidebar entry.
115
- - **Model tools**: per-tool visibility for all 26, saved per layer.
116
- - **Maintenance**: old-backup cleanup, feature overview, recent changes.
117
-
118
- <details>
119
- <summary><b>Where data lives · security boundaries</b></summary>
120
-
121
- | Content | Location |
122
- |:-------------------------------------------------------------- |:---------------------------------------------------------------------------- |
123
- | MCP definitions | `~/.dsh/cordis.patch.yml` (global) · `~/.dsh/profiles/<name>/cordis.patch.yml` (current profile) |
124
- | Skill policy / custom directories | `~/.dsh/tool-management/skills-state.json` |
125
- | Skills / memories / personas / presets | `~/.dsh/tool-management/{skills,memories,subagents,prompts}/` |
126
- | Memory index / scenes / profiles | `~/.dsh/tool-management/memories-index.json` |
127
- | Recycle bins (skills / memories / personas / presets / scenes) | `~/.dsh/tool-management/trash/<domain>-trash/` |
128
- | Archive ledger / retention | `~/.dsh/tool-management/history-*.json` |
129
- | MCP sidecars (disabled tools / known tools / notes / settings) | `~/.dsh/tool-management/mcp-*.json` |
130
- | Injection settings (six domain switches · catalog caps) | `~/.dsh/tool-management/inject-settings.json` |
131
- | Model-tool table / scope overrides | `~/.dsh/tool-management/tool-table.json` · `scope-overrides.json` |
132
- | Runtime log / patch backups | `~/.dsh/tool-management/tool-management.log` · `backups/` |
133
-
134
- - **Write scope**: skill sources are never touched; MCP changes go to the two patch files above (five backups each); applying a prompt overwrites the `~/.dsh/AGENTS.md` the host reads (the previous text is kept inside the hub); the desktop build clears `dsh-auth-*` cookies older than ten minutes at startup.
135
- - **Token**: once set, every write and every plaintext secret requires `x-dsh-token`; the UI stores it in browser localStorage bound to the current boot (a restart asks again), and plaintext still needs the token.
136
- - **Process-level boundary is the token**: writes normally sit behind the host's browser auth; when the host fence is absent the route falls back to a loopback-only check, which any local process can pass — only the access token gives you a process-level boundary.
137
- - **Plaintext on disk**: masking happens in the UI only. MCP `env` / `headers` and the plugin `token` stay plaintext in the patch file, and backups are not encrypted. The token gate cannot stop disk reads — file permissions are the boundary.
138
- - **Deletes are recoverable**: skills / memories / personas / presets / scenes go to the recycle bin (permanent session deletion excepted), with an optional retention period (keep forever by default).
139
-
140
- </details>
141
-
142
- ## FAQ
143
-
144
- | Symptom | Fix |
145
- |:--------------------------------------- |:-------------------------------------------------------------------------------------------------------------------------------------------------------- |
146
- | No panel after installing | Hard-refresh the browser; if that fails, restart DSH. |
147
- | The model cannot call a tool | Host page → “Model tools”, make sure the right conversation / workspace is selected (18 tools are off by default). The panel and scripts are unaffected. |
148
- | Actions unavailable after a DSH upgrade | Check the reason on the Host page; run `node scripts/doctor.mjs`, then `node scripts/host-deps.mjs --fix`. |
149
- | Version mismatch | Supports DSH **0.2.2** only (`>=0.2.2-rc.1 <0.2.3`); cross-generation upgrades wait for the plugin to catch up. Install 0.21.x for older hosts. |
150
- | Duplicate MCP tab | Remove the old loader line from `cordis.patch.yml` and restart. |
151
- | DSH won't start after a bad edit | Restore the newest `cordis.patch.yml.*.bak-*` from `~/.dsh/tool-management/backups/`. |
152
-
153
- Full troubleshooting guide: [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md).
154
-
155
- ## Docs
156
-
157
- | Doc | When to read it |
158
- |:-------------------------------------------------------------- |:--------------------------------------------------------------------------------------------------------- |
159
- | [Troubleshooting](docs/TROUBLESHOOTING.md) | Missing panel, duplicate tab, actions unavailable after an upgrade, broken sidecars |
160
- | [Architecture](docs/ARCHITECTURE.md) | How content reaches the model, why one toggle differs between conversations, which file a change lands in |
161
- | [Compatibility matrix](docs/COMPATIBILITY.md) | Capability matrix per DSH version (verified / untested / unavailable) |
162
- | [Changelog](CHANGELOG.md) · [Release overview](docs/UPDATE.md) | What changed in each version |
163
-
164
- ## Development
165
-
166
- ```bash
167
- npm install
168
- npm run build # tsc + sync client
169
- npm test # build + i18n + contract tests
170
- npm run doctor # host compatibility check
171
- ```
172
-
173
- `lib/` is not committed — run `npm run build` after cloning, and restart `dsh web` to pick up changes. Runtime dependencies are `fflate`, `js-yaml` and `semver` (static imports in the build; the plugin will not load without any of them); every `@deepseek-ai/*` package uses the host's copy.
174
-
175
- ## License
176
-
177
- MIT
1
+ <p align="center">
2
+ <img src="docs/images/banner-en.png" alt="Tool Management — one click swaps the entire environment" width="100%">
3
+ </p>
4
+
5
+ <p align="center">
6
+ <a href="https://www.npmjs.com/package/dsh-plugin-tool-management"><img src="https://img.shields.io/npm/v/dsh-plugin-tool-management?logo=npm&color=cb3837&style=flat-square" alt="npm"></a>
7
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" alt="MIT"></a>
8
+ <img src="https://img.shields.io/badge/DSH-0.2.2-4f7cf7?style=flat-square" alt="DSH 0.2.2">
9
+ <a href="https://github.com/ouli-1242/dsh-plugin-tool-management"><img src="https://img.shields.io/badge/GitHub-ouli--1242-181717?logo=github&style=flat-square" alt="GitHub"></a>
10
+ </p>
11
+
12
+ <p align="center">
13
+ <a href="https://dsh.market/"><img src="https://raw.githubusercontent.com/2BingLing/dsh-market/master/assets/readme/badge-listed-en.svg" height="20" alt="DSH Market"></a>
14
+ <a href="https://awesome-dsh-plugin.com"><img src="https://img.shields.io/badge/awesome--dsh--plugin-listed-3fb950?style=flat-square" alt="awesome-dsh-plugin"></a>
15
+ <a href="https://dshfind.com/en/plugins/ouli-1242/dsh-plugin-tool-management"><img src="https://dshfind.com/api/badge/ouli-1242/dsh-plugin-tool-management?lang=en" alt="dshfind"></a>
16
+ <a href="https://github.com/0xsline/awesome-deepseek-harness"><img src="https://img.shields.io/badge/0xsline-listed-3fb950?style=flat-square" alt="0xsline"></a>
17
+ </p>
18
+
19
+ <p align="center">
20
+ <a href="README.md">简体中文</a> · <b>English</b> · <a href="CHANGELOG.md">Changelog</a>
21
+ </p>
22
+
23
+ MCP servers, skills, subagents, prompts, memories and archived sessions for DeepSeek Harness — all in one panel. Bundle them into a **scene**, swap the whole environment with one click, and roll back to the pre-entry snapshot when you leave.
24
+
25
+ ```sh
26
+ dsh plugin --profile web add dsh-plugin-tool-management@latest # web
27
+ dsh plugin --profile desktop add dsh-plugin-tool-management@latest # desktop
28
+ ```
29
+
30
+ Hard-refresh the browser after installing for web (Cmd/Ctrl+Shift+R), or restart the desktop app — then open **Settings → Tools Management**. For desktop, open the app once and quit it completely before running the command. An older version usually means registry lag or pnpm's `minimumReleaseAge` — install an exact version (`@0.X.X`) instead.
31
+
32
+ ---
33
+
34
+ ## Highlights
35
+
36
+ <table>
37
+ <tr>
38
+ <td width="33%" valign="top"><b>One-click scene switch</b><br>Each scene stores a full profile: MCP, skills, subagents, memories, quick prompts, a prompt preset and a model-tool table. Enter it and the whole stack switches; leave it and the pre-entry snapshot comes back.</td>
39
+ <td width="33%" valign="top"><b>Control from the chat</b><br>Type <code>/</code> for a “Tools” section: enter or leave a scene, toggle any of the six domains. The menu stays open and leaves no command text in the composer.</td>
40
+ <td width="34%" valign="top"><b>Three scopes</b><br>All global / per workspace / per conversation. By default every conversation has its own settings — two conversations in the same project can run two different environments at once.</td>
41
+ </tr>
42
+ <tr>
43
+ <td valign="top"><b>The agent can drive it</b><br>23 model tools across six domains: list, read, create, update, delete, toggle, enter scenes, apply prompts, run personas. Writes ask for confirmation (except in a full-permission session, where the card is skipped and only a log line is written); disabled tools are not in the schema at all.</td>
44
+ <td valign="top"><b>The Host page is a control center</b><br>Version and capability checks, access token, scope mode, per-domain injection switches, the model-tool table and the sidebar entry — all on one page.</td>
45
+ <td valign="top"><b>One panel, eight tabs</b><br>Scenes / MCP / Skills / Subagents / Prompts / Memories / Sessions / Host — no more hunting through six different settings pages.</td>
46
+ </tr>
47
+ </table>
48
+
49
+ ## Demo
50
+
51
+ <video controls width="100%" src="https://github.com/user-attachments/assets/ff3111c3-4228-45b7-9e28-b85dc60fb6b3"></video>
52
+
53
+ Player refuses to start (browsers with a stricter CSP sometimes block the inline embed)? [Watch the same file directly](https://github.com/user-attachments/assets/ff3111c3-4228-45b7-9e28-b85dc60fb6b3).
54
+
55
+ Every interface shown is a real screenshot of the running product.
56
+
57
+ Music: Kevin MacLeod「Limit 70」, [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
58
+
59
+ ## Screenshots
60
+
61
+ | | |
62
+ |:----------------------------------------------------------------------------:|:------------------------------------------------------------------------------:|
63
+ | <img src="docs/images/1-EN.png" alt="Scenes" width="100%"><br>**Scenes** | <img src="docs/images/2-EN.png" alt="MCP" width="100%"><br>**MCP** |
64
+ | <img src="docs/images/3-EN.png" alt="Skills" width="100%"><br>**Skills** | <img src="docs/images/4-EN.png" alt="Subagents" width="100%"><br>**Subagents** |
65
+ | <img src="docs/images/5-EN.png" alt="Prompts" width="100%"><br>**Prompts** | <img src="docs/images/6-EN.png" alt="Memories" width="100%"><br>**Memories** |
66
+ | <img src="docs/images/7-EN.png" alt="Sessions" width="100%"><br>**Sessions** | <img src="docs/images/8-EN.png" alt="Host" width="100%"><br>**Host** |
67
+
68
+ ## Three scopes
69
+
70
+ Every conversation gets its own settings by default. Switch once on the **Host page → Scope**, and the whole panel plus every model tool follows that layer:
71
+
72
+ | | All global | Per workspace | Per conversation (default) |
73
+ |:------------------------ |:---------------------------------------------- |:------------------------------------------ |:------------------------------------------ |
74
+ | **Who shares one set** | Every conversation | Conversations in the same workspace | Each conversation separately |
75
+ | **Best for** | One person, one machine, consistent everywhere | One project, one environment | Parallel tasks in one project |
76
+ | **Lost when switching?** | — | Nothing is deleted; switch back to restore | Nothing is deleted; switch back to restore |
77
+
78
+ The selector at the top of the panel jumps to a specific conversation or workspace and shows its own copy; when that layer is locked, the unlock button sits on the same row. Within a layer, every switch resolves top-down: **this layer's edit > entered scene > creation snapshot > global**.
79
+
80
+ Scenes work in all three scopes. Under per-conversation, conversation A can sit in “Coding” while B stays in “Writing”, each with its own MCP servers, skills and personas.
81
+
82
+ ## What each tab does
83
+
84
+ <table>
85
+ <tr><th width="15%" align="left">Tab</th><th align="left">What it does</th></tr>
86
+ <tr><td><b>Scenes</b></td><td>Save the whole environment as a profile; enter and leave with one click; lock it against edits; bind a prompt preset and a model-tool table; deleting it sends its memories to the recycle bin too.</td></tr>
87
+ <tr><td><b>MCP</b></td><td>Add, edit and remove servers; toggle individual tools; write a note the model sees; inspect the last-known tool list while a server is stopped; import/export with automatic backups.</td></tr>
88
+ <tr><td><b>Skills</b></td><td>Grouped by source; enable, remove, import, edit; same-name skills show which copy is in effect; external directories stay read-only.</td></tr>
89
+ <tr><td><b>Subagents</b></td><td>One <code>.md</code> per persona; delegate work, limit tools, pick a model; only the result comes back, never into your History.</td></tr>
90
+ <tr><td><b>Prompts</b></td><td>Multiple <code>AGENTS.md</code> baselines with one-click apply/undo and five generations of backups; quick prompts paste into the composer from <code>/</code>.</td></tr>
91
+ <tr><td><b>Memories</b></td><td>Global / workspace / scene layers; <code>.md</code> bodies are injected automatically; import/export, recycle bin, injection budget (shared 256 KiB with learned notes; over the limit, whole entries step aside and are listed).</td></tr>
92
+ <tr><td><b>Sessions</b></td><td>Archived by project, searchable, batch restore; import Claude Code / Cursor / Codex transcripts; export Markdown / JSONL.</td></tr>
93
+ <tr><td><b>Host</b></td><td>Version and capability checks, access token, scope mode, injection switches, model-tool table, sidebar entry, backup cleanup.</td></tr>
94
+ </table>
95
+
96
+ ### Autonomous memory
97
+
98
+ Off by default. When on, the agent records preferences, facts and corrections worth keeping across conversations — **and asks you in the chat whether to keep each one, and at which scope**.
99
+
100
+ > **Experimental**: behaviour and UI are still changing. Please [open an issue](https://github.com/ouli-1242/dsh-plugin-tool-management/issues) if something goes wrong.
101
+
102
+ - **Two independent switches**: global and this workspace can be on together or one at a time; learning and injection both follow them, and the card only lists the layers that are on. On the Memory page global autonomous notes sit inside the Global card, and workspace notes get their own card with a section per workspace.
103
+ - **Every learn asks once**: a new note always gets a card — pick "add to global", "add to this workspace", or "do not add". Only two cases skip it: auto-confirm is on (the agent decides), and merging into a note that is already active (the layer is already settled). The agent does not scan the conversation during normal work — when the host compacts the context, that summary is reviewed once for anything durable.
104
+ - **Card language, rewording, and pending**: the card uses the language of the note body; type your own wording in the card and it goes back to the model to rewrite, then asks you again. Without an interactive card (background review, headless sessions) the note saves as pending and is handled on the Memory page; with auto-confirm on it goes active directly.
105
+ - **Type decides shelf life, and a wrong call is yours to fix**: every note carries a type (preference / fact / correction / procedure). Facts and procedures get a review reminder after 30 days; preferences and corrections never expire. The review card and the editor both state the current type and what it means; if the model got it wrong, change it in the editor and the shelf life is recomputed.
106
+ - **Learn only**: the settings panel can turn off “Inject into conversation”. Notes are still learned and still listed on the Memory page — they just stay out of the conversation context, which is useful when you want to watch what the agent would record.
107
+ - **Two injection messages**: global learned notes join the always-on block, while workspace learned notes and hand-written workspace memories are merged into one “Workspace memories” block; adding one note re-sends only its block.
108
+ - **Evidence comes in three tiers and the model cannot claim one**: a verbatim match of your own words, your confirmation on a card that showed the text, or the agent's own inference — sorting and page labels use those tiers, and `memory_note` has no “I'm confident” parameter to fill in. Something already covered by your own memories is not written a second time.
109
+ - **Shared injection budget with hand-written memories**: 256 KiB for everything together; over the limit, whole entries step aside in the order workspace notes → global notes → workspace memories → scene memories → global memories, the ones left out are listed at the end, and the page-header budget turns red.
110
+ - **Disable, archive and delete are three different things**: the row switch only flips "not injected for now" — the note stays in the list and flips back any time. The ⋯ menu's reject archives it (no longer injected, folded away in the list, restorable at any time, file untouched). Only delete moves it to the recycle bin and writes a tombstone, so the wording cannot be re-learned for 30 days; restore or delete it permanently from there. The ⋯ menu also edits the body.
111
+ - **Background review and upkeep**: review runs only when the host compacts the context — no compaction, no review; failures retry with backoff and have a manual retry entry; maintenance runs at most once a day and only changes status, never deletes files. Bodies and state live under `evolution/notes/`, and the tool never appears in the model tool table or follows scenes — only the two switches.
112
+
113
+ ## Let the agent drive it
114
+
115
+ Six domains, **23 model tools**: list, read, create, update, delete, toggle, enter or leave a scene, apply a prompt, run a persona. 22 of them can be toggled individually in the tool table; `memory_note` follows the autonomous-memory switch.
116
+
117
+ - **Only 5 ship enabled** (`tool_manager_tools` / `memory_get` / `memory_remember` / `skill_manager_read` / `subagent_manager_run`); the other 18 stay off. Off means **not in the schema at all** — the model cannot see them, let alone call them.
118
+ - **Scoped writes**: the model writes to the current layer by default and the receipt says which one; `scope: "global"` is required to touch everything.
119
+ - **Confirmation cards**: stopping servers, deleting, machine-wide toggles and similar writes ask first; recovery actions (restart, restore, undo apply) go straight through.
120
+ - **Per-tool control**: the model-tool table on the Host page adjusts visibility per layer. All 22 on is ~6k tokens/turn; profiles can be saved per task and switched together with a scene.
121
+ - **The model can switch tools back on**: the always-on `tool_manager_tools` lists the tools that are off in this conversation (name, purpose, ≈tokens) and turns them on as needed — when the user asks for a scene whose tools happen to be off, the model has a way forward instead of bouncing back to the user.
122
+
123
+ ## The Host page
124
+
125
+ More than a version number:
126
+
127
+ - **Checks**: host version, the plugin build actually loaded this run, and whether each action is native / adapted / unavailable, with reasons. Items whose names can be checked but whose timing or rendering cannot are listed under “not automatically verifiable”. If an upgrade quietly breaks something, it shows up here; the “Re-check” button re-runs the probe in place.
128
+ - **Upgrade diff**: per-package versions for cordis, the 11 peers and 15 runtime-only official packages against the verified baseline (out-of-range peers become blockers), plus canaries for event names, session-directory layout, patch dialect, MCP config keys and tool argument schemas, prompt section ordering, client UI slots and official skill assets.
129
+ - **Access token**: set / disable / change / delete; writes and plaintext secrets go through it.
130
+ - **Scope**: all global / per workspace / per conversation.
131
+ - **Injection**: per-domain switches, minimal-preset fallback, catalog caps for skills / MCP / subagents (overflow folds into a one-line count; per-entry description length is configurable too), the two slash-menu entries, sidebar entry.
132
+ - **Model tools**: per-tool visibility for 22 of them (`memory_note` follows the autonomous-memory switch), saved per layer.
133
+ - **Maintenance**: old-backup cleanup, feature overview, recent changes.
134
+
135
+ <details>
136
+ <summary><b>Where data lives · security boundaries</b></summary>
137
+
138
+ | Content | Location |
139
+ |:-------------------------------------------------------------- |:---------------------------------------------------------------------------- |
140
+ | MCP definitions | `~/.dsh/cordis.patch.yml` (global) · `~/.dsh/profiles/<name>/cordis.patch.yml` (current profile) |
141
+ | Skill policy / custom directories | `~/.dsh/tool-management/skills-state.json` |
142
+ | Skills / memories / personas / presets | `~/.dsh/tool-management/{skills,memories,subagents,prompts}/` |
143
+ | Memory index / scenes / profiles | `~/.dsh/tool-management/memories-index.json` |
144
+ | Recycle bins (skills / memories / personas / presets / scenes) | `~/.dsh/tool-management/trash/<domain>-trash/` |
145
+ | Archive ledger / retention | `~/.dsh/tool-management/history-*.json` |
146
+ | MCP sidecars (disabled tools / known tools / notes / settings) | `~/.dsh/tool-management/mcp-*.json` |
147
+ | Injection settings (six domain switches · catalog caps) | `~/.dsh/tool-management/inject-settings.json` |
148
+ | Model-tool table / scope overrides | `~/.dsh/tool-management/tool-table.json` · `scope-overrides.json` |
149
+ | Runtime log / patch backups | `~/.dsh/tool-management/tool-management.log` · `backups/` |
150
+
151
+ - **Write scope**: skill sources are never touched; MCP changes go to the two patch files above (five backups each); applying a prompt overwrites the `~/.dsh/AGENTS.md` the host reads (the previous text is kept inside the hub); the desktop build clears `dsh-auth-*` cookies older than ten minutes at startup.
152
+ - **Token**: once set, every write and every plaintext secret requires `x-dsh-token`; the UI stores it in browser localStorage bound to the current boot (a restart asks again), and plaintext still needs the token.
153
+ - **Process-level boundary is the token**: writes normally sit behind the host's browser auth; when the host fence is absent the route falls back to a loopback-only check, which any local process can pass — only the access token gives you a process-level boundary.
154
+ - **Plaintext on disk**: masking happens in the UI only. MCP `env` / `headers` and the plugin `token` stay plaintext in the patch file, and backups are not encrypted. The token gate cannot stop disk reads — file permissions are the boundary.
155
+ - **Deletes are recoverable**: skills / memories / personas / presets / scenes go to the recycle bin (permanent session deletion excepted), with an optional retention period (keep forever by default).
156
+
157
+ </details>
158
+
159
+ ## FAQ
160
+
161
+ | Symptom | Fix |
162
+ |:--------------------------------------- |:-------------------------------------------------------------------------------------------------------------------------------------------------------- |
163
+ | No panel after installing | Hard-refresh the browser; if that fails, restart DSH. |
164
+ | The model cannot call a tool | Host page → “Model tools”, make sure the right conversation / workspace is selected (18 tools are off by default). The panel and scripts are unaffected. |
165
+ | Actions unavailable after a DSH upgrade | Check the reason on the Host page; run `node scripts/doctor.mjs`, then `node scripts/host-deps.mjs --fix`. |
166
+ | Version mismatch | Supports DSH **0.2.2** only (`>=0.2.2-rc.1 <0.2.3`); cross-generation upgrades wait for the plugin to catch up. Install 0.21.x for older hosts. |
167
+ | Duplicate MCP tab | Remove the old loader line from `cordis.patch.yml` and restart. |
168
+ | DSH won't start after a bad edit | Restore the newest `cordis.patch.yml.*.bak-*` from `~/.dsh/tool-management/backups/`. |
169
+
170
+ Full troubleshooting guide: [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md).
171
+
172
+ ## Docs
173
+
174
+ | Doc | When to read it |
175
+ |:-------------------------------------------------------------- |:--------------------------------------------------------------------------------------------------------- |
176
+ | [Troubleshooting](docs/TROUBLESHOOTING.md) | Missing panel, duplicate tab, actions unavailable after an upgrade, broken sidecars |
177
+ | [Architecture](docs/ARCHITECTURE.md) | How content reaches the model, why one toggle differs between conversations, which file a change lands in |
178
+ | [Compatibility matrix](docs/COMPATIBILITY.md) | Capability matrix per DSH version (verified / untested / unavailable) |
179
+ | [Changelog](CHANGELOG.md) | What changed in each version |
180
+
181
+ ## Development
182
+
183
+ ```bash
184
+ npm install
185
+ npm run build # tsc + sync client
186
+ npm test # build + i18n + contract tests
187
+ npm run doctor # host compatibility check
188
+ ```
189
+
190
+ `lib/` is not committed — run `npm run build` after cloning, and restart `dsh web` to pick up changes. Runtime dependencies are `fflate`, `js-yaml` and `semver` (static imports in the build; the plugin will not load without any of them); every `@deepseek-ai/*` package uses the host's copy.
191
+
192
+ ## License
193
+
194
+ MIT