@user-mrz/dsh-system-prompt-studio 0.2.0 → 0.3.0

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.
package/CHANGELOG.md CHANGED
@@ -12,6 +12,107 @@ integration still targets the same DSH shapes, a major bump means it may not.
12
12
 
13
13
  Nothing yet.
14
14
 
15
+ ## [0.3.0] — 2026-11-13
16
+
17
+ ### Added
18
+
19
+ - **Workspace-level overrides.** There were two scopes — this conversation, and the global default —
20
+ with nothing in between, which is the wrong shape for the most common need: rules that belong to a
21
+ project. "Be terse, this repo has no test suite" had to be re-typed into every conversation opened in
22
+ that directory, or pushed into the global default where it leaks into unrelated work. The panel now has
23
+ a third scope, **This workspace**, keyed on the conversation's current working directory.
24
+
25
+ The precedence chain is, from most to least specific: this conversation → inherited from a fork →
26
+ **this workspace** → global default. Workspace sits above the global default because it is narrower;
27
+ below a fork's inherited rules because a fork carries the context of the work it branched from, and a
28
+ rule the user wrote for that specific branch is a more specific statement than the directory's default.
29
+
30
+ Two deliberate asymmetries:
31
+
32
+ - `workspaceScope` defaults to `all` (subagents included) while `globalDefaultScope` defaults to
33
+ `roots`. A global persona leaking into a tool-shaped subagent pollutes it; a project's rules
34
+ *should* reach the subagents doing that project's work, or the actual workers are the ones not
35
+ following them.
36
+ - `resetAll` clears per-conversation entries and leaves workspace entries alone. Workspace rules are
37
+ accumulated project configuration, not per-conversation scratch state; destroying them behind a
38
+ button labelled "clear all conversation overrides" would be unrecoverable and unexpected.
39
+
40
+ - **Directory changes are reconciled at assembly time.** `workingDirectory.set` (a user switching a
41
+ conversation to another project) emits no event, so a signature computed at install time would leave
42
+ the old directory's rules in force with nothing to explain it. The assembly listener now recomputes
43
+ each live agent's signature and reinstalls on a mismatch. It runs after the sections are already
44
+ collected, so the current request is unaffected and the change lands on the next one.
45
+
46
+ ### Fixed
47
+
48
+ - **The workspace key is not `workingDirectory.get()`.** That call returns
49
+ `stateOf(session) ?? defaultDirectory`, so a conversation that never changed directory reports the
50
+ *deployment default* directory rather than its own project. Keying on it directly would have collapsed
51
+ every conversation onto one workspace entry — rules saved in one project applying in another, with
52
+ nothing on screen to explain it. The key now comes from `workspaceRegistry` first (the workspace the
53
+ sidebar shows), then `workingDirectory.get()` **only when it differs from `defaultDirectory`** (i.e. a
54
+ change was really committed), then the session's recorded `header.cwd`.
55
+
56
+ - **Cold conversations could not use the workspace scope at all.** Resolving the workspace required a
57
+ `Session` object, and a cold conversation is neither a live agent nor in the in-memory session store,
58
+ so the lookup returned nothing: the panel showed "no usable workspace" and a conversation that had not
59
+ been resumed yet could not be given its project's rules. The registry is durable, so its ownership
60
+ lookup now runs on the bare session id alone, and the `Session`-dependent fallbacks are only tried when
61
+ one is actually available. A rule saved from a cold conversation applies to its live siblings
62
+ immediately.
63
+
64
+ ### Security
65
+
66
+ - **The workspace path is derived on the host, never supplied by the panel.** A workspace save sends a
67
+ `sessionId`; the host resolves that conversation's current directory itself. Accepting an arbitrary
68
+ path from the client would let any same-origin script write rules for directories the user never
69
+ opened — the loopback fence stops remote callers but not injected script. An explicit `workspaceKey`
70
+ field is still accepted when no `sessionId` is given, for scripts and tests, and passes the same
71
+ normalisation.
72
+
73
+ ### Changed
74
+
75
+ - Workspace keys are normalised paths, not `workspaceRegistry` ids: separators unified, trailing and
76
+ duplicate separators collapsed, `.` segments dropped, case folded on Windows. Re-registering a deleted
77
+ workspace would mint a new id, and a user's project rules should not evaporate because of that. The
78
+ *path* is read from the registry entry; the *id* is deliberately not used as the key.
79
+ - An unknown `scope` value still falls back to `session` rather than to `global`. Falling back to
80
+ `global` on a typo would silently rewrite every conversation while the user believes they edited one.
81
+
82
+ ## [0.2.1] — 2026-11-12
83
+
84
+ ### Fixed
85
+
86
+ - **The section-order table was one DSH release behind.** DSH `0.2.2-rc.2` added two entries to
87
+ `SECTION_ORDERS`: `TOOL_PTY_PANEL` (1710) and `TOOL_COMPUTER_USE` (3000). Neither was in this plugin's
88
+ hardcoded copy, so they were treated as unknown sections and given an interpolated order from their
89
+ neighbours. Nothing failed, but "Replace a section" could not select them and the panel's order column
90
+ drifted for them. Both are now recorded under the names they actually assemble as: `tool:pty-panel`
91
+ (registered by `dsh-terminal-panel`) and `computer-use:dsh-cua` (registered by `dsh-cua`).
92
+
93
+ - **The section listing behind "Replace everything" misjudged plugin sections in both directions.** It
94
+ decided ownership from a name prefix, which was wrong twice over. `dsh-m` registers its section as
95
+ `tool:dshm`, which looks first-party and was silently counted as such; `dsh-cua`'s
96
+ `computer-use:dsh-cua` does not start with a first-party prefix and would have been counted as a
97
+ plugin. The check is now a whitelist of the section names first-party packages actually register, so
98
+ anything not on it is reported as a plugin's. That errs toward over-reporting, which is the safe
99
+ direction: a user is sent to read the list, rather than having a plugin's silent failure hidden from
100
+ them. On a profile running `dsh-m`, the count now correctly includes `tool:dshm`.
101
+
102
+ ### Changed
103
+
104
+ - Four new host checks pin the two `rc.2` order constants and their position relative to their
105
+ neighbours; five new client checks pin the whitelist, including that neither `tool:dshm` nor
106
+ `computer-use:dsh-cua` is on it.
107
+
108
+ ### Note
109
+
110
+ No DSH surface this plugin uses changed shape in `0.2.2-rc.2`: `system-prompt/assemble` keeps its
111
+ `(assembly, context, next)` waterfall signature, `systemPrompt.section()` and the `PromptSection` fields
112
+ are unchanged, and the `agents` / `sessions` / `webServer` services are as before. The two order
113
+ constants were the only drift. `engines.dsh` still reads `>=0.2.2-0 <0.3.0-0`, which already admits
114
+ `0.2.2-rc.2`; no dependency range changed.
115
+
15
116
  ## [0.2.0] — 2026-11-10
