dsh-lead-mode 0.1.7 → 0.2.1
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/README.md +38 -7
- package/README.zh-CN.md +38 -7
- package/lib/index.js +99 -40
- package/package.json +1 -1
- package/skills/lead-mode/SKILL.md +5 -1
- package/skills/team-digest/SKILL.md +200 -0
package/README.md
CHANGED
|
@@ -2,21 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
English | [中文](README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
Adds a Lead mode to DSH. One preset,
|
|
5
|
+
Adds a Lead mode to DSH. One preset, two skills, one self-check command, two reminders.
|
|
6
|
+
|
|
7
|
+
The official Team runtime ships tools: `spawn_teammate`, `send_message`, `team_task_*`. When to delegate, whom to delegate to, how to wait for a result, how to write the closing message, how to merge several members' output: none of that is in the tools. This plugin adds that layer. It does not replace the official Team mode; it sits on top of it.
|
|
6
8
|
|
|
7
9
|
Once installed, the model works the way a Lead does: split the work, delegate it, accept the result. It delegates hands-on work instead of doing everything alone.
|
|
8
10
|
|
|
9
11
|
## What you get
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
Five things. None of them touch dsh itself.
|
|
12
14
|
|
|
13
15
|
| Capability | Entry point | What you do |
|
|
14
16
|
|---|---|---|
|
|
15
17
|
| Lead mode preset | "Lead 模式" in the preset list | Switch to it |
|
|
16
18
|
| Lead working method skill | `/skill lead-mode`; the model also loads it on its own | Nothing |
|
|
19
|
+
| Team digest skill | `/skill team-digest`; the model decides at wrap-up whether to write one | Nothing |
|
|
17
20
|
| Dependency self-check | `/lead-mode` | Run it when dependencies look wrong |
|
|
18
21
|
| Two upfront reminders | Automatic | Nothing |
|
|
19
22
|
|
|
23
|
+
Additive only. `cordis.patch.yml` holds exactly two `insert` rows: this plugin, and a new `lead-mode` preset. The official `standard` preset is untouched; the new one copies 21 of its rows field for field and swaps only the persona.
|
|
24
|
+
|
|
25
|
+
It registers no tools, listens to no agent lifecycle events, and intercepts no requests. `lib/index.js` writes to two registries only: `skills` (two entries) and `commands` (one), plus a single warn at startup. Uninstall the plugin and those entries are gone; official behaviour goes back to what it was.
|
|
26
|
+
|
|
27
|
+
The one place it can collide is a skill or command with the same name. If you already have `lead-mode` or `team-digest`, the host takes the first one it sees, warns, and ignores ours; a collision means we step aside.
|
|
28
|
+
|
|
20
29
|
### 1. The Lead mode preset
|
|
21
30
|
|
|
22
31
|
Switch to it and the session's model becomes a Lead.
|
|
@@ -47,7 +56,20 @@ So the skill's default is: finish your turn after delegating and let the notific
|
|
|
47
56
|
|
|
48
57
|
Tell the teammate to put the **deliverable in its closing message** — that message is what comes back to you with the notification.
|
|
49
58
|
|
|
50
|
-
### 3. The
|
|
59
|
+
### 3. The team digest skill
|
|
60
|
+
|
|
61
|
+
At wrap-up the team's output sits in N closing messages and N worklogs, with nothing merging them. This skill writes it into one `reports/<YYYY-MM-DD>-<effort>.md`.
|
|
62
|
+
|
|
63
|
+
| Item | Rule |
|
|
64
|
+
|---|---|
|
|
65
|
+
| When | Before the final answer, when the effort had 2 or more members, or ran 2 or more rounds |
|
|
66
|
+
| Where | `reports/<YYYY-MM-DD>-<effort>.md`, one path, written once at wrap-up |
|
|
67
|
+
| Six blocks | 结论 / 谁干了什么 / 验收证据 / 偏离与未验证 / 死路与决策 / 未决与下一步 (conclusion, who did what, acceptance evidence, deviations and unverified, dead ends and decisions, open items and next steps) |
|
|
68
|
+
| Source layers | Closing messages build the skeleton, worklogs add process detail, session logs as the fallback |
|
|
69
|
+
|
|
70
|
+
The six headings are fixed Chinese strings; an empty block says 无. Take the layers in order and stop at the first one that is enough. Details are in the `team-digest` skill.
|
|
71
|
+
|
|
72
|
+
### 4. The dependency self-check command
|
|
51
73
|
|
|
52
74
|
`/lead-mode` reports the current dependency state.
|
|
53
75
|
|
|
@@ -59,9 +81,9 @@ Tell the teammate to put the **deliverable in its closing message** — that mes
|
|
|
59
81
|
|
|
60
82
|
Everything in place returns success. Anything missing returns error. Nothing is skipped silently.
|
|
61
83
|
|
|
62
|
-
###
|
|
84
|
+
### 5. Two upfront reminders
|
|
63
85
|
|
|
64
|
-
|
|
86
|
+
**When the session has no Team tools, it tells you to enable the official Agent Teams instead of letting the model work alone.**
|
|
65
87
|
|
|
66
88
|
Two channels:
|
|
67
89
|
|
|
@@ -114,6 +136,14 @@ Three steps.
|
|
|
114
136
|
|
|
115
137
|
**3. Let the model work.** With the delegation tools in place, the model splits the work, delegates to teammates, and waits for all of them before wrapping up. Without them, its first move is to tell you to enable the Team runtime.
|
|
116
138
|
|
|
139
|
+
## Using the skills without switching presets
|
|
140
|
+
|
|
141
|
+
You do not have to touch your preset. Install the plugin, keep `standard` or whatever you already use, and run `/skill lead-mode` in any session to load the method; the model also loads it when it judges the task needs it.
|
|
142
|
+
|
|
143
|
+
One thing is missing: the upfront reminder lives in the persona, so it appears only under the `lead-mode` preset. Run `/lead-mode` once before you start to check the dependencies; it prints the version-pinned install command when the Team runtime is absent.
|
|
144
|
+
|
|
145
|
+
`team-digest` works the same way. It is not tied to a preset, any session can use it, and the model decides at wrap-up whether a digest is worth writing.
|
|
146
|
+
|
|
117
147
|
## Friendly link: dsh-context
|
|
118
148
|
|
|
119
149
|
This plugin only does Lead mode. Visualising Team state and comms is **dsh-context**'s job, and that is a separate project:
|
|
@@ -199,15 +229,16 @@ The four classic subagent rows (`tool-subagent-control`, `tool-subagent-list-age
|
|
|
199
229
|
|
|
200
230
|
`apply()` in `@deepseek-ai/dsh-experimental-tool-agent-team` listens on the global `agent/created` event and installs Team tools on every agent. It is a host-plane plugin; putting it in a preset would leak it into every session.
|
|
201
231
|
|
|
202
|
-
So this plugin stays at: preset,
|
|
232
|
+
So this plugin stays at: preset, two skills, reminder. Whether the Team runtime is on is decided by the user through the official profile package.
|
|
203
233
|
|
|
204
234
|
## Layout
|
|
205
235
|
|
|
206
236
|
```
|
|
207
237
|
package.json package metadata; dsh.bundle.patch points at cordis.patch.yml
|
|
208
238
|
cordis.patch.yml two insert rows: this plugin and the lead-mode preset
|
|
209
|
-
lib/index.js host half: register
|
|
239
|
+
lib/index.js host half: scan skills/, register each one, register the command, startup check
|
|
210
240
|
skills/lead-mode/ the Lead working method
|
|
241
|
+
skills/team-digest/ the team digest method
|
|
211
242
|
dsh-plugin.naming.json naming manifest
|
|
212
243
|
test/ behaviour assertions, zero dependencies
|
|
213
244
|
```
|
package/README.zh-CN.md
CHANGED
|
@@ -2,21 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
中文 | [English](README.md)
|
|
4
4
|
|
|
5
|
-
给 DSH 加一个 Lead
|
|
5
|
+
给 DSH 加一个 Lead 模式。一个预设、两个 skill、一个自检命令、两条前置提醒。
|
|
6
|
+
|
|
7
|
+
官方 Team 运行时只给工具:`spawn_teammate`、`send_message`、`team_task_*`。什么时候派活、派给谁、怎么等结果、收尾怎么写、多成员的产出怎么合并,这些方法它不管。本插件补的就是这一层。它不替代官方 Team 模式,是配套。
|
|
6
8
|
|
|
7
9
|
装好后模型能按 Lead 的方式干活:拆活、派活、验收。动手的活尽量派出去。
|
|
8
10
|
|
|
9
11
|
## 提供的能力
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
五样东西,都不碰 dsh 本体。
|
|
12
14
|
|
|
13
15
|
| 能力 | 入口 | 你要做什么 |
|
|
14
16
|
|---|---|---|
|
|
15
17
|
| Lead 模式预设 | 预设下拉里的「Lead 模式」 | 切过去 |
|
|
16
18
|
| Lead 工作法 skill | `/skill lead-mode`,模型也会自己加载 | 不用管 |
|
|
19
|
+
| 团队汇总 skill | `/skill team-digest`,模型收尾前自己判断写不写 | 不用管 |
|
|
17
20
|
| 依赖自检 | `/lead-mode` | 依赖不对时敲一下 |
|
|
18
21
|
| 两层前置提醒 | 自动 | 不用管 |
|
|
19
22
|
|
|
23
|
+
只新增,不修改。`cordis.patch.yml` 全文只有两行 `insert`:一行本插件,一行新建的 `lead-mode` 预设。官方 `standard` 预设一个字没动,新预设的 21 行逐字段照抄它,只换 persona。
|
|
24
|
+
|
|
25
|
+
不注册任何工具,不监听 agent 生命周期,不拦截任何请求。`lib/index.js` 只往两个注册表写:`skills`(两个 skill)与 `commands`(一个命令);启动时另打一条 warn。卸载后这些条目全部消失,官方行为回到原样。
|
|
26
|
+
|
|
27
|
+
唯一可能撞的地方是同名 skill 或命令。你已经装了 `lead-mode` 或 `team-digest` 时,宿主按先到先得处理,打一条 warn,忽略本插件那条;撞了也只是我们让位。
|
|
28
|
+
|
|
20
29
|
### 一、Lead 模式预设
|
|
21
30
|
|
|
22
31
|
切过去,这个会话的模型就换成 Lead 人设。
|
|
@@ -47,7 +56,20 @@
|
|
|
47
56
|
|
|
48
57
|
派活 prompt 里要要求 teammate **把交付物写进收尾那条消息**——那条消息会随通知回到你手上。
|
|
49
58
|
|
|
50
|
-
###
|
|
59
|
+
### 三、团队汇总 skill
|
|
60
|
+
|
|
61
|
+
收尾时全队产出散在 N 条收尾消息和 N 份工作日志里,没人合并,过一周想回看就得重新查一遍。这个 skill 把它们合成一份 `reports/<YYYY-MM-DD>-<effort>.md`。
|
|
62
|
+
|
|
63
|
+
| 项 | 规则 |
|
|
64
|
+
|---|---|
|
|
65
|
+
| 什么时候写 | 给最终答复前,本 effort 有 2 个以上成员,或跨 2 轮以上 |
|
|
66
|
+
| 写到哪 | `reports/<YYYY-MM-DD>-<effort>.md`,单一路径,收尾一次成型 |
|
|
67
|
+
| 六块骨架 | 结论 / 谁干了什么 / 验收证据 / 偏离与未验证 / 死路与决策 / 未决与下一步 |
|
|
68
|
+
| 原料分层 | 收尾消息做骨架,工作日志补过程细节,会话日志兜底 |
|
|
69
|
+
|
|
70
|
+
六块标题写死,某块没内容就写「无」。原料按顺序取,上层够用就不下钻。细节看 `team-digest` skill。
|
|
71
|
+
|
|
72
|
+
### 四、依赖自检命令
|
|
51
73
|
|
|
52
74
|
`/lead-mode` 报告当前依赖状态。
|
|
53
75
|
|
|
@@ -59,9 +81,9 @@
|
|
|
59
81
|
|
|
60
82
|
依赖齐全返回 success,缺东西返回 error。不会静默跳过。
|
|
61
83
|
|
|
62
|
-
###
|
|
84
|
+
### 五、两层前置提醒
|
|
63
85
|
|
|
64
|
-
|
|
86
|
+
**本会话没有 Team 工具时,提醒你去开官方 Agent Teams,而不是让模型硬干。**
|
|
65
87
|
|
|
66
88
|
走两条路:
|
|
67
89
|
|
|
@@ -114,6 +136,14 @@ dsh plugin --profile <你的 profile 名> add https://github.com/xiebaiyuan/dsh-
|
|
|
114
136
|
|
|
115
137
|
**3. 让模型干活。** 派活工具齐了,模型会自己拆活、派给 teammate、等齐再收尾。工具不齐,它第一句就是让你去开 Team 运行时。
|
|
116
138
|
|
|
139
|
+
## 只用 skill,不换预设
|
|
140
|
+
|
|
141
|
+
预设不动也能用。插件装好,预设保持 `standard` 或你自己的,任何会话敲 `/skill lead-mode` 就加载那套方法;模型判断任务需要时也会自己加载。
|
|
142
|
+
|
|
143
|
+
少了一样东西:persona 里那段前置提醒只在 `lead-mode` 预设里,不切过去就看不到。所以第一次先敲 `/lead-mode` 看依赖,缺 Team 运行时会给出带版本号的安装命令。
|
|
144
|
+
|
|
145
|
+
`team-digest` 同理。它不绑预设,任何会话可用,收尾时模型自己判断要不要写汇总。
|
|
146
|
+
|
|
117
147
|
## 友链:dsh-context
|
|
118
148
|
|
|
119
149
|
本插件只做 Lead 模式。团队状态与通信的可视化是 **dsh-context** 的活,那是另一个项目:
|
|
@@ -199,15 +229,16 @@ classic subagent 四行(`tool-subagent-control`、`tool-subagent-list-agents`
|
|
|
199
229
|
|
|
200
230
|
`@deepseek-ai/dsh-experimental-tool-agent-team` 的 `apply()` 监听全局 `agent/created`,给每一个 agent 装 Team 工具。它是 host 平面的插件,放进预设会漏到所有会话。
|
|
201
231
|
|
|
202
|
-
所以本插件的定位是:预设 + skill + 提醒。开不开 Team 运行时,用户用官方 profile 包决定。
|
|
232
|
+
所以本插件的定位是:预设 + 两个 skill + 提醒。开不开 Team 运行时,用户用官方 profile 包决定。
|
|
203
233
|
|
|
204
234
|
## 目录
|
|
205
235
|
|
|
206
236
|
```
|
|
207
237
|
package.json 包元数据,dsh.bundle.patch 指向 cordis.patch.yml
|
|
208
238
|
cordis.patch.yml 两行 insert:本插件 + lead-mode 预设
|
|
209
|
-
lib/index.js host
|
|
239
|
+
lib/index.js host 半边:扫 skills/ 逐个注册、注册命令、启动自检
|
|
210
240
|
skills/lead-mode/ Lead 工作法正文
|
|
241
|
+
skills/team-digest/ 团队汇总正文
|
|
211
242
|
dsh-plugin.naming.json 命名清单
|
|
212
243
|
test/ 行为断言,零依赖
|
|
213
244
|
```
|
package/lib/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dsh-lead-mode host half.
|
|
3
3
|
*
|
|
4
|
-
* Three jobs: register
|
|
5
|
-
*
|
|
4
|
+
* Three jobs: register every bundled runtime skill (`skills/<name>/SKILL.md`,
|
|
5
|
+
* discovered at apply time), register the `/lead-mode` slash command, and warn
|
|
6
|
+
* at startup when the Team runtime is absent.
|
|
6
7
|
*
|
|
7
8
|
* The plugin declares no `inject` of its own. Each surface waits for its own
|
|
8
9
|
* service through `ctx.inject()`, so a host missing `dsh-skill` still mounts the
|
|
@@ -12,7 +13,8 @@
|
|
|
12
13
|
*
|
|
13
14
|
* @module dsh-lead-mode
|
|
14
15
|
*/
|
|
15
|
-
import { readFileSync } from 'node:fs'
|
|
16
|
+
import { readFileSync, readdirSync } from 'node:fs'
|
|
17
|
+
import { join } from 'node:path'
|
|
16
18
|
import { fileURLToPath } from 'node:url'
|
|
17
19
|
|
|
18
20
|
/** Cordis plugin name. */
|
|
@@ -27,11 +29,8 @@ const ENABLE_COMMAND = `dsh plugin --profile <你的 profile 名> add ${TEAM_PRO
|
|
|
27
29
|
/** Why the version pin matters, repeated wherever the command appears. */
|
|
28
30
|
const VERSION_NOTE = '不带版本号会装到 0.1.5-alpha.2,和 0.2.1 宿主对不上。'
|
|
29
31
|
|
|
30
|
-
/**
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
/** Skill name shared by the file on disk, the runtime registration, and the naming manifest. */
|
|
34
|
-
const SKILL_NAME = 'lead-mode'
|
|
32
|
+
/** Directory holding one subdirectory per bundled skill; the directory name is the skill name. */
|
|
33
|
+
const SKILLS_DIR = new URL('../skills/', import.meta.url)
|
|
35
34
|
|
|
36
35
|
/** Command name shared by the registration and the naming manifest. */
|
|
37
36
|
const COMMAND_NAME = 'lead-mode'
|
|
@@ -40,25 +39,104 @@ const COMMAND_NAME = 'lead-mode'
|
|
|
40
39
|
const PRESET_ID = 'lead-mode'
|
|
41
40
|
|
|
42
41
|
/**
|
|
43
|
-
* Read
|
|
42
|
+
* Read one bundled skill and split off its YAML frontmatter.
|
|
44
43
|
*
|
|
45
44
|
* The runtime skill registry wants `description` as its own field, so the body
|
|
46
45
|
* handed to it must not repeat the frontmatter block. Reading synchronously
|
|
47
|
-
* keeps `apply` synchronous;
|
|
46
|
+
* keeps `apply` synchronous; each file is a few kilobytes shipped inside this
|
|
48
47
|
* package, so there is no I/O worth deferring.
|
|
49
48
|
*
|
|
50
|
-
*
|
|
49
|
+
* A skill directory whose file is unreadable, has no frontmatter, declares no
|
|
50
|
+
* `name`, mismatches its directory name, declares no `description`, or has an
|
|
51
|
+
* empty body is reported through `warn` and dropped. One broken skill must not
|
|
52
|
+
* take the whole injection down with it.
|
|
53
|
+
*
|
|
54
|
+
* @param skillsRoot - absolute path of the `skills/` directory.
|
|
55
|
+
* @param dirName - the skill directory name, which is also the expected skill name.
|
|
56
|
+
* @param warn - receives one Chinese diagnostic per skipped skill.
|
|
57
|
+
* @returns the registry payload, or `undefined` when this skill was skipped.
|
|
51
58
|
*/
|
|
52
|
-
function readBundledSkill() {
|
|
53
|
-
const path =
|
|
54
|
-
|
|
59
|
+
function readBundledSkill(skillsRoot, dirName, warn) {
|
|
60
|
+
const path = join(skillsRoot, dirName, 'SKILL.md')
|
|
61
|
+
let raw
|
|
62
|
+
try {
|
|
63
|
+
raw = readFileSync(path, 'utf8')
|
|
64
|
+
} catch (error) {
|
|
65
|
+
warn(`[lead-mode] 读不到 ${path},${dirName} 这个 skill 跳过:${String(error)}`)
|
|
66
|
+
return undefined
|
|
67
|
+
}
|
|
55
68
|
const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?/.exec(raw)
|
|
56
|
-
if (match === null)
|
|
57
|
-
|
|
58
|
-
|
|
69
|
+
if (match === null) {
|
|
70
|
+
warn(`[lead-mode] ${path} 没有 YAML frontmatter,${dirName} 这个 skill 跳过`)
|
|
71
|
+
return undefined
|
|
72
|
+
}
|
|
73
|
+
const declared = /^name:\s*(.+)$/m.exec(match[1])?.[1]?.trim()
|
|
74
|
+
if (declared !== dirName) {
|
|
75
|
+
warn(`[lead-mode] ${path} 的 frontmatter name 是「${declared ?? '缺'}」,与目录名「${dirName}」不一致,跳过这一个`)
|
|
76
|
+
return undefined
|
|
77
|
+
}
|
|
78
|
+
const description = /^description:\s*(.+)$/m.exec(match[1])?.[1]?.trim()
|
|
79
|
+
if (description === undefined) {
|
|
80
|
+
warn(`[lead-mode] ${path} 的 frontmatter 没有 description,${dirName} 这个 skill 跳过`)
|
|
81
|
+
return undefined
|
|
82
|
+
}
|
|
59
83
|
const content = raw.slice(match[0].length).trim()
|
|
60
|
-
if (content.length === 0)
|
|
61
|
-
|
|
84
|
+
if (content.length === 0) {
|
|
85
|
+
warn(`[lead-mode] ${path} 正文是空的,${dirName} 这个 skill 跳过`)
|
|
86
|
+
return undefined
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
name: declared,
|
|
90
|
+
description,
|
|
91
|
+
content,
|
|
92
|
+
// `source` is required by the registry's load-time validation but is NOT
|
|
93
|
+
// defaulted by `register()`: `validateRuntimeSkill` (register) checks only
|
|
94
|
+
// name, description and invocation, while `validateDefinition` (load)
|
|
95
|
+
// throws unless `source` is a string. Omitting it registers fine and then
|
|
96
|
+
// fails every `skill` tool call with `source must be a string`.
|
|
97
|
+
source: `dsh-lead-mode/skills/${declared}/SKILL.md`,
|
|
98
|
+
path,
|
|
99
|
+
invocation: { modelInvocable: true, userInvocable: true },
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Scan `skillsRoot` and register every valid bundled skill.
|
|
105
|
+
*
|
|
106
|
+
* Directory order is sorted so the registration order is stable across hosts.
|
|
107
|
+
* A missing or unreadable root, an unreadable skill file, and a registry that
|
|
108
|
+
* throws on one skill all degrade to a warning instead of failing the callback.
|
|
109
|
+
*
|
|
110
|
+
* @param skillsRoot - absolute path of the `skills/` directory.
|
|
111
|
+
* @param registry - the `skills` service (`register(definition)`).
|
|
112
|
+
* @param warn - receives one Chinese diagnostic per skipped skill.
|
|
113
|
+
* @returns the names that were registered, in registration order.
|
|
114
|
+
*/
|
|
115
|
+
export function syncBundledSkills(skillsRoot, registry, warn) {
|
|
116
|
+
let entries
|
|
117
|
+
try {
|
|
118
|
+
entries = readdirSync(skillsRoot, { withFileTypes: true })
|
|
119
|
+
} catch (error) {
|
|
120
|
+
warn(`[lead-mode] 扫描 ${skillsRoot} 失败,本插件的 skill 都没注册:${String(error)}`)
|
|
121
|
+
return []
|
|
122
|
+
}
|
|
123
|
+
const dirNames = entries
|
|
124
|
+
.filter((entry) => entry.isDirectory())
|
|
125
|
+
.map((entry) => entry.name)
|
|
126
|
+
.sort()
|
|
127
|
+
const registered = []
|
|
128
|
+
for (const dirName of dirNames) {
|
|
129
|
+
const skill = readBundledSkill(skillsRoot, dirName, warn)
|
|
130
|
+
if (skill === undefined) continue
|
|
131
|
+
try {
|
|
132
|
+
registry.register(skill)
|
|
133
|
+
} catch (error) {
|
|
134
|
+
warn(`[lead-mode] 注册 skill ${skill.name} 失败:${String(error)}`)
|
|
135
|
+
continue
|
|
136
|
+
}
|
|
137
|
+
registered.push(skill.name)
|
|
138
|
+
}
|
|
139
|
+
return registered
|
|
62
140
|
}
|
|
63
141
|
|
|
64
142
|
/**
|
|
@@ -155,26 +233,7 @@ export function apply(ctx) {
|
|
|
155
233
|
const warn = (message) => ctx.logger.warn(message)
|
|
156
234
|
|
|
157
235
|
ctx.inject(['skills'], (skillsCtx) => {
|
|
158
|
-
|
|
159
|
-
try {
|
|
160
|
-
skill = readBundledSkill()
|
|
161
|
-
} catch (error) {
|
|
162
|
-
warn(`[lead-mode] 读不到 skills/lead-mode/SKILL.md,lead-mode skill 没注册:${String(error)}`)
|
|
163
|
-
return
|
|
164
|
-
}
|
|
165
|
-
skillsCtx.skills.register({
|
|
166
|
-
name: SKILL_NAME,
|
|
167
|
-
description: skill.description,
|
|
168
|
-
content: skill.content,
|
|
169
|
-
// `source` is required by the registry's load-time validation but is NOT
|
|
170
|
-
// defaulted by `register()`: `validateRuntimeSkill` (register) checks only
|
|
171
|
-
// name, description and invocation, while `validateDefinition` (load)
|
|
172
|
-
// throws unless `source` is a string. Omitting it registers fine and then
|
|
173
|
-
// fails every `skill` tool call with `source must be a string`.
|
|
174
|
-
source: 'dsh-lead-mode/skills/lead-mode/SKILL.md',
|
|
175
|
-
path: skill.path,
|
|
176
|
-
invocation: { modelInvocable: true, userInvocable: true },
|
|
177
|
-
})
|
|
236
|
+
syncBundledSkills(fileURLToPath(SKILLS_DIR), skillsCtx.skills, warn)
|
|
178
237
|
})
|
|
179
238
|
|
|
180
239
|
ctx.inject(['commands'], (commandsCtx) => {
|
|
@@ -186,7 +245,7 @@ export function apply(ctx) {
|
|
|
186
245
|
})
|
|
187
246
|
|
|
188
247
|
if (ctx.get('skills') === undefined) {
|
|
189
|
-
warn('[lead-mode] skills
|
|
248
|
+
warn('[lead-mode] skills 服务不在,本插件的 skill 暂时都没注册。它会等 dsh-skill 挂载后再注册;一直不出现就检查 dsh-skill 是否装好。')
|
|
190
249
|
}
|
|
191
250
|
if (ctx.get('commands') === undefined) {
|
|
192
251
|
warn('[lead-mode] commands 服务不在,/lead-mode 命令暂时没注册。它会等 dsh-commands 挂载后再注册。')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-lead-mode",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Lead mode for DSH: an agent preset, a working-method skill, a dependency self-check, and two reminders that tell you to enable the official Agent Teams. | 给 DSH 加 Lead 模式:预设、skill、依赖自检、两条前置提醒。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -142,7 +142,7 @@ teammate 收工时,它**最后那条消息**会随通知回到你手上,格
|
|
|
142
142
|
|
|
143
143
|
位置固定在 `.scratch/<effort>/`。一人一个 `worklog-<mate>.md`,换人时写 `handoff-<mate>-<n>.md`。
|
|
144
144
|
|
|
145
|
-
`.scratch`
|
|
145
|
+
`.scratch` 存在就用(通常是 `obsidian-docs/scratch/` 的软链,笔记库能看见,不进 git);不存在就先建目录,别假设它一定有。
|
|
146
146
|
|
|
147
147
|
工作日志(worklog)分两段:
|
|
148
148
|
|
|
@@ -243,6 +243,10 @@ teammate 继承你(Lead)在 spawn 那一刻的 provider 和 model。想换
|
|
|
243
243
|
|
|
244
244
|
派活时可以直接告诉用户去这儿看进度,比自己复述一遍更清楚。
|
|
245
245
|
|
|
246
|
+
## 收尾要写团队汇总
|
|
247
|
+
|
|
248
|
+
本 effort 有 2 个以上成员或跨 2 轮以上时,收尾要写一份团队汇总。加载 `team-digest` skill:触发阈值、落盘路径、六块骨架、原料取法都在那里,这里不展开格式。
|
|
249
|
+
|
|
246
250
|
## 给最终答复前
|
|
247
251
|
|
|
248
252
|
- 必需的 teammate 都等齐了再答。没等齐就说「还在跑」,别把半成品当结论。
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: team-digest
|
|
3
|
+
description: 收尾、结项、写报告时用的团队汇总。把多个成员的产出合并成一份 markdown,本 effort 有 2 个以上成员或跨 2 轮以上才写。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 团队汇总
|
|
7
|
+
|
|
8
|
+
成员各交一段收尾消息,各写一份工作日志。收尾时没人合并,用户得自己翻 N 条通知,过一周想回看还得重新调查一遍。这份 skill 产出那份合并物。
|
|
9
|
+
|
|
10
|
+
主要用途是日后回看。当场看懂是它的副产物,不要为了「当场好看」多写。
|
|
11
|
+
|
|
12
|
+
## 什么时候写
|
|
13
|
+
|
|
14
|
+
给最终答复之前判断,满足一条就写:
|
|
15
|
+
|
|
16
|
+
| 条件 | 说明 |
|
|
17
|
+
|---|---|
|
|
18
|
+
| 本 effort 有 2 个以上成员 | 一人一段就要合并,否则用户得自己拼 |
|
|
19
|
+
| 跨 2 轮以上 | 同一成员多轮、或换过续作成员,过程散在多轮里 |
|
|
20
|
+
|
|
21
|
+
不写的情况:只有一个成员一轮干完、只查了资料没改动、纯问答。别为一次调用产出一份报告。
|
|
22
|
+
|
|
23
|
+
## 写到哪
|
|
24
|
+
|
|
25
|
+
`reports/<YYYY-MM-DD>-<effort>.md`,相对仓库根,单一路径。
|
|
26
|
+
|
|
27
|
+
- `<effort>` 用 `.scratch/` 下那个目录名,和工作日志同源,别另起一套命名。
|
|
28
|
+
- 不新增目录层级,不加 `-v2`、`-final` 这类后缀。
|
|
29
|
+
- 同一 effort 同一天只写一份。收尾时一次成型,不追加、不做增量、不设「晋升」步骤。
|
|
30
|
+
- 想进笔记库,自己给 `reports` 建软链,不要改路径。
|
|
31
|
+
- 目录不存在就建。建不了(只读挂载等)就在最终答复里说清楚,别悄悄丢。
|
|
32
|
+
|
|
33
|
+
## 六块骨架
|
|
34
|
+
|
|
35
|
+
六块标题写死:不改名、不合并、不跳块。某块没内容就写「无」。
|
|
36
|
+
|
|
37
|
+
| 块 | 标题 | 写什么 |
|
|
38
|
+
|---|---|---|
|
|
39
|
+
| 1 | 结论 | 做完了什么、能不能用,一到两句。不放清单 |
|
|
40
|
+
| 2 | 谁干了什么 | 表格:成员 / 交付物 / 状态 / 过程产物指针 |
|
|
41
|
+
| 3 | 验收证据 | 一条一行:可粘贴的命令 + 输出摘要 + 是不是 Lead 自己复跑过 |
|
|
42
|
+
| 4 | 偏离与未验证 | 偏离规格的、只口头声称没证据的 |
|
|
43
|
+
| 5 | 死路与决策 | 结论级死路一行一条;不可逆决策一条一记录 |
|
|
44
|
+
| 6 | 未决与下一步 | 还没定的、下一轮第一件事、明确不做什么 |
|
|
45
|
+
|
|
46
|
+
照这个骨架填,标题一个字都别改:
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
# 团队汇总 · <effort>
|
|
50
|
+
|
|
51
|
+
## 结论
|
|
52
|
+
|
|
53
|
+
## 谁干了什么
|
|
54
|
+
|
|
55
|
+
| 成员 | 交付物 | 状态 | 过程产物指针 |
|
|
56
|
+
|---|---|---|---|
|
|
57
|
+
|
|
58
|
+
## 验收证据
|
|
59
|
+
|
|
60
|
+
## 偏离与未验证
|
|
61
|
+
|
|
62
|
+
### 未验证清单
|
|
63
|
+
|
|
64
|
+
## 死路与决策
|
|
65
|
+
|
|
66
|
+
## 未决与下一步
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
第 4 块是隔离区。「已通过」但拿不出证据的东西只能写在这里,不许混进第 1、2、3 块。
|
|
70
|
+
|
|
71
|
+
### 第 2 块的状态列
|
|
72
|
+
|
|
73
|
+
只有五个取值,别扩展:
|
|
74
|
+
|
|
75
|
+
| 取值 | 什么时候用 |
|
|
76
|
+
|---|---|
|
|
77
|
+
| 完成 | 交付物在,验收证据也核过 |
|
|
78
|
+
| 未验证 | 交付物在,但只有口头声称,没有可复跑的证据 |
|
|
79
|
+
| 卡住 | 没干完,阻塞点还在 |
|
|
80
|
+
| 被打断 | 被 `interrupt_agent` 或用户中途停掉 |
|
|
81
|
+
| 上下文已降级 | 会话被自动压缩过,细节只剩摘要 |
|
|
82
|
+
|
|
83
|
+
除「完成」外,其余四个都要在末尾「未验证」清单里点名。
|
|
84
|
+
|
|
85
|
+
### 第 3 块怎么写
|
|
86
|
+
|
|
87
|
+
每条证据占一行,三项齐:命令、输出摘要、是否复跑。
|
|
88
|
+
|
|
89
|
+
- 命令要能直接粘贴,带工作目录或绝对路径。
|
|
90
|
+
- 输出摘要写判定结果,比如 `31 pass / 0 fail`、`diff 为空`,不贴整段日志。
|
|
91
|
+
- 复跑分三种:Lead 自己跑过、只有成员跑过、谁都没跑。第三种不算证据。
|
|
92
|
+
|
|
93
|
+
### 第 5 块怎么写
|
|
94
|
+
|
|
95
|
+
死路按结论级写,一行一条,形状是「试过 X,不行,因为 Y」。不写探索过程。
|
|
96
|
+
|
|
97
|
+
不可逆决策一条一记录,五个字段:
|
|
98
|
+
|
|
99
|
+
1. 背景:当时卡在什么上。
|
|
100
|
+
2. 备选:还考虑过什么。
|
|
101
|
+
3. 选的:最后选了哪个。
|
|
102
|
+
4. 依据:为什么是它。
|
|
103
|
+
5. 什么情况下推翻:什么信号出现就该翻案。
|
|
104
|
+
|
|
105
|
+
## 原料怎么取
|
|
106
|
+
|
|
107
|
+
三层,按顺序取,别跳级。上层够用就不下钻。
|
|
108
|
+
|
|
109
|
+
| 层 | 来源 | 取什么 |
|
|
110
|
+
|---|---|---|
|
|
111
|
+
| 1 | 收尾消息 | 结论、文件清单、验收输出、偏离规格四块,做骨架 |
|
|
112
|
+
| 2 | 工作日志 | `.scratch/<effort>/worklog-<mate>.md`,过程细节、死路、决策 |
|
|
113
|
+
| 3 | 会话日志 | 兜底,只在收尾消息缺字段或工作日志不存在时 |
|
|
114
|
+
|
|
115
|
+
### 第 1 层:收尾消息
|
|
116
|
+
|
|
117
|
+
成员收工时,它最后那条消息随通知进你的上下文。大多数情况这一层就够写第 1、2、3 块。
|
|
118
|
+
|
|
119
|
+
有两种情况会缺:
|
|
120
|
+
|
|
121
|
+
- 上下文被压缩,早期成员的通知只剩摘要。
|
|
122
|
+
- 成员收工前刚发过 `send_message`,收尾正文会被省掉。
|
|
123
|
+
|
|
124
|
+
捞回来用 `session_event_search`,`session_id` 填自己的会话 id,`surfaces` 同时带被遮蔽和只进日志两面:
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
session_event_search({
|
|
128
|
+
session_id: '<你自己的会话 id>',
|
|
129
|
+
query: '<成员名或交付物关键词>',
|
|
130
|
+
surfaces: ['shadowed', 'log-only'],
|
|
131
|
+
})
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
`query` 是必填的全文关键词,做的是字符串匹配,不是语义检索。写成员名或文件名最准。
|
|
135
|
+
|
|
136
|
+
### 第 2 层:工作日志
|
|
137
|
+
|
|
138
|
+
路径固定 `.scratch/<effort>/worklog-<mate>.md`。头部状态摘要给第 2 块,下面的轮次记录给第 4、5 块。
|
|
139
|
+
|
|
140
|
+
文件不存在不算异常:说明该成员没按派活要求写日志,第 2 块状态照实写,末尾清单点名。
|
|
141
|
+
|
|
142
|
+
### 第 3 层:会话日志下钻
|
|
143
|
+
|
|
144
|
+
只在「收尾消息缺字段」或「工作日志不存在」时用,**一个成员最多下钻一次**。
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
session_event_search({
|
|
148
|
+
session_id: '<成员 id>',
|
|
149
|
+
event_types: ['assistant/message'],
|
|
150
|
+
})
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
两条限制:
|
|
154
|
+
|
|
155
|
+
- 跨 cwd 读不到。成员会话的工作目录必须和 Lead 相同,否则这条查不到东西。
|
|
156
|
+
- 下钻一次还不齐就写「未验证」,不要反复翻。
|
|
157
|
+
|
|
158
|
+
## 证据指针怎么挂
|
|
159
|
+
|
|
160
|
+
按证据类型挂,挂错类型等于没挂。
|
|
161
|
+
|
|
162
|
+
| 证据类型 | 挂什么 | 例子 |
|
|
163
|
+
|---|---|---|
|
|
164
|
+
| 改动 | `路径:行号` | `skills/team-digest/SKILL.md:38` |
|
|
165
|
+
| 验收 | 可粘贴命令 | `node --test test/*.test.mjs` |
|
|
166
|
+
| 决策 | 工作日志段名,或 `session-<id>#seq` | `worklog-skill-author.md 第 5 块` |
|
|
167
|
+
|
|
168
|
+
指针指向已有产物,不复制正文。复制两份,改一份就有一份在骗人。
|
|
169
|
+
|
|
170
|
+
## 异常成员怎么处理
|
|
171
|
+
|
|
172
|
+
| 情况 | 第 2 块状态 | 额外动作 |
|
|
173
|
+
|---|---|---|
|
|
174
|
+
| 没交收尾消息 | 被打断 | 末尾清单列出它负责的交付物 |
|
|
175
|
+
| 只有「已通过」「已修复」这类话 | 未验证 | 能复跑就复跑,跑不了就照实写缺什么 |
|
|
176
|
+
| 工作日志没写 | 按实际交付判 | 末尾清单点名「无工作日志」 |
|
|
177
|
+
| 被压缩过 | 上下文已降级 | 需要细节时下钻一次,结论降一档置信度 |
|
|
178
|
+
| 创建失败或始终没起来 | 卡住 | 单列一行,写清失败现象 |
|
|
179
|
+
|
|
180
|
+
「未验证」清单不是第 4 块的替代品:第 4 块写偏离规格和无证据的结论,清单写「谁、什么没验、缺什么证据」。
|
|
181
|
+
|
|
182
|
+
## 宿主事实
|
|
183
|
+
|
|
184
|
+
这些是宿主当前行为,别按直觉推:
|
|
185
|
+
|
|
186
|
+
| 事实 | 后果 |
|
|
187
|
+
|---|---|
|
|
188
|
+
| `team_task_update` 的 `complete` 不能带结果载荷 | 任务板不是结果记录本,结论只能写进汇总 |
|
|
189
|
+
| `wait_agent` 只返回 `{timedOut, noProgress}` | 它不带任何内容,别指望从返回值里拿到成员说了什么 |
|
|
190
|
+
| 宿主没有报告类工具 | 汇总只能自己组织,没有现成模板命令可调 |
|
|
191
|
+
| 压缩事件(`compaction/start` 等)都是 log-only | 检索必须显式带 `surfaces: ['log-only']`,否则查不到 |
|
|
192
|
+
| 成员名额 `maxMembers` 由 profile 层设为 8 | 名字永不释放,创建失败也占名额 |
|
|
193
|
+
|
|
194
|
+
## 写作口径
|
|
195
|
+
|
|
196
|
+
- 中文,短句,结论在前。
|
|
197
|
+
- 没实测的数字不写精确值,写「未验证」。
|
|
198
|
+
- 六块标题写死,不许改名、不许合并、不许跳块。
|
|
199
|
+
- 纯 markdown,零外部依赖。Obsidian、answer-me-with-html、dsh-context 一律「装了才用」,没装也要能写完。
|
|
200
|
+
- 术语固定四个:团队汇总、死路、过程产物、证据指针。不另造近义词。
|