dsh-plugin-prompt-tool 2.1.0 → 3.0.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.
Files changed (204) hide show
  1. package/README.md +100 -233
  2. package/engine/actions/append-context.mjs +3 -24
  3. package/engine/actions/assembly.mjs +70 -94
  4. package/engine/actions/catalog.mjs +65 -28
  5. package/engine/actions/content.mjs +8 -152
  6. package/engine/actions/examples.mjs +8 -4
  7. package/engine/actions/inbox-prepend.mjs +4 -5
  8. package/engine/actions/index.mjs +17 -9
  9. package/engine/actions/inject-text.mjs +24 -4
  10. package/engine/actions/pre-step-filter.mjs +3 -4
  11. package/engine/actions/registration.mjs +20 -28
  12. package/engine/actions/request-params.mjs +21 -1
  13. package/engine/actions/shared.mjs +22 -13
  14. package/engine/actions/stream-output.mjs +26 -0
  15. package/engine/actions/tool-gate.mjs +31 -0
  16. package/engine/actions/tool-result.mjs +36 -0
  17. package/engine/actions/tool-visibility.mjs +248 -0
  18. package/engine/agent-capability.mjs +67 -0
  19. package/engine/anchor-match.mjs +14 -21
  20. package/engine/audience.d.mts +2 -0
  21. package/engine/audience.mjs +102 -0
  22. package/engine/branch.d.mts +4 -0
  23. package/engine/branch.mjs +61 -18
  24. package/engine/compaction-epoch.d.mts +25 -0
  25. package/engine/compaction-epoch.mjs +27 -4
  26. package/engine/compositions/source/local/filesystem-editor.yml +3 -3
  27. package/engine/compositions/source/local/instruction-hint.yml +2 -4
  28. package/engine/compositions/source/local/module-file-tools.yml +2 -0
  29. package/engine/compositions/source/local/module-import-tools.yml +4 -0
  30. package/engine/compositions/source/local/module-manifest-tools.yml +2 -0
  31. package/engine/compositions/source/local/module-rule-tools.yml +5 -0
  32. package/engine/compositions/source/local/module-variable-tools.yml +5 -0
  33. package/engine/compositions/source/local/present-as.yml +26 -0
  34. package/engine/compositions/source/local/tool-config-engine.yml +2 -3
  35. package/engine/compositions/source/local/tool-search.yml +11 -0
  36. package/engine/condition-facts.mjs +84 -0
  37. package/engine/conditions/anchor.mjs +63 -23
  38. package/engine/conditions/availability.mjs +1 -1
  39. package/engine/conditions/composite.mjs +3 -3
  40. package/engine/conditions/count.mjs +42 -11
  41. package/engine/conditions/evaluation.mjs +74 -19
  42. package/engine/conditions/examples.mjs +2 -1
  43. package/engine/conditions/index.d.mts +15 -0
  44. package/engine/conditions/index.mjs +23 -9
  45. package/engine/conditions/operators.mjs +4 -0
  46. package/engine/conditions/phase.mjs +9 -3
  47. package/engine/conditions/preset.mjs +1 -1
  48. package/engine/conditions/session.mjs +8 -2
  49. package/engine/conditions/subject.mjs +144 -65
  50. package/engine/conditions/text.mjs +26 -8
  51. package/engine/conditions/variable.mjs +83 -0
  52. package/engine/context-activation.d.mts +11 -0
  53. package/engine/{st-world-book.mjs → context-activation.mjs} +104 -64
  54. package/engine/delivery.d.mts +2 -0
  55. package/engine/delivery.mjs +93 -0
  56. package/engine/discovery.d.mts +38 -0
  57. package/engine/discovery.mjs +146 -0
  58. package/engine/env-safety.mjs +14 -0
  59. package/engine/executor.d.mts +28 -0
  60. package/engine/executor.mjs +290 -205
  61. package/engine/fillers.mjs +39 -8
  62. package/engine/fixed-registration.mjs +12 -0
  63. package/engine/history.mjs +71 -0
  64. package/engine/instruction-blocks.d.mts +13 -0
  65. package/engine/instruction-blocks.mjs +21 -0
  66. package/engine/instruction-files.d.mts +5 -0
  67. package/engine/instruction-files.mjs +97 -0
  68. package/engine/instruction-hint.mjs +69 -103
  69. package/engine/interpolate.d.mts +7 -0
  70. package/engine/interpolate.mjs +44 -13
  71. package/engine/layers.mjs +163 -227
  72. package/engine/machine-paths.mjs +40 -0
  73. package/engine/module-file-tools.mjs +8 -0
  74. package/engine/module-import-tools.mjs +10 -0
  75. package/engine/module-manifest-tools.mjs +8 -0
  76. package/engine/module-rule-tools.mjs +10 -0
  77. package/engine/module-variable-tools.mjs +10 -0
  78. package/engine/order.d.mts +14 -0
  79. package/engine/order.mjs +0 -3
  80. package/engine/path-safety.d.mts +2 -0
  81. package/engine/path-safety.mjs +58 -0
  82. package/engine/pre-step-source.d.mts +69 -0
  83. package/engine/pre-step-source.mjs +103 -0
  84. package/engine/present-as.mjs +77 -0
  85. package/engine/promotion-pool.d.mts +9 -0
  86. package/engine/promotion-pool.mjs +69 -0
  87. package/engine/record.mjs +2 -0
  88. package/engine/rule-engine.mjs +3 -2
  89. package/engine/rule-facts.d.mts +11 -0
  90. package/engine/rule-facts.mjs +60 -0
  91. package/engine/rule-runtime.d.mts +46 -0
  92. package/engine/rule-runtime.mjs +98 -13
  93. package/engine/rule-spec.d.mts +106 -0
  94. package/engine/rule-spec.mjs +301 -27
  95. package/engine/run-code-env.mjs +73 -19
  96. package/engine/schema.mjs +165 -243
  97. package/engine/sdk-strip.mjs +2 -2
  98. package/engine/service-names.d.mts +10 -0
  99. package/engine/service-names.mjs +10 -0
  100. package/engine/shared.d.mts +21 -0
  101. package/engine/shared.mjs +46 -13
  102. package/engine/skill-search.mjs +125 -53
  103. package/engine/source-kind.d.mts +9 -0
  104. package/engine/source-kind.mjs +16 -0
  105. package/engine/strategy-ids.mjs +5 -0
  106. package/engine/template-evaluation.d.mts +16 -0
  107. package/engine/template-evaluation.mjs +178 -0
  108. package/engine/template-frame.d.mts +16 -0
  109. package/engine/template-frame.mjs +69 -0
  110. package/engine/tool-config-engine.mjs +38 -34
  111. package/engine/tool-definition.d.mts +4 -0
  112. package/engine/tool-definition.mjs +5 -1
  113. package/engine/tool-git-bash.mjs +5 -1
  114. package/engine/tool-scope.mjs +22 -0
  115. package/engine/{dev-tool-search.mjs → tool-search.mjs} +63 -65
  116. package/engine/trigger.mjs +15 -270
  117. package/engine/vendor/yaml/dist/compose/resolve-flow-scalar.js +19 -18
  118. package/engine/vendor/yaml/dist/nodes/Alias.js +25 -23
  119. package/engine/vendor/yaml/package.json +1 -1
  120. package/lib/client.js +8312 -6724
  121. package/lib/client.js.map +1 -1
  122. package/lib/index.d.mts +16 -2120
  123. package/lib/index.mjs +26914 -5816
  124. package/modules/ponytail/module.yml +83 -203
  125. package/modules/ptc-mode/module.yml +45 -0
  126. package/modules/soul/assets/core-hard.md +6 -0
  127. package/modules/soul/assets/criteria.md +12 -0
  128. package/modules/soul/assets/echo.md +12 -0
  129. package/modules/soul/assets/layers.md +11 -0
  130. package/modules/soul/assets/ledger.md +9 -0
  131. package/modules/soul/assets/manifest.yml +20 -0
  132. package/modules/soul/assets/reference/00-layers.md +27 -0
  133. package/modules/soul/assets/reference/01-criteria.md +32 -0
  134. package/modules/soul/assets/reference/02-echo.md +158 -0
  135. package/modules/soul/assets/reference/03-vital.md +183 -0
  136. package/modules/soul/assets/reference/04-manifest.json +106 -0
  137. package/modules/soul/assets/reference/05-doctor.md +67 -0
  138. package/modules/soul/assets/reference/06-reference.md +189 -0
  139. package/modules/soul/assets/reference/07-bundle.json +431 -0
  140. package/modules/soul/assets/reference/08-/350/270/251/345/235/221/345/256/236/345/275/225.md +59 -0
  141. package/modules/soul/assets/reference/09-dev-workflow.md +109 -0
  142. package/modules/soul/assets/reference/10-echo-anatomy.md +100 -0
  143. package/modules/soul/assets/reference/11-self.md +80 -0
  144. package/modules/soul/assets/reference/12-ledger.md +159 -0
  145. package/modules/soul/assets/reference/README.md +10 -0
  146. package/modules/soul/assets/templates/agents-template.md +6 -0
  147. package/modules/soul/assets/vital.md +9 -0
  148. package/modules/soul/module.yml +311 -0
  149. package/modules/superpowers/module.yml +122 -0
  150. package/modules/tool-surface/module.yml +51 -47
  151. package/package.json +37 -40
  152. package/skills/dsh-module/SKILL.md +67 -147
  153. package/skills/dsh-module/reference.md +113 -86
  154. package/templates/10-pre-step.yml +2 -3
  155. package/templates/14-first-turn-anchor.yml +10 -14
  156. package/templates/15-guide-auto.yml +32 -28
  157. package/templates/16-custom-fallback.yml +33 -21
  158. package/templates/20-system-section.yml +1 -4
  159. package/templates/50-llm-stream.yml +4 -10
  160. package/templates/60-tool-pipeline.yml +12 -10
  161. package/templates/63-append-context.yml +4 -6
  162. package/templates/65-turn-stop.yml +2 -2
  163. package/templates/67-inbox-prepend.yml +2 -2
  164. package/templates/70-subagent-maintenance.yml +9 -10
  165. package/templates/75-subagent-end.yml +2 -2
  166. package/templates/80-tool-surface.yml +41 -57
  167. package/templates/tools/40-delegate-module-import.yml +22 -0
  168. package/templates/tools/50-delegate-module-rules.yml +14 -0
  169. package/templates/tools/60-delegate-module-variables.yml +17 -0
  170. package/templates/tools/70-delegate-module-rules-edit.yml +31 -0
  171. package/engine/actions/decision.mjs +0 -54
  172. package/engine/actions/guard.mjs +0 -80
  173. package/engine/actions/sdk-strip.mjs +0 -30
  174. package/engine/character-tools.mjs +0 -8
  175. package/engine/classify-task.mjs +0 -53
  176. package/engine/compositions/source/local/character-tools.yml +0 -5
  177. package/engine/compositions/source/local/dev-tool-search.yml +0 -11
  178. package/engine/compositions/source/local/session-var-tools.yml +0 -5
  179. package/engine/compositions/source/local/subagent-tool-policy.yml +0 -21
  180. package/engine/compositions/source/local/world-book-tools.yml +0 -5
  181. package/engine/condition.mjs +0 -96
  182. package/engine/declared-triggers.mjs +0 -93
  183. package/engine/session-var-tools.mjs +0 -8
  184. package/engine/session-vars.mjs +0 -54
  185. package/engine/st-macros.d.mts +0 -22
  186. package/engine/st-macros.mjs +0 -208
  187. package/engine/st-render.mjs +0 -109
  188. package/engine/st-world-book.d.mts +0 -10
  189. package/engine/subagent-tool-policy-core.mjs +0 -400
  190. package/engine/subagent-tool-policy.mjs +0 -352
  191. package/engine/trigger-spec.mjs +0 -173
  192. package/engine/world-book-tools.mjs +0 -8
  193. package/lib/migrate-rules.d.mts +0 -1
  194. package/lib/migrate-rules.mjs +0 -610
  195. package/lib/module-package-DqJZaE71.mjs +0 -2
  196. package/lib/module-package-q2gDRu9H.mjs +0 -2869
  197. package/lib/rule-builder-DMrJten6.mjs +0 -14767
  198. package/templates/61-deny-tools-presentation.yml +0 -27
  199. package/templates/62-guard-deny-tools.yml +0 -20
  200. package/templates/policies/legacy-defaults.yml +0 -34
  201. package/templates/tools/40-delegate-character.yml +0 -15
  202. package/templates/tools/50-delegate-worldbook.yml +0 -15
  203. package/templates/tools/60-delegate-session-var.yml +0 -15
  204. package/templates/tools/70-delegate-worldbook-upsert.yml +0 -36
