Pick by the problem, not by the artifact.
| Mode | You are here when | Output |
|---|
| Design | Starting a new app, service, or surface, and the structure is not decided yet | An architecture brief |
| Deepen | The code works, but change is expensive: concepts scattered, seams leaking, one idea under three names | Ranked opportunities, then one migrated slice |
| Harden | The structure is decided and keeps decaying, or agents keep doing the wrong thing in this repo | Wired checks, markers, and recipes |
Modes compose, and running more than one is normal. Design ends in Harden, because a contract with no check is a suggestion. Deepen ends in Harden, so the new seam cannot decay back. Harden runs alone when the structure is already right and only the enforcement is missing, which is the common case in a repo that agents work in.
When the two look equally right, prefer Deepen. A user reporting "agents keep using the old pattern" is describing a Harden symptom, but if the cause is one concept living in two places, quarantine only freezes the duplicate in place: Deepen deletes it and Harden holds the line until that lands. Harden alone is the right answer when the old thing genuinely has to stay.
When you cannot write to the repo (no checkout, read-only request, or the user asked a question rather than for a change), each mode's output degrades to its plan: the brief, the ranked opportunities, or the named checks with their rungs. Say which checks remain unproven, since none of them are wired.
As simple as possible, no simpler. Every mode cuts: surfaces in Design, concepts in Deepen, dual paths and dormant config in Harden. The floor does not get cut for simplicity: validation at trust boundaries, error handling that prevents data loss, security, accessibility, observability on anything deployed, and whatever was explicitly asked for. A simplification that reaches one of those is a bug, not a simplification. Where a corner is genuinely cut on purpose, mark it with its ceiling and upgrade path rather than leaving the next reader to guess whether it is finished.
根据问题选择模式,而非根据产物。
| 模式 | 适用场景 | 输出结果 |
|---|
| 设计模式 | 启动新应用、服务或接口,且架构结构尚未确定 | 架构文档 |
| 深化模式 | 代码可正常运行,但变更成本极高:概念分散、边界泄露、同一概念对应多个名称 | 优先级排序的优化机会,以及首个迁移的代码切片 |
| 加固模式 | 架构已确定但持续退化,或是Agent在仓库中频繁执行错误操作 | 配置完成的检查规则、标记和操作指南 |
模式可组合使用,同时运行多种模式是常见情况。 设计模式最终会进入加固模式,因为没有检查机制的契约只是建议。深化模式最终也会进入加固模式,确保新的代码边界不会再次退化。当架构本身合理但缺乏执行机制时,可单独运行加固模式,这也是Agent工作的仓库中的常见情况。
当两种模式看起来同样合适时,优先选择深化模式。 用户反馈“Agent持续使用旧模式”是加固模式的症状,但如果原因是同一概念存在于两个位置,隔离只会固化重复内容:而深化模式会删除重复内容,再由加固模式维持规范。只有当旧内容确实必须保留时,单独使用加固模式才是正确选择。
当无法写入仓库时(无检出权限、只读请求,或用户仅提问而非要求变更),每种模式的输出会降级为对应的计划:架构文档大纲、优先级排序的优化机会,或带执行层级的命名检查规则。需说明哪些检查尚未验证,因为它们均未配置生效。
保持极简,但不能过度简化。 每种模式都会做减法:设计模式减少对外接口,深化模式精简概念,加固模式移除双路径和休眠配置。但以下内容不能简化:信任边界的验证、防止数据丢失的错误处理、安全、可访问性、已部署服务的可观测性,以及用户明确要求的内容。如果简化触及这些内容,那是漏洞而非优化。若确实需要刻意简化某个细节,需标记其上限和升级路径,避免后续开发者猜测是否已完成。