16
117
 
17
118
  ### Added
@@ -197,7 +298,9 @@ scoped name unambiguous for anyone who arrives from GitHub.
197
298
  - Read-only assembly observer listing the real section names, order and size.
198
299
  - Loopback-only HTTP route for the panel; forged `Host` headers are refused.
199
300
 
200
- [Unreleased]: https://github.com/user-Mrz/dsh-system-prompt-studio/compare/v0.2.0...HEAD
301
+ [Unreleased]: https://github.com/user-Mrz/dsh-system-prompt-studio/compare/v0.3.0...HEAD
302
+ [0.3.0]: https://github.com/user-Mrz/dsh-system-prompt-studio/compare/v0.2.1...v0.3.0
303
+ [0.2.1]: https://github.com/user-Mrz/dsh-system-prompt-studio/compare/v0.2.0...v0.2.1
201
304
  [0.2.0]: https://github.com/user-Mrz/dsh-system-prompt-studio/compare/v0.1.9...v0.2.0
202
305
  [0.1.9]: https://github.com/user-Mrz/dsh-system-prompt-studio/compare/v0.1.8...v0.1.9
203
306
  [0.1.8]: https://github.com/user-Mrz/dsh-system-prompt-studio/compare/v0.1.7...v0.1.8
package/README.md CHANGED
@@ -34,7 +34,8 @@ session, effective immediately.
34
34
  | **Replace everything** | Your text becomes the entire system prompt. Highest risk: drops first-party guidance **and every other plugin's sections** — see below. |