@@ -0,0 +1,311 @@
1
+ # 灵魂架构(推送层 + 判据 + 按需条目 + 状态规则)
2
+ # 工具面由本项目通用能力提供:module_file_read/append 读写模块私有文件,module_manifest 执行 assets/manifest.yml,module_variables 读写状态;不提供 soul 专属工具。
3
+ # 正文放 assets/,用 templateFile 引用;运行源是本模块,soul 仓库是作者稿。
4
+ id: soul
5
+ name: 灵魂架构(判据与推送)
6
+ version: 1.0.0
7
+ engineCompat: ">=0.7.2"
8
+ description: 灵魂架构模块(资产 + 规则):常驻四条判据与子代理硬线,按需注入五层/ECHO/VITAL/账本,压缩后与每 12 轮各提醒一次;工具由项目内置引擎提供,本模块分发规则、资产与装配清单。
9
+ meta:
10
+ source: manual
11
+ modules:
12
+ - rule-engine
13
+ - module-file-tools
14
+ - module-manifest-tools
15
+ - module-variable-tools
16
+ order: 10
17
+ variables:
18
+ # 状态键由本模块声明;引擎只按普通模块变量处理,不认 soul 前缀。
19
+ plan_step: ''
20
+ plan_at: ''
21
+ check_verdict: ''
22
+ check_at: ''
23
+ check_failed: '0'
24
+ scaffold_done: ''
25
+ scaffold_root: data
26
+ ledger_seq: '0'
27
+ ledger_open: '0'
28
+ rules:
29
+ - id: soul-core
30
+ name: 四条判据(常驻)
31
+ enabled: true
32
+ layer: runtime-context
33
+ if:
34
+ scope:
35
+ audience: main
36
+ then:
37
+ - id: inject
38
+ kind: inject-text
39
+ config:
40
+ id: soul-core
41
+ strategy: static
42
+ layer: runtime-context
43
+ order: 132
44
+ params:
45
+ contextName: agent:soul-core
46
+ templateFile: ./assets/criteria.md
47
+
48
+ - id: soul-core-sub
49
+ name: 子代理硬线
50
+ enabled: true
51
+ layer: subagent-start
52
+ then:
53
+ - id: inject
54
+ kind: inject-text
55
+ config:
56
+ id: soul-core-sub
57
+ strategy: static
58
+ layer: subagent-start
59
+ order: 216
60
+ templateFile: ./assets/core-hard.md
61
+
62
+ - id: soul-layers
63
+ name: 五层(按需)
64
+ enabled: true
65
+ layer: pre-step
66
+ then:
67
+ - id: inject
68
+ kind: inject-text
69
+ config:
70
+ id: soul-layers
71
+ strategy: context-activation
72
+ layer: pre-step
73
+ order: 120
74
+ position: before-all
75
+ role: user
76
+ templateFile: ./assets/layers.md
77
+ params:
78
+ constant: false
79
+ keys: [灵魂, 五层, ECHO, VITAL, 架构]
80
+ secondaryKeys: []
81
+ selectiveLogic: AND_ANY
82
+ wordBoundary: ascii-token
83
+ activation:
84
+ scan: history
85
+ scanDepth: 6
86
+ selective: false
87
+
88
+ - id: soul-echo
89
+ name: ECHO 机制(按需)
90
+ enabled: true
91
+ layer: pre-step
92
+ then:
93
+ - id: inject
94
+ kind: inject-text
95
+ config:
96
+ id: soul-echo
97
+ strategy: context-activation
98
+ layer: pre-step
99
+ order: 121
100
+ position: before-all
101
+ role: user
102
+ templateFile: ./assets/echo.md
103
+ params:
104
+ constant: false
105
+ keys: [压缩, 上下文满, 摘要, 找不回, 退化]
106
+ secondaryKeys: []
107
+ selectiveLogic: AND_ANY
108
+ wordBoundary: ascii-token
109
+ activation:
110
+ scan: history
111
+ scanDepth: 8
112
+ selective: false
113
+
114
+ - id: soul-vital
115
+ name: VITAL 机制(按需)
116
+ enabled: true
117
+ layer: pre-step
118
+ then:
119
+ - id: inject
120
+ kind: inject-text
121
+ config:
122
+ id: soul-vital
123
+ strategy: context-activation
124
+ layer: pre-step
125
+ order: 122
126
+ position: before-all
127
+ role: user
128
+ templateFile: ./assets/vital.md
129
+ params:
130
+ constant: false
131
+ keys: [预算, 烧光, 打转, 空转, 该停, 阈值]
132
+ secondaryKeys: []
133
+ selectiveLogic: AND_ANY
134
+ wordBoundary: ascii-token
135
+ activation:
136
+ scan: history
137
+ scanDepth: 8
138
+ selective: false
139
+
140
+ - id: soul-ledger
141
+ name: 账本纪律(按需)
142
+ enabled: true
143
+ layer: pre-step
144
+ then:
145
+ - id: inject
146
+ kind: inject-text
147
+ config:
148
+ id: soul-ledger
149
+ strategy: context-activation
150
+ layer: pre-step
151
+ order: 123
152
+ position: before-all
153
+ role: user
154
+ templateFile: ./assets/ledger.md
155
+ params:
156
+ constant: false
157
+ keys: [账本, 未结, 承诺, 只追加]
158
+ secondaryKeys: []
159
+ selectiveLogic: AND_ANY
160
+ wordBoundary: ascii-token
161
+ activation:
162
+ scan: history
163
+ scanDepth: 6
164
+ selective: false
165
+
166
+ - id: soul-post-compaction
167
+ name: 压缩后指针纪律
168
+ enabled: true
169
+ layer: system-section
170
+ if:
171
+ phase:
172
+ compacted: true
173
+ then:
174
+ - id: inject
175
+ kind: inject-text
176
+ config:
177
+ id: soul-post-compaction
178
+ strategy: static
179
+ layer: system-section
180
+ order: 245
181
+ text: |-
182
+ 压缩摘要里每条结论都要能回到原文;回不去的写成检索入口,不要写成断言。继续推理前先核对前提。
183
+
184
+ - id: soul-tick
185
+ name: 每 12 轮自检
186
+ enabled: true
187
+ layer: system-section
188
+ if:
189
+ count:
190
+ of: turn
191
+ every: 12
192
+ then:
193
+ - id: inject
194
+ kind: inject-text
195
+ config:
196
+ id: soul-tick
197
+ strategy: static
198
+ layer: system-section
199
+ order: 246
200
+ text: |-
201
+ 自检三问:压缩后丢掉的东西还能按指针找回吗?现在是不是在错误的前提上继续推理?「还能更好」和「没做完」分得开吗?
202
+
203
+ # 状态规则:变量谓词在挂载期按来源模块(soul)读取有效值。
204
+ # 工具主语写死 moduleId: soul;模块被复制或改名后需要同步这些正文。
205
+ - id: soul-plan
206
+ name: 计划纪律(首轮,未写计划时)
207
+ enabled: true
208
+ layer: pre-step
209
+ if:
210
+ all:
211
+ - variable:
212
+ key: plan_step
213
+ op: eq
214
+ value: ''
215
+ - count:
216
+ of: user-message
217
+ per: session
218
+ max: 1
219
+ then:
220
+ - id: inject
221
+ kind: inject-text
222
+ config:
223
+ id: soul-plan
224
+ layer: pre-step
225
+ strategy: static
226
+ position: before-all
227
+ order: 124
228
+ role: user
229
+ text: |-
230
+ 先定一步计划再动手:用 module_variables(moduleId: soul,scope: module)读取 plan_step 与 plan_at,
231
+ 写入一行「下一步 + 判据」,带回 expectedRevisions;计划变了就覆盖,不要留旧计划当真相。
232
+ 连续三步没有进展时停下来重写计划,而不是继续加动作。
233
+ 需要看装配进度时先 module_manifest(moduleId: soul)action=next,再决定改计划还是先装配。
234
+
235
+ - id: soul-scaffold
236
+ name: 书房装配(首轮,未装配时)
237
+ enabled: true
238
+ layer: pre-step
239
+ if:
240
+ all:
241
+ - variable:
242
+ key: scaffold_done
243
+ op: eq
244
+ value: ''
245
+ - count:
246
+ of: user-message
247
+ per: session
248
+ max: 1
249
+ then:
250
+ - id: inject
251
+ kind: inject-text
252
+ config:
253
+ id: soul-scaffold
254
+ layer: pre-step
255
+ strategy: static
256
+ position: before-all
257
+ order: 125
258
+ role: user
259
+ text: |-
260
+ 书房还没装配:先 module_manifest(moduleId: soul)action=next 看第一条缺失,
261
+ 再 action=check 看已有文件的状况,最后由用户决定是否 action=apply。
262
+ AGENTS.md 落在 data/AGENTS.md(模板 assets/templates/agents-template.md),已存在不覆盖,
263
+ 它不是工作区指令文件;apply 只建目录、只落缺失文件,已存在的一律不碰;
264
+ 装配完成后把 scaffold_done 置为 true。
265
+
266
+ - id: soul-check
267
+ name: 检查失败处置
268
+ enabled: true
269
+ layer: system-section
270
+ if:
271
+ variable:
272
+ key: check_failed
273
+ op: gt
274
+ value: '0'
275
+ then:
276
+ - id: inject
277
+ kind: inject-text
278
+ config:
279
+ id: soul-check
280
+ layer: system-section
281
+ strategy: static
282
+ order: 247
283
+ text: |-
284
+ 上一轮自检有失败项:先 module_manifest(moduleId: soul)action=check 重新核对,
285
+ 把结论写进 check_verdict(ok/fail)、check_at(时间)与 check_failed(失败数),
286
+ 再说清是哪一条、证据是什么、下一步改哪个文件或哪条规则;
287
+ 不要用「已修复」代替重新检查,也不要把失败项藏进总结。
288
+
289
+ - id: soul-ledger-open
290
+ name: 未结账本提醒
291
+ enabled: true
292
+ layer: pre-step
293
+ if:
294
+ variable:
295
+ key: ledger_open
296
+ op: gt
297
+ value: '0'
298
+ then:
299
+ - id: inject
300
+ kind: inject-text
301
+ config:
302
+ id: soul-ledger-open
303
+ layer: pre-step
304
+ strategy: static
305
+ position: before-all
306
+ order: 126
307
+ role: user
308
+ text: |-
309
+ 账本还有未结事项:回复里逐条收口,或说清为什么先放着。
310
+ 需要追加时用 module_file_append(moduleId: soul,path: data/02-墨.jsonl,entry: {...}),
311
+ 只往后加,不改旧行;收口后把 ledger_open 减到 0。
@@ -0,0 +1,122 @@
1
+ # Superpowers 引导 —— 上游 using-superpowers 的 DSH 常驻副本。
2
+ #
3
+ # 来源:obra/superpowers v7.0.1 的 `skills/using-superpowers/SKILL.md` 原文
4
+ # (与 $DSH_HOME/skills/using-superpowers/SKILL.md 同源)。上游用 SessionStart
5
+ # hook 注入整份技能正文;DSH 没有该 hook 通道,本模块把同一份正文放进常驻
6
+ # system-section。DSH 适配只有三处:skill_search/skill_load 调用方式、
7
+ # superpowers:<name> 前缀映射、DSH 平台适配参考文件的路径。
8
+ #
9
+ # Skill Routing 表按上游 README 的「The Basic Workflow」(brainstorming →
10
+ # using-git-worktrees → writing-plans → subagent-driven-development/executing-plans
11
+ # → test-driven-development → requesting-code-review → finishing-a-development-branch)
12
+ # 与「Skills Library」分类整理,技能名与描述保持英文原文。
13
+ #
14
+ # 只进主会话:上游 <SUBAGENT-STOP> 段保留在正文里,这里再用 scope 门做硬保证。
15
+ # 与 ponytail 的冲突:用户指令优先;要消歧就在工作台停用一个,停用即回滚。
16
+
17
+ id: superpowers
18
+ name: Superpowers 技能优先引导(bootstrap)
19
+ version: 1.3.0
20
+ engineCompat: ">=0.4.2"
21
+ description: 常驻注入上游 using-superpowers 技能原文(v7.0.1):任何回答或动作前先查技能,附技能优先级、英文路由表、红旗清单与用户指令优先级。技能正文留在技能库,本模块不分发技能文件。
22
+ meta:
23
+ source: manual
24
+ modules:
25
+ - rule-engine
26
+ order: 8
27
+ rules:
28
+ - id: superpowers-bootstrap
29
+ name: Superpowers 引导(常驻·上游原文)
30
+ enabled: true
31
+ if:
32
+ scope:
33
+ audience: main
34
+ layer: system-section
35
+ then:
36
+ - id: inject
37
+ kind: inject-text
38
+ config:
39
+ id: superpowers-bootstrap
40
+ strategy: static
41
+ layer: system-section
42
+ order: 210
43
+ text: |-
44
+ You have superpowers.
45
+
46
+ Below is the full content of the `using-superpowers` skill. For all other skills, use `skill_search` to find one and `skill_load` to load it by exact name. Cross-references that upstream spells `superpowers:<name>` are simply `<name>` here.
47
+
48
+ <SUBAGENT-STOP>
49
+ If you were dispatched as a subagent to execute a specific task, ignore this skill.
50
+ </SUBAGENT-STOP>
51
+
52
+ <EXTREMELY-IMPORTANT>
53
+ If you think there is even a 1% chance a skill might apply to what you are doing, you ABSOLUTELY MUST invoke the skill.
54
+
55
+ IF A SKILL APPLIES TO YOUR TASK, YOU DO NOT HAVE A CHOICE. YOU MUST USE IT.
56
+
57
+ This is not negotiable. You cannot rationalize your way out of this.
58
+ </EXTREMELY-IMPORTANT>
59
+
60
+ ## The Rule
61
+
62
+ **Invoke relevant or requested skills BEFORE any response or action** — including clarifying questions, exploring the codebase, or checking files. If it turns out wrong for the situation, you don't have to use it.
63
+
64
+ **Before entering plan mode:** if you haven't already brainstormed, invoke the brainstorming skill first.
65
+
66
+ Then announce "Using [skill] to [purpose]" and follow the skill exactly. If it has a checklist, create a todo per item.
67
+
68
+ ## Skill Priority
69
+
70
+ When multiple skills apply, process skills come first — they set the approach, then implementation skills (frontend-design, etc.) carry it out. Brainstorming and systematic-debugging are Superpowers' most common process skills, but the rule holds for any of them.
71
+
72
+ - "Let's build X" → superpowers:brainstorming first, then implementation skills.
73
+ - "Fix this bug" → superpowers:systematic-debugging first, then domain skills.
74
+
75
+ ## Skill Routing
76
+
77
+ | Task signal | Load first |
78
+ |---|---|
79
+ | Building something new; requirements still forming | `brainstorming` |
80
+ | Design approved; need an isolated workspace | `using-git-worktrees` |
81
+ | Design approved; ready to break work into tasks | `writing-plans` |
82
+ | Plan ready; execute task by task | `subagent-driven-development` (fresh subagent per task, review after each); `executing-plans` when inline is cheaper or no subagent tool |
83
+ | About to write or change implementation code | `test-driven-development` (RED-GREEN-REFACTOR) |
84
+ | Task boundary reached; review against the plan | `requesting-code-review` |
85
+ | All tasks done; merge / PR / cleanup decision | `finishing-a-development-branch` |
86
+ | Bug, failing test, unexplained behavior | `systematic-debugging` |
87
+ | About to claim the work is complete | `verification-before-completion` |
88
+ | Review feedback received | `receiving-code-review` |
89
+ | Several independent tasks that can run in parallel | `dispatching-parallel-agents` |
90
+ | Session misbehaved; diagnose the process | `diagnosing-superpowers` |
91
+ | Creating or editing a skill | `writing-skills` |
92
+
93
+ If no row matches, search with words that literally appear in the skill's name or description; an empty query lists every visible skill. When the exact name is known, `skill_load` it directly.
94
+
95
+ ## Red Flags
96
+
97
+ These thoughts mean STOP—you're rationalizing:
98
+
99
+ | Thought | Reality |
100
+ |---------|---------|
101
+ | "This is just a simple question" | Questions are tasks. Check for skills. |
102
+ | "I need more context first" | Skill check comes BEFORE clarifying questions. |
103
+ | "Let me explore the codebase first" | Skills tell you HOW to explore. Check first. |
104
+ | "I can check git/files quickly" | Files lack conversation context. Check for skills. |
105
+ | "Let me gather information first" | Skills tell you HOW to gather information. |
106
+ | "This doesn't need a formal skill" | If a skill exists, use it. |
107
+ | "I remember this skill" | Skills evolve. Read current version. |
108
+ | "This doesn't count as a task" | Action = task. Check for skills. |
109
+ | "The skill is overkill" | Simple things become complex. Use it. |
110
+ | "I'll just do this one thing first" | Check BEFORE doing anything. |
111
+ | "This feels productive" | Undisciplined action wastes time. Skills prevent this. |
112
+ | "I know what that means" | Knowing the concept ≠ using the skill. Invoke it. |
113
+
114
+ ## Platform Adaptation
115
+
116
+ If your harness appears here, read its reference file for special instructions:
117
+
118
+ - DSH (DeepSeek Harness): `references/dsh-tools.md` in `$DSH_HOME/skills/using-superpowers/`
119
+
120
+ ## User Instructions
121
+
122
+ User instructions (CLAUDE.md, AGENTS.md, GEMINI.md, etc, direct requests) take precedence over skills, which in turn override default behavior. Only skip skill workflows or instructions when your human partner has explicitly told you to.
@@ -1,67 +1,71 @@
1
- # 工具面收窄 —— 常驻核心集 + dev_tool_search 按需解锁。
1
+ # 工具面收窄 —— 常驻核心集 + tool_search 按需解锁。
2
2
  #
