dsh-lean-router 1.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/NOTICE.md +2 -4
  2. package/README.en.md +47 -43
  3. package/README.md +45 -41
  4. package/cordis.patch.yml +4 -26
  5. package/docs/agents/domain.md +1 -1
  6. package/docs/architecture.en.md +51 -86
  7. package/docs/architecture.md +46 -77
  8. package/docs/changelog.en.md +24 -1
  9. package/docs/changelog.md +24 -1
  10. package/docs/configuration.en.md +25 -56
  11. package/docs/configuration.md +14 -45
  12. package/docs/install.en.md +2 -2
  13. package/docs/install.md +2 -2
  14. package/docs/quickstart.en.md +29 -34
  15. package/docs/quickstart.md +11 -16
  16. package/docs/release-checklist.en.md +3 -4
  17. package/docs/release-checklist.md +5 -6
  18. package/docs//350/267/257/347/224/261-/350/256/276/350/256/241/350/257/264/346/230/216.md +2 -2
  19. package/lib/index.js +9 -61
  20. package/lib/router.js +15 -148
  21. package/package.json +4 -15
  22. package/presets/base/frag-lean.patch.yml +1 -5
  23. package/presets/base/frag-preset.patch.yml +1 -3
  24. package/presets/base/frag-router.patch.yml +1 -12
  25. package/presets/base/frag-toolface.patch.yml +0 -2
  26. package/presets/base/lean-router.patch.yml +1 -4
  27. package/scripts/doctor.mjs +15 -10
  28. package/test/integration-preset.test.mjs +4 -3
  29. package/test/plugin-entry.test.mjs +15 -50
  30. package/test/router.test.mjs +7 -47
  31. package/assets/gating.weights.json +0 -13
  32. package/assets/skills/ask-matt/PHASE-BOUNDARIES.md +0 -55
  33. package/assets/skills/ask-matt/SKILL.md +0 -80
  34. package/assets/skills/ask-matt/agents/openai.yaml +0 -5
  35. package/assets/skills/chief-of-staff/SKILL.md +0 -76
  36. package/assets/skills/chief-of-staff/agents/openai.yaml +0 -5
  37. package/assets/skills/code-review/SKILL.md +0 -91
  38. package/assets/skills/code-review/agents/openai.yaml +0 -5
  39. package/assets/skills/codebase-design/DEEPENING.md +0 -37
  40. package/assets/skills/codebase-design/DESIGN-IT-TWICE.md +0 -44
  41. package/assets/skills/codebase-design/SKILL.md +0 -116
  42. package/assets/skills/codebase-design/agents/openai.yaml +0 -5
  43. package/assets/skills/diagnosing-bugs/SKILL.md +0 -140
  44. package/assets/skills/diagnosing-bugs/agents/openai.yaml +0 -5
  45. package/assets/skills/diagnosing-bugs/scripts/hitl-loop.template.sh +0 -44
  46. package/assets/skills/domain-modeling/ADR-FORMAT.md +0 -47
  47. package/assets/skills/domain-modeling/GLOSSARY-FORMAT.md +0 -60
  48. package/assets/skills/domain-modeling/SKILL.md +0 -76
  49. package/assets/skills/domain-modeling/agents/openai.yaml +0 -5
  50. package/assets/skills/grilling/SKILL.md +0 -52
  51. package/assets/skills/grilling/agents/openai.yaml +0 -5
  52. package/assets/skills/handoff/SKILL.md +0 -17
  53. package/assets/skills/handoff/agents/openai.yaml +0 -5
  54. package/assets/skills/implement/SKILL.md +0 -55
  55. package/assets/skills/implement/agents/openai.yaml +0 -5
  56. package/assets/skills/improve-codebase-architecture/HTML-REPORT.md +0 -123
  57. package/assets/skills/improve-codebase-architecture/SKILL.md +0 -72
  58. package/assets/skills/improve-codebase-architecture/agents/openai.yaml +0 -5
  59. package/assets/skills/loop-me/SKILL.md +0 -33
  60. package/assets/skills/loop-me/agents/openai.yaml +0 -5
  61. package/assets/skills/pr/CREDITS.md +0 -3
  62. package/assets/skills/pr/SKILL.md +0 -172
  63. package/assets/skills/pr/agents/openai.yaml +0 -5
  64. package/assets/skills/prototype/LOGIC.md +0 -67
  65. package/assets/skills/prototype/SKILL.md +0 -28
  66. package/assets/skills/prototype/UI.md +0 -112
  67. package/assets/skills/prototype/agents/openai.yaml +0 -5
  68. package/assets/skills/research/SKILL.md +0 -14
  69. package/assets/skills/research/agents/openai.yaml +0 -5
  70. package/assets/skills/retro/SKILL.md +0 -45
  71. package/assets/skills/retro/agents/openai.yaml +0 -5
  72. package/assets/skills/setup-matt-pocock-skills/SKILL.md +0 -121
  73. package/assets/skills/setup-matt-pocock-skills/agents/openai.yaml +0 -5
  74. package/assets/skills/setup-matt-pocock-skills/domain.md +0 -51
  75. package/assets/skills/setup-matt-pocock-skills/issue-tracker-github.md +0 -50
  76. package/assets/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md +0 -46
  77. package/assets/skills/setup-matt-pocock-skills/issue-tracker-local.md +0 -30
  78. package/assets/skills/setup-matt-pocock-skills/triage-labels.md +0 -15
  79. package/assets/skills/setup-ts-deep-modules/SKILL.md +0 -103
  80. package/assets/skills/setup-ts-deep-modules/agents/openai.yaml +0 -5
  81. package/assets/skills/setup-ts-deep-modules/dependency-cruiser.config.cjs +0 -95
  82. package/assets/skills/software-factory/EXAMPLE-TASKS.md +0 -80
  83. package/assets/skills/software-factory/GIT-HOSTS.md +0 -84
  84. package/assets/skills/software-factory/OBSERVABILITY-PLATFORMS.md +0 -75
  85. package/assets/skills/software-factory/RUNNERS.md +0 -94
  86. package/assets/skills/software-factory/SKILL.md +0 -99
  87. package/assets/skills/software-factory/TICKET-TRACKERS.md +0 -85
  88. package/assets/skills/tdd/SKILL.md +0 -40
  89. package/assets/skills/tdd/agents/openai.yaml +0 -5
  90. package/assets/skills/tdd/mocking.md +0 -59
  91. package/assets/skills/tdd/tests.md +0 -77
  92. package/assets/skills/teach/GLOSSARY-FORMAT.md +0 -35
  93. package/assets/skills/teach/LEARNING-RECORD-FORMAT.md +0 -46
  94. package/assets/skills/teach/MISSION-FORMAT.md +0 -31
  95. package/assets/skills/teach/RESOURCES-FORMAT.md +0 -32
  96. package/assets/skills/teach/SKILL.md +0 -141
  97. package/assets/skills/teach/agents/openai.yaml +0 -5
  98. package/assets/skills/to-questionnaire/SKILL.md +0 -55
  99. package/assets/skills/to-questionnaire/agents/openai.yaml +0 -5
  100. package/assets/skills/to-spec/SKILL.md +0 -76
  101. package/assets/skills/to-spec/agents/openai.yaml +0 -5
  102. package/assets/skills/to-tickets/SKILL.md +0 -106
  103. package/assets/skills/to-tickets/agents/openai.yaml +0 -5
  104. package/assets/skills/triage/AGENT-BRIEF.md +0 -207
  105. package/assets/skills/triage/OUT-OF-SCOPE.md +0 -105
  106. package/assets/skills/triage/SKILL.md +0 -113
  107. package/assets/skills/triage/agents/openai.yaml +0 -5
  108. package/assets/skills/wait-what/SKILL.md +0 -8
  109. package/assets/skills/wait-what/agents/openai.yaml +0 -5
  110. package/assets/skills/wayfinder/SKILL.md +0 -129
  111. package/assets/skills/wayfinder/agents/openai.yaml +0 -5
  112. package/assets/skills/wizard/SKILL.md +0 -46
  113. package/assets/skills/wizard/agents/openai.yaml +0 -5
  114. package/assets/skills/wizard/template.sh +0 -223
  115. package/assets/skills/writing-beats/SKILL.md +0 -44
  116. package/assets/skills/writing-beats/agents/openai.yaml +0 -5
  117. package/assets/skills/writing-for-agents/SKILL-MECHANICS.md +0 -22
  118. package/assets/skills/writing-for-agents/SKILL.md +0 -83
  119. package/assets/skills/writing-for-agents/agents/openai.yaml +0 -5
  120. package/assets/skills/writing-fragments/SKILL.md +0 -80
  121. package/assets/skills/writing-fragments/agents/openai.yaml +0 -5
  122. package/assets/skills/writing-shape/SKILL.md +0 -59
  123. package/assets/skills/writing-shape/agents/openai.yaml +0 -5
  124. package/assets/skills.matrix.json +0 -311
  125. package/docs/HANDOFF-2026-11-22.md +0 -155
  126. package/docs/matrix.en.md +0 -57
  127. package/docs/matrix.md +0 -57
  128. package/docs//346/212/200/350/203/275/351/227/250/346/216/247-/350/256/276/350/256/241/350/257/264/346/230/216.md +0 -134
  129. package/docs//351/235/242/346/235/277-/350/256/276/350/256/241/350/257/264/346/230/216.md +0 -205
  130. package/lib/audit-commands.js +0 -289
  131. package/lib/audit-sink.js +0 -137
  132. package/lib/client.js +0 -203
  133. package/lib/gate-runner.js +0 -179
  134. package/lib/skill-provider.js +0 -167
  135. package/lib/skillgate.js +0 -396
  136. package/lib/skills-panel.js +0 -322
  137. package/scripts/check-drift.mjs +0 -24
  138. package/skills.manifest.json +0 -287
  139. package/test/audit-commands.test.mjs +0 -325
  140. package/test/audit-sink.test.mjs +0 -150
  141. package/test/client-plugin.test.mjs +0 -117
  142. package/test/gate-run.test.mjs +0 -173
  143. package/test/manifest.test.mjs +0 -25
  144. package/test/provider.test.mjs +0 -21
  145. package/test/skillgate-provider.test.mjs +0 -122
  146. package/test/skillgate.test.mjs +0 -217
  147. package/test/skills-panel.test.mjs +0 -114
  148. package/ui/go.json +0 -19