35
35
 
36
36
  - **Applies on the next model request.** No restart, no reload.
37
- - **Persists per session**, and a **global default** applies to new conversations automatically.
37
+ - **Three scopes**: this conversation, **this workspace** (a directory), or the global default. Rules
38
+ persist per session *and* per working directory.
38
39
  - **Inherits across forks.** A forked conversation picks up its parent's rules along the `parentSession`
39
40
  chain, with a **Pin** action to freeze the inherited result locally.
40
41
  - **Guards unsaved edits.** Esc, backdrop click and the close button all ask before discarding.
@@ -89,7 +90,7 @@ dsh plugin --profile <profile> add @user-mrz/dsh-system-prompt-studio
89
90
  From GitHub, which tracks the default branch and therefore needs a ref if you want a fixed version:
90
91
 
91
92
  ```bash
92
- dsh plugin --profile <profile> add github:user-Mrz/dsh-system-prompt-studio#v0.2.0
93
+ dsh plugin --profile <profile> add github:user-Mrz/dsh-system-prompt-studio#v0.3.0
93
94
  ```
94
95
 
95
96
  Replace `<profile>` with your profile name — for the Web build that is usually `web`.
@@ -98,7 +99,7 @@ Replace `<profile>` with your profile name — for the Web build that is usually
98
99
  changes what you install next time:
99
100
 
100
101
  ```bash
101
- dsh plugin --profile <profile> add @user-mrz/dsh-system-prompt-studio@0.2.0
102
+ dsh plugin --profile <profile> add @user-mrz/dsh-system-prompt-studio@0.3.0
102
103
  ```
103
104
 
104
105
  <details>
@@ -157,30 +158,68 @@ Your saved overrides are **not** deleted.
157
158
  conversation already has its own override). On a **brand-new conversation** the title bar is
158
159
  hidden by the harness, so the button lives in the welcome area instead, labeled
159
160
  **Set system prompt**.
160
- 2. Pick a scope: **this conversation** or **global default**. The global default applies to top-level
161
- conversations only — not to subagents.
161
+ 2. Pick a scope — **this conversation**, **this workspace**, or **global default**. The global default
162
+ applies to top-level conversations only (not subagents); the workspace scope applies to every
163
+ conversation whose working directory is that directory, subagents included.
162
164
  3. Choose a mode, write your text, save. It takes effect on your next message.
163
165
  4. Expand the two read-only blocks at the bottom to check reality:
164
166
  - *System prompt of the latest request* — what was actually sent;
165
167
  - *Sections assembled for this conversation* — real section names, order and size.
166
168
 
169
+ ### Scopes and precedence
170
+
171
+ From most specific to least, the first one that exists wins:
172
+
173
+ | # | Scope | Applies to | Survives a new conversation? |
174
+ | --- | --- | --- | --- |
175
+ | 1 | **This conversation** | exactly one conversation | no |
176
+ | 2 | **Inherited from a fork** | that fork and its descendants | n/a (lineage) |
177
+ | 3 | **This workspace** | every conversation in that directory | **yes** |
178
+ | 4 | **Global default** | every top-level conversation | yes |
179
+
180
+ The workspace scope sits above the global default because it is narrower — a project's rules should not
181
+ be overridden by a blanket persona. It sits *below* a fork's inherited rules because a fork carries the
182
+ context of the work it branched from, and a rule written for that specific branch is a more specific
183
+ statement than the directory's default.
184
+
185
+ **The directory is resolved from the workspace registry first.** The panel shows the resolved path next to
186
+ the tabs. Priority: the workspace this conversation belongs to in `workspaceRegistry` (the one you see in
187
+ the sidebar), then — only when no workspace owns it — the conversation's current directory, then the
188
+ directory recorded when the conversation was created.
189
+
190
+ That ordering matters more than it looks. `workingDirectory.get()` returns the **deployment default
191
+ directory** for a conversation that never changed directory, not its own project; keying on it directly
192
+ would make every conversation share one workspace entry, so rules saved in one project would apply in
193
+ another. It is therefore only trusted when it differs from that default, i.e. when a change was really
194
+ committed.
195
+
196
+ The panel displays the **original path spelling**, not the normalised key: normalisation lowercases the
197
+ Windows drive and directory names, which is right for matching and wrong for a path a user is meant to
198
+ recognise.
199
+
200
+ The path is resolved on the host — the panel never sends one, so a same-origin script cannot write rules
201
+ for directories you never opened.
202
+
203
+ `resetAll` (the API action that clears every per-conversation override) **does not** touch workspace
204
+ entries: those are accumulated project configuration, not per-conversation scratch state.
205
+
167
206
  ### Can I set the prompt of a conversation that hasn't started yet?