3
- # 为什么:工具面实测 **156 个工具、描述合计 46894 字符(≈12K token)**,每个请求都付,
4
- # 而多数请求只用到其中几个。收窄到核心集后只剩 10 个左右。
3
+ # 为什么:工具面实测 **156 个工具、描述合计 46894 字符(约 12K token)**,每个请求都付。
4
+ # 收窄到核心集后只剩十来个,其余按需解锁。
5
5
  #
6
- # 三件东西互相依赖,缺一件就退化(详见 docs/engine-reuse.md 的「工具面收窄与按需解锁」):
7
- # 1. 本模块的 `narrow-tools` 规则 —— 常驻白名单 `allow` + 动态白名单 `allowFrom`
8
- # 2. `dev-tool-search` 组合源行 —— 唯一发现入口,模型靠它搜索并解锁
9
- # 3. `allowFrom` 读回 —— 解锁名写进持久 `tool/call` 参数,下次请求起生效
10
- # 只挂插件不配 allowFrom 的话,解锁是**一次性的**(当次请求用完即被裁)。
6
+ # `tool-visibility` 声明目录与 SDK 正文的呈现、执行闸和发现来源。
7
+ # 常驻集只在这里写一次;首轮提示由普通注入动作组合。
11
8
  #
12
- # 相位用 any 两支表达(单个 phase 节点无法表达「两个相位都命中」):
13
- # `promoted` 的缺省是 **true**(= 只匹配已晋升,不是「任意」);而 `promoted: 'ignore'`
14
- # 要求同时声明只接受布尔值的 `compacted`。所以:
15
- # 支 1 `promoted: true` → 已晋升(不论压缩与否)
16
- # 支 2 `{compacted: true, promoted: false}` → 压缩后未晋升
17
- # **首轮(未晋升且未压缩)刻意不收窄**——先让模型看到完整目录,再随相位推进收窄;
18
- # 长会话必然进入上面两支,省下的正是大头。
9
+ # 解锁的生效时机:声明在每个 model step 前重算,解锁在下一步的模型请求里已经可见。
10
+ # `requireMatch: true` 是刻意的:任一常驻工具缺失(或模型解锁了不存在的名字)就放弃裁剪、
11
+ # 暴露完整目录——收窄错了会让当前工作流调不到工具,比多花上下文严重。
19
12
  #