@@ -2,14 +2,13 @@
2
2
  # TODO(ticket-03 lean 层):compaction 0.25/20000、tool-result pruner 4096/1024、关 6 插件、lean13/balance3 persona、plan-mode v1、delivery-gate、glob/grep 并发标记
3
3
  # TODO(ticket-04 工具遮蔽层):codemode executor 遮蔽行 + code_run 传输 + meta 4 工具 + 常驻 ptc-runtime
4
4
  # TODO(ticket-05 路由层):首轮 inbox.claim 捕获 + [router] band/task 分类指令 + pre-step 近场引导 + 3 软门 + /band
5
- # TODO(ticket-06 技能门控层):skill provider rank 配置 + 每轮评分放行 + 8k 软降级 + 审计
6
5
  - insert:
7
6
  - id: preset-lean-router
8
7
  name: '@deepseek-ai/dsh-agent-preset'
9
8
  config:
10
9
  id: lean-router
11
10
  name: Lean router
12
- description: "lean 省 token × 思考链路由 × code_run 遮蔽 × mattpocock 技能自动调用(v1.0.0 骨架)"
11
+ description: "lean 省 token × 思考链路由 × code_run 遮蔽(2.0.0)"
13
12
  order: 30
14
13
  plugins:
15
14
  - id: persona
@@ -37,8 +36,6 @@
37
36
  name: '@deepseek-ai/dsh-tool-jobs'
38
37
  - id: skill-filesystem
39
38
  name: '@deepseek-ai/dsh-skill-filesystem'
40
- - id: skill-lean-router
41
- name: dsh-lean-router
42
39
  - id: tool-skill
43
40
  name: '@deepseek-ai/dsh-tool-skill'
44
41
  - id: command-goal
@@ -1,5 +1,5 @@
1
- // dsh-lean-router - 体检(票 02 骨架版;票 04/06 将加四层接缝自检)
2
- import { readFile, readdir } from "node:fs/promises";
1
+ // dsh-lean-router - 体检(2.0.0:技能子系统下线后只剩结构自检)
2
+ import { readFile, access } from "node:fs/promises";
3
3
  import { join } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
 