168
207
 
169
208
  Yes, and it applies from the **first** message, not the second. The harness creates the agent the
170
209
  moment the conversation exists — before you type anything — so the override is already registered by
171
210
  the time your first prompt is assembled. Open the welcome-area button and save.
172
211
 
173
- Two ways to cover a new conversation:
212
+ Three ways to cover a new conversation:
174
213
 
175
214
  | Want | Do this |
176
215
  | --- | --- |
177
216
  | Just this one new conversation | Open its welcome-area button → **this conversation** → save |
217
+ | Every conversation in this project | Open the button in any conversation in that directory → **this workspace** → save |
178
218
  | Every top-level conversation that has no override of its own | Open the button in any conversation → **global default** → save |
179
219
 
180
- The global default is **not** limited to conversations created after you save it: it is re-evaluated
181
- for every live conversation on each save, so existing top-level conversations without an override of
182
- their own pick it up immediately too. A conversation that has its own override keeps it — the global
183
- default only fills in where nothing more specific exists.
220
+ The global default and the workspace rules are **not** limited to conversations created after you save
221
+ them: both are re-evaluated for every live conversation on each save, so existing conversations without
222
+ something more specific pick them up immediately too. A conversation that has its own override keeps it.
184
223
 
185
224
  ### Choosing a section to replace
186
225
 
@@ -239,6 +278,7 @@ Edit the row in `cordis.patch.yml` or override it in your profile patch. The mos
239
278
  | `globalDefaultScope` | `roots` | Whether the global default also applies to subagents (`all` to include) |
240
279
  | `inheritOnFork` | `true` | Whether forked conversations inherit upstream rules |
241
280
  | `maxInheritDepth` | `3` | How many levels to walk up (1–8); `0` behaves like off |
281
+ | `workspaceScope` | `all` | Whether workspace rules also apply to subagents (`roots` for top-level only) |
242
282
  | `observeAssemblies` | `true` | Read-only assembly observer; required for the section list |
243
283
  | `visible` | `true` | Whether the panel button is shown (client-side) |
244
284
  | `showOnNewConversation` | `true` | Whether the welcome area of a brand-new conversation also gets a button (client-side) |
@@ -254,10 +294,18 @@ Every key is documented in [`cordis.patch.yml`](cordis.patch.yml).
254
294
  {
255
295
  "version": 1,
256
296
  "global": { "enabled": false, "mode": "append", "text": "", "target": "", "updatedAt": 0 },
257
- "sessions": { "<sessionId>": { "enabled": true, "mode": "append", "text": "…", "target": "", "updatedAt": 0 } }
297
+ "sessions": { "<sessionId>": { "enabled": true, "mode": "append", "text": "…", "target": "", "updatedAt": 0 } },
298
+ "workspaces": { "C:/work/alpha": { "enabled": true, "mode": "append", "text": "…", "target": "", "updatedAt": 0 } }
258
299
  }