20
- # `requireMatch: true` 是刻意的:任一 allow 工具缺失(或模型解锁了一个不存在的名字)
21
- # 就放弃裁剪、暴露完整目录。宁可多给上下文,也不静默裁成空目录——收窄错了会让当前
22
- # 工作流调不到工具,那是比多花 token 严重得多的故障。
23
- #
24
- # 工具名必须与**实际装配名**一致:本项目 harness 是 `pwsh`(不是 `bash`)、
25
- # `edit` + `write`(不是 `str_replace_editor`)。写错名字的后果很隐蔽——写进 allow 的
26
- # 名字不存在会触发 requireMatch 的 fail-open,表现为「收窄没生效」而不是报错。
13
+ # 工具名必须与**实际装配名**一致:本项目 harness 是 `pwsh`、`edit` + `write`;
14
+ # `bash` 由平台各自提供——Windows 是本模块声明的 `tool-git-bash` 行(Git Bash,`bash -c`),
15
+ # POSIX 是官方持久 bash。写错名字会触发 requireMatch 的 fail-open,表现为「收窄没生效」。
27
16
  #
28
17
  # 停用即回滚:本模块在 config.yml 的 enabled 里删掉即可,重启后工具面完全恢复。
29
18
 
30
19
  id: tool-surface
31
20
  name: 工具面收窄(核心文件与任务集)
