egm-drift-report
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDetect Drift In Designs and Code
检测设计与代码中的漂移
When running in Codex or ChatGPT Work, first read Codex integration.
In Claude Code or Cowork, read first.
${CLAUDE_PLUGIN_ROOT}/docs/claude.mdWhen the user asks to detect drift across all designs or a set of READMEs, the
goal is to identify all instances where the codebase has diverged or failed to
implement the specifications described by those designs or READMEs.
-
Check Input: Verify a directory containing design documents or READMEs is provided. If not provided, ask the user to specify the target directory.
-
List Documents: List all files in the design directory.
-
Analyze: For EACH design document:
- Contextualize: Read the design document. Identify the intent, proposed changes, and specific filenames/symbols mentioned.
- Locate Source: Find the corresponding source code files in the source tree. If paths aren't explicit, use code search or grep to locate the relevant classes, functions, or API endpoints mentioned in the doc. Prompt the user to add missing links to the document to make future detection cheaper.
- Verify: Read the current state of those source files.
- Detect Drift: Compare the design vs. reality. Look specifically for:
- Missing Features: Logic described in the doc but absent in the code.
- Incomplete Models: Dataclasses/Classes/Structs/Protos missing fields specified in the design.
- Logic Shortcuts: Hardcoded values where dynamic logic was planned.
- Architectural Divergence: Implementation using different patterns/libraries than proposed.
- Filter: Report ONLY the differences. Do not describe what is working or what matches. If the code matches the design perfectly, output "No drift detected."
-
Report: Produce a single report listing all discrepancies found.
-
Append the analysis for each file tousing your file-writing tool.
{YYYY-MM-DD}_DRIFT_REPORT.md -
Strict Format:markdown
## <DESIGN_DOC_NAME> <Bulleted list of specific divergences found> <Or "No drift detected">
-
-
Guidance
- Be rigorous. If a design doc mentions a specific object, field or file name and the code doesn't have it, that is a reportable drift. Double check for coverage. If there is some part of the logic that is not referenced in a design or README, this is a reportable drift.
- Read files liberally to ensure you are looking at the current state of the code, not relying on memory.
- Process the files sequentially to ensure the tool output buffer doesn't overflow.
在 Codex 或 ChatGPT Work 中运行时,先阅读 Codex 集成。
在 Claude Code 或 Cowork 中运行时,先阅读 。
${CLAUDE_PLUGIN_ROOT}/docs/claude.md当用户要求检测所有设计或一组 README 的漂移时,目标是找出代码库已经偏离或未能实现这些设计或 README 所描述规格的所有情况。
-
检查输入:确认是否提供了一个包含设计文档或 README 的目录。如果未提供,请让用户指定目标目录。
-
列出文档:列出设计目录中的所有文件。
-
分析:对于每一份设计文档:
- 理解上下文:阅读设计文档。确定其意图、拟议的变更以及提到的具体文件名或符号。
- 定位源代码:在源码树中找到对应的源文件。如果路径不明确,请使用代码搜索或 grep 定位文档中提到的相关类、函数或 API 端点。提示用户补充文档中缺失的链接,以降低后续检测成本。
- 验证:阅读这些源文件的当前状态。
- 检测漂移:比较设计与实际情况。 specifically 检查:
- 缺失功能:文档中描述的逻辑在代码中不存在。
- 不完整模型:Dataclasses/Classes/Structs/Protos 缺少设计指定的字段。
- 逻辑捷径:原本计划使用动态逻辑的地方使用了硬编码值。
- 架构偏差:实现采用了与设计建议不同的模式或库。
- 过滤:仅报告差异。不要描述正常工作的部分或匹配的内容。如果代码与设计完全匹配,输出“未检测到漂移。”
-
报告:生成一份列出所有已发现差异的单独报告。
-
使用文件写入工具,将每个文件的分析追加到。
{YYYY-MM-DD}_DRIFT_REPORT.md -
严格使用以下格式:markdown
## <DESIGN_DOC_NAME> <发现的具体差异项的要点列表> <或“未检测到漂移”>
-
-
指导原则
- 保持严谨。如果设计文档提到了某个具体对象、字段或文件名,而代码中不存在,则应将其报告为漂移。再次检查覆盖范围。如果代码中的某部分逻辑未在设计或 README 中被引用,这也应报告为漂移。
- 广泛阅读文件,以确保检查的是代码的当前状态,而不是依赖记忆。
- 按顺序处理文件,以确保工具输出缓冲区不会溢出。