259
300
  ```
260
301
 
302
+ Workspace keys are **normalised directory paths**, not `workspaceRegistry` ids. Separators are unified
303
+ to `/`, trailing and duplicate separators and `.` segments are dropped, and case is folded on Windows —
304
+ so `C:\work\alpha\`, `C:/work/alpha` and `c:/Work/Alpha` are one key. Ids were rejected on purpose:
305
+ deleting and re-registering a workspace mints a new id, and a project's rules should not evaporate
306
+ because of that. Keys that do not normalise cleanly (empty, or a bare drive like `C:`) are treated as
307
+ "no usable directory" rather than as a shared bucket.
308
+
261
309
  - Writes go through a temp file plus atomic `rename`, serialized on one queue.
262
310
  - If a write fails, the panel says so explicitly (*in memory only, lost on restart*) rather than
263
311
  pretending the save worked.
@@ -269,26 +317,34 @@ Every key is documented in [`cordis.patch.yml`](cordis.patch.yml).
269
317
  ```
270
318
  GET /api/system-prompt-studio?session=<sessionId>
271
319
  POST /api/system-prompt-studio
272
- { "action": "set", "scope": "session"|"global", "sessionId"?: "…", "patch": { "enabled": true, "mode": "append"|"replace"|"complete", "text": "…", "target": "…" } }
273
- { "action": "clear", "scope": "session"|"global", "sessionId"?: "…" }
320
+ { "action": "set", "scope": "session"|"workspace"|"global", "sessionId"?: "…", "patch": { "enabled": true, "mode": "append"|"replace"|"complete", "text": "…", "target": "…" } }
321
+ { "action": "clear", "scope": "session"|"workspace"|"global", "sessionId"?: "…" }
274
322
  { "action": "pin", "scope": "session", "sessionId": "…" }
275
323
  { "action": "resetAll", "confirm": true }
276
324
  ```
277
325
 
278
326
  - Loopback-only: both the socket and the `Host` header must be loopback; cross-site origins get 403.
279
327
  - POST bodies over `maxChars * 4` bytes are rejected with 413 (never truncated).
328
+ - `scope: "workspace"` resolves the directory **from `sessionId`** on the host. An explicit
329
+ `"workspaceKey": "C:/path"` is honoured only when no `sessionId` is given (scripts and tests) and goes
330
+ through the same normalisation. Sending a path is not how the panel works, by design: accepting one
331
+ would let same-origin script write rules for directories the user never opened.
332
+ - An unrecognised `scope` value falls back to `session`, never to `global`.
280
333
  - Stable error codes: `TEXT_TOO_LONG`, `EMPTY_TEXT`, `TARGET_REQUIRED`, `COMPLETE_BLOCKED`,
281
- `UNKNOWN_ACTION`, `MISSING_SESSION`, `NOTHING_TO_PIN`, `PIN_SESSION_ONLY`, `CONFIRM_REQUIRED`,
282
- `INVALID_JSON`, `BODY_TOO_LARGE`, `method-not-allowed`, `forbidden: loopback-only`.
334
+ `UNKNOWN_ACTION`, `MISSING_SESSION`, `MISSING_WORKSPACE`, `NOTHING_TO_PIN`, `PIN_SESSION_ONLY`,
335
+ `CONFIRM_REQUIRED`, `INVALID_JSON`, `BODY_TOO_LARGE`, `method-not-allowed`, `forbidden: loopback-only`.
283
336
 
284
337
  ## Known limitations
285
338
 
286
339
  1. **Overrides are keyed by session id, but forks inherit.** A forked conversation picks up the nearest
287
340
  ancestor's rules (disable with `inheritOnFork`). Subagents do not take the global default and do not
288
- participate in the chain. Resuming a session under the same id re-applies its rules.
289
- 2. **Cold sessions** (no live agent) can be saved for, but take effect once resumed. Inheritance
341
+ participate in the fork chain; they *do* take workspace rules unless `workspaceScope: roots`.
342
+ Resuming a session under the same id re-applies its rules.
343
+ 2. **Cold sessions** (no live agent) can be saved for, but take effect once resumed. Fork inheritance
290
344
  specifically requires a live agent, because the parent chain is read from the session header — a cold
291
- session has none until it is running again.
345
+ session has none until it is running again. Workspace rules work for cold sessions too: the registry
346
+ lookup only needs the session id, so a conversation that has not been resumed yet can still be given
347
+ its project's rules, and its live siblings pick them up immediately.
292
348
  3. **`{{…}}` is not interpolated.** Bodies are registered with `interpolate: false`, so braces stay
293
349
  literal. This is deliberate: otherwise any `{{x}}` in your text would fail assembly with
294
350
  *unknown prompt variable*.
@@ -299,6 +355,10 @@ POST /api/system-prompt-studio
299
355
  6. **Section attribution is approximate.** The list is attributed via the assembly context's scope (the
300
356
  agent); if that is unavailable it falls back to the most recent assembly. Overrides themselves are
301
357
  unaffected.
358
+ 7. **Workspace matching is textual, not filesystem-resolved.** Keys are normalised path spellings; `..`
359
+ is not resolved (that needs filesystem semantics this plugin does not touch) and symlinks are not
360
+ followed. The host prefers the `workspaceRegistry` entry, whose path is canonicalised by DSH itself,
361
+ so the normal case is exact.
302
362
 
303
363
  ## Development
304
364
 
@@ -377,13 +437,13 @@ dsh plugin --profile <profile> add @user-mrz/dsh-system-prompt-studio
377
437
  或从 GitHub(跟随默认分支,建议锁 tag):
378
438
 
379
439
  ```bash