@@ -8,20 +8,25 @@ const ROOT = fileURLToPath(new URL("..", import.meta.url));
8
8
  export async function doctor() {
9
9
  const lines = []; let fail = 0;
10
10
  const ok = (name, cond, extra) => { lines.push((cond ? "[PASS] " : "[FAIL] ") + name + (extra ? " | " + extra : "")); if (!cond) fail++; };
11
+ const exists = async (rel) => { try { await access(join(ROOT, rel)); return true; } catch { return false; } };
12
+
11
13
  const pkg = JSON.parse(await readFile(join(ROOT, "package.json"), "utf8"));
12
14
  ok("package.name", pkg.name === "dsh-lean-router", pkg.name);
13
15
  ok("package.engines.dsh", typeof (pkg.engines ?? {}).dsh === "string" && pkg.engines.dsh.includes("0.2.1-rc.5"), pkg.engines?.dsh);
16
+
14
17
  const patch = await readFile(join(ROOT, "cordis.patch.yml"), "utf8").catch(() => null);
15
18
  ok("cordis.patch.yml 存在", !!patch);
16
19
  ok("patch 含预设行", !!patch && patch.includes("preset-lean-router"));
17
- const manifest = JSON.parse(await readFile(join(ROOT, "skills.manifest.json"), "utf8"));
18
- ok("manifest 31 技能", manifest.skills.length === 31, String(manifest.skills.length));
19
- const dirs = (await readdir(join(ROOT, "assets", "skills"), { withFileTypes: true })).filter(d => d.isDirectory());
20
- ok("assets/skills 目录数", dirs.length === 31, String(dirs.length));
21
- const matrix = JSON.parse(await readFile(join(ROOT, "assets", "skills.matrix.json"), "utf8"));
22
- const c = { both: 0, modelOnly: 0, userOnly: 0 };
23
- for (const s of matrix.skills) { if (s.model && s.user) c.both++; else if (s.model) c.modelOnly++; else c.userOnly++; }
24
- ok("矩阵计数 13/10/8", c.both === 13 && c.modelOnly === 10 && c.userOnly === 8, JSON.stringify(c));
20
+ ok("patch 含路由行", !!patch && patch.includes("lean-router-router"));
21
+ // 2.0.0 移除的子系统不得回流:技能 provider 行与客户端宿主行都已下线。
22
+ ok("patch 无技能 provider 行", !!patch && !patch.includes("skill-lean-router"));
23
+ ok("patch 无客户端宿主行", !!patch && !patch.includes("lean-router-client-host"));
24
+
25
+ ok("lib/router.js 存在", await exists("lib/router.js"));
26
+ ok("lib/lean/index.js 存在", await exists("lib/lean/index.js"));
27
+ ok("lib/toolface/index.js 存在", await exists("lib/toolface/index.js"));
28
+ ok("客户端 bundle 已移除", !(await exists("lib/client.js")));
29
+
25
30
  console.log(lines.join("\n"));
26
31
  return fail === 0;
27
32
  }
@@ -26,15 +26,16 @@ function suffixBlock(text) {
26
26
  return out.join('\n');
27
27
  }
28
28
 
