@heihei0299/matt-skills 3.0.1 → 3.0.3

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.
@@ -35,32 +35,37 @@ disable-model-invocation: true
35
35
 
36
36
  读取 [verify.md](references/verify.md),执行当前 issue 所需的最终验证。
37
37
 
38
- 最终验证通过且 diff 稳定后执行完整 `code-review`。
38
+ 最终验证通过且 diff 稳定后进入 Review。
39
39
 
40
40
  #### Review
41
41
 
42
- 每个 issue 只在 Verify 的最终 diff 稳定后调用一次完整 `code-review`;审查维度、reviewer 数量、提示词和输出格式全部由 `code-review` 自己定义,`tdd-implement` 不复制这些规则。`code-review` 未完成或存在 blocking finding 时 issue 不得收敛;多 issue 层收敛不再次调用完整 Review。
42
+ 每个 issue 维护以下 Review 状态:
43
43
 
44
- 若完整 Review 存在 blocking finding:
44
+ - `full_review_done = false`
45
+ - `open_findings = []`
46
+
47
+ 当 `full_review_done = false` 时,只调用一次完整 `code-review`。完成后立即设置 `full_review_done = true`,并将 blocking findings 写入 `open_findings`。
48
+
49
+ 当 `full_review_done = true` 时,完整 `code-review` 路径关闭,不得再次启动完整双轴 Review。后续仅处理 `open_findings`:
45
50
 
46
51
  1. 仅修复对应 finding,不扩大当前 issue 范围;
47
- 2. 修复后仅对该 finding 及其直接影响执行增量 Review;
48
- 3. 未受影响的 Review 结论继续有效;
49
- 4. 不重新执行完整双轴 Review
50
- 5. 若增量 Review 仍存在问题,仅继续修复并复核剩余 finding。
52
+ 2. 重新验证该修复直接影响的证据;
53
+ 3. 直接针对该 finding 与修复 diff 做增量 Review;增量 Review 不调用完整 `code-review`;
54
+ 4. 复核通过后从 `open_findings` 移除该 finding
55
+ 5. 若修复产生新的 Behavior,返回 Red-Green 对该 Behavior 执行 TDD,再回 Verify 验证受影响范围;`full_review_done` 保持为 `true`。
51
56
 
52
- 所有 blocking finding 关闭后 Review 才算通过。
57
+ `full_review_done = true` `open_findings` 为空时 Review 才算通过。审查维度、reviewer 数量、提示词和输出格式仍以 `code-review` 为唯一事实源。
53
58
 
54
59
  **出口:**
55
60
 
56
61
  - 当前 issue 所需最终验证通过;
57
62
  - 要求的真实运行验证完成;
58
- - 完整 Review 已完成;
59
- - 所有 blocking finding 已关闭。
63
+ - `full_review_done = true`;
64
+ - `open_findings` 为空。
60
65
 
61
66
  ## Finalize
62
67
 
63
- Verify 通过后读取 [finalize.md](references/finalize.md),完成当前 issue 的必要同步、独立 commit 与 tracker/progress 收尾。
68
+ Verify 与 Review 通过后读取 [finalize.md](references/finalize.md),完成当前 issue 的必要同步、tracker/progress 与仓库 Git policy 收尾。
64
69
 
65
70
  Finalize 不新增产品 Behavior;若发现实现或验证遗漏,回到对应 Step 完成后再收尾。
66
71
 
@@ -69,7 +74,8 @@ Finalize 不新增产品 Behavior;若发现实现或验证遗漏,回到对
69
74
  - Red-Green 必须覆盖当前 issue 的全部待实现 Behavior,不能只对第一个改动执行 TDD。
70
75
  - 一个 Behavior 完成后继续下一个 Behavior,直到 Step ① 出口满足。
71
76
  - Verify 只做当前 issue 必要的最终验证;已通过的等价验证不机械重复。
72
- - 完整双轴 Review 每个 issue 只执行一次;后续修复只执行受影响 finding 的增量 Review。
77
+ - 每个 issue 的完整双轴 Review 只允许从 `full_review_done = false` 进入一次;之后只处理 `open_findings` 的增量 Review。
78
+ - Git 提交数量与粒度服从当前仓库规则和用户指令,本技能不另行规定。
73
79
  - 当前 Step 达到出口后继续进入下一 Step;仅在需要用户决策或存在外部阻塞时暂停。
74
80
 
75
81
  ## References
@@ -1,16 +1,16 @@
1
1
  # Finalize
2
2
 
3
- 仅在 Verify 通过后执行;不新增产品 Behavior。
3
+ 仅在 Verify 与 Review 通过后执行;不新增产品 Behavior。Git 提交数量与粒度由当前仓库规则和用户指令决定,本文件不另行规定。
4
4
 
5
5
  1. 完成实现要求的必要 docs/config 同步。
6
- 2. 为当前 issue 创建一个独立 commit。
7
- 3. 更新 progress/tracker,记录 commit、Review、验证与运行结果,并解除已满足的 blockers。
8
- 4. Acceptance Criteria 标记完成,issue 标记 `resolved`。
6
+ 2. 更新 Acceptance Criteria 与 progress/tracker,记录 Review、验证与运行结果;若当前仓库策略已产生 commit,可记录对应 commit
7
+ 3. issue 标记 `resolved`,并解除已满足的 blockers。
8
+ 4. 若当前仓库规则或用户指令要求提交,按其 Git policy 执行。
9
9
 
10
10
  若发现实现或验证遗漏,返回对应 Step 完成后再收尾。
11
11
 
12
12
  ## 出口
13
13
 
14
- - 当前 issue 的独立 commit 已创建;
15
14
  - Acceptance Criteria 全部通过;
16
- - tracker/progress 与实际完成状态一致。
15
+ - issue、blockers 与 tracker/progress 和实际完成状态一致;
16
+ - Git 行为符合当前仓库规则与用户指令。
@@ -25,19 +25,19 @@ for each layer:
25
25
 
26
26
  一个 issue Finalize 完成后立即进入下一个可调度 issue。前置 issue 未完成时,其依赖项保持 `blocked`。
27
27
 
28
- 每个 issue 的 TDD、验证、ReviewFinalize 规则分别以 `SKILL.md`、`red-green.md`、`verify.md`、`finalize.md` 为准,本文件不重复定义。
28
+ 每个 issue 的 Red-GreenReview 编排以 `SKILL.md` 为准;验证与 Finalize 分别以 `verify.md`、`finalize.md` 为准,本文件不重复定义。
29
29
 
30
30
  ## 3. 状态收敛
31
31
 
32
32
  每个 issue 完成后同步:
33
33
 
34
34
  - `Status`;
35
- - commit;
36
35
  - Review 状态;
37
36
  - 验证结果;
38
- - 已解除的 blockers
37
+ - 已解除的 blockers
38
+ - commit(仅当当前仓库 Git policy 已产生对应 commit 时)。
39
39
 
40
- 当前层所有 issue 完成后进入下一层。全部层完成后,确认 issue 与 progress 状态一致即可结束;不额外扩大验证范围,也不再次执行完整 Review。
40
+ 当前层所有 issue 完成后进入下一层。全部层完成后,确认 issue 与 progress 状态一致即可结束;不额外扩大验证范围,也不再次执行完整 Review。Git 提交数量与粒度始终服从当前仓库规则和用户指令。
41
41
 
42
42
  ## 冲突与失败
43
43
 
@@ -49,6 +49,6 @@ for each layer:
49
49
  ## 出口
50
50
 
51
51
  - 所有可执行 issue 均按依赖顺序完成;
52
- - 每个完成的 issue 均有独立 commit;
53
52
  - issue、依赖状态与 progress 一致;
53
+ - Git 行为符合当前仓库规则与用户指令;
54
54
  - 不存在被误当作已完成的 blocked issue。
package/README.md CHANGED
@@ -55,7 +55,7 @@ npx @heihei0299/matt-skills sync --all # 同步全部可分发 skills
55
55
  npx @heihei0299/matt-skills sync --dry-run --json