380
- dsh plugin --profile <profile> add github:user-Mrz/dsh-system-prompt-studio#v0.2.0
440
+ dsh plugin --profile <profile> add github:user-Mrz/dsh-system-prompt-studio#v0.3.0
381
441
  ```
382
442
 
383
443
  锁定版本,保证装到的是一份确定的代码:
384
444
 
385
445
  ```bash
386
- dsh plugin --profile <profile> add @user-mrz/dsh-system-prompt-studio@0.2.0
446
+ dsh plugin --profile <profile> add @user-mrz/dsh-system-prompt-studio@0.3.0
387
447
  ```
388
448
 
389
449
  `prepare` 脚本只校验入口文件存在,不做编译。若被 pnpm 拦下,把 `pnpm-workspace.yaml` 里
@@ -392,7 +452,8 @@ dsh plugin --profile <profile> add @user-mrz/dsh-system-prompt-studio@0.2.0
392
452
 
393
453
  **安装后**:Host 半即时生效;客户端是新的 JS,需要刷新一次页面才会出现标题栏按钮。
394
454
 
395
- **使用**:打开对话 → 标题栏「系统提示词」按钮 → 选作用域、模式、写正文 → 保存,下一次发消息生效。
455
+ **使用**:打开对话 → 标题栏「系统提示词」按钮 → 选作用域(本对话 / 本工作区 / 全局默认)、模式、
456
+ 写正文 → 保存,下一次发消息生效。
396
457
  **新开的空对话**标题栏是隐藏的,入口改在欢迎区(文字为「设置系统提示词」)—— 会话一创建 agent
397
458
  就已经在了,所以这里保存的覆盖**从第一句话**就生效,不是等到第二句。
398
459
  面板底部两个只读区块分别显示「最近一次请求真正发出的系统提示词」与「本次装配到的段清单」。
@@ -405,8 +466,24 @@ dsh plugin --profile <profile> add @user-mrz/dsh-system-prompt-studio@0.2.0
405
466
  整体换成 `[completeSection]`,所以任何观察者(包括本插件)必然先看到全量。面板会把这种情况标出来,
406
467
  而不是让你对着几十个段怀疑替换没生效。
407
468
 
408
- **新对话怎么生效**:「本对话」只作用于这一个新对话;「全局默认」作用于**所有没有自身覆盖的顶层
409
- 对话**——包括保存时就已经存在的那些,它是「兜底」而不是「只对新对话」。
469
+ **新对话怎么生效**:「本对话」只作用于这一个新对话;「本工作区」作用于**这个目录下的所有对话**
470
+ (含子代理);「全局默认」作用于**所有没有自身覆盖的顶层对话**——后两者都包括保存时就已经存在的
471
+ 那些,它们是「兜底」而不是「只对新对话」。
472
+
473
+ **三档作用域的优先级**(从具体到宽泛,命中第一个就停):本对话 → fork 继承 → 本工作区 → 全局默认。
474
+ 工作区排在全局之上是因为它更窄;排在 fork 继承之下是因为 fork 带着它分叉出来的那段工作的上下文,
475
+ 用户为那个分支单独调过的规则比目录默认更具体。
476
+
477
+ **工作区按你侧边栏看到的那个工作区算**:优先用 `workspaceRegistry` 里的归属(会话在注册表里属于哪个
478
+ 工作区),所以它不会因为你在对话里 `cd` 而漂移;注册表里没有归属时,才退回这个对话的当前目录,再退回
479
+ 会话创建时记下的原始目录。面板会显示解析出来的**原始路径**(不是归一化后的小写键),供你核对。
480
+
481
+ > 这里有个坑值得说明:`workingDirectory.get()` 对**没换过目录**的会话返回的是部署默认目录,不是会话
482
+ > 自己的项目目录。直接拿它当工作区键,所有会话会共用同一个键——在这个项目里设的规则会莫名其妙地对
483
+ > 别处生效。所以它只在「确实换过目录」时才被采用。
484
+
485
+ 路径由宿主自己解析——面板从不传路径,否则同源脚本就能给用户从没打开过的目录写规则。`resetAll`
486
+ (清空所有会话覆盖的 API 动作)**不动**工作区条目:那是攒下来的项目配置,不是逐对话的临时状态。
410
487
 
411
488
  **fork 继承**:fork 出的对话是新 session id,会沿 `parentSession` 链继承最近的祖先规则;面板显示
412
489
  「继承自 …」并提供「在此固定」把继承结果固化成本地规则。子对话自己一改就停止继承。默认上溯 3 层,
@@ -418,5 +495,6 @@ dsh plugin --profile <profile> add @user-mrz/dsh-system-prompt-studio@0.2.0
418
495
  **数据位置**:`$DSH_HOME/dsh-system-prompt-studio/state.json`,原子写入;写失败会明说「只在内存」,
419
496
  文件损坏会先备份成 `.corrupt-<时间戳>` 再空态起步。
420
497
 
421
- **已知限制**:冷会话(没有活 agent)可以保存,但要等它恢复后才生效,且继承需要活会话才能读到父链;
422
- `{{…}}` 不插值(刻意为之);系统提示词一变,该对话的缓存前缀从首个变化的 token 起失效。
498
+ **已知限制**:冷会话(没有活 agent)可以保存,但要等它恢复后才生效,且 fork 继承需要活会话才能读到
499
+ 父链(工作区规则对冷会话也有效,目录从已存的会话里读);`{{…}}` 不插值(刻意为之);系统提示词一变,
500
+ 该对话的缓存前缀从首个变化的 token 起失效;工作区匹配是文本归一化,不解析 `..`、不跟随符号链接。
package/cordis.patch.yml CHANGED
@@ -27,6 +27,11 @@
27
27
  # maxObservedScopes 观察缓存的作用域上限(FIFO 淘汰),防止长期运行堆积。
28
28
  # globalDefaultScope 「全局默认」套用到哪些会话:roots(默认,只套用到顶层会话,
29
29
  # 不碰子代理)| all(含子代理)。
30
+ # workspaceScope 「工作区级」规则套用到哪些会话:all(默认,含子代理)|
31
+ # roots(只套用到顶层会话)。
32
+ # 默认值与 globalDefaultScope 不同是有意的:全局默认是「所有
33
+ # 对话的人格」,漏进子代理会污染工具型子任务;工作区级是
34
+ # 「这个项目的规矩」,子代理正是替这个项目干活的那批。
30
35
  # inheritOnFork fork 继承:子会话没有自身覆盖时,沿 parentSession 链向上找。
31
36
  # true(默认)| false(各会话独立,退回旧行为)。
32
37
  # maxInheritDepth 继承最多上溯几层(1–8,默认 3)。0 等同于关闭继承。
@@ -57,6 +62,7 @@
57
62
  observeAssemblies: true
58
63
  maxObservedScopes: 64
59
64
  globalDefaultScope: roots
65
+ workspaceScope: all
60
66
  inheritOnFork: true
61
67
  maxInheritDepth: 3
62
68
  visible: true