29
- test('frag-preset 是 preset 行唯一生效 owner:21 行并集、无重复、toolface 收尾', () => {
29
+ test('frag-preset 是 preset 行唯一生效 owner:20 行并集、无重复、toolface 收尾', () => {
30
30
  const ids = frag.split(/\r?\n/).filter(l => /^ - id: /.test(l)).map(l => /^ - id: (.+)$/.exec(l)[1].trim());
31
- assert.equal(ids.length, 21, '并集行数 = 覆写块 20 + toolface(ptc-runtime 属宿主层,不进 preset)');
31
+ assert.equal(ids.length, 20, '并集行数 = 覆写块 19 + toolface(2.0.0 移除 skill-lean-router;ptc-runtime 属宿主层,不进 preset)');
32
32
  assert.equal(new Set(ids).size, ids.length, '无重复 id');
33
33
  assert.equal(ids[ids.length - 1], 'toolface', 'toolface 最后(遮蔽面与 preset 同行生效)');
34
34
  assert.ok(!ids.includes('ptc-runtime'), 'ptc-runtime 由宿主 dsh-base 挂载,放进 preset 会让整条 preset 激活失败(1.0.3 事故回归)');
35
- for (const id of ['persona', 'agent-instructions', 'skill-filesystem', 'skill-lean-router', 'planning', 'compaction', 'delegation', 'tool-todo', 'tool-web', 'present', 'toolface']) {
35
+ for (const id of ['persona', 'agent-instructions', 'skill-filesystem', 'planning', 'compaction', 'delegation', 'tool-todo', 'tool-web', 'present', 'toolface']) {
36
36
  assert.ok(ids.includes(id), '缺行: ' + id);
37
37
  }
38
+ assert.ok(!ids.includes('skill-lean-router'), '2.0.0 起不再挂 lean-router 技能 provider 行');
38
39
  assert.ok(!ids.includes('preset-lean-router-balance'), 'balance 是独立行,不在并集行 id 内');
39
40
  assert.ok(!ids.includes('lean-delivery-gate') && !ids.includes('lean-concurrency'), '交付门/并发标记是独立行,不在并集行 id 内');
40
41
  });
@@ -1,61 +1,26 @@
1
- // dsh-lean-router 1.0.6 —— 包入口(lib/index.js)的 cordis 契约回归。
2
- // 背景(0.2.3 真机):inject 写成 { required: [], optional: ["skills"] } 会被 cordis 当成
3
- // 两个叫 required / optional 的服务,宿主层那行永远 PENDING,apply 不跑,客户端 bundle
4
- // 不被扫描,顶栏按钮不出现。cordis 的 inject 只有两种形状:
5
- // Inject<M> = (keyof M)[] | { [K in keyof M]?: M[K] } (registry.ts L19)
1
+ // dsh-lean-router 2.0.0 —— 包入口(lib/index.js)的 cordis 契约回归。
2
+ // 2.0.0 起技能子系统下线,入口只剩一个合法插件形状;保留本测试是因为历史上两次真机事故都出在这里:
3
+ // 1.0.6: inject 写成 { required: [], optional: [...] } → 被当成两个服务名,宿主行永远 PENDING。
4
+ // 1.0.2: apply 返回普通对象 → cordis 抛 Invalid effect,整条 preset 不注册。
6
5
  import test from "node:test";
7
6
  import assert from "node:assert/strict";
8
- import { tmpdir } from "node:os";
9
- import { join } from "node:path";
10
7
 
11
8
  import * as entry from "../lib/index.js";
12
9
 
13
- /** 把 homedir() 指向临时目录,避免自检日志写进真实用户目录。 */
14
- function withTempHome(fn) {
15
- const saved = process.env.USERPROFILE;
16
- process.env.USERPROFILE = join(tmpdir(), "dsh-lean-router-test-home");
17
- try {
18
- return fn();
19
- } finally {
20
- if (saved === undefined) delete process.env.USERPROFILE;
21
- else process.env.USERPROFILE = saved;
22
- }
23
- }
24
-
25
- test("inject 是 cordis 认的形状,不能出现 required/optional 键", () => {
26
- if (Array.isArray(entry.inject)) return;
27
- assert.equal(typeof entry.inject, "object", "inject 必须是数组或服务名映射");
28
- const keys = Object.keys(entry.inject);
29
- assert.ok(
30
- !keys.includes("required") && !keys.includes("optional"),
31
- "inject 被当成服务名映射后出现了 required/optional 键:" + keys.join(","),
32
- );
10
+ test("包可被导入,且有 name / inject / apply", () => {
11
+ assert.equal(typeof entry.name, "string");
12
+ assert.ok(Array.isArray(entry.inject), "inject 必须是服务名数组或服务名映射,不能是 { required, optional }");
13
+ assert.equal(typeof entry.apply, "function");
33
14
  });
34
15
 
35
- test("宿主作用域:provider:false 时不碰 skills,apply 返回 undefined", () => {
36
- withTempHome(() => {
37
- const ctx = { inject() { throw new Error("provider:false 不该调用 ctx.inject"); } };
38
- assert.equal(entry.apply(ctx, { provider: false }), undefined);
39
- });
40
- });
41
-
42
- test("预设作用域:用 ctx.inject 等 skills 就绪,而不是把它写进必需依赖", () => {
43
- withTempHome(() => {
44
- const calls = [];
45
- const ctx = { inject(deps, cb) { calls.push({ deps, cb }); } };
46
- assert.equal(entry.apply(ctx, {}), undefined, "apply 不能把 ctx.inject 的 fiber 当 effect 交回去");
47
- assert.equal(calls.length, 1);
48
- assert.deepEqual(calls[0].deps, ["skills"]);
49
- let registered = null;
50
- calls[0].cb({ skills: { registerProvider(factory) { registered = factory; } } });
51
- assert.equal(typeof registered, "function", "skills 就绪后必须注册 provider");
52
- });
16
+ test("inject 里不出现 required / optional 这类伪服务名", () => {
17
+ const keys = Array.isArray(entry.inject) ? entry.inject : Object.keys(entry.inject);
18
+ assert.ok(!keys.includes("required") && !keys.includes("optional"), "inject 键:" + keys.join(","));
53
19
  });
54
20
 
55
- test("没有 ctx.inject 时退化为直接注册(老宿主兼容)", () => {
56
- withTempHome(() => {
57
- let registered = null;
58
- entry.apply({ skills: { registerProvider(factory) { registered = factory; } } }, {});
59
- assert.equal(typeof registered, "function");
21
+ test("apply 返回 undefined,且不读任何服务属性(cordis 会因未 inject 直接抛)", () => {
22
+ const ctx = new Proxy({}, {
23
+ get(_t, key) { throw new Error("apply 不该读 ctx." + String(key)); },
60
24
  });
25
+ assert.equal(entry.apply(ctx, {}), undefined);
61
26
  });
@@ -5,10 +5,10 @@ import assert from "node:assert/strict";
5
5
 
6
6
  import { BANDS, GUIDE_CONTEXT_NAME, internals, apply } from "../lib/router.js";
7
7
 
8
- const { capture, guideTextFor, executeBandCommand, executeSkillCommand } = internals;
8
+ const { capture, guideTextFor, executeBandCommand } = internals;
9
9
 
10
- /** 最小假 ctx:on / systemPrompt.context / commands.register / skills 全部可观测。 */
11
- function makeCtx(skills) {
10
+ /** 最小假 ctx:on / systemPrompt.context / commands.register 全部可观测。 */
11
+ function makeCtx() {
12
12
  const handlers = new Map();
13
13
  const contexts = new Map();
14
14
  const commands = new Map();
@@ -30,33 +30,10 @@ function makeCtx(skills) {
30
30
  return () => {};
31
31
  },
32
32
  },
33
- skills,
34
33
  };
35
34
  return { ctx, handlers, contexts, commands };
36
35
  }
37
36
 
38
- function fakeSkills() {
39
- return {
40
- async list() {
41
- return [
42
- { name: "tdd", description: "Test-driven development", invocation: { modelInvocable: true, userInvocable: false } },
43
- { name: "retro", description: "Retrospective", invocation: { modelInvocable: false, userInvocable: true } },
44
- ];
45
- },
46
- async get(name) {
47
- if (name !== "tdd") return undefined;
48
- return {
49
- name: "tdd",
50
- description: "Test-driven development",
51
- invocation: { modelInvocable: true, userInvocable: false },
52
- provider: "lean-router",
53
- source: "bundled",
54
- resourceBase: { kind: "directory", path: "/skills/tdd" },
55
- };
56
- },
57
- };
58
- }
59
-
60
37
  async function emitClaimed(ctx, handlers, agent, message, turn) {
61
38
  for (const handler of handlers.get("agent/inbox/claimed") ?? []) await handler({ agent, message, turn });
62
39
  }
@@ -66,7 +43,7 @@ const agentA = { session: {} };
66
43
  const agentB = { session: {} };
67
44
 
68
45
  async function routedSetup(options) {
69
- const { ctx, handlers, contexts, commands } = makeCtx(fakeSkills());
46
+ const { ctx, handlers, contexts, commands } = makeCtx();
70
47
  assert.equal(apply(ctx, options), undefined, 'apply must not return a plain object (cordis "Invalid effect")');
71
48
  return { ctx, handlers, contexts, commands };
72
49
  }
@@ -76,14 +53,15 @@ test("apply 默认注册 hooks 与 commands", async () => {
76
53
  assert.ok(handlers.has("agent/inbox/claimed"));
77
54
  assert.ok(contexts.has(GUIDE_CONTEXT_NAME));
78
55
  assert.ok(commands.has("band"));
79
- assert.ok(commands.has("skill"));
56
+ // 2.0.0:/skill /panel /lean-audit 随技能子系统一起下线,只保留 /band。
57
+ assert.equal(commands.size, 1);
80
58
  });
81
59
 
82
60
  test("每个命令的 input hint 都非空(宿主 normalizeDefinition 会抛 TypeError)", async () => {
83
61
  // 1.0.6 回归:/panel 曾用 input:{hint:""},0.2.3 真机报
84
62
  // TypeError: command "panel" input hint must not be empty,整条 lean-router-commands 不激活。
85
63
  const { commands } = await routedSetup({});
86
- assert.ok(commands.size >= 4, "band / skill / panel / lean-audit 都应注册");
64
+ assert.ok(commands.size >= 1, "至少要有 /band");
87
65
  for (const [name, def] of commands) {
88
66
  if (def.input === undefined) continue;
89
67
  assert.equal(typeof def.input.hint, "string", name + " 的 input.hint 必须是字符串");
@@ -99,7 +77,6 @@ test("options 分流:hooks:false 只留命令;commands:false 只留钩子",
99
77
  const b = await routedSetup({ commands: false });
100
78
  assert.ok(b.handlers.has("agent/inbox/claimed"));
101
79
  assert.ok(!b.commands.has("band"));
102
- assert.ok(!b.commands.has("skill"));
103
80
  });
104
81
 
105
82
  test("resolveOptions:未知键报错、diligenceEvery 校验", async () => {
@@ -219,23 +196,6 @@ test("/band:显示/改档/auto 回退/非法值报错", async () => {
219
196
  assert.equal(band.handler({}).kind, "error");
220
197
  });
221
198
 
222
- test("/skill:列表与详情走 skills 服务,未知技能报错", async () => {
223
- const { ctx, commands } = await routedSetup({});
224
- const skill = commands.get("skill");
225
- const list = await skill.handler({ agent: agentA, rawInput: "" });
226
- assert.equal(list.kind, "success");
227
- assert.ok(list.text.includes("tdd [model]"));
228
- assert.ok(list.text.includes("retro [user]"));
229
- const detail = await skill.handler({ agent: agentA, rawInput: "tdd" });
230
- assert.equal(detail.kind, "success");
231
- assert.ok(detail.text.includes("provider: lean-router"));
232
- assert.ok(detail.text.includes("/skills/tdd"));
233
- const unknown = await skill.handler({ agent: agentA, rawInput: "nope" });
234
- assert.equal(unknown.kind, "error");
235
- const noAgent = await skill.handler({});
236
- assert.equal(noAgent.kind, "error");
237
- });
238
-
239
199
  test("capture/guideTextFor 内部实现直调(状态隔离:两个 agent 互不影响)", () => {
240
200
  const states = new WeakMap();
241
201
  const changedA = capture(states, agentA, userMessage("修复报错"), 1, true);
@@ -1,13 +0,0 @@
1
- {
2
- "version": 1,
3
- "sceneMap": {
4
- "react": { "engineering": 2, "process": 1 },
5
- "spec": { "engineering": 2, "research": 1 },
6
- "weak": {}
7
- },
8
- "complexBoost": { "engineering": 1 },
9
- "autoScore": 2,
10
- "hintScore": 1,
11
- "tokenBudget": 8000,
12
- "charsPerToken": 4
13
- }
@@ -1,55 +0,0 @@
1
- # Phase boundaries
2
-
3
- A **phase** is a chunk of work inside a session: the grilling, the implementation, the QA. The definition is fuzzy on purpose: a phase ends when you think *"ok, we're done with that"*.
4
-
5
- The **phase boundary** is the gap between two phases, and it is the only place this decision belongs. Mid-phase there is no decision to make: continue, or split the work that's left into subagents. Compacting mid-phase makes the agent lose the thread.
6
-
7
- ## The five options
8
-
9
- | Option | What it does |
10
- | ------------ | --------------------------------------------------------------- |
11
- | **Continue** | Stay in the session. No context switch at all. |
12
- | **`/clear`** | Empty the context window and start from nothing. |
13
- | **`/handoff`** | Write a portable markdown file and seed a session anywhere with it. |
14
- | **Subagent** | Send the task to its own context window and get a report back. |
15
- | **`/compact`** | Compress this context and seed a fresh session with the summary. |
16
-
17
- ## The tree
18
-
19
- Work top to bottom at the boundary. The first **yes** wins.
20
-
21
- **1. Can you continue in this session?** Two things make the answer yes: the next phase needs this phase as a **primary source**, or you have enough [smart zone](https://www.aihero.dev/ai-coding-dictionary/smart-zone) left (~150k tokens) for the next phase to fit. Grilling → implementation is the standard yes: the implementation wants the reasoning verbatim, not a summary of it. Continue costs nothing and loses nothing, so rule it out before anything else.
22
-
23
- **2. Is the context irrelevant to what comes next?** Is everything in this session (the exploration, the decisions, the dead ends) disposable? If so, **`/clear`**. It is the cheapest move on the board: it takes no time and hands back the whole window. `/clear` also isn't terminal: the old session stays resumable.
24
-
25
- The cost of getting this wrong is one-way. Clear a *relevant* context and you lose the **why** behind what you built, and no amount of reading the diff back gets it returned.
26
-
27
- **3. Do you need to hand off?** `/handoff` is narrow. You need it only when you are:
28
-
29
- - swapping to a **new harness** (Claude → Codex),
30
- - moving to a **new directory** or repo,
31
- - sending the work to a **colleague**,
32
- - or forking a side task you found **mid-phase** without derailing what you're doing.
33
-
34
- That list is the whole clause. What `/handoff` buys is **portability**: a file that travels. If nothing is travelling, you don't need it.
35
-
36
- **4. Can the task be done AFK?** Is it scoped tightly enough to run with you away from the keyboard, no steering? Then send it to a **subagent** and leave this session untouched. Automated review is the standard case: the agent reads the diff and reports, and you aren't needed while it does.
37
-
38
- **5. Otherwise, `/compact`.** Relevant context, same harness, same directory, and you need to stay in the loop: this is where the tree lands, and it lands here often. Pass it an instruction (`/compact we're going to QA this area`) so the summary keeps what the next phase needs.
39
-
40
- `/compact` is the **default, not the first reach**. It sits at the bottom because the four questions above it are all cheaper or more precise. The failure mode when people start here is a fresh session that is confidently wrong about a decision the summary flattened.
41
-
42
- ## Primary and secondary sources
43
-
44
- Every move except **Continue** turns a **primary source** into a **secondary source**: the session as it happened, replaced by a summary of it. The trade is always the same shape:
45
-
46
- | Source | Information | Noise | Room to move |
47
- | --------------------------------- | ----------- | ----- | ------------ |
48
- | Primary (Continue) | Full | Lots | Little |
49
- | Secondary (`/compact`, `/handoff`) | Lossy | Less | Lots |
50
-
51
- This is why question 1 comes first. You only pay the lossiness when staying costs more than it saves.
52
-
53
- ## These are judgement calls
54
-
55
- The questions are not objective: each has taste in it, and the same boundary can go two ways on two days. The value is in asking them **in order**, at the boundary rather than in the middle of the work.
@@ -1,80 +0,0 @@
1
- ---
2
- name: ask-matt
3
- description: Ask which /command fits your situation. A router over the installed skills, all of which are invoked by the user, never by the model.
4
- disable-model-invocation: true
5
- user-invocable: true
6
- ---
7
-
8
- # Ask Matt
9
-
10
- You don't remember every skill, so ask. Describe the situation and get back **one next `/command` to type**, and why.
11
-
12
- Every skill in this set is **user-invoked**: none of them appear in the model's catalog and the model cannot load one on its own. Only the user typing `/name` brings a skill in. That shapes how this router works:
13
-
14
- - Recommend **one command per step**, named exactly, so the user can type it.
15
- - When a skill needs another one, its body points at a file (for example `../tdd/SKILL.md`) that you can read directly. Reading such a file is not invoking the skill; it is following the instructions already in front of you.
16
- - Before describing what a skill does or recommending that a step be skipped, read that skill's `SKILL.md`. The summaries here are for orientation only.
17
-
18
- A **flow** is a path through the skills. Most paths run along one **main flow**, and a few **on-ramps** merge onto it.
19
-
20
- ## The main flow: idea → ship
21
-
22
- 1. **`/grilling`** sharpens the idea by interview. With `--docs` it is stateful: decisions land in `GLOSSARY.md` and ADRs as you go. Use `--docs` whenever there is a working directory to leave a paper trail in; use the plain mode for a plan, a design, or a piece of writing with no repo under it.
23
- 2. **Branch: can you settle every question in conversation?** If a question needs a runnable answer (state, business logic, a UI you have to see), detour through a prototype:
24
- - **`/handoff`** out, then open a fresh session against that file,
25
- - **`/prototype`** to answer the question with throwaway code,
26
- - **`/handoff`** back what you learned, and reference it from the original idea thread.
27
- 3. **Branch: is this a multi-session build?**
28
- - **Yes** → **`/to-spec`** (turn the thread into a spec), then **`/to-tickets`** to split it into tracer-bullet tickets, each declaring its **blocking edges**.
29
- - **No** → **`/implement`** right here, in the same context window.
30
- 4. **`/implement`** does the build either way, in one of its two shapes: hand it a spec and it treats the tickets as a **task graph**, running implementer subagents across the ready **frontier** in parallel and landing everything on one **integration branch**; hand it a single ticket and it builds that on the current branch. Both drive `/tdd` (one red-green slice at a time) and close with `/code-review`.
31
- 5. **`/pr`** shapes the body when the work goes up as a pull request: the smallest visual that shows the change, before/after evidence that it works, and a one-way or two-way door call.
32
- 6. **`/retro`** closes the loop. It looks back over the session and suggests changes to the agent's **environment**, not the code: navigation pointers, automated checks, the coding standards `/code-review` enforces, steering files, tooling. Mechanical mistakes become deterministic checks; judgement calls become coding standards.
33
-
34
- Reach for **`/tdd`** on its own when you just want to build one concrete behaviour test-first without a spec, and **`/code-review`** on its own whenever you want a branch or PR reviewed against a fixed point.
35
-
36
- ### Context hygiene
37
-
38
- Keep the grilling, the spec, and the tickets in **one unbroken context window** so they build on the same thinking. Each `/implement` then starts fresh from the ticket. Run `/retro` in the session it looks back on, before you clear.
39
-
40
- The limit is the window in which the model still reasons sharply (roughly 150k tokens for current models). If a session approaches it before `/to-tickets`, do not push on degraded: compact or split at the nearest phase boundary and carry on.
41
-
42
- ## On-ramps
43
-
44
- A starting situation that generates work, then merges onto the main flow.
45
-
46
- - **Bugs and requests piling up** → **`/triage`**. It moves issues through triage roles and produces agent-ready issues, which `/implement` later picks up. Triage is only for issues **you didn't create**: bug reports, incoming requests, anything that arrives raw. Tickets that `/to-tickets` produced are already agent-ready, so don't triage them.
47
- - **Something's broken** → **`/diagnosing-bugs`**. For the hard ones: the bug that resists a first glance, the intermittent flake, the regression that crept in between two known-good states. It refuses to theorise until it has a **tight feedback loop** (one command that already goes red on *this* bug), then fixes with a regression test. After the fix, run `/retro` to ask what would have prevented it; if the real finding is that there is no good seam to lock it down, that is a job for `/improve-codebase-architecture`.
48
- - **A huge, foggy effort, too big for one session** → **`/wayfinder`**, the most cognitively demanding flow here. When the way from here to the destination isn't visible yet, it charts a **shared map** of decision tickets and resolves them one at a time, producing **decisions, not deliverables**, until the fog clears. Where `/grilling --docs` sharpens an idea you can hold in one session, wayfinder is for the idea you can't: slower and denser, so never use it on a well-scoped feature. When the map clears it **hands off, it doesn't build**: merge back into the main flow at `/to-spec`.
49
- - **You have a spare moment to keep the codebase healthy** → **`/improve-codebase-architecture`**. It surveys for **deepening opportunities** and presents them as a visual report; picking one generates an idea you take back to `/grilling --docs`.
50
-
51
- ## Vocabulary underneath
52
-
53
- Two references that run *beneath* the other skills, each the single source of truth for its vocabulary. Reach for them directly when the **words**, not the process, are the problem, or follow them when a skill above points at them.
54
-
55
- - **`/domain-modeling`**: sharpen the project's *domain* language: challenge a fuzzy term, resolve an overloaded word ("account" doing three jobs), record a hard-to-reverse decision as an ADR. This is the discipline `/grilling --docs` drives to keep `GLOSSARY.md` a clean glossary.
56
- - **`/codebase-design`**: the deep-module vocabulary (module, interface, depth, seam, adapter, leverage, locality) for designing a module's *shape*: a lot of behaviour behind a small interface at a clean seam. `/tdd` and `/improve-codebase-architecture` both speak it.
57
-
58
- ## Phase boundaries
59
-
60
- A **phase** is a chunk of work inside a session: the grilling, the implementation, the QA. At the boundary between two of them you have five options, and picking between them is the fuzziest decision in this whole map: **continue**, **clear** the window, **`/handoff`** a portable file, send a **subagent**, or **compact**. Read [PHASE-BOUNDARIES.md](PHASE-BOUNDARIES.md) for the ordered tree, the reasoning behind each branch, and why "Continue" is the one to rule out first. `/handoff` is narrow: a new harness, a new directory, a colleague, or forking a side task mid-phase. What it buys is portability.
61
-
62
- ## Standalone
63
-
64
- Off the main flow entirely.
65
-
66
- - **`/research`**: delegate reading legwork to a background agent. It investigates against **primary sources**, then leaves a cited Markdown file in the repo. Keep working while it reads. Research feeds thinking rather than replacing it, so take its file into `/grilling --docs`.
67
- - **`/prototype`**: a small, throwaway program that answers one design question: does this state model feel right, or what should this UI look like. Throwaway is a constraint on how the code is written, not a promise to destroy it: the answer folds into the real code, and the prototype itself is kept as a **primary source** on a `prototype/<name>` branch, pointed at from the implementation issue.
68
- - **`/wizard`**: for the steps only a **human** can take: provisioning infrastructure, setting up credentials or CI secrets, clicking through an unfamiliar dashboard, running a one-off migration. It generates an interactive bash script that opens each URL, captures each value, and writes it into `.env` and secrets, so the procedure stops being something you re-explain every time. If you could just do it yourself, do it yourself; this is for where a human is genuinely in the loop.
69
- - **`/to-questionnaire`**: when the thing blocking you isn't in your head or the codebase but in **someone else's**. It writes them a questionnaire to fill in, interviewing you about the **send** (who it goes to, what you need back) and aiming the questions at the gap. What comes back is material for `/grilling --docs` or `/to-spec`.
70
- - **`/wait-what`**: the corrective for a message that didn't land. Use it mid-conversation, inside any other skill, and the agent re-pitches what it just said with the context you were missing, in plain English, using the `GLOSSARY.md` vocabulary.
71
- - **`/teach`**: learn a concept over multiple sessions, using the current directory as a stateful workspace.
72
- - **`/writing-for-agents`**: the reference for writing documents agents consume: skills, AGENTS.md, pointed-at docs.
73
- - **`/writing-fragments`** → **`/writing-beats`** or **`/writing-shape`**: writing a long piece. Fragments is explore (mine raw material, no structure). Beats is exploit as a choose-your-own-adventure journey; shape is exploit as a thesis-driven article grown paragraph by paragraph. Both read `../_shared/WRITING-MECHANICS.md` for the grounding accounting they share.
74
- - **`/loop-me`**: `/grilling` aimed at **workflow** specs, with its own vocabulary and definition of done.
75
- - **`/software-factory`**: the shared language for designing a system of agents that turns tickets, PRs, and schedules into merged code. Vocabulary, not a process.
76
- - **`/chief-of-staff`** and **`/setup-ts-deep-modules`**: the two heavier in-progress skills. Chief-of-staff pursues a long-running goal in one session by co-ordinating subagents; setup-ts-deep-modules wires dependency-cruiser into a TypeScript repo so each package is a deep module.
77
-
78
- ## Precondition
79
-
80
- **`/setup-matt-pocock-skills`**: run before your first engineering flow to configure the issue tracker, triage labels, and doc layout the other skills assume. Custom issue trackers also work.
@@ -1,5 +0,0 @@
1
- interface:
2
- display_name: "Ask Matt"
3
- short_description: "Find the right skill or workflow"
4
- policy:
5
- allow_implicit_invocation: false
@@ -1,76 +0,0 @@
1
- ---
2
- name: chief-of-staff
3
- description: Pursue a long-running goal in a single session by co-ordinating subagents.
4
- disable-model-invocation: true
5
- user-invocable: true
6
- ---
7
-
8
- You are a chief of staff, co-ordinating subagents and schedules to pursue a long-running goal. This session will run for a long time, accruing tribal knowledge and helping you make long-term strategic decisions.
9
-
10
- You are the Directly Responsible Individual for this goal. You are empowered to think much longer-term than you're used to. You must think on two tracks simultaneously:
11
-
12
- - Tactical: how do I complete the immediate task?
13
- - Strategic: how do I modify the environment to improve the outcomes of the _next_ task?
14
-
15
- ## Schedules
16
-
17
- Harness-permitting, you will suggest recurring schedules which can help in achieving the goal.
18
-
19
- ## Subagents
20
-
21
- All work should be done in subagents. Protect your context window.
22
-
23
- Use background agents so you can stay in active dialogue with the user. Start every subagent with a fresh context window.
24
-
25
- Communication to and from subagents should be sparse. Communicate primarily through **context pointers**: research notes, previous commits, wiki pages, and others. Don't duplicate information already available via pointers.
26
-
27
- ## Wiki
28
-
29
- Keep your memory in a **wiki**: a folder of interlinked markdown pages that outlives this session. Tribal knowledge that lives only in your context is lost at compaction; the wiki is how it reaches the next session. Look for a shared wiki first, one the user or other agents already keep, and write your pages into it, following its conventions where they differ from the ones below. Only if there is none, agree a location with the user before the first write.
30
-
31
- - `index.md` lists every page with a link and a one-line summary, grouped by category.
32
- - Each other page covers one thing: a decision, a recurring problem, a subsystem, a user preference. Link related pages to each other.
33
- - Sources (issues, PRs, transcripts, subagent reports) are never copied in or edited. Pages cite them.
34
-
35
- Three operations keep it alive:
36
-
37
- - **Ingest.** When you learn something durable (a decision, a user correction, a subagent's finding), update every page it touches and the index, not only a new page.
38
- - **Query.** Before a decision, read `index.md` and the pages it points to. If the answer you build is worth keeping, file it as a page.
39
- - **Lint.** Periodically look for contradictions, orphan pages, missing links and claims newer sources have overtaken. Suggest this as a schedule.
40
-
41
- ### Write history, not the present
42
-
43
- The wiki is a historical record. It never claims to describe how things are now, because it cannot keep up with the code.
44
-
45
- - Date every claim: "On 2026-10-13, Matt decided..."
46
- - When a claim concerns code, cite the commit it was true at, with its repo: "As of `mattpocock/skills@abc1234`, `retro` loads `writing-for-agents` in step 1."
47
- - Never write "currently", "now" or "is" about code without a date or commit beside it.
48
- - When something changes, add a new dated claim and mark the old one superseded. Don't rewrite the old one.
49
-
50
- ## Procedures
51
-
52
- Some procedures you run live in other skills, installed beside this one. To run one, read its `SKILL.md` at the path below, relative to this skill's directory, and follow it.
53
-
54
- - **Retro** (`../retro/SKILL.md`): run a retro on about one in five of your subagents' sessions, including those an `implement` run dispatches. Pick first the ones where something went wrong. In place of retro's last step, decide yourself which candidates are worth pursuing, then pursue them.
55
- - **Large chunks of work**: write a spec with `../to-spec/SKILL.md`, break it into tickets with `../to-tickets/SKILL.md`, publish both to the issue tracker, then implement them with `../implement/SKILL.md`.
56
-
57
- ## Strategic View
58
-
59
- As part of any and all work, FIRST consider how the environment the agents operate in might be improved. Agents thrive in the **pit of success**:
60
-
61
- - API's and functions which are extremely constrained and limited
62
- - Lint rules which force correctness
63
- - CODING_STANDARDS.md files which let code reviewers enforce best practices
64
-
65
- They also need relevant **data sources** to succeed:
66
-
67
- - Logs from critical running processes, like dev servers (or production logs)
68
- - Access to test environment databases
69
- - Access to the browser (when necessary) for clicking around and taking screenshots
70
-
71
- Finally, create environments (and codebases) that obey the **"no workarounds"** rule:
72
-
73
- - No one-off workarounds, or hacks that bypass established processes
74
- - Any deviations from conventions must be fixed proactively, before feature work is done
75
-
76
- Be relentless in improving the environment. Use every user message as an excuse to search for these improvements.
@@ -1,5 +0,0 @@
1
- interface:
2
- display_name: "Chief Of Staff"
3
- short_description: "Pursue a long-running goal in a single session by co-ordinating subagents"
4
- policy:
5
- allow_implicit_invocation: false
@@ -1,91 +0,0 @@
1
- ---
2
- name: code-review
3
- description: "Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/spec asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to \"review since X\"."
4
- disable-model-invocation: true
5
- user-invocable: true
6
- ---
7
-
8
- Two-axis review of the diff between `HEAD` and a fixed point the user supplies:
9
-
10
- - **Standards**: does the code conform to this repo's documented coding standards?
11
- - **Spec**: does the code faithfully implement the originating issue / spec?
12
-
13
- Both axes run as **parallel sub-agents** so they don't pollute each other's context, then this skill aggregates their findings. Start every sub-agent with a fresh context window.
14
-
15
- The issue tracker should have been provided to you. If not, tell the user to run `/setup-matt-pocock-skills`.
16
-
17
- ## Process
18
-
19
- ### 1. Pin the fixed point
20
-
21
- Whatever the user said is the fixed point (a commit SHA, branch name, tag, `main`, `HEAD~5`, etc.). If they didn't specify one, ask for it.
22
-
23
- Capture the diff command once: `git diff <fixed-point>...HEAD` (three-dot, so the comparison is against the merge-base). Also note the list of commits via `git log <fixed-point>..HEAD --oneline`.
24
-
25
- Before going further, confirm the fixed point resolves (`git rev-parse <fixed-point>`) and the diff is non-empty. A bad ref or empty diff should fail here, not inside two parallel sub-agents.
26
-
27
- ### 2. Identify the spec source
28
-
29
- Look for the originating spec, in this order:
30
-
31
- 1. Issue references in the commit messages (`#123`, `Closes #45`, GitLab `!67`, etc.), fetched via the workflow in the tracker doc.
32
- 2. A path the user passed as an argument.
33
- 3. A spec file under `docs/`, `specs/`, or `.scratch/` matching the branch name or feature.
34
- 4. If nothing is found, ask the user where the spec is. If they say there isn't one, the **Spec** sub-agent will skip and report "no spec available".
35
-
36
- ### 3. Identify the standards sources
37
-
38
- Search the repo for every file that documents how code should be written. When `CODING_STANDARDS.md` or `CONTRIBUTING.md` exists, it must be on the list.
39
-
40
- On top of whatever the repo documents, the Standards axis always carries the **smell baseline** below: a fixed set of Fowler code smells (_Refactoring_, ch.3) that applies even when a repo documents nothing. Two rules bind it:
41
-
42
- - **The repo overrides.** A documented repo standard always wins; where it endorses something the baseline would flag, suppress the smell.
43
- - **Always a judgement call.** Each smell is a labelled heuristic ("possible Feature Envy"), never a hard violation. Like any standard here, skip anything tooling already enforces.
44
-
45
- Each smell reads *what it is* → *how to fix*; match it against the diff:
46
-
47
- - **Mysterious Name**: a function, variable, or type whose name doesn't reveal what it does or holds. → rename it; if no honest name comes, the design's murky.
48
- - **Duplicated Code**: the same logic shape appears in more than one hunk or file in the change. → extract the shared shape, call it from both.
49
- - **Feature Envy**: a method that reaches into another object's data more than its own. → move the method onto the data it envies.
50
- - **Data Clumps**: the same few fields or params keep travelling together (a type wanting to be born). → bundle them into one type, pass that.
51
- - **Primitive Obsession**: a primitive or string standing in for a domain concept that deserves its own type. → give the concept its own small type.
52
- - **Repeated Switches**: the same `switch`/`if`-cascade on the same type recurs across the change. → replace with polymorphism, or one map both sites share.
53
- - **Shotgun Surgery**: one logical change forces scattered edits across many files in the diff. → gather what changes together into one module.
54
- - **Divergent Change**: one file or module is edited for several unrelated reasons. → split so each module changes for one reason.
55
- - **Speculative Generality**: abstraction, parameters, or hooks added for needs the spec doesn't have. → delete it; inline back until a real need shows.
56
- - **Message Chains**: long `a.b().c().d()` navigation the caller shouldn't depend on. → hide the walk behind one method on the first object.
57
- - **Middle Man**: a class or function that mostly just delegates onward. → cut it, call the real target direct.
58
- - **Refused Bequest**: a subclass or implementer that ignores or overrides most of what it inherits. → drop the inheritance, use composition.
59
-
60
- ### 4. Spawn both sub-agents in parallel
61
-
62
- Issue both sub-agent calls together, in the foreground, and aggregate the reports they return.
63
-
64
- **Standards sub-agent prompt** should include:
65
-
66
- - The full diff command and commit list.
67
- - The list of standards-source files you found in step 3, **plus the smell baseline from step 3** pasted in full (the sub-agent has no other access to it).
68
- - The brief: "Report, per file/hunk where relevant, (a) every place the diff violates a documented standard: cite the standard (file + the rule); and (b) any baseline smell you spot: name it and quote the hunk. Distinguish hard violations from judgement calls: documented-standard breaches can be hard, but baseline smells are always judgement calls, and a documented repo standard overrides the baseline. Skip anything tooling enforces. Under 400 words."
69
-
70
- **Spec sub-agent prompt** should include:
71
-
72
- - The diff command and commit list.
73
- - The path or fetched contents of the spec.
74
- - The brief: "Report: (a) requirements the spec asked for that are missing or partial; (b) behaviour in the diff that wasn't asked for (scope creep); (c) requirements that look implemented but where the implementation looks wrong. Quote the spec line for each finding. Under 400 words."
75
-
76
- If the spec is missing, skip the Spec sub-agent and note this in the final report.
77
-
78
- ### 5. Aggregate
79
-
80
- Present the two reports under `## Standards` and `## Spec` headings, verbatim or lightly cleaned. Do **not** merge or rerank findings, because the two axes are deliberately separate (see _Why two axes_).
81
-
82
- End with a one-line summary: total findings per axis, and the worst issue _within each axis_ (if any). Don't pick a single winner across axes: that's the reranking the separation exists to prevent.
83
-
84
- ## Why two axes
85
-
86
- A change can pass one axis and fail the other:
87
-
88
- - Code that follows every standard but implements the wrong thing → **Standards pass, Spec fail.**
89
- - Code that does exactly what the issue asked but breaks the project's conventions → **Spec pass, Standards fail.**
90
-
91
- Reporting them separately stops one axis from masking the other.
@@ -1,5 +0,0 @@
1
- interface:
2
- display_name: "Code Review"
3
- short_description: "Review a diff on standards and spec"
4
- policy:
5
- allow_implicit_invocation: false