32
- version: 1.0.0
33
- engineCompat: ">=0.4.2"
34
- description: 把工具面收窄到常驻核心集(pwsh/read/write/edit/glob/grep/todo_write/skill_search/skill_load/dev_tool_search),其余由 dev_tool_search 按需解锁;解锁名经 allowFrom 从持久 tool/call 参数回收,跨请求与压缩保留。实测工具描述合计 46894 字符。
21
+ version: 2.0.0
22
+ engineCompat: ">=0.7.2"
23
+ description: 把工具面收窄到常驻核心集(bash/pwsh/read/write/edit/glob/grep/todo_write/skill_search/skill_load/tool_search),其余由 tool_search 按需解锁;解锁名从持久调用记录(顶层 tool/call 或 PTC tool/ptc-dispatch)参数回收,跨请求与压缩保留。
35
24
  meta:
36
25
  source: manual
37
26
  modules:
38
27
  - rule-engine
39
- - dev-tool-search
28
+ - tool-search
29
+ # Windows Git Bash 适配行:以 `bash` 之名注册工具、实际执行 Git Bash。
30
+ # 不声明 layerSettings 覆盖 toolGitBashEnabled:能力卡默认就是 true,写出来只会让本模块
31
+ # 覆盖全局开关(内置模块只声明 rules/modules 的声明面契约)。
32
+ - tool-git-bash
40
33
  order: 7