56
56
  ```
57
57
 
58
- `init` 默认保护已有 `AGENTS.md`;需要刷新完整模板时使用 `init --all`。`sync` 不删除目标项目的额外文件或自定义 skills。
58
+ `init` 默认保护已有 `AGENTS.md`;需要刷新完整模板时使用 `init --all`。默认 `sync` 只刷新 `AGENTS.md` 的 `matt-skills:managed` 受管区块并保留标记外的项目规则;旧的无标记 `AGENTS.md` 原样保留,`sync --all` 才整体刷新。`sync` 不删除目标项目的额外文件或自定义 skills。
59
59
 
60
60
  默认 programming 范围中的 4 个独有 skills 是 `tdd-implement`、`diagnose-fix`、`grill-to-spec`、`show-me`。
61
61
 
package/bin/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { readdir, readFile, cp, stat, rm, mkdir } from 'node:fs/promises';
2
+ import { readdir, readFile, writeFile, cp, stat, rm, mkdir } from 'node:fs/promises';
3
3
  import os from 'node:os';
4
4
  import path from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
@@ -71,7 +71,7 @@ Sync options:
71
71
  --dest <path> Target directory (default: current directory)
72
72
  --help, -h Show this help
73
73
 
74
- 说明:默认不带 --all 仅增量同步默认 programming skill AGENTS.md 有定制则跳过;--all 时同步全部可分发 skill 并强制更新 AGENTS.md。
74
+ 说明:默认不带 --all 增量同步默认 programming skill,并只更新 AGENTS.md 的 matt-skills 受管区块;没有受管标记的现有 AGENTS.md 原样保留。--all 时同步全部可分发 skill 并强制刷新 AGENTS.md。
75
75
 
76
76
  提示:matt-skills --help 查看全量
77
77
  `;
@@ -187,6 +187,34 @@ function shouldCopyTemplatePath(src) {
187
187
  return !(parts[0] === '.agents' && parts[1] === 'skills');
188
188
  }
189
189
 
190
+ const AGENTS_MANAGED_START = '<!-- matt-skills:managed:start -->';
191
+ const AGENTS_MANAGED_END = '<!-- matt-skills:managed:end -->';
192
+
193
+ function findManagedBlock(content) {
194
+ const start = content.indexOf(AGENTS_MANAGED_START);
195
+ if (start < 0 || content.indexOf(AGENTS_MANAGED_START, start + AGENTS_MANAGED_START.length) >= 0) return null;
196
+ const endStart = content.indexOf(AGENTS_MANAGED_END, start + AGENTS_MANAGED_START.length);
197
+ if (endStart < 0 || content.indexOf(AGENTS_MANAGED_END, endStart + AGENTS_MANAGED_END.length) >= 0) return null;
198
+ return { start, end: endStart + AGENTS_MANAGED_END.length };
199
+ }
200
+
201
+ function mergeManagedAgents(current, template) {
202
+ const currentBlock = findManagedBlock(current);
203
+ const templateBlock = findManagedBlock(template);
204
+ if (!currentBlock || !templateBlock) return null;
205
+ const managed = template.slice(templateBlock.start, templateBlock.end);
206
+ return current.slice(0, currentBlock.start) + managed + current.slice(currentBlock.end);
207
+ }
208
+
209
+ async function syncManagedAgents(targetFile) {
210
+ const current = await readFile(targetFile, 'utf8');
211
+ const template = await readFile(path.join(TEMPLATE_DIR, 'AGENTS.md'), 'utf8');
212
+ const merged = mergeManagedAgents(current, template);
213
+ if (merged === null) return false;
214
+ if (merged !== current) await writeFile(targetFile, merged);
215
+ return true;
216
+ }
217
+
190
218
  const TOOLS = ['codex', 'pi', 'opencode', 'claude'];
191
219
 
192
220
  // 统一源:共享技能全部在 .agents/skills,harness 的 .pi/skills/.opencode/skills 仅用于项目自定义
