mirror of
https://github.com/codestable/CodeStable.git
synced 2026-09-19 09:03:09 +08:00
feat(cs-issue): add diagnosis-only workflow
This commit is contained in:
+1
-1
@@ -71,7 +71,7 @@ When you are unsure which entry fits, call `/cs`; you can also call the owning s
|
||||
| `cs` | Route explicit actions, in-session discussion, advice, and system overview |
|
||||
| `cs-onboard` | Create the minimal project-memory skeleton |
|
||||
| `cs-feat` | Implement new capability or change existing behavior |
|
||||
| `cs-issue` | Fix bugs or broken behavior with red-to-green evidence |
|
||||
| `cs-issue` | Diagnose problems; once repair is authorized, fix with red-to-green evidence |
|
||||
| `cs-refactor` | Change structure or performance under equivalence evidence |
|
||||
| `cs-epic` | Decompose and advance multiple deliverable items under confirmed policies |
|
||||
| `cs-review` | Read-only leaf executor; one review, with no child agent |
|
||||
|
||||
@@ -69,7 +69,7 @@ npx skills@latest add codestable/CodeStable/plugins/codestable
|
||||
| `cs` | 路由明确行动、会话内讨论、咨询与体系导览 |
|
||||
| `cs-onboard` | 为仓库创建最小项目记忆骨架 |
|
||||
| `cs-feat` | 实现新功能或改变既有行为 |
|
||||
| `cs-issue` | 用红到绿证据修复 bug 或行为异常 |
|
||||
| `cs-issue` | 诊断问题;获授权后用红到绿证据修复 |
|
||||
| `cs-refactor` | 在行为等价证据下调整结构或性能 |
|
||||
| `cs-epic` | 拆解并按已确认策略推进多个可交付子项 |
|
||||
| `cs-review` | 只读叶子执行器;单轮审查,不创建子 agent |
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ skill files or a centralized onboard runtime.
|
||||
| Navigation | `cs` | Clear actions dispatch in the same turn. Requests to discuss first converge in the current session and hand off in the same turn; advice only recommends; the overview writes no files |
|
||||
| Onboarding | `cs-onboard` | Create minimal project memory and explain a lossless v1 upgrade |
|
||||
| Feature | `cs-feat` | Implement new capability; scale design confirmation and independent review with risk |
|
||||
| Issue | `cs-issue` | Fix bugs or broken existing behavior with red-to-green evidence |
|
||||
| Issue | `cs-issue` | Diagnose problems; once repair is authorized, fix with red-to-green evidence |
|
||||
| Refactor | `cs-refactor` | Change structure or performance under verifiable behavioral equivalence |
|
||||
| Epic | `cs-epic` | Decompose, confirm, and advance multiple deliverable items serially and continuously through a permanent Epic doc and temporary work cursor |
|
||||
| Review | `cs-review` | Read-only leaf executor for one change, design, module, or repository review |
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ runtime。
|
||||
| 导航 | `cs` | 明确行动同轮直转;先讨论的请求在当前会话收敛后同轮移交;咨询只推荐;导览不写文件 |
|
||||
| 接入 | `cs-onboard` | 创建最小项目记忆骨架;无损说明 v1 升级边界 |
|
||||
| 功能 | `cs-feat` | 实现新功能;按风险决定是否先确认设计或做独立 review |
|
||||
| 问题 | `cs-issue` | 用红到绿的验证修复 bug 或既有行为异常 |
|
||||
| 问题 | `cs-issue` | 诊断问题;获授权后用红到绿证据修复 |
|
||||
| 重构 | `cs-refactor` | 在可核验的行为等价约束下调整结构或性能 |
|
||||
| 大需求 | `cs-epic` | 用永久 Epic 文档与临时 work 游标拆解、确认并串行连续推进多个可交付子项 |
|
||||
| 审查 | `cs-review` | 只读叶子执行器;单轮审查,不创建子 agent |
|
||||
|
||||
+9
-4
@@ -12,9 +12,10 @@ without a task gets an overview.
|
||||
unsure which entry -> cs
|
||||
discuss / align first -> cs -> cs-feat / cs-issue / cs-epic
|
||||
onboard / v1 upgrade -> cs-onboard
|
||||
new capability -> cs-feat ---------\
|
||||
bug / broken behavior -> cs-issue ----------> cs-review (high risk or on demand)
|
||||
equivalent refactor -> cs-refactor ------/
|
||||
diagnose / investigate -> cs-issue (no product diff; no change review)
|
||||
new capability -> cs-feat -> cs-review (default; documentation-only tiny changes may be skipped with an explanation)
|
||||
authorized repair of bug / performance regression / broken behavior -> cs-issue -> cs-review (default; single-line tiny fixes may be skipped with an explanation)
|
||||
equivalent refactor -> cs-refactor -> cs-review (cross-module, public-interface, or performance-sensitive work; tiny cleanups may be skipped with an explanation)
|
||||
large initiative -> cs-epic -> cs-feat / cs-issue / cs-refactor
|
||||
lessons and memory -> cs-keep
|
||||
```
|
||||
@@ -46,8 +47,12 @@ Execution strength follows risk:
|
||||
|
||||
- `cs-feat` normally understands, implements, and verifies directly. Public contracts, data,
|
||||
authorization, concurrency, or real design tradeoffs require owner confirmation first.
|
||||
- `cs-issue` establishes a reliably failing check before changing code, then proves it turns green.
|
||||
- `cs-issue` first establishes a repeatable failure signal for the user's actual symptom. A diagnosis-only request leaves
|
||||
zero product changes and reports a confirmed root cause, falsifiable hypothesis, or insufficient evidence; once repair
|
||||
is authorized, the same signal must go from red to green.
|
||||
- `cs-refactor` establishes equivalence evidence first and keeps verification green after each step.
|
||||
- A performance regression or anomalous slowdown enters `cs-issue`; without an existing failure, proactive optimization
|
||||
under behavioral equivalence remains in `cs-refactor`.
|
||||
- `cs-epic` keeps approved delivery contracts in a permanent Epic document and active execution in
|
||||
a temporary work cursor. Decomposition, contract changes, and overall acceptance each cross an owner gate.
|
||||
- When independent review is needed, the outer workflow creates the reviewer. That reviewer runs
|
||||
|
||||
+7
-4
@@ -10,9 +10,10 @@ CodeStable v2 是 8 个独立安装的 thin-harness skill,加一个项目记
|
||||
不确定入口 -> cs
|
||||
先讨论 / 对齐 -> cs -> cs-feat / cs-issue / cs-epic
|
||||
仓库接入 / v1 升级 -> cs-onboard
|
||||
新功能 -> cs-feat ---------\
|
||||
bug / 行为异常 -> cs-issue ----------> cs-review(高风险或按需)
|
||||
行为等价重构 -> cs-refactor ------/
|
||||
只诊断 / 排查 -> cs-issue(无产品 diff,不进入 change review)
|
||||
新功能 -> cs-feat -> cs-review(默认;仅文案级微小改动可说明后跳过)
|
||||
获授权修复 bug / 性能回退 / 行为异常 -> cs-issue -> cs-review(默认;仅单行级微小修复可说明后跳过)
|
||||
行为等价重构 -> cs-refactor -> cs-review(跨模块大范围、公开 interface 或性能敏感路径;微小整理可说明后跳过)
|
||||
大需求拆解 -> cs-epic -> cs-feat / cs-issue / cs-refactor
|
||||
经验与项目记忆 -> cs-keep
|
||||
```
|
||||
@@ -38,8 +39,10 @@ bug / 行为异常 -> cs-issue ----------> cs-review(高风险或按需)
|
||||
执行强度与风险相称:
|
||||
|
||||
- `cs-feat` 默认直接理解、实现、验证;公开契约、数据、权限、并发或真实方案取舍先经用户确认。
|
||||
- `cs-issue` 先建立能明确变红的验证,再修复并证明它变绿。
|
||||
- `cs-issue` 先针对用户实际症状建立可重复的失败信号。只要求诊断时保持零产品改动,结论明确归为
|
||||
已证实根因、可证伪假设或证据不足;获授权修复后,沿用同一信号证明红到绿。
|
||||
- `cs-refactor` 先建立等价性证据,分步改动并持续保持验证为绿。
|
||||
- 性能回退或异常变慢进入 `cs-issue`;没有既有异常、仅要求行为等价的主动优化仍进入 `cs-refactor`。
|
||||
- `cs-epic` 用永久 Epic 文档维护批准后的交付契约,用临时 work 游标恢复活动执行;拆解、契约变化和整体验收分别经过 owner gate。
|
||||
- 需要独立审查时由外层主流程创建 reviewer;reviewer 每轮执行一次 `cs-review`,返回结果前不再创建子 agent。每个独立审查阶段的首轮使用 fresh reviewer;reviewer 独立性要求它独立于实现者,不要求对自身上一轮审查失忆。
|
||||
- 一个独立审查阶段由单一审查目的界定;design review、change review、contract review 与 Epic final acceptance 是不同阶段。只有为本阶段 findings 所作修复的复审,才属于同一阶段并沿用原 reviewer lineage;审查目的变化时开启新阶段。
|
||||
|
||||
@@ -55,6 +55,9 @@ worktree 里按 skill 完整跑流程——不是单次问答。
|
||||
- 种真 bug 三档:单行逻辑错(易)/ 跨函数状态错(中)/ 需读多文件推理根因(难)。
|
||||
- 验收:hidden test 红→绿 + 回归绿 + `fix-note.md` 根因正确(关键词/judge 双轨)。
|
||||
- **陷阱场景**:bug 报告实为新需求 → 正确动作是转 `cs-feat` 而非硬修(防"无脑往前冲")。
|
||||
- **未来 diagnosis-only 场景(未实施)**:用户只授权排查真实 bug,不授权修复。机械判分“零产品
|
||||
写入”(不修改产品代码、测试或配置,不创建 commit)、结论证据等级,以及临时 harness / 埋点清理;
|
||||
该场景仍是待实现的评测设计,不代表已完成效果评测。
|
||||
|
||||
### cs-feat(P1)
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
"experiments/seeds/dispatchboard-learning/build-seed.py": "4c7f7090abe69aca0b6be2a3568c85a91345374a4879f94da9f6704f028689b1",
|
||||
"plugins/codestable/skills/cs-epic/SKILL.md": "9ae0118ab9b2786a69470099c8683d1fcd79147f353c514cd4ec643e0758ff2d",
|
||||
"plugins/codestable/skills/cs-feat/SKILL.md": "75630a8a186652dd91a0fe65675dc05bf0951fecaa110f2c9562ea0323a5e41d",
|
||||
"plugins/codestable/skills/cs-issue/SKILL.md": "377f03b4dd0e9b7116331badb2055a8ac8305fb84ae0fb21094084b87609dbdb",
|
||||
"plugins/codestable/skills/cs-issue/SKILL.md": "2f57adc1e6e96af011e385895ce654cbdf60ef7fd4b4e4d06a1f60ca3e1a9463",
|
||||
"plugins/codestable/skills/cs-keep/SKILL.md": "1d8f56aae90ab45b0ab966ae15c42d8d958e1a3a1a29ca2e196871afda90354d",
|
||||
"plugins/codestable/skills/cs-refactor/SKILL.md": "8c8332d1d71232e1b1fafacf84793f1ae4d4a41580b6e1a12e2b3c15b47451e3"
|
||||
},
|
||||
|
||||
@@ -1,21 +1,41 @@
|
||||
---
|
||||
name: cs-issue
|
||||
description: 修复 bug、报错或既有行为异常。不用于新功能(cs-feat)或行为等价重构(cs-refactor)。
|
||||
description: 诊断或修复 bug、报错、性能回退或既有行为异常。不用于新功能(cs-feat)或行为等价重构(cs-refactor)。
|
||||
argument-hint: "[问题描述]"
|
||||
---
|
||||
|
||||
# cs-issue
|
||||
|
||||
修一个 bug,并证明它修好了。
|
||||
把问题诊断清楚;获得修复授权时,再修根因并证明它修好了。
|
||||
|
||||
## 开工
|
||||
|
||||
- 有 `.codestable/attention.md` 就先读。
|
||||
- 按错误信息与相关模块关键词检索 `.codestable/lessons/`、项目文档,以及存在的 v1 只读知识目录:`.codestable/roadmap/`、`.codestable/features/`、`.codestable/issues/`、`.codestable/refactors/`、`.codestable/goals/`、`.codestable/compound/`、`.codestable/audits/`、`.codestable/brainstorms/`、`.codestable/feedback/`;这个坑可能踩过,命中要报告来源路径。上述 v1 目录不得继续生成、原地改写或批量迁移,新结论按归属进入 v2 Epic、项目文档、ADR 或 lesson。
|
||||
- 同一会话由 `cs` 交入且带已确认 handoff 时,直接消费目标入口、原始诉求、目标或期望行为、范围/非目标、验收、已核实仓库事实及来源、owner 已确认的术语与决策、未决风险、canonical 资产指针或资产候选;packet 精确范围内已确认的事项不重复询问。handoff 只证明当前会话共识,不扩大实现、commit、发布或写入授权,也不替代本 skill 的 review、验证与确认门槛;字段缺失、仓库事实冲突、出现会改变结果的新风险、缺少会改变方向的事实或超出已确认边界时再按本 skill 规则确认。
|
||||
- 对照检查:目标(期望行为)、现场(复现条件与环境)、边界(哪些不能动)、验收(怎么算修好)。缺少会改变修复方向的事实时先问用户,一次最多 3 个问题,形成共识即停。
|
||||
- 对照检查:目标(期望行为)、现场(复现条件与环境)、边界(哪些不能动)、验收(怎么算诊断清楚或修好)。缺少会改变诊断或修复方向的事实时先问用户,一次最多 3 个问题,形成共识即停。
|
||||
- 诉求其实是新增能力而不是坏掉的行为时,转 `cs-feat`,不在 issue 里偷做。
|
||||
|
||||
## 模式与证据
|
||||
|
||||
- 用户只要求定位、分析、解释或排查时,执行只诊断;只有用户明确要求或既有授权包含修复时才改动。
|
||||
诊断结论不扩大为修复授权。
|
||||
- 只诊断不改产品代码、测试或配置,不创建 commit;跨会话 work 游标仍按既有规则处理。
|
||||
diagnose 不新增审查阶段,无产品 diff 时不触发 change review。
|
||||
- 需要新建临时 harness、日志或埋点时,先停下说明目标、路径、影响与清理方式,获得用户确认再动;
|
||||
优先使用仓库外临时目录。生产或其他受控环境的临时埋点同样必须先确认。
|
||||
- 两种模式都先钉住预期、实际、触发条件和环境,建立覆盖用户实际症状、可再次执行的失败信号。
|
||||
diagnose 优先运行既有只读检查;新增回归测试只属于已获授权的 fix。
|
||||
- 诊断只交付 `已证实根因` / `可证伪假设` / `证据不足`。`已证实根因` 必须给出至少实际运行一次、
|
||||
可再次执行的命令及红色输出,或已与用户确认并至少实际完成一次的手工复现步骤及失败观察;还要用
|
||||
区分性证据定位有效状态首次变无效的地方,否则降级结论。
|
||||
- 没有失败信号时不猜根因、不改代码。无法建立时列明已尝试,以及所缺的日志、trace、环境访问或
|
||||
临时埋点授权,再给出下一项最低成本核验。
|
||||
- diagnose 终止前清理临时产物并核对工作树与仓库外临时路径,报告任何残留文件与保留理由;未清理
|
||||
的诊断 diff 不得混入 fix review。同会话直接授权修复不算诊断终止,保留并沿用同一失败信号,
|
||||
清理义务顺延到 fix 收尾。用户要求保留的诊断文件须列为单独 change candidate,重新确认 scope 后
|
||||
审查。复杂问题的升级与可核验清理方式见 `references/debug.md`。
|
||||
|
||||
## 持续学习
|
||||
|
||||
检索到 lesson 后先做 read-repair。只做一次有界、最低成本的定向核实,优先读取已有代码、测试或
|
||||
@@ -51,6 +71,8 @@ gate,随当次代码、证据和
|
||||
## 硬门槛
|
||||
|
||||
- **没有稳定、快速、能明确变红的验证,不许猜根因、不许改代码。** 优先失败测试;无法自动化时与用户确认一个手工复现步骤。
|
||||
- diagnose 下“优先失败测试”指优先运行既有失败或只读检查,不新建测试文件;这里的“不许猜根因”是
|
||||
指不得把假设宣称为已证实根因,diagnose 仍可按结论分级交付可证伪假设。
|
||||
- 声称修复完成前,**那条变红的验证必须变绿**,并附运行输出;相关既有测试不得变红。
|
||||
- **根因是有效状态第一次变成无效的地方,不是报错处**;只消除因果断点,不在症状处堆特殊分支。
|
||||
- 同一修复路径失败两次,停下来重新审视根因假设,不要变着花样重试;升级手段(可证伪假设、一次一个变量)与"怀疑结构"信号见 `references/debug.md`。
|
||||
@@ -72,5 +94,7 @@ gate,随当次代码、证据和
|
||||
- 主流程处理 findings 后先修复并重跑验证,再冻结新的完整审查目标;仅因处理 findings 产生的修复,复审必须沿用同一 reviewer 的同一 session,以 follow-up 继续。复审同时检查完整当前候选与本轮修复增量,逐项报告 `resolved` / `unresolved` / `new findings`;不得只核对旧 finding 或机械打勾。reviewer 独立性要求它独立于实现者,不要求对自身上一轮审查失忆。
|
||||
- 同一审查阶段累计最多 3 个有终态报告的轮次;更换 reviewer 不重置计数。只有原 run/session 失败或不可恢复、能力不满足、目标、范围、设计或核心路径发生重大变化、reviewer 声明无法继续独立判断,或 owner 要求第二意见时,才可更换 reviewer;更换时创建 fresh reviewer。超限仍有 blocking 或分歧时交用户裁决,不得继续对轮或宣称完成。
|
||||
- reviewer 创建后绑定该运行并记录 run identity:目标有效、能力仍满足,且 reviewer 状态为 running,或 `Awaiting` 携带可查询的同一 run identity 且查询仍为活动态时为健康;状态健康时等待终态报告,不因后来发现更优创建方式而取消、重复创建或并行补发。仅在运行明确失败或终止无报告、idle / `Awaiting` 且无可恢复 run identity、能力不满足或目标失效时,本轮失败且不计轮次;不得盲目重发,先检查 task packet 与 agent 状态,再决定一次有界重试、更换创建方式或交用户。
|
||||
- 只诊断报告包含症状与证据、已排除路径、结论等级、下一项最低成本核验,以及临时产物清理结果;
|
||||
没有产品 diff 时直接结束,不启动 change review。
|
||||
- 报告:根因一句话、改动文件、验证结果。
|
||||
- 需要跨会话继续时写 `.codestable/work/issue-{slug}.md`(目标 / 现场 / 边界 / 证据 / 验收 / 状态与未决六节;work 文档一律带类型前缀)。完成后先在报告列毕业去向(结论进哪、lesson 沉哪,或明说无可毕业)再删除;目标位置不存在时在清单中建议落点请用户拍板,拍板前不删。用户要求留档则保留。
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Debug 升级路径
|
||||
# 诊断与 Debug 升级路径
|
||||
|
||||
debug 的核心不是"把报错消掉",而是找到行为为什么偏离预期,并确认修完后偏离消失。压力会诱人乱改:看到症状→猜一个原因→改一处→不行再改——系统会变成猜测残留物。(源自 codestable-lite 分支的实践沉淀)
|
||||
|
||||
@@ -6,9 +6,20 @@ debug 的核心不是"把报错消掉",而是找到行为为什么偏离预期
|
||||
|
||||
**根因是有效状态第一次变成无效状态的地方,不是"这里报错了"的地方。** 从症状往回追:坏值从哪来?谁调用了这里?状态在哪里第一次变坏?修复只消除因果断点,不在症状处堆特殊分支,不顺手重构。
|
||||
|
||||
## 反馈信号
|
||||
|
||||
反馈信号必须覆盖用户实际症状,而不是只证明程序能运行。优先选择最低成本且可重复的现有通道:
|
||||
失败测试、CLI / HTTP 调用、浏览器操作、已捕获 trace replay、好坏两态差分;必要时经用户确认后
|
||||
创建最小 harness。收紧信号时优先缩短运行时间、冻结时间与随机性、隔离文件系统和网络。
|
||||
|
||||
无法建立反馈信号时停止根因断言,列明已经尝试的通道、缺失 artifact 或环境权限,以及下一项最小
|
||||
取证动作。不要用阅读代码得到的合理故事冒充可核验证据。
|
||||
|
||||
## 快路径(默认)
|
||||
|
||||
钉住三件事(几句话即可):预期行为、实际行为、在什么场景分叉。用户步骤、堆栈、日志、挂掉的测试都是证据。然后:定位最可能根因 → 最小试修 → **用原来坏的方式再验证一次**(同一操作 / 同一命令 / 同一测试 / 同一日志点)。好了就停。
|
||||
钉住三件事(几句话即可):预期行为、实际行为、在什么场景分叉。用户步骤、堆栈、日志、挂掉的测试
|
||||
都是证据。然后定位最可能根因:diagnose 按结论等级交付并停止;已获授权的 fix 才做最小试修,并
|
||||
**用原来坏的方式再验证一次**(同一操作 / 同一命令 / 同一测试 / 同一日志点)。好了就停。
|
||||
|
||||
## 升级条件(出现任一才升级,不默认升级)
|
||||
|
||||
@@ -17,7 +28,22 @@ debug 的核心不是"把报错消掉",而是找到行为为什么偏离预期
|
||||
- 偶现、环境相关,需要固定失败信号;
|
||||
- 核心路径、金额、权限等,值得留下可重复检查。
|
||||
|
||||
升级动作:复现并最小化(能稳现则稳现)→ 写 3–5 个**可证伪假设**("根因是 X,因为…;若真,应看到 Y")→ **一次只动一个变量**,不叠一堆改动"看会不会好" → 需要时补最小失败检查(失败测试、脚本或固定手测步骤)→ 修根因,回跑同一失败信号,确认相关检查没被打坏。
|
||||
升级动作:复现并最小化(能稳现则稳现)→ 写 3-5 个排序的可证伪假设("根因是 X,因为…;若真,
|
||||
应看到 Y")→ 一次只动一个变量,不叠一堆改动"看会不会好" → 需要时补最小失败检查 → 修根因,
|
||||
回跑同一失败信号,确认相关检查没被打坏。
|
||||
|
||||
已知好 / 坏 commit、版本、配置或数据集时,先把判据自动化,再做自动化二分。偶现问题不等一份完美
|
||||
复现;通过循环、固定随机性或收窄时序提高并报告复现率。性能问题先建立可比较的性能基线,再使用
|
||||
profiler、query plan 或等价测量定位,不能用泛化日志猜慢点。
|
||||
|
||||
## 探针、接缝与清理
|
||||
|
||||
探针只放在能区分假设的边界,优先 debugger / REPL,其次是定向日志。临时日志和埋点使用唯一
|
||||
`[DEBUG-{id}]` 前缀或等价标签,收尾用一次定向搜索证明已移除;仓库外临时目录也记录精确路径并
|
||||
验证为空或不存在。
|
||||
|
||||
只有真实调用路径上的正确接缝才值得固化回归测试;过浅测试会伪造保障。fix 完成后既回跑最小场景,
|
||||
也回跑用户的原始完整复现,再运行相关回归。没有正确接缝时把它作为架构事实报告,不硬塞测试。
|
||||
|
||||
## 修不动时,怀疑结构
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ argument-hint: "[诉求]"
|
||||
|
||||
| 用户输入 | 行为 |
|
||||
|---|---|
|
||||
| 明确行动诉求(修这个 bug、实现 X、重构 Y、审一下、记住这个…) | **同轮直转**:报一句"按 `cs-xxx` 处理:{一句理由}",随即在当前回合按该 skill 的纪律继续执行,不要求用户重新调用或再次确认 |
|
||||
| 明确行动诉求(修这个 bug、排查这个报错为什么发生、实现 X、重构 Y、审一下、记住这个…) | **同轮直转**:报一句"按 `cs-xxx` 处理:{一句理由}",随即在当前回合按该 skill 的纪律继续执行,不要求用户重新调用或再次确认 |
|
||||
| 用户显式要求先讨论,或调查仓库事实后仍无法安全判断行动类型 / owning skill,且产品决策会实质改变建档或改代码路径 | 在当前会话对齐;用户没有要求先讨论且 owning skill 已可判定时,直接转入,不在入口层细化目标或验收 |
|
||||
| 咨询(该用哪个 / 流程怎么走 / 你建议怎么做) | 只推荐入口并说明理由,不启动执行 |
|
||||
| 只说 cs、想了解体系、无具体诉求 | 输出体系速读 |
|
||||
@@ -33,8 +33,8 @@ argument-hint: "[诉求]"
|
||||
| 诉求 | 入口 |
|
||||
|---|---|
|
||||
| 新功能、功能改造 | `cs-feat` |
|
||||
| bug、报错、行为异常 | `cs-issue` |
|
||||
| 行为等价的重构、优化 | `cs-refactor` |
|
||||
| 排查、诊断、bug、报错、性能回退、行为异常 | `cs-issue` |
|
||||
| 行为等价的重构、主动性能优化 | `cs-refactor` |
|
||||
| 审查 diff 或按需审计代码 | `cs-review` |
|
||||
| 大需求拆解与长程推进 | `cs-epic` |
|
||||
| 沉淀经验、教训、"记住这个" | `cs-keep` |
|
||||
|
||||
@@ -150,6 +150,43 @@ THIN_SKILL_FORBIDDEN_TEXT = {
|
||||
"cs-refactor": ("git push", "read all references"),
|
||||
}
|
||||
|
||||
ISSUE_DIAGNOSIS_CONTRACT = (
|
||||
"用户只要求定位、分析、解释或排查时,执行只诊断",
|
||||
"诊断结论不扩大为修复授权",
|
||||
"不改产品代码、测试或配置,不创建 commit",
|
||||
"diagnose 不新增审查阶段",
|
||||
"`已证实根因` / `可证伪假设` / `证据不足`",
|
||||
"至少实际运行一次",
|
||||
"可再次执行的命令及红色输出",
|
||||
"手工复现步骤及失败观察",
|
||||
"diagnose 下“优先失败测试”指优先运行既有失败或只读检查",
|
||||
"同一失败信号",
|
||||
"那条变红的验证必须变绿",
|
||||
"无法建立时列明已尝试",
|
||||
"日志、trace、环境访问",
|
||||
"临时 harness、日志或埋点",
|
||||
"先停下说明目标、路径、影响与清理方式",
|
||||
"同会话直接授权修复不算诊断终止",
|
||||
"核对工作树与仓库外临时路径",
|
||||
"残留文件与保留理由",
|
||||
"单独 change candidate",
|
||||
)
|
||||
|
||||
ISSUE_DEBUG_REFERENCE_CONTRACT = (
|
||||
"覆盖用户实际症状",
|
||||
"出现任一才升级,不默认升级",
|
||||
"3-5 个排序的可证伪假设",
|
||||
"一次只动一个变量",
|
||||
"自动化二分",
|
||||
"提高并报告复现率",
|
||||
"性能问题先建立可比较的性能基线",
|
||||
"正确接缝",
|
||||
"前缀或等价标签",
|
||||
"定向搜索证明已移除",
|
||||
"最小场景",
|
||||
"原始完整复现",
|
||||
)
|
||||
|
||||
|
||||
def _read_skill(path: Path) -> tuple[dict[str, object], str]:
|
||||
text = path.read_text(encoding="utf-8")
|
||||
@@ -196,6 +233,27 @@ def test_thin_skills_keep_explicit_safety_invariants() -> None:
|
||||
assert "派发独立 subagent reviewer" not in review_prompt
|
||||
|
||||
|
||||
def test_cs_issue_owns_diagnosis_and_authorized_fix_modes() -> None:
|
||||
frontmatter, issue = _read_skill(SKILLS / "cs-issue/SKILL.md")
|
||||
debug = (SKILLS / "cs-issue/references/debug.md").read_text(encoding="utf-8")
|
||||
_, cs = _read_skill(SKILLS / "cs/SKILL.md")
|
||||
|
||||
assert str(frontmatter["description"]).startswith("诊断或修复 bug、报错、性能回退")
|
||||
for anchor in ISSUE_DIAGNOSIS_CONTRACT:
|
||||
assert _contains_contract(issue, anchor), f"cs-issue: missing {anchor!r}"
|
||||
for anchor in ISSUE_DEBUG_REFERENCE_CONTRACT:
|
||||
assert _contains_contract(debug, anchor), f"debug reference: missing {anchor!r}"
|
||||
|
||||
shipped_issue = issue + debug
|
||||
assert "diagnosing-bugs" not in shipped_issue
|
||||
assert "排查这个报错为什么发生" in cs
|
||||
assert "排查、诊断、bug、报错、性能回退、行为异常" in cs
|
||||
|
||||
refactor_frontmatter, refactor = _read_skill(SKILLS / "cs-refactor/SKILL.md")
|
||||
assert "行为等价" in refactor
|
||||
assert "性能优化" in str(refactor_frontmatter["description"])
|
||||
|
||||
|
||||
def test_cs_discusses_in_session_then_hands_off_same_turn() -> None:
|
||||
_, cs = _read_skill(SKILLS / "cs/SKILL.md")
|
||||
for anchor in (
|
||||
|
||||
@@ -454,6 +454,46 @@ def test_cs_session_discussion_and_handoff_contract_is_bilingual() -> None:
|
||||
assert "stable assets graduate through the owning skill into their canonical homes" in en_catalog
|
||||
|
||||
|
||||
def test_issue_diagnosis_and_authorized_fix_contract_is_bilingual() -> None:
|
||||
zh_readme = _read("README.md")
|
||||
en_readme = _read("README.en.md")
|
||||
zh_catalog = _read("SKILL_CATALOG.md")
|
||||
en_catalog = _read("SKILL_CATALOG.en.md")
|
||||
zh_workflow = " ".join(_read("WORKFLOW.md").split())
|
||||
en_workflow = " ".join(_read("WORKFLOW.en.md").split())
|
||||
|
||||
for document in (zh_readme, zh_catalog):
|
||||
assert "诊断问题;获授权后用红到绿证据修复" in document
|
||||
for document in (en_readme, en_catalog):
|
||||
assert "Diagnose problems; once repair is authorized, fix with red-to-green evidence" in document
|
||||
|
||||
for anchor in (
|
||||
"只诊断 / 排查",
|
||||
"获授权修复 bug / 性能回退 / 行为异常",
|
||||
"默认;仅文案级微小改动可说明后跳过",
|
||||
"默认;仅单行级微小修复可说明后跳过",
|
||||
"跨模块大范围、公开 interface 或性能敏感路径",
|
||||
"只要求诊断时保持零产品改动",
|
||||
"已证实根因、可证伪假设或证据不足",
|
||||
"性能回退或异常变慢",
|
||||
"行为等价的主动优化",
|
||||
):
|
||||
assert anchor in zh_workflow
|
||||
|
||||
for anchor in (
|
||||
"diagnose / investigate",
|
||||
"authorized repair of bug / performance regression / broken behavior",
|
||||
"default; documentation-only tiny changes may be skipped with an explanation",
|
||||
"default; single-line tiny fixes may be skipped with an explanation",
|
||||
"cross-module, public-interface, or performance-sensitive work",
|
||||
"A diagnosis-only request leaves zero product changes",
|
||||
"confirmed root cause, falsifiable hypothesis, or insufficient evidence",
|
||||
"performance regression or anomalous slowdown",
|
||||
"proactive optimization under behavioral equivalence",
|
||||
):
|
||||
assert anchor in en_workflow
|
||||
|
||||
|
||||
def test_workflow_owns_epic_and_legacy_knowledge_contracts() -> None:
|
||||
zh_workflow = " ".join(_read("WORKFLOW.md").split())
|
||||
en_workflow = " ".join(_read("WORKFLOW.en.md").split())
|
||||
|
||||
Reference in New Issue
Block a user