sillyspec 3.26.10 → 3.26.11
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/.claude/skills/sillyspec-archive/SKILL.md +85 -85
- package/.claude/skills/sillyspec-brainstorm/SKILL.md +114 -114
- package/.claude/skills/sillyspec-commit/SKILL.md +109 -109
- package/.claude/skills/sillyspec-continue/SKILL.md +45 -45
- package/.claude/skills/sillyspec-doctor/SKILL.md +76 -76
- package/.claude/skills/sillyspec-execute/SKILL.md +200 -200
- package/.claude/skills/sillyspec-explore/SKILL.md +95 -95
- package/.claude/skills/sillyspec-knowledge/SKILL.md +269 -269
- package/.claude/skills/sillyspec-plan/SKILL.md +148 -148
- package/.claude/skills/sillyspec-quick/SKILL.md +111 -111
- package/.claude/skills/sillyspec-resume/SKILL.md +68 -68
- package/.claude/skills/sillyspec-scan/SKILL.md +79 -79
- package/.claude/skills/sillyspec-state/SKILL.md +64 -64
- package/.claude/skills/sillyspec-status/SKILL.md +54 -54
- package/.claude/skills/sillyspec-verify/SKILL.md +83 -83
- package/.claude/skills/sillyspec-workspace/SKILL.md +169 -169
- package/.gitattributes +2 -0
- package/.husky/pre-push +20 -20
- package/.npmrc-publish +2 -0
- package/README.md +201 -201
- package/SKILL.md +90 -90
- package/package.json +39 -39
- package/packages/dashboard/dist/assets/index-Bq_Z2hne.js +7446 -7446
- package/packages/dashboard/dist/assets/index-O2W5RV4z.css +1 -1
- package/packages/dashboard/dist/index.html +16 -16
- package/packages/dashboard/package.json +25 -25
- package/packages/dashboard/server/executor.js +86 -86
- package/packages/dashboard/server/index.js +601 -601
- package/packages/dashboard/server/parser.js +526 -526
- package/src/change-risk-profile.js +254 -254
- package/src/classify-change.js +109 -109
- package/src/config-schema.js +310 -310
- package/src/contract-matrix.js +379 -379
- package/src/db.js +350 -350
- package/src/dispatch/backends/local-agent.js +155 -155
- package/src/dispatch/backends/sillyhub-mcp.js +245 -245
- package/src/dispatch/probe.js +210 -210
- package/src/dispatch/strategy.js +121 -121
- package/src/docs-check.js +131 -4
- package/src/doctor-diagnostics.js +711 -711
- package/src/endpoint-extractor.js +401 -401
- package/src/fs-atomic.js +69 -69
- package/src/git-helper.js +79 -79
- package/src/hooks/claude-pre-tool-use.cjs +125 -125
- package/src/hooks/worktree-guard.js +848 -848
- package/src/index.js +90 -8
- package/src/init.js +623 -623
- package/src/knowledge-match.js +130 -130
- package/src/local-detect.js +120 -120
- package/src/machine-interface.js +543 -543
- package/src/migrate.js +127 -127
- package/src/progress/change-registry.js +297 -260
- package/src/progress/consistency-doctor.js +355 -355
- package/src/progress/shared.js +36 -36
- package/src/progress/stage-machine.js +29 -1
- package/src/progress/step-store.js +261 -261
- package/src/progress.js +1131 -1127
- package/src/quicklog.js +693 -693
- package/src/review-tier.js +77 -77
- package/src/run/command.js +1385 -1364
- package/src/run/complete-handlers.js +1443 -1399
- package/src/run/complete.js +225 -24
- package/src/run/gates.js +755 -755
- package/src/run/prompt.js +761 -761
- package/src/run/quick-audit.js +155 -146
- package/src/run/shared.js +1268 -1215
- package/src/run/stage.js +487 -479
- package/src/scan-postcheck.js +371 -371
- package/src/setup.js +416 -416
- package/src/sillyhub-mcp/client.js +529 -529
- package/src/spec-sync.js +323 -319
- package/src/stage-contract.js +897 -897
- package/src/stage-review.js +549 -549
- package/src/stages/archive.js +155 -155
- package/src/stages/brainstorm-auto.js +236 -236
- package/src/stages/brainstorm.js +596 -597
- package/src/stages/cmd-existence.js +145 -145
- package/src/stages/doctor.js +371 -371
- package/src/stages/execute.js +1003 -1003
- package/src/stages/explore.js +34 -34
- package/src/stages/index.js +29 -29
- package/src/stages/knowledge.js +498 -498
- package/src/stages/plan-postcheck.js +1302 -1302
- package/src/stages/plan.js +625 -623
- package/src/stages/quick.js +151 -151
- package/src/stages/scan.js +607 -607
- package/src/stages/status.js +64 -64
- package/src/stages/verify.js +264 -264
- package/src/sync.js +1223 -1135
- package/src/task-review.js +1019 -1019
- package/src/verify-postcheck.js +1186 -1186
- package/src/workflow.js +600 -600
- package/src/worktree-apply.js +1213 -1136
- package/src/worktree-deps.js +353 -353
- package/src/worktree.js +1481 -1481
- package/templates/workflows/archive-impact.yaml +79 -79
- package/templates/workflows/scan-docs.yaml +132 -132
|
@@ -1,155 +1,155 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Local 后端派发指令模板(task-dispatcher 抽象层)— task-03
|
|
3
|
-
*
|
|
4
|
-
* 定位(D-007):dispatcher **不是 JS 执行体**。本机 Agent tool(Claude Code Task 工具)
|
|
5
|
-
* 只有 agent 能调,CLI(Node)进程调不了。所以本文件 = **派发指令模板生成器**:
|
|
6
|
-
* 生成注入 execute prompt 的「派发指令文本」,告诉 agent 如何用本机 Agent tool 启动
|
|
7
|
-
* 子代理;实际 Agent tool 调用由 agent 执行,本模块不调任何 tool。
|
|
8
|
-
*
|
|
9
|
-
* Local 后端 = **默认与降级路径**(D-005),保留现有 buildWavePrompt(src/stages/execute.js)
|
|
10
|
-
* 的本机 Agent tool 派发行为:每任务一个独立子代理、workdir 强制 = worktreePath、
|
|
11
|
-
* worker 终态后 SillySpec 对 worktree 工作区 git diff 写 review.json(复用既有
|
|
12
|
-
* task-review 契约)。SillyHub MCP 不可用 / 未配置 / 路径 A 未落地时全程走此路径,零回归。
|
|
13
|
-
*
|
|
14
|
-
* Local 后端**忽略** contract 中的 modelHint / agentProfileHint:本机 Agent tool 不做
|
|
15
|
-
* 异构模型 / agent 分配,这两字段仅 SillyHub 后端消费。
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Local 后端结果回收约定(worker 终态 → review.json)。
|
|
20
|
-
*
|
|
21
|
-
* 抽成独立常量供 strategy.js 在拼接「兜底 / 降级 / SillyHub 回收」段时复用,避免 Local
|
|
22
|
-
* 与 SillyHub 两份回收文案重复维护(R-07:回收统一走 review.json,屏蔽后端差异)。
|
|
23
|
-
*
|
|
24
|
-
* 含 `<runId>` 占位符,使用方按实际 contract.runId 替换(见 renderLocalInstruction)。
|
|
25
|
-
*/
|
|
26
|
-
export const LOCAL_RECYCLE_RULE = `### 回收约定(worker 终态 → review.json)
|
|
27
|
-
|
|
28
|
-
worker 子代理结束后,**回收不依赖 worker 自报结果,也不依赖 worker git commit**:
|
|
29
|
-
SillySpec 主体(你,调度 agent)对 worktree **工作区**做 git diff,按既有 task-review
|
|
30
|
-
契约写 review.json。
|
|
31
|
-
|
|
32
|
-
1. 读取该 task 在 worktree 工作区的 git diff(task 开始 → 完成的变更)
|
|
33
|
-
2. 对照 plan.md 与 tasks/task-XX.md 检查实现(不信任 implementer 自报,只看当前 task 的 diff)
|
|
34
|
-
3. 写入 review.json:\`.runtime/execute-runs/<runId>/tasks/task-XX/review.json\`
|
|
35
|
-
4. review.json 写入成功后,该 task 的派发回收完成
|
|
36
|
-
|
|
37
|
-
review.json 复用既有 task-review 契约(必填字段:schemaVersion / task / base / head /
|
|
38
|
-
changedFiles / specVerdict / qualityVerdict / reviewerNotes / requiredEvidence),不发明
|
|
39
|
-
新契约。回收屏蔽后端差异:无论 Local 还是 SillyHub worker,SillySpec 都自己 diff worktree
|
|
40
|
-
工作区写 review.json。`
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* @typedef {object} DispatchContract
|
|
44
|
-
* @property {string} brief - 任务目标 + 蓝图路径(注入子代理 prompt)
|
|
45
|
-
* @property {string} worktreePath - SillySpec worktree 绝对路径(子代理 cwd)
|
|
46
|
-
* @property {string} branch - worktree 当前分支
|
|
47
|
-
* @property {string[]} allowedPaths - task 边界(子代理 prompt 里声明,SillySpec 侧 assess/apply 校验)
|
|
48
|
-
* @property {boolean} readOnly - execute 写模式=false;true=只读 QA(仅读/diff/写 review.json)
|
|
49
|
-
* @property {string} [modelHint] - tasks.md [model:xxx](Local 忽略,仅 SillyHub 消费)
|
|
50
|
-
* @property {string} [agentProfileHint] - agent profile(Local 忽略,仅 SillyHub 消费)
|
|
51
|
-
* @property {string} runId - SillySpec execute-run id(关联 review.json 路径)
|
|
52
|
-
* @property {string} [missionId] - Wave 级 mission id(D-008,SillyHub 专属,Local 忽略)
|
|
53
|
-
*/
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* 渲染 Local 后端派发指令文本。
|
|
57
|
-
*
|
|
58
|
-
* 纯模板生成器:不校验 contract 完整性、不调任何 tool,只把 contract 字段拼成可注入
|
|
59
|
-
* execute prompt 的中文指令字符串。contract 缺字段时回退到醒目占位符(`<未提供 ...>`),
|
|
60
|
-
* 让 agent 在 prompt 里一眼看到派发前必须补齐的参数,而非静默产出错位指令。
|
|
61
|
-
*
|
|
62
|
-
* @param {DispatchContract} [contract] - 派发契约(见 design.md DispatchContract 接口定义)
|
|
63
|
-
* @returns {string} 注入 execute prompt 的 Local 后端派发指令文本
|
|
64
|
-
*/
|
|
65
|
-
export function renderLocalInstruction(contract) {
|
|
66
|
-
const c = contract || {}
|
|
67
|
-
const worktreePath = c.worktreePath
|
|
68
|
-
const branch = c.branch
|
|
69
|
-
const allowedPaths = Array.isArray(c.allowedPaths) ? c.allowedPaths : null
|
|
70
|
-
const readOnly = !!c.readOnly
|
|
71
|
-
const brief = c.brief
|
|
72
|
-
const runId = c.runId
|
|
73
|
-
|
|
74
|
-
// 回收约定:替换 <runId> 占位符;runId 缺失保留占位符让 agent 警觉
|
|
75
|
-
const recycleRule = LOCAL_RECYCLE_RULE.replaceAll(
|
|
76
|
-
'<runId>',
|
|
77
|
-
runId ? String(runId) : '<未提供 runId>'
|
|
78
|
-
)
|
|
79
|
-
|
|
80
|
-
const workdirDisplay = worktreePath
|
|
81
|
-
? String(worktreePath)
|
|
82
|
-
: '<未提供 contract.worktreePath — 派发前必须补齐,否则破坏 worktree 隔离>'
|
|
83
|
-
|
|
84
|
-
const branchLine = branch
|
|
85
|
-
? `- worktree 当前分支:\`${branch}\``
|
|
86
|
-
: '- worktree 当前分支:未提供(沿用 worktree 检出时的既有分支)'
|
|
87
|
-
|
|
88
|
-
const allowedLine = allowedPaths && allowedPaths.length
|
|
89
|
-
? `- 本次任务边界(allowedPaths):${allowedPaths.map(p => `\`${p}\``).join(' / ')}`
|
|
90
|
-
: '- 本次任务边界(allowedPaths):未提供,按蓝图 tasks/task-XX.md 的 allowed_paths 为准'
|
|
91
|
-
|
|
92
|
-
const briefLine = brief
|
|
93
|
-
? String(brief)
|
|
94
|
-
: '<未提供 contract.brief — 派发前必须补齐任务目标与蓝图路径>'
|
|
95
|
-
|
|
96
|
-
const modeLine = readOnly
|
|
97
|
-
? '5. **只读模式(readOnly=true)**:本子代理只读 / 审查 / 写 review.json,**不改源码**'
|
|
98
|
-
: '5. **写模式(readOnly=false)**:按蓝图实现源码(TDD:先读后写 → 写测试 → 写实现)'
|
|
99
|
-
|
|
100
|
-
return `### 派发后端:Local(本机 Agent tool)— 默认与降级路径
|
|
101
|
-
|
|
102
|
-
本指令用**本机 Agent tool**(Claude Code Task 工具)启动子代理执行任务。这是默认与降级
|
|
103
|
-
路径:SillyHub MCP 不可用 / 未配置 / 路径 A 未落地时全程走此路径,派发行为与既有 execute
|
|
104
|
-
波次派发等价(零回归)。
|
|
105
|
-
|
|
106
|
-
**你的角色是调度者 + 审查者,不要自己写代码。** 每个任务由一个独立子代理执行,同 Wave 内
|
|
107
|
-
可并行启动多个子代理。
|
|
108
|
-
|
|
109
|
-
### 启动子代理(必须严格遵守)
|
|
110
|
-
|
|
111
|
-
调用本机 Agent tool(Task 工具)为该 task 启动一个独立子代理,参数结构范例:
|
|
112
|
-
|
|
113
|
-
\`\`\`json
|
|
114
|
-
{
|
|
115
|
-
"subagent_type": "general",
|
|
116
|
-
"workdir": "${workdirDisplay}",
|
|
117
|
-
"prompt": "在此编写任务描述:任务目标 + 蓝图路径 + 编码铁律(见下方要点)"
|
|
118
|
-
}
|
|
119
|
-
\`\`\`
|
|
120
|
-
|
|
121
|
-
### workdir 强制必传 = contract.worktreePath(关键)
|
|
122
|
-
|
|
123
|
-
**workdir 参数是强制必传的,值必须为 \`${workdirDisplay}\`(contract.worktreePath)。**
|
|
124
|
-
|
|
125
|
-
- **不传 workdir,子代理会在主工作区(主仓库根)而非 worktree 里读写文件**,把改动写到
|
|
126
|
-
主工作区、**破坏 worktree 隔离**,后续 assess / apply / review.json 全部错位,并可能
|
|
127
|
-
撞其他并行 agent 的改动。
|
|
128
|
-
${branchLine}
|
|
129
|
-
- 蓝图文件(tasks.md / design.md / tasks/task-XX.md)在主工作区 \`.sillyspec/changes/<change>/\`
|
|
130
|
-
下,可能不在 worktree 中——**读蓝图用主工作区绝对路径,不要拼接到 worktree 路径下**;
|
|
131
|
-
写代码必须落在 workdir(worktree)内。
|
|
132
|
-
|
|
133
|
-
### 子代理 prompt 要点
|
|
134
|
-
|
|
135
|
-
在子代理 prompt 里写明:
|
|
136
|
-
1. 任务目标(brief):${briefLine}
|
|
137
|
-
2. 蓝图文件路径(让子代理按需读取详情,不要内联整份蓝图污染上下文)
|
|
138
|
-
3. 编码铁律:先读后写、TDD、不编造方法、只做蓝图里写的事、遵守边界处理规则、不超出 allowedPaths
|
|
139
|
-
4. 如存在模块文档(\`.sillyspec/docs/*/modules/\`),按需读取涉及模块的 <module>.md 参考接口约定与数据流
|
|
140
|
-
5. 任务含测试代码时,把下方「测试用例设计」整段复制进子代理 prompt,要求子代理按此设计测试用例
|
|
141
|
-
|
|
142
|
-
{{include: testcase-design}}
|
|
143
|
-
${modeLine}
|
|
144
|
-
${allowedLine}
|
|
145
|
-
|
|
146
|
-
### Local 后端忽略的字段(不消费)
|
|
147
|
-
|
|
148
|
-
本机 Agent tool 不做异构模型 / agent 分配,故 Local 后端**忽略** contract 中的以下字段
|
|
149
|
-
(仅 SillyHub 后端消费,此处列出仅为避免 agent 误把它们塞进 Agent tool 参数):
|
|
150
|
-
- \`modelHint\` → SillyHub model 映射,Local 不传给本机 Agent tool
|
|
151
|
-
- \`agentProfileHint\` → SillyHub agent_profile_id 映射,Local 不传给本机 Agent tool
|
|
152
|
-
- \`missionId\` → SillyHub「一 Wave 一 mission」概念(D-008),Local 无 mission
|
|
153
|
-
|
|
154
|
-
${recycleRule}`
|
|
155
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Local 后端派发指令模板(task-dispatcher 抽象层)— task-03
|
|
3
|
+
*
|
|
4
|
+
* 定位(D-007):dispatcher **不是 JS 执行体**。本机 Agent tool(Claude Code Task 工具)
|
|
5
|
+
* 只有 agent 能调,CLI(Node)进程调不了。所以本文件 = **派发指令模板生成器**:
|
|
6
|
+
* 生成注入 execute prompt 的「派发指令文本」,告诉 agent 如何用本机 Agent tool 启动
|
|
7
|
+
* 子代理;实际 Agent tool 调用由 agent 执行,本模块不调任何 tool。
|
|
8
|
+
*
|
|
9
|
+
* Local 后端 = **默认与降级路径**(D-005),保留现有 buildWavePrompt(src/stages/execute.js)
|
|
10
|
+
* 的本机 Agent tool 派发行为:每任务一个独立子代理、workdir 强制 = worktreePath、
|
|
11
|
+
* worker 终态后 SillySpec 对 worktree 工作区 git diff 写 review.json(复用既有
|
|
12
|
+
* task-review 契约)。SillyHub MCP 不可用 / 未配置 / 路径 A 未落地时全程走此路径,零回归。
|
|
13
|
+
*
|
|
14
|
+
* Local 后端**忽略** contract 中的 modelHint / agentProfileHint:本机 Agent tool 不做
|
|
15
|
+
* 异构模型 / agent 分配,这两字段仅 SillyHub 后端消费。
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Local 后端结果回收约定(worker 终态 → review.json)。
|
|
20
|
+
*
|
|
21
|
+
* 抽成独立常量供 strategy.js 在拼接「兜底 / 降级 / SillyHub 回收」段时复用,避免 Local
|
|
22
|
+
* 与 SillyHub 两份回收文案重复维护(R-07:回收统一走 review.json,屏蔽后端差异)。
|
|
23
|
+
*
|
|
24
|
+
* 含 `<runId>` 占位符,使用方按实际 contract.runId 替换(见 renderLocalInstruction)。
|
|
25
|
+
*/
|
|
26
|
+
export const LOCAL_RECYCLE_RULE = `### 回收约定(worker 终态 → review.json)
|
|
27
|
+
|
|
28
|
+
worker 子代理结束后,**回收不依赖 worker 自报结果,也不依赖 worker git commit**:
|
|
29
|
+
SillySpec 主体(你,调度 agent)对 worktree **工作区**做 git diff,按既有 task-review
|
|
30
|
+
契约写 review.json。
|
|
31
|
+
|
|
32
|
+
1. 读取该 task 在 worktree 工作区的 git diff(task 开始 → 完成的变更)
|
|
33
|
+
2. 对照 plan.md 与 tasks/task-XX.md 检查实现(不信任 implementer 自报,只看当前 task 的 diff)
|
|
34
|
+
3. 写入 review.json:\`.runtime/execute-runs/<runId>/tasks/task-XX/review.json\`
|
|
35
|
+
4. review.json 写入成功后,该 task 的派发回收完成
|
|
36
|
+
|
|
37
|
+
review.json 复用既有 task-review 契约(必填字段:schemaVersion / task / base / head /
|
|
38
|
+
changedFiles / specVerdict / qualityVerdict / reviewerNotes / requiredEvidence),不发明
|
|
39
|
+
新契约。回收屏蔽后端差异:无论 Local 还是 SillyHub worker,SillySpec 都自己 diff worktree
|
|
40
|
+
工作区写 review.json。`
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @typedef {object} DispatchContract
|
|
44
|
+
* @property {string} brief - 任务目标 + 蓝图路径(注入子代理 prompt)
|
|
45
|
+
* @property {string} worktreePath - SillySpec worktree 绝对路径(子代理 cwd)
|
|
46
|
+
* @property {string} branch - worktree 当前分支
|
|
47
|
+
* @property {string[]} allowedPaths - task 边界(子代理 prompt 里声明,SillySpec 侧 assess/apply 校验)
|
|
48
|
+
* @property {boolean} readOnly - execute 写模式=false;true=只读 QA(仅读/diff/写 review.json)
|
|
49
|
+
* @property {string} [modelHint] - tasks.md [model:xxx](Local 忽略,仅 SillyHub 消费)
|
|
50
|
+
* @property {string} [agentProfileHint] - agent profile(Local 忽略,仅 SillyHub 消费)
|
|
51
|
+
* @property {string} runId - SillySpec execute-run id(关联 review.json 路径)
|
|
52
|
+
* @property {string} [missionId] - Wave 级 mission id(D-008,SillyHub 专属,Local 忽略)
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 渲染 Local 后端派发指令文本。
|
|
57
|
+
*
|
|
58
|
+
* 纯模板生成器:不校验 contract 完整性、不调任何 tool,只把 contract 字段拼成可注入
|
|
59
|
+
* execute prompt 的中文指令字符串。contract 缺字段时回退到醒目占位符(`<未提供 ...>`),
|
|
60
|
+
* 让 agent 在 prompt 里一眼看到派发前必须补齐的参数,而非静默产出错位指令。
|
|
61
|
+
*
|
|
62
|
+
* @param {DispatchContract} [contract] - 派发契约(见 design.md DispatchContract 接口定义)
|
|
63
|
+
* @returns {string} 注入 execute prompt 的 Local 后端派发指令文本
|
|
64
|
+
*/
|
|
65
|
+
export function renderLocalInstruction(contract) {
|
|
66
|
+
const c = contract || {}
|
|
67
|
+
const worktreePath = c.worktreePath
|
|
68
|
+
const branch = c.branch
|
|
69
|
+
const allowedPaths = Array.isArray(c.allowedPaths) ? c.allowedPaths : null
|
|
70
|
+
const readOnly = !!c.readOnly
|
|
71
|
+
const brief = c.brief
|
|
72
|
+
const runId = c.runId
|
|
73
|
+
|
|
74
|
+
// 回收约定:替换 <runId> 占位符;runId 缺失保留占位符让 agent 警觉
|
|
75
|
+
const recycleRule = LOCAL_RECYCLE_RULE.replaceAll(
|
|
76
|
+
'<runId>',
|
|
77
|
+
runId ? String(runId) : '<未提供 runId>'
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
const workdirDisplay = worktreePath
|
|
81
|
+
? String(worktreePath)
|
|
82
|
+
: '<未提供 contract.worktreePath — 派发前必须补齐,否则破坏 worktree 隔离>'
|
|
83
|
+
|
|
84
|
+
const branchLine = branch
|
|
85
|
+
? `- worktree 当前分支:\`${branch}\``
|
|
86
|
+
: '- worktree 当前分支:未提供(沿用 worktree 检出时的既有分支)'
|
|
87
|
+
|
|
88
|
+
const allowedLine = allowedPaths && allowedPaths.length
|
|
89
|
+
? `- 本次任务边界(allowedPaths):${allowedPaths.map(p => `\`${p}\``).join(' / ')}`
|
|
90
|
+
: '- 本次任务边界(allowedPaths):未提供,按蓝图 tasks/task-XX.md 的 allowed_paths 为准'
|
|
91
|
+
|
|
92
|
+
const briefLine = brief
|
|
93
|
+
? String(brief)
|
|
94
|
+
: '<未提供 contract.brief — 派发前必须补齐任务目标与蓝图路径>'
|
|
95
|
+
|
|
96
|
+
const modeLine = readOnly
|
|
97
|
+
? '5. **只读模式(readOnly=true)**:本子代理只读 / 审查 / 写 review.json,**不改源码**'
|
|
98
|
+
: '5. **写模式(readOnly=false)**:按蓝图实现源码(TDD:先读后写 → 写测试 → 写实现)'
|
|
99
|
+
|
|
100
|
+
return `### 派发后端:Local(本机 Agent tool)— 默认与降级路径
|
|
101
|
+
|
|
102
|
+
本指令用**本机 Agent tool**(Claude Code Task 工具)启动子代理执行任务。这是默认与降级
|
|
103
|
+
路径:SillyHub MCP 不可用 / 未配置 / 路径 A 未落地时全程走此路径,派发行为与既有 execute
|
|
104
|
+
波次派发等价(零回归)。
|
|
105
|
+
|
|
106
|
+
**你的角色是调度者 + 审查者,不要自己写代码。** 每个任务由一个独立子代理执行,同 Wave 内
|
|
107
|
+
可并行启动多个子代理。
|
|
108
|
+
|
|
109
|
+
### 启动子代理(必须严格遵守)
|
|
110
|
+
|
|
111
|
+
调用本机 Agent tool(Task 工具)为该 task 启动一个独立子代理,参数结构范例:
|
|
112
|
+
|
|
113
|
+
\`\`\`json
|
|
114
|
+
{
|
|
115
|
+
"subagent_type": "general",
|
|
116
|
+
"workdir": "${workdirDisplay}",
|
|
117
|
+
"prompt": "在此编写任务描述:任务目标 + 蓝图路径 + 编码铁律(见下方要点)"
|
|
118
|
+
}
|
|
119
|
+
\`\`\`
|
|
120
|
+
|
|
121
|
+
### workdir 强制必传 = contract.worktreePath(关键)
|
|
122
|
+
|
|
123
|
+
**workdir 参数是强制必传的,值必须为 \`${workdirDisplay}\`(contract.worktreePath)。**
|
|
124
|
+
|
|
125
|
+
- **不传 workdir,子代理会在主工作区(主仓库根)而非 worktree 里读写文件**,把改动写到
|
|
126
|
+
主工作区、**破坏 worktree 隔离**,后续 assess / apply / review.json 全部错位,并可能
|
|
127
|
+
撞其他并行 agent 的改动。
|
|
128
|
+
${branchLine}
|
|
129
|
+
- 蓝图文件(tasks.md / design.md / tasks/task-XX.md)在主工作区 \`.sillyspec/changes/<change>/\`
|
|
130
|
+
下,可能不在 worktree 中——**读蓝图用主工作区绝对路径,不要拼接到 worktree 路径下**;
|
|
131
|
+
写代码必须落在 workdir(worktree)内。
|
|
132
|
+
|
|
133
|
+
### 子代理 prompt 要点
|
|
134
|
+
|
|
135
|
+
在子代理 prompt 里写明:
|
|
136
|
+
1. 任务目标(brief):${briefLine}
|
|
137
|
+
2. 蓝图文件路径(让子代理按需读取详情,不要内联整份蓝图污染上下文)
|
|
138
|
+
3. 编码铁律:先读后写、TDD、不编造方法、只做蓝图里写的事、遵守边界处理规则、不超出 allowedPaths
|
|
139
|
+
4. 如存在模块文档(\`.sillyspec/docs/*/modules/\`),按需读取涉及模块的 <module>.md 参考接口约定与数据流
|
|
140
|
+
5. 任务含测试代码时,把下方「测试用例设计」整段复制进子代理 prompt,要求子代理按此设计测试用例
|
|
141
|
+
|
|
142
|
+
{{include: testcase-design}}
|
|
143
|
+
${modeLine}
|
|
144
|
+
${allowedLine}
|
|
145
|
+
|
|
146
|
+
### Local 后端忽略的字段(不消费)
|
|
147
|
+
|
|
148
|
+
本机 Agent tool 不做异构模型 / agent 分配,故 Local 后端**忽略** contract 中的以下字段
|
|
149
|
+
(仅 SillyHub 后端消费,此处列出仅为避免 agent 误把它们塞进 Agent tool 参数):
|
|
150
|
+
- \`modelHint\` → SillyHub model 映射,Local 不传给本机 Agent tool
|
|
151
|
+
- \`agentProfileHint\` → SillyHub agent_profile_id 映射,Local 不传给本机 Agent tool
|
|
152
|
+
- \`missionId\` → SillyHub「一 Wave 一 mission」概念(D-008),Local 无 mission
|
|
153
|
+
|
|
154
|
+
${recycleRule}`
|
|
155
|
+
}
|