41
34
  rules:
42
35
  - id: tool-surface-resident
43
36
  name: 工具面收窄(核心文件与任务集)
44
37
  enabled: true
45
- if:
46
- any:
47
- - phase: { promoteOn: either, includeSubagents: true, promoted: true }
48
- - phase: { promoteOn: either, includeSubagents: true, compacted: true, promoted: false }
49
38
  then:
50
39
  - id: narrow-tools
51
- kind: assembly
52
- target:
53
- tools:
54
- allow:
55
- - pwsh
56
- - read
57
- - write
58
- - edit
59
- - glob
60
- - grep
61
- - todo_write
62
- - skill_search
63
- - skill_load
64
- - dev_tool_search
65
- # 解锁项从 dev_tool_search 的持久调用参数回收({ tool, key } 精确匹配)。
66
- allowFrom: { tool: dev_tool_search, key: toolNames }
67
- requireMatch: true
40
+ kind: tool-visibility
41
+ allow:
42
+ - pwsh
43
+ - read
44
+ - write
45
+ - edit
46
+ - glob
47
+ - grep
48
+ - todo_write
49
+ - skill_search
50
+ - skill_load
51
+ - tool_search
52
+ # 平台各自的 bash 名:装配里没有提供方时这里就是缺失名,收窄整体失效。
53
+ - bash
54
+ discovery: { kind: tools }
55
+ requireMatch: true
56
+ - if:
57
+ count:
58
+ of: user-message
59
+ max: 1
60
+ then:
61
+ - id: discovery-notice
62
+ kind: inject-text
63
+ config:
64
+ layer: pre-step
65
+ strategy: placeholder
66
+ fill: tool-catalog
67
+ position: after-all
68
+ dedupe: session
69
+ text: 常驻工具:{{RESIDENT_TOOLS}}。缺少所需工具时,先用 {{DISCOVERY_TOOL}} 搜索并解锁。
70
+ params:
71
+ action: narrow-tools