@@ -340,26 +368,12 @@ async function initCommand({ dest, all }) {
340
368
  async function syncCommand({ dest, all, dryRun, json, upstreamUrl, ref }) {
341
369
  const onlyProgramming = !all;
342
370
  if (dryRun) {
343
- const { compare } = await import('../scripts/sync-upstream.js');
371
+ const { compare, formatComparison } = await import('../scripts/sync-upstream.js');
344
372
  const cmp = await compare({ upstreamUrl, ref, onlyProgramming });
345
373
  if (json) {
346
374
  process.stdout.write(JSON.stringify({ head: cmp.head, counts: cmp.counts, result: cmp.result, onlyProgramming }, null, 2) + '\n');
347
375
  } else {
348
- const modeHint = onlyProgramming ? '(默认:engineering + 独有所需)' : '(全量上游)';
349
- const lines = [];
350
- lines.push(`上游 HEAD: ${cmp.head}`);
351
- lines.push(`本地非独有: ${cmp.counts.local} 上游: ${cmp.counts.upstream} ${modeHint}`);
352
- lines.push('');
353
- const totalDiff = cmp.result.added.length + cmp.result.updated.length + cmp.result.removed.length + cmp.result.renamed.length;
354
- if (totalDiff === 0) lines.push('✅ 已是最新,无差异');
355
- else {
356
- if (cmp.result.added.length) lines.push(`新增 (${cmp.result.added.length}): ${cmp.result.added.join(', ')}`);
357
- if (cmp.result.updated.length) lines.push(`更新 (${cmp.result.updated.length}): ${cmp.result.updated.join(', ')}`);
358
- if (cmp.result.renamed.length) lines.push(`重命名 (${cmp.result.renamed.length}): ${cmp.result.renamed.map((r) => `${r.from}→${r.to}`).join(', ')}`);
359
- if (cmp.result.removed.length) lines.push(`删除 (${cmp.result.removed.length}): ${cmp.result.removed.join(', ')}`);
360
- if (cmp.result.same.length) lines.push(`一致 (${cmp.result.same.length}): ${cmp.result.same.join(', ')}`);
361
- }
362
- process.stdout.write(lines.join('\n') + '\n');
376
+ process.stdout.write(formatComparison(cmp) + '\n');
363
377
  }
364
378
  const { rm } = await import('node:fs/promises');
365
379
  await rm(cmp.dest, { recursive: true, force: true });
@@ -396,26 +410,25 @@ async function syncCommand({ dest, all, dryRun, json, upstreamUrl, ref }) {
396
410
  process.stdout.write('模板:已复制(AGENTS.md、.opencode/、.pi/)\n');
397
411
  } else {
398
412
  process.stdout.write('同步:检测到现有项目,将增量更新\n');
399
- let skipAgents = false;
400
- // --all 时强制更新 AGENTS.md,不跳过
401
- if (!all) {
402
- try {
403
- const content = await readFile(path.join(target, 'AGENTS.md'), 'utf8');
404
- if (content.includes('tdd-implement')) skipAgents = true;
405
- } catch {}
406
- }
407
- if (skipAgents) {
408
- await cp(path.join(TEMPLATE_DIR, '.opencode'), path.join(target, '.opencode'), { recursive: true, force: true });
409
- await cp(path.join(TEMPLATE_DIR, '.pi'), path.join(target, '.pi'), { recursive: true, force: true });
410
- process.stdout.write('模板:已同步(AGENTS.md 跳过,已含定制)\n');
411
- } else {
412
- if (onlyProgramming) await copyTemplateFiltered();
413
- else await cp(TEMPLATE_DIR, target, {
413
+ if (all) {
414
+ await cp(TEMPLATE_DIR, target, {
414
415
  recursive: true,
415
416
  force: true,
416
417
  filter: shouldCopyTemplatePath,
417
418
  });
418
- process.stdout.write('模板:已同步(AGENTS.md、.agents/skills、.opencode/、.pi/)\n');
419
+ process.stdout.write('模板:已同步(AGENTS.md 整体刷新、.opencode/、.pi/)\n');
420
+ } else {
421
+ let agentsManaged = false;
422
+ try {
423
+ agentsManaged = await syncManagedAgents(marker);
424
+ } catch {}
425
+ await cp(path.join(TEMPLATE_DIR, '.opencode'), path.join(target, '.opencode'), { recursive: true, force: true });
426
+ await cp(path.join(TEMPLATE_DIR, '.pi'), path.join(target, '.pi'), { recursive: true, force: true });
427
+ if (agentsManaged) {
428
+ process.stdout.write('模板:已同步(AGENTS.md 受管区块已更新,项目自定义内容已保留)\n');
429
+ } else {
430
+ process.stdout.write('模板:已同步(AGENTS.md 未受管,已原样保留)\n');
431
+ }
419
432
  }
420
433
  }
421
434
  // 技能同步:--all 仅更新同名可分发技能内容,存在则覆盖,不存在则新增,并更新 AGENTS.md(由上一步已处理);默认范围为默认 programming,不删多余
@@ -559,7 +572,7 @@ function parseInstallArgs(args) {
559
572
  }
560
573
 
561
574
  async function checkCommand(args) {
562
- const { compare } = await import('../scripts/sync-upstream.js');
575
+ const { compare, formatComparison } = await import('../scripts/sync-upstream.js');
563
576
  const json = args.includes('--json');
564
577
  const onlyProgramming = !args.includes('--all');
565
578
  const upstreamIdx = args.indexOf('--upstream');
@@ -572,22 +585,7 @@ async function checkCommand(args) {
572
585
  if (json) {
573
586
  process.stdout.write(JSON.stringify({ head: cmp.head, counts: cmp.counts, result: cmp.result, onlyProgramming }, null, 2) + '\n');
574
587
  } else {
575
- const lines = [];
576
- lines.push(`上游 HEAD: ${cmp.head}`);
577
- const modeHint = onlyProgramming ? '(默认:engineering + 独有所需)' : '(全量上游)';
578
- lines.push(`本地非独有: ${cmp.counts.local} 上游: ${cmp.counts.upstream} ${modeHint}`);
579
- lines.push('');
580
- const totalDiff = cmp.result.added.length + cmp.result.updated.length + cmp.result.removed.length + cmp.result.renamed.length;
581
- if (totalDiff === 0) {
582
- lines.push('✅ 已是最新,无差异');
583
- } else {
584
- if (cmp.result.added.length) lines.push(`新增 (${cmp.result.added.length}): ${cmp.result.added.join(', ')}`);
585
- if (cmp.result.updated.length) lines.push(`更新 (${cmp.result.updated.length}): ${cmp.result.updated.join(', ')}`);
586
- if (cmp.result.renamed.length) lines.push(`重命名 (${cmp.result.renamed.length}): ${cmp.result.renamed.map((r) => `${r.from}→${r.to}`).join(', ')}`);
587
- if (cmp.result.removed.length) lines.push(`删除 (${cmp.result.removed.length}): ${cmp.result.removed.join(', ')}`);
588
- if (cmp.result.same.length) lines.push(`一致 (${cmp.result.same.length}): ${cmp.result.same.join(', ')}`);
589
- }
590
- process.stdout.write(lines.join('\n') + '\n');
588
+ process.stdout.write(formatComparison(cmp) + '\n');
591
589
  }
592
590
  const { rm } = await import('node:fs/promises');
593
591
  await rm(cmp.dest, { recursive: true, force: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heihei0299/matt-skills",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "description": "Agent skills + 项目配置模板:一条命令初始化 opencode / pi-agent 项目(含 mattpocock/skills 上游技能)",
5
5
  "type": "module",
6
6
  "bin": {
@@ -111,12 +111,12 @@ async function collectLocalSkills(proprietary) {
111
111
  export async function compare({ upstreamUrl, tmpDir, ref, onlyProgramming = true } = {}) {
112
112
  const proprietary = await loadProprietary();
113
113
  const engineering = await loadEngineering();
114
+ const required = await loadRequired();
114
115
  const fetched = await fetchUpstream({ tmpDir, upstreamUrl, ref });
115
116
  const upstreamRoot = fetched.dest;
116
117
  const upstreamMapFull = await collectUpstreamSkills(upstreamRoot);
117
118
  const localMapFull = await collectLocalSkills(proprietary);
118
119
  // 默认范围:engineering 桶(编程)+ 独有所需(config/required.json,如 grill-to-spec 经 grill-with-docs 所需的 grilling);--all 则含全部 productivity
119
- const required = await loadRequired();
120
120
  const upstreamMap = onlyProgramming
121
121
  ? new Map([...upstreamMapFull.entries()].filter(([name, v]) => v.bucket === 'engineering' || required.has(name)))
122
122
  : upstreamMapFull;
@@ -242,7 +242,7 @@ export async function applySync({ upstreamUrl, tmpDir, ref, dryRun = false, forc
242
242
 
243
243
  return { ...cmp, dest: null, actions, head };
244
244
  }
245
- function formatTable(cmp) {
245
+ export function formatComparison(cmp) {
246
246
  const { result, counts, head, onlyProgramming } = cmp;
247
247
  const lines = [];
248
248
  lines.push(`上游 HEAD: ${head}`);
@@ -307,7 +307,7 @@ Options:
307
307
  if (opts.json) {
308
308
  process.stdout.write(JSON.stringify({ head: res.head, result: res.result, actions: res.actions, dryRun: opts.dryRun, onlyProgramming }, null, 2) + '\n');
309
309
  } else {
310
- process.stdout.write(formatTable(res) + '\n');
310
+ process.stdout.write(formatComparison(res) + '\n');
311
311
  if (res.actions.length) {
312
312
  process.stdout.write(`\n已执行 ${res.actions.length} 项:\n`);
313
313
  for (const a of res.actions) process.stdout.write(` - ${a}\n`);
@@ -324,7 +324,7 @@ Options:
324
324
  if (opts.json) {
325
325
  process.stdout.write(JSON.stringify({ head: cmp.head, counts: cmp.counts, result: cmp.result, onlyProgramming }, null, 2) + '\n');
326
326
  } else {
327
- process.stdout.write(formatTable(cmp) + '\n');
327
+ process.stdout.write(formatComparison(cmp) + '\n');
328
328
  }
329
329
  const hasDiff = cmp.result.added.length + cmp.result.updated.length + cmp.result.removed.length + cmp.result.renamed.length > 0;
330
330
  // 清理临时目录
@@ -1,6 +1,6 @@
1
1
  # matt-skills
2
2
 
3
- The domain vocabulary for this repo two sections: how this repository is positioned (`## Repository`) and the terms that govern how long-horizon skills are written, reviewed, and evolved (`## Skill Design`). Every term here is a single source of truth; skills and docs reference it rather than restating the definition.
3
+ Repository vocabulary for this project. This file defines domain terms only; execution policy belongs to the active `AGENTS.md`, and skill-specific behavior belongs to each live `SKILL.md` and its references.
4
4
 
5
5
  ## Repository
6
6
 
@@ -9,47 +9,29 @@ This repository's identity. It is the config repo for mattpocock/skills: it dist
9
9
  _Avoid_: skill distribution repo
10
10
 
11
11
  **Upstream Repository** (上游仓库):
12
- mattpocock/skills — the source of the 26 Skill bodies (skills/engineering + skills/productivity) that are mirrored into this repo's Workspace canonical Skill source and then distributed by the CLI. This repo syncs them via `scripts/sync-upstream.js` and `matt-skills sync`.
12
+ mattpocock/skills — the source of the upstream Skill bodies mirrored into this repo's Workspace canonical Skill source and then distributed by the CLI. This repo syncs them via `scripts/sync-upstream.js` and `matt-skills sync`.
13
13
  _Avoid_: source repo, skill origin
14
14
 
15
15
  **Proprietary Skill** (独有技能):
16
- A skill that does not exist upstream and lives only in this repo (currently ci-guard, tdd-implement, grill-to-spec, diagnose-fix, commit-check, scaffold-functional-test and show-me). Before adding a new skill, check the Upstream Repository first; only skills absent there qualify as proprietary. The 7 proprietary skills are classified as 5 distributable (`tdd-implement`, `diagnose-fix`, `grill-to-spec`, `scaffold-functional-test`, `show-me`) and 2 repo-local (`ci-guard`, `commit-check`). The default programming set includes 4 proprietary skills: `tdd-implement`, `diagnose-fix`, `grill-to-spec` and `show-me`; `scaffold-functional-test` is distributable but optional. Repo-local skills serve matt-skills maintenance and are never distributed. The issue-audit subagent is NOT a skill: it ships as a subagent + command under `.opencode/` and is distributed through the Template Snapshot without a skill directory.
16
+ A skill that does not exist upstream and lives only in this repo. The current proprietary set is classified in `config/proprietary.json` as distributable or repo-local; that config is the source of truth for membership. Repo-local skills serve matt-skills maintenance and are never distributed. Before adding a new proprietary skill, check the Upstream Repository first.
17
17
  _Avoid_: private skill, local skill
18
18
 
19
19
  **Workspace** (工作区):
20
- The root-level working copies of the template content — `.agents/skills/` (upstream plus all proprietary Skills, the canonical shared Skill source), `.opencode/` (issue-audit agent, explicit-Skill commands), `.pi/` (pi-agent prompts: `issue-audit`), `AGENTS.md`, `CONTEXT.md`, `docs/`. This is where the repo's own sessions load, modify and test the content. The Template Snapshot projects only the distributable configuration and skeleton: `.opencode/commands/*.md` → `template/.opencode/commands/`, `.pi/prompts/issue-audit.md` `template/.pi/prompts/issue-audit.md`, and root-level `CONTEXT.md` and `docs/agents/` → `template/.opencode/` + `template/.pi/`. The CLI assembles selected shared Skills from the canonical source into a Target Repository. Harness-specific Skill dirs `.pi/skills/` and `.opencode/skills/` are reserved for project-local custom Skills (empty placeholders with `.gitkeep` + `README.md` in the Template Snapshot).
20
+ The root-level canonical working area: `.agents/skills/` for shared Skills, `.opencode/` and `.pi/` for harness configuration, plus repository docs and configuration. Shared Skills are authored here. Harness-specific `.pi/skills/` and `.opencode/skills/` are reserved for project-local custom Skills rather than shared mirrors.
21
21
  _Avoid_: working copy, source repo
22
22
 
23
23
  **Template Snapshot** (模板快照):
24
- Everything under `template/` the distributable snapshot of project skeleton content: harness Skill dirs `.pi/skills/` + `.opencode/skills/` as empty placeholders for project custom Skills, distributable opencode commands under `.opencode/commands/`, the pi issue-audit command under `.pi/prompts/`, discipline files and glossary under `.opencode/` + `.pi/`, and AGENTS.md at the top level. It is generated by `node scripts/build-template.js` and used to initialize other repositories. Shared Skills and repo-local Skills remain in the Workspace; the CLI distributes only the selected shared Skills. The sync direction for the skeleton is one-way: Workspace → Template Snapshot. Template structure tests guard the content the snapshot owns.
24
+ Everything under `template/` that is generated or copied from Workspace sources for Target Repository initialization. The snapshot owns project skeleton/configuration, while shared Skills are assembled separately by the CLI from the Workspace canonical source. Skeleton sync is one-way: Workspace → Template Snapshot.
25
25
  _Avoid_: release snapshot, published snapshot
26
26
 
27
27
  **Target Repository** (目标仓库):
28
- A repository initialized by copying the Template Snapshot skeleton into its root and then receiving selected distributable shared Skills from the CLI. It loads shared Skills from its own `.agents/skills/`, project-local custom Skills from `.pi/skills/` / `.opencode/skills/` (if any), the distributable commands from `.opencode/commands/` (opencode) and the `issue-audit` command from `.pi/prompts/` (pi) / `.opencode/commands/` (opencode), and the project-level global config from `.opencode/` + `.pi/` and AGENTS.md. Repo-local matt-skills maintenance Skills are not part of a Target Repository by default.
28
+ A repository initialized from the Template Snapshot and selected distributable shared Skills. Its root `AGENTS.md` is the project-level execution policy. Shared Skills live in `.agents/skills/`; project-local custom Skills may live in harness-specific skill directories.
29
29
  _Avoid_: inheriting repo, child repo
30
30
 
31
31
  **Initialize** (初始化):
32
- The one-time action of setting up a Target Repository: copying the Template Snapshot skeleton into its root, then having the CLI create its shared Skill directory and copy the selected distributable Skills from the Workspace canonical source. No separate upstream fetch is needed. Repo-local Skills are intentionally absent. Copying, not inheriting — no runtime relationship survives the copy.
32
+ The one-time action of setting up a Target Repository by copying the Template Snapshot skeleton and installing the selected distributable Skills. Repo-local Skills are intentionally excluded.
33
33
  _Avoid_: inherit, bootstrap
34
34
 
35
35
  **Sync** (同步):
36
- `matt-skills sync` 同步 Target Repository skeleton Skills:`--dry-run` 仅对比不写盘(`check`,`--json` 可解析,有差异 `exit 1`),默认安全增量(`AGENTS.md` 有定制如 `tdd-implement` 则跳过,canonical shared Skills 按默认 programming 范围覆盖但不删多余,Template Snapshot `.opencode` / `.pi` 配置增量 add/update,`.pi/skills` `.opencode/skills` 中已有的 project-local Skill 不按名称删除,避免把项目自定义 Skill 误删)、`--all` 仅更新同名可分发 Skill 内容(存在则覆盖,不存在则新增)并更新 `AGENTS.md`(不跳过定制),不删多余 Skill。Repo-local Skill 永远不新增、不覆盖、不删除,只在发现历史副本时提示保留。`update` 已合并到 `sync` 并删除。
36
+ `matt-skills sync` updates Target Repository skeleton/configuration and selected distributable Skills according to CLI policy. Default sync preserves project customization where the CLI can identify it; `--all` applies the broader distributable scope. Repo-local Skills are never newly distributed by sync.
37
37
  _Avoid_: update, force sync
38
-
39
- ## Skill Design
40
-
41
- **Turn Continuity** (回合连续性):
42
- The rule that a long-horizon skill must carry a positive instruction to keep executing within a turn — red → green → typecheck → next seam serial in one turn until the stage's exit condition is met. The stage exit is reached when all of its seams are complete — one seam going green is not an exit, and progress output does not itself end the turn. It is the skill's own guard against premature turn-end; it must not rely on the harness `/goal` line (which does not exist when no `/goal` is active).
43
- _Avoid_: keep going, don't stop
44
-
45
- **Chunking** (拆小步 / 进度编排):
46
- Splitting a giant turn — one large `write` or a batch of `replace`s — into small steps that are individually verified before continuing, so the turn never hits output caps and gets truncated mid-work.
47
- _Avoid_: step-by-step, take it slow
48
-
49
- **Git History Preservation** (Git 历史保护):
50
- Every git-touching skill must preserve history after `BASE_HEAD=$(git rev-parse HEAD)` recorded at stage entry — history may only be appended. Before any commit or stage exit, verify `git merge-base --is-ancestor $BASE_HEAD HEAD`; if it fails, history was rewritten and must be recovered via `git reflog` before continuing. "Directory clean" (`git status` clean) may only be achieved by deleting the skill's own temporary artifacts (`[DEBUG-...]`, one-off scripts, untracked probe files); destructive git commands `git reset --hard`, `git checkout .`, `git clean -fd`, `git stash push --include-untracked`, `git push --force`, `git rebase -i` are forbidden without explicit user confirmation.
51
- _Avoid_: force clean, stash all
52
-
53
- **Long-Horizon Skill** (长程多阶段技能):
54
- A skill whose run spans multiple stages or seams executed continuously (e.g. tdd-implement, diagnosing-bugs, improve-codebase-architecture, wayfinder, grill-to-spec, to-spec). The class of skill that must carry a Turn Continuity rule.
55
- _Avoid_: complex skill, big skill
@@ -1,37 +1,26 @@
1
1
  # Runtime Discipline
2
2
 
3
- 本仓库会话的运行时纪律,执行口径源自 `docs/agents/skill-design.md` 的四条规则(规范正文)。术语定义见 `CONTEXT.md`。
3
+ This file contains only general execution discipline. It does not override the active project `AGENTS.md` or any skill-specific lifecycle.
4
4
 
5
- ## 回合连续性规则
5
+ ## Ownership
6
6
 
7
- 每个逻辑单元(红-绿循环、typecheck、测试修复)必须在一个回合内连续执行完毕后才输出:测试 分析失败 修正 重跑 全绿整条链一气呵成,中途不输出、不停止、不等用户"继续"。
7
+ - authorization, validation scope, review scope and Git policy come from the active `AGENTS.md` and explicit user instructions;
8
+ - a skill owns only its own lifecycle, state transitions and exit conditions;
9
+ - TDD semantics belong to `.agents/skills/tdd/SKILL.md`;
10
+ - full code-review semantics belong to `.agents/skills/code-review/SKILL.md`.
8
11
 
9
- 输出只允许发生在三种情况:
10
- - 合规交互点:技能/流程要求的用户确认(如 tdd-implement 的 seams 清单确认)
11
- - 外部阻塞:权限拒绝、缺失授权、依赖不可用——明确说明所需授权或替代路径,不静默停止
12
- - 阶段完成:整个阶段的出口条件满足(如 seam 全绿、typecheck 通过、commit 完成)
12
+ When rules disagree, do not invent a merged policy: follow the higher-scope project/user rule for repository policy and the owning skill for its internal protocol.
13
13
 
14
- 预告下一步后立即执行该步骤,禁止把"分析/预告"当作回合终点。随包示例见 `.agents/skills/tdd-implement/SKILL.md` 与 `references/stages.md` 阶段③ 3e。
14
+ ## Execution
15
15
 
16
- ## 运行纪律(长程任务)
16
+ - Continue the active workflow until its stated exit condition, a required user decision, or an external blocker.
17
+ - Progress output does not reset lifecycle state or authorize restarting completed stages.
18
+ - Reuse still-valid evidence; do not repeat equivalent validation or review merely for reassurance.
19
+ - Do not invent build, test, typecheck, commit, or review requirements that are absent from the owning policy.
20
+ - Keep changes local to the requested scope and reuse existing abstractions and dependency direction.
17
21
 
18
- 本仓库会话做**长程任务**(Long-Horizon Skill:多阶段/多 seam 串行执行,如 tdd-implement、diagnosing-bugs、improve-codebase-architecture、wayfinder、grill-to-spec、to-spec)时:
22
+ ## Documentation Maintenance
19
23
 
20
- - **长程声明**:执行长程技能前,确认技能文本自带长程任务声明与回合连续性规则(Turn Continuity)——阶段内连续动作一回合内完成,不依赖 harness `/goal` 防线。tdd-implement 已内嵌(SKILL.md 声明 + references/stages.md 阶段③规则)。
21
- - **模型选择**:flash 级模型长程任务卡住概率显著更高;关键长任务优先强模型或 `/goal` 模式。
22
- - **任务分解(Chunking)**:巨型操作拆小步执行——单次 `write` 超过 ~150 行先写骨架再分批补全;批量 `replace` 超过 ~5 处分批执行,每批后立即验证。tdd-implement 已内嵌该规则(随包分发)。
23
- - **Git 历史保护(Git History Preservation)**:任何触及 git 的操作必须追加历史、不可改写丢弃。阶段入口记录 `BASE_HEAD=$(git rev-parse HEAD)`,阶段出口与 commit 前校验 `git merge-base --is-ancestor $BASE_HEAD HEAD`,失败即经 `git reflog` 恢复后才继续。"目录卫生"仅删本次产生的 `[DEBUG-...]`/一次性脚本等未跟踪临时文件,禁止为达干净而执行 `git reset --hard`、`git checkout .`、`git clean -fd`、`git stash push --include-untracked`、`git push --force`、`git rebase -i` 等(需显式用户确认)。
24
-
25
- ## 执行原则(细则)
26
-
27
- - 先澄清边界再实现;任务收敛后直接执行,不做不必要的形式化流程
28
- - 局部修改、最小充分实现,避免无关扩张
29
- - 用户当次明确指令优先于历史经验与参考项目
30
- - 脏工作区不回滚他人改动;遇到未明改动先理解再兼容
31
-
32
- ## 文档维护(细则)
33
-
34
- - 本文件与分文件只记录长期有效、跨任务可复用的工程经验与项目级约定
35
- - 一次性需求、临时接口选择、用户当次指定方案不沉淀;更换接口/方案视为需求变更,不判定"旧错新对"
36
- - 仅当问题重复出现、暴露长期约束、影响后续多次开发、用户明确要求沉淀,或涉及安全/构建/测试/发布/架构边界时更新
37
- - 经验条目包含:标题、触发信号、根因/约束、正确做法、验证方式、适用范围
24
+ - Keep only durable, cross-task rules here.
25
+ - One-off decisions and temporary implementation choices do not become runtime policy.
26
+ - When a repeated failure reveals a missing invariant, prefer enforcing it in the owning skill, test, tool, type, or repository policy rather than duplicating prose across layers.
@@ -1,37 +1,15 @@
1
- # Skill Design Spec
1
+ # Skill Design — Deprecated
2
2
 
3
- The design rules every skill in this repo must obey. Apply them when writing a new skill or editing an existing one. Terms are defined once in [`CONTEXT.md`](../../CONTEXT.md) — reference them there, never restate the definition.
3
+ This file is retained temporarily for compatibility. It is **not** a normative rule source.
4
4
 
5
- This spec exists because of a real incident: a long-horizon skill run on a flash-class model stopped its turn at "announce the next step" points four times in one session (see `DIAGNOSIS-tdd-implement-stuck.md`). The four rules below are the preventive measures that came out of that diagnosis and subsequent git-history incidents (see `docs/adr/0003-git-history-preservation.md`). They are repo rules, not advice.
6
- ## Rule 1 — Turn Continuity
5
+ Current ownership is:
7
6
 
8
- Every **Long-Horizon Skill** must carry a positive **Turn Continuity** rule of its own: the consecutive actions of a stage (red green → typecheck → next seam) are executed serially **within one turn**, until the stage's exit condition is met. Do not end the turn at "announce the next step" points, and do not wait for the user to say "continue".
7
+ - repository or project execution policy → the active `AGENTS.md`;
8
+ - repository vocabulary and distribution concepts → `CONTEXT.md`;
9
+ - skill-specific lifecycle and state → that skill's `SKILL.md` and live references;
10
+ - TDD semantics → `.agents/skills/tdd/SKILL.md`;
11
+ - full code-review semantics → `.agents/skills/code-review/SKILL.md`.
9
12
 
10
- - State it **positively** (per the negation principle in `writing-for-agents`): describe the target behaviour, never the banned one.
11
- - It must be **self-contained** — the skill cannot rely on the harness `/goal` line, because no `/goal` exists when the user does not activate one.
12
- - Every stage ends on a checkable exit condition; reaching it is the only thing that ends the turn.
13
- - A sub-step going green (e.g. one seam) is not a stage exit — a stage ends only when all of its seams are complete. Progress output does not itself end the turn: output, then keep executing until one of the three endpoints (compliance checkpoint, external blocker, stage exit) is reached.
14
- - Canonical example: the 回合连续性 rule in [`.agents/skills/tdd-implement/references/stages.md`](.agents/skills/tdd-implement/references/stages.md), especially the Red-Green continuity section.
13
+ Do not add Git policy, build/test policy, review lifecycle, model-selection rules, or cross-skill orchestration here. New or changed behavior must be owned by the layer that executes it.
15
14
 
16
- ## Rule 2 Model Selection
17
-
18
- Flash-class models are markedly more likely to stop prematurely on long-horizon agentic work. For critical long tasks, prefer a stronger model or `/goal` mode. This is a runtime choice, not something a skill text can enforce — record it here so skill authors and session runners share the same guidance.
19
-
20
- ## Rule 3 — Progress Chunking
21
-
22
- Giant turns — a single `write` of a large file, or a batch `replace` of a hundred-plus lines — hit output caps and get truncated mid-work. Chunk the work into small, individually verifiable steps:
23
-
24
- - A single `write` over ~150 lines: write the skeleton first, then fill in batches.
25
- - A batch of more than ~5 `replace`s: split into batches and verify after each batch.
26
-
27
- These thresholds are experience defaults; adjust them as practice shows better values.
28
- ## Rule 4 — Git History Preservation
29
-
30
- Every skill that touches git must preserve history after `BASE_HEAD`: history may only be appended, never rewritten or dropped. The skill must record `BASE_HEAD=$(git rev-parse HEAD)` at stage entry, and verify `git merge-base --is-ancestor $BASE_HEAD HEAD` at every stage exit and before any commit — failure means history was rewritten and the skill must recover via `git reflog` before continuing.
31
-
32
- To achieve "directory clean" (`git status` clean) the skill may only delete its own temporary artifacts (`[DEBUG-...]`, one-off scripts, untracked probe files) — it must never use git-level destructive commands to reach a clean state. The following are forbidden without explicit user confirmation: `git reset --hard`, `git checkout .`, `git clean -fd`, `git stash push --include-untracked` (use `--keep-index` instead and `pop` with verification), `git push --force`, `git rebase -i` and any `reset`/`checkout` that moves `HEAD` backward.
33
-
34
- Canonical enforcement: [`tdd-implement/references/stages.md`](.agents/skills/tdd-implement/references/stages.md) checks `BASE_HEAD` at every delivery-stage exit and before the Finalize commit; multi-issue enforcement lives in [`tdd-implement/references/orchestration.md`](.agents/skills/tdd-implement/references/orchestration.md) A2-A4. Repository-local commit gating remains a workspace-only concern and is not part of the distributable template.
35
- ## Long-horizon skills inventory
36
-
37
- Skills currently classified as Long-Horizon, to be evolved against these rules as they are touched: `tdd-implement` (fixed), `diagnose-fix` (fixed — orchestration for diagnosis + TDD fix), `diagnosing-bugs`, `improve-codebase-architecture`, `wayfinder`, `grill-to-spec` (fixed — carries its own Turn Continuity rule), `to-spec`. Backfilling existing skill texts is out of scope for now — these rules bind new and edited skills going forward.
15
+ This compatibility file can be removed once no maintained consumer depends on its path.
@@ -1,6 +1,6 @@
1
1
  # matt-skills
2
2
 
3
- The domain vocabulary for this repo two sections: how this repository is positioned (`## Repository`) and the terms that govern how long-horizon skills are written, reviewed, and evolved (`## Skill Design`). Every term here is a single source of truth; skills and docs reference it rather than restating the definition.
3
+ Repository vocabulary for this project. This file defines domain terms only; execution policy belongs to the active `AGENTS.md`, and skill-specific behavior belongs to each live `SKILL.md` and its references.
4
4
 
5
5
  ## Repository
6
6
 
@@ -9,47 +9,29 @@ This repository's identity. It is the config repo for mattpocock/skills: it dist
9
9
  _Avoid_: skill distribution repo
10
10
 
11
11
  **Upstream Repository** (上游仓库):
12
- mattpocock/skills — the source of the 26 Skill bodies (skills/engineering + skills/productivity) that are mirrored into this repo's Workspace canonical Skill source and then distributed by the CLI. This repo syncs them via `scripts/sync-upstream.js` and `matt-skills sync`.
12
+ mattpocock/skills — the source of the upstream Skill bodies mirrored into this repo's Workspace canonical Skill source and then distributed by the CLI. This repo syncs them via `scripts/sync-upstream.js` and `matt-skills sync`.
13
13
  _Avoid_: source repo, skill origin
14
14
 
15
15
  **Proprietary Skill** (独有技能):
16
- A skill that does not exist upstream and lives only in this repo (currently ci-guard, tdd-implement, grill-to-spec, diagnose-fix, commit-check, scaffold-functional-test and show-me). Before adding a new skill, check the Upstream Repository first; only skills absent there qualify as proprietary. The 7 proprietary skills are classified as 5 distributable (`tdd-implement`, `diagnose-fix`, `grill-to-spec`, `scaffold-functional-test`, `show-me`) and 2 repo-local (`ci-guard`, `commit-check`). The default programming set includes 4 proprietary skills: `tdd-implement`, `diagnose-fix`, `grill-to-spec` and `show-me`; `scaffold-functional-test` is distributable but optional. Repo-local skills serve matt-skills maintenance and are never distributed. The issue-audit subagent is NOT a skill: it ships as a subagent + command under `.opencode/` and is distributed through the Template Snapshot without a skill directory.
16
+ A skill that does not exist upstream and lives only in this repo. The current proprietary set is classified in `config/proprietary.json` as distributable or repo-local; that config is the source of truth for membership. Repo-local skills serve matt-skills maintenance and are never distributed. Before adding a new proprietary skill, check the Upstream Repository first.
17
17
  _Avoid_: private skill, local skill
18
18
 
19
19
  **Workspace** (工作区):
20
- The root-level working copies of the template content — `.agents/skills/` (upstream plus all proprietary Skills, the canonical shared Skill source), `.opencode/` (issue-audit agent, explicit-Skill commands), `.pi/` (pi-agent prompts: `issue-audit`), `AGENTS.md`, `CONTEXT.md`, `docs/`. This is where the repo's own sessions load, modify and test the content. The Template Snapshot projects only the distributable configuration and skeleton: `.opencode/commands/*.md` → `template/.opencode/commands/`, `.pi/prompts/issue-audit.md` `template/.pi/prompts/issue-audit.md`, and root-level `CONTEXT.md` and `docs/agents/` → `template/.opencode/` + `template/.pi/`. The CLI assembles selected shared Skills from the canonical source into a Target Repository. Harness-specific Skill dirs `.pi/skills/` and `.opencode/skills/` are reserved for project-local custom Skills (empty placeholders with `.gitkeep` + `README.md` in the Template Snapshot).
20
+ The root-level canonical working area: `.agents/skills/` for shared Skills, `.opencode/` and `.pi/` for harness configuration, plus repository docs and configuration. Shared Skills are authored here. Harness-specific `.pi/skills/` and `.opencode/skills/` are reserved for project-local custom Skills rather than shared mirrors.
21
21
  _Avoid_: working copy, source repo
22
22
 
23
23
  **Template Snapshot** (模板快照):
24
- Everything under `template/` the distributable snapshot of project skeleton content: harness Skill dirs `.pi/skills/` + `.opencode/skills/` as empty placeholders for project custom Skills, distributable opencode commands under `.opencode/commands/`, the pi issue-audit command under `.pi/prompts/`, discipline files and glossary under `.opencode/` + `.pi/`, and AGENTS.md at the top level. It is generated by `node scripts/build-template.js` and used to initialize other repositories. Shared Skills and repo-local Skills remain in the Workspace; the CLI distributes only the selected shared Skills. The sync direction for the skeleton is one-way: Workspace → Template Snapshot. Template structure tests guard the content the snapshot owns.
24
+ Everything under `template/` that is generated or copied from Workspace sources for Target Repository initialization. The snapshot owns project skeleton/configuration, while shared Skills are assembled separately by the CLI from the Workspace canonical source. Skeleton sync is one-way: Workspace → Template Snapshot.
25
25
  _Avoid_: release snapshot, published snapshot
26
26
 
27
27
  **Target Repository** (目标仓库):
28
- A repository initialized by copying the Template Snapshot skeleton into its root and then receiving selected distributable shared Skills from the CLI. It loads shared Skills from its own `.agents/skills/`, project-local custom Skills from `.pi/skills/` / `.opencode/skills/` (if any), the distributable commands from `.opencode/commands/` (opencode) and the `issue-audit` command from `.pi/prompts/` (pi) / `.opencode/commands/` (opencode), and the project-level global config from `.opencode/` + `.pi/` and AGENTS.md. Repo-local matt-skills maintenance Skills are not part of a Target Repository by default.
28
+ A repository initialized from the Template Snapshot and selected distributable shared Skills. Its root `AGENTS.md` is the project-level execution policy. Shared Skills live in `.agents/skills/`; project-local custom Skills may live in harness-specific skill directories.
29
29
  _Avoid_: inheriting repo, child repo
30
30
 
31
31
  **Initialize** (初始化):
32
- The one-time action of setting up a Target Repository: copying the Template Snapshot skeleton into its root, then having the CLI create its shared Skill directory and copy the selected distributable Skills from the Workspace canonical source. No separate upstream fetch is needed. Repo-local Skills are intentionally absent. Copying, not inheriting — no runtime relationship survives the copy.
32
+ The one-time action of setting up a Target Repository by copying the Template Snapshot skeleton and installing the selected distributable Skills. Repo-local Skills are intentionally excluded.
33
33
  _Avoid_: inherit, bootstrap
34
34
 
35
35
  **Sync** (同步):
36
- `matt-skills sync` 同步 Target Repository skeleton Skills:`--dry-run` 仅对比不写盘(`check`,`--json` 可解析,有差异 `exit 1`),默认安全增量(`AGENTS.md` 有定制如 `tdd-implement` 则跳过,canonical shared Skills 按默认 programming 范围覆盖但不删多余,Template Snapshot `.opencode` / `.pi` 配置增量 add/update,`.pi/skills` `.opencode/skills` 中已有的 project-local Skill 不按名称删除,避免把项目自定义 Skill 误删)、`--all` 仅更新同名可分发 Skill 内容(存在则覆盖,不存在则新增)并更新 `AGENTS.md`(不跳过定制),不删多余 Skill。Repo-local Skill 永远不新增、不覆盖、不删除,只在发现历史副本时提示保留。`update` 已合并到 `sync` 并删除。
36
+ `matt-skills sync` updates Target Repository skeleton/configuration and selected distributable Skills according to CLI policy. Default sync preserves project customization where the CLI can identify it; `--all` applies the broader distributable scope. Repo-local Skills are never newly distributed by sync.
37
37
  _Avoid_: update, force sync
38
-
39
- ## Skill Design
40
-
41
- **Turn Continuity** (回合连续性):
42
- The rule that a long-horizon skill must carry a positive instruction to keep executing within a turn — red → green → typecheck → next seam serial in one turn until the stage's exit condition is met. The stage exit is reached when all of its seams are complete — one seam going green is not an exit, and progress output does not itself end the turn. It is the skill's own guard against premature turn-end; it must not rely on the harness `/goal` line (which does not exist when no `/goal` is active).
43
- _Avoid_: keep going, don't stop
44
-
45
- **Chunking** (拆小步 / 进度编排):
46
- Splitting a giant turn — one large `write` or a batch of `replace`s — into small steps that are individually verified before continuing, so the turn never hits output caps and gets truncated mid-work.
47
- _Avoid_: step-by-step, take it slow
48
-
49
- **Git History Preservation** (Git 历史保护):
50
- Every git-touching skill must preserve history after `BASE_HEAD=$(git rev-parse HEAD)` recorded at stage entry — history may only be appended. Before any commit or stage exit, verify `git merge-base --is-ancestor $BASE_HEAD HEAD`; if it fails, history was rewritten and must be recovered via `git reflog` before continuing. "Directory clean" (`git status` clean) may only be achieved by deleting the skill's own temporary artifacts (`[DEBUG-...]`, one-off scripts, untracked probe files); destructive git commands `git reset --hard`, `git checkout .`, `git clean -fd`, `git stash push --include-untracked`, `git push --force`, `git rebase -i` are forbidden without explicit user confirmation.
51
- _Avoid_: force clean, stash all
52
-
53
- **Long-Horizon Skill** (长程多阶段技能):
54
- A skill whose run spans multiple stages or seams executed continuously (e.g. tdd-implement, diagnosing-bugs, improve-codebase-architecture, wayfinder, grill-to-spec, to-spec). The class of skill that must carry a Turn Continuity rule.
55
- _Avoid_: complex skill, big skill
@@ -1,37 +1,26 @@
1
1
  # Runtime Discipline
2
2
 
3
- 本仓库会话的运行时纪律,执行口径源自 `docs/agents/skill-design.md` 的四条规则(规范正文)。术语定义见 `CONTEXT.md`。
3
+ This file contains only general execution discipline. It does not override the active project `AGENTS.md` or any skill-specific lifecycle.
4
4
 
5
- ## 回合连续性规则
5
+ ## Ownership
6
6
 
7
- 每个逻辑单元(红-绿循环、typecheck、测试修复)必须在一个回合内连续执行完毕后才输出:测试 分析失败 修正 重跑 全绿整条链一气呵成,中途不输出、不停止、不等用户"继续"。
7
+ - authorization, validation scope, review scope and Git policy come from the active `AGENTS.md` and explicit user instructions;
8
+ - a skill owns only its own lifecycle, state transitions and exit conditions;
9
+ - TDD semantics belong to `.agents/skills/tdd/SKILL.md`;
10
+ - full code-review semantics belong to `.agents/skills/code-review/SKILL.md`.
8
11
 
9
- 输出只允许发生在三种情况:
10
- - 合规交互点:技能/流程要求的用户确认(如 tdd-implement 的 seams 清单确认)
11
- - 外部阻塞:权限拒绝、缺失授权、依赖不可用——明确说明所需授权或替代路径,不静默停止
12
- - 阶段完成:整个阶段的出口条件满足(如 seam 全绿、typecheck 通过、commit 完成)
12
+ When rules disagree, do not invent a merged policy: follow the higher-scope project/user rule for repository policy and the owning skill for its internal protocol.
13
13
 
14
- 预告下一步后立即执行该步骤,禁止把"分析/预告"当作回合终点。随包示例见 `.agents/skills/tdd-implement/SKILL.md` 与 `references/stages.md` 阶段③ 3e。
14
+ ## Execution
15
15
 
16
- ## 运行纪律(长程任务)
16
+ - Continue the active workflow until its stated exit condition, a required user decision, or an external blocker.
17
+ - Progress output does not reset lifecycle state or authorize restarting completed stages.
18
+ - Reuse still-valid evidence; do not repeat equivalent validation or review merely for reassurance.
19
+ - Do not invent build, test, typecheck, commit, or review requirements that are absent from the owning policy.
20
+ - Keep changes local to the requested scope and reuse existing abstractions and dependency direction.
17
21
 
18
- 本仓库会话做**长程任务**(Long-Horizon Skill:多阶段/多 seam 串行执行,如 tdd-implement、diagnosing-bugs、improve-codebase-architecture、wayfinder、grill-to-spec、to-spec)时:
22
+ ## Documentation Maintenance
19
23
 
20
- - **长程声明**:执行长程技能前,确认技能文本自带长程任务声明与回合连续性规则(Turn Continuity)——阶段内连续动作一回合内完成,不依赖 harness `/goal` 防线。tdd-implement 已内嵌(SKILL.md 声明 + references/stages.md 阶段③规则)。
21
- - **模型选择**:flash 级模型长程任务卡住概率显著更高;关键长任务优先强模型或 `/goal` 模式。
22
- - **任务分解(Chunking)**:巨型操作拆小步执行——单次 `write` 超过 ~150 行先写骨架再分批补全;批量 `replace` 超过 ~5 处分批执行,每批后立即验证。tdd-implement 已内嵌该规则(随包分发)。
23
- - **Git 历史保护(Git History Preservation)**:任何触及 git 的操作必须追加历史、不可改写丢弃。阶段入口记录 `BASE_HEAD=$(git rev-parse HEAD)`,阶段出口与 commit 前校验 `git merge-base --is-ancestor $BASE_HEAD HEAD`,失败即经 `git reflog` 恢复后才继续。"目录卫生"仅删本次产生的 `[DEBUG-...]`/一次性脚本等未跟踪临时文件,禁止为达干净而执行 `git reset --hard`、`git checkout .`、`git clean -fd`、`git stash push --include-untracked`、`git push --force`、`git rebase -i` 等(需显式用户确认)。
24
-
25
- ## 执行原则(细则)
26
-
27
- - 先澄清边界再实现;任务收敛后直接执行,不做不必要的形式化流程
28
- - 局部修改、最小充分实现,避免无关扩张
29
- - 用户当次明确指令优先于历史经验与参考项目
30
- - 脏工作区不回滚他人改动;遇到未明改动先理解再兼容
31
-
32
- ## 文档维护(细则)
33
-
34
- - 本文件与分文件只记录长期有效、跨任务可复用的工程经验与项目级约定
35
- - 一次性需求、临时接口选择、用户当次指定方案不沉淀;更换接口/方案视为需求变更,不判定"旧错新对"
36
- - 仅当问题重复出现、暴露长期约束、影响后续多次开发、用户明确要求沉淀,或涉及安全/构建/测试/发布/架构边界时更新
37
- - 经验条目包含:标题、触发信号、根因/约束、正确做法、验证方式、适用范围
24
+ - Keep only durable, cross-task rules here.
25
+ - One-off decisions and temporary implementation choices do not become runtime policy.
26
+ - When a repeated failure reveals a missing invariant, prefer enforcing it in the owning skill, test, tool, type, or repository policy rather than duplicating prose across layers.
@@ -1,37 +1,15 @@
1
- # Skill Design Spec
1
+ # Skill Design — Deprecated
2
2
 
3
- The design rules every skill in this repo must obey. Apply them when writing a new skill or editing an existing one. Terms are defined once in [`CONTEXT.md`](../../CONTEXT.md) — reference them there, never restate the definition.
3
+ This file is retained temporarily for compatibility. It is **not** a normative rule source.
4
4
 
5
- This spec exists because of a real incident: a long-horizon skill run on a flash-class model stopped its turn at "announce the next step" points four times in one session (see `DIAGNOSIS-tdd-implement-stuck.md`). The four rules below are the preventive measures that came out of that diagnosis and subsequent git-history incidents (see `docs/adr/0003-git-history-preservation.md`). They are repo rules, not advice.
6
- ## Rule 1 — Turn Continuity
5
+ Current ownership is:
7
6
 
8
- Every **Long-Horizon Skill** must carry a positive **Turn Continuity** rule of its own: the consecutive actions of a stage (red green → typecheck → next seam) are executed serially **within one turn**, until the stage's exit condition is met. Do not end the turn at "announce the next step" points, and do not wait for the user to say "continue".
7
+ - repository or project execution policy → the active `AGENTS.md`;
8
+ - repository vocabulary and distribution concepts → `CONTEXT.md`;
9
+ - skill-specific lifecycle and state → that skill's `SKILL.md` and live references;
10
+ - TDD semantics → `.agents/skills/tdd/SKILL.md`;
11
+ - full code-review semantics → `.agents/skills/code-review/SKILL.md`.
9
12
 
10
- - State it **positively** (per the negation principle in `writing-for-agents`): describe the target behaviour, never the banned one.
11
- - It must be **self-contained** — the skill cannot rely on the harness `/goal` line, because no `/goal` exists when the user does not activate one.
12
- - Every stage ends on a checkable exit condition; reaching it is the only thing that ends the turn.
13
- - A sub-step going green (e.g. one seam) is not a stage exit — a stage ends only when all of its seams are complete. Progress output does not itself end the turn: output, then keep executing until one of the three endpoints (compliance checkpoint, external blocker, stage exit) is reached.
14
- - Canonical example: the 回合连续性 rule in [`.agents/skills/tdd-implement/references/stages.md`](.agents/skills/tdd-implement/references/stages.md), especially the Red-Green continuity section.
13
+ Do not add Git policy, build/test policy, review lifecycle, model-selection rules, or cross-skill orchestration here. New or changed behavior must be owned by the layer that executes it.
15
14
 
16
- ## Rule 2 Model Selection
17
-
18
- Flash-class models are markedly more likely to stop prematurely on long-horizon agentic work. For critical long tasks, prefer a stronger model or `/goal` mode. This is a runtime choice, not something a skill text can enforce — record it here so skill authors and session runners share the same guidance.
19
-
20
- ## Rule 3 — Progress Chunking
21
-
22
- Giant turns — a single `write` of a large file, or a batch `replace` of a hundred-plus lines — hit output caps and get truncated mid-work. Chunk the work into small, individually verifiable steps:
23
-
24
- - A single `write` over ~150 lines: write the skeleton first, then fill in batches.
25
- - A batch of more than ~5 `replace`s: split into batches and verify after each batch.
26
-
27
- These thresholds are experience defaults; adjust them as practice shows better values.
28
- ## Rule 4 — Git History Preservation
29
-
30
- Every skill that touches git must preserve history after `BASE_HEAD`: history may only be appended, never rewritten or dropped. The skill must record `BASE_HEAD=$(git rev-parse HEAD)` at stage entry, and verify `git merge-base --is-ancestor $BASE_HEAD HEAD` at every stage exit and before any commit — failure means history was rewritten and the skill must recover via `git reflog` before continuing.
31
-
32
- To achieve "directory clean" (`git status` clean) the skill may only delete its own temporary artifacts (`[DEBUG-...]`, one-off scripts, untracked probe files) — it must never use git-level destructive commands to reach a clean state. The following are forbidden without explicit user confirmation: `git reset --hard`, `git checkout .`, `git clean -fd`, `git stash push --include-untracked` (use `--keep-index` instead and `pop` with verification), `git push --force`, `git rebase -i` and any `reset`/`checkout` that moves `HEAD` backward.
33
-
34
- Canonical enforcement: [`tdd-implement/references/stages.md`](.agents/skills/tdd-implement/references/stages.md) checks `BASE_HEAD` at every delivery-stage exit and before the Finalize commit; multi-issue enforcement lives in [`tdd-implement/references/orchestration.md`](.agents/skills/tdd-implement/references/orchestration.md) A2-A4. Repository-local commit gating remains a workspace-only concern and is not part of the distributable template.
35
- ## Long-horizon skills inventory
36
-
37
- Skills currently classified as Long-Horizon, to be evolved against these rules as they are touched: `tdd-implement` (fixed), `diagnose-fix` (fixed — orchestration for diagnosis + TDD fix), `diagnosing-bugs`, `improve-codebase-architecture`, `wayfinder`, `grill-to-spec` (fixed — carries its own Turn Continuity rule), `to-spec`. Backfilling existing skill texts is out of scope for now — these rules bind new and edited skills going forward.
15
+ This compatibility file can be removed once no maintained consumer depends on its path.
@@ -1,5 +1,7 @@
1
1
  # AGENTS.md
2
2
 
3
+ <!-- matt-skills:managed:start -->
4
+
3
5
  ## Workflow
4
6
 
5
7
  按任务目标选择 skill / 工具,并用一行声明:
@@ -82,3 +84,5 @@ codegraph node "<符号>"
82
84
  ## Completion
83
85
 
84
86
  有实际修改时说明:改动、验证、未验证项 / 风险、commit hash(如有)。
87
+
88
+ <!-- matt-skills:managed:end -->