why
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWhy
为什么
Recover the forces that shaped code from historical evidence. Separate documented intent from supported inference, plausible hypotheses, and unknowns.
Code is evidence of mechanics, not motivation. Motivation may live in source history, reviews, tickets, documents, team discussions, incidents, telemetry, or product data.
从历史证据中还原塑造代码的影响因素,区分有记录的设计意图、有支撑的推断、合理假设和未知项。
代码是机制的证据,而非动机的证据。动机可能存在于源码历史、评审记录、工单、文档、团队讨论、事件、可观测数据或产品数据中。
Investigation workflow
调查工作流
1. Frame the question
1. 界定问题
Identify:
- the target code, pattern, feature, or decision;
- the specific rationale the user wants;
- any hypothesis embedded in the question.
Use open files, recent edits, and conversation context to interpret a vague referent. State the interpretation so the user can redirect it. Ask only when different interpretations would require materially different investigations.
Treat the user's suggested explanation as a hypothesis to test.
Complete when: the target and question are precise enough to define relevant evidence.
明确以下内容:
- 目标代码、模式、功能或决策;
- 用户想要了解的具体决策依据;
- 问题中隐含的任何假设。
对于模糊的指代对象,可结合打开的文件、最近的编辑记录和对话上下文进行解读。请明确说明你的解读,以便用户调整方向。仅当不同解读会导致完全不同的调查方向时,才需要向用户询问。
将用户提出的解释视为待验证的假设。
完成条件: 目标和问题足够明确,能够确定需要查找哪些相关证据。
2. Build the code anchor
2. 建立代码锚点
Record the relevant paths and lines, key symbols, last-touch commits, earlier history through renames, and linked reviews or tickets. Useful starting commands include:
bash
git blame -L <start>,<end> <file>
git log --follow -p -- <file>
git log --oneline -20 -- <file>
git log -1 --format=%B <commit>Use an available forge client or API to read review descriptions and discussion. Do not assume a particular forge or tool is installed.
Capture paths, symbols, commits, review IDs, ticket IDs, dates, authors, and search terms for reuse across sources.
Complete when: an investigator can search another system without rediscovering what code and time window the question concerns.
记录相关的文件路径和行号、关键符号、最后修改的提交、经过重命名的更早历史记录,以及关联的评审或工单。常用的起始命令包括:
bash
git blame -L <start>,<end> <file>
git log --follow -p -- <file>
git log --oneline -20 -- <file>
git log -1 --format=%B <commit>使用可用的代码托管平台客户端或API来读取评审描述和讨论内容。不要假设系统已安装特定的平台或工具。
记录路径、符号、提交、评审ID、工单ID、日期、作者和搜索词,以便在不同来源中复用。
完成条件: 调查人员无需重新确认问题涉及的代码范围和时间窗口,即可在其他系统中进行搜索。
3. Build the coverage map
3. 构建覆盖范围图
Discover the repository and external read-only connectors available in the current runtime. Create one ledger entry per connector, then map each entry to an evidence category:
- source control and code review;
- issue or ticket tracking;
- long-form documents;
- real-time team discussion;
- infrastructure observability and incidents;
- error or exception tracking;
- product analytics or warehouse data.
Read references/source-playbook.md, then load only the playbook for each available category. Tool names and schemas come from the runtime, not this skill.
Search every available connector by default, including multiple connectors in one category when they hold distinct records. Mark each ledger entry , , , or , with a reason and scope. A category may be inapplicable only when the target cannot enter it by construction.
searchedunavailableinaccessibleinapplicableComplete when: every discovered connector has a search plan or a specific status reason, and all seven categories appear in the ledger even when no connector is available.
发现当前运行时中可用的代码仓库和外部只读连接器。为每个连接器创建一条台账记录,然后将每条记录映射到一个证据类别:
- 版本控制与代码评审;
- 问题或工单跟踪;
- 长文档;
- 团队实时讨论;
- 基础设施可观测性与事件;
- 错误或异常跟踪;
- 产品分析或数据仓库数据。
阅读 references/source-playbook.md,然后仅加载每个可用类别的操作手册。工具名称和模式由运行时提供,而非本技能定义。
默认搜索所有可用的连接器,包括同一类别中存储不同记录的多个连接器。将每条台账记录标记为(已搜索)、(不可用)、(无法访问)或(不适用),并注明原因和范围。仅当目标从结构上不可能进入该类别时,该类别才可能不适用。
searchedunavailableinaccessibleinapplicable完成条件: 每个发现的连接器都有对应的搜索计划或明确的状态原因,且即使没有可用连接器,台账中也应包含全部七个类别。
4. Investigate each source
4. 调查每个来源
Search connectors concurrently when independent read-only agents are available; otherwise search them sequentially. Use one bounded lane per connector, combining connectors only when they expose the same records and query vocabulary. The method must not depend on a particular agent provider, model, or runner configuration.
Use references/investigator-prompt.md as the lane contract. Pass the question, code anchor, category playbook, and any cross-cutting incident angle. Investigators gather evidence rather than answer the question.
For each source:
- search broadly, then narrow;
- read complete relevant items and their discussion;
- capture exact quotations with stable citations when wording matters;
- record queries, time ranges, null results, contradictions, and access limits;
- pass cross-source leads to the matching category rather than silently changing scope.
A null result becomes useful evidence only when the search that produced it is documented.
Complete when: every planned category returns cited evidence, a documented null result, or a named access gap.
如果有独立的只读Agent可用,可并行搜索多个连接器;否则按顺序搜索。每个连接器使用一个独立的受限通道,仅当连接器暴露的记录和查询词汇相同时,才可以合并使用。该方法不得依赖特定的Agent提供商、模型或运行器配置。
使用 references/investigator-prompt.md 作为通道契约。传入问题、代码锚点、类别操作手册以及任何跨领域的事件视角。调查员的职责是收集证据,而非直接回答问题。
对于每个来源:
- 先广泛搜索,再逐步缩小范围;
- 阅读完整的相关条目及其讨论内容;
- 当措辞很重要时,记录准确的引用内容并附上稳定的引用来源;
- 记录查询语句、时间范围、零结果情况、矛盾之处和访问限制;
- 将跨来源的线索传递给对应类别,而非悄悄变更调查范围。
只有当产生零结果的搜索过程被记录下来时,零结果才会成为有用的证据。
完成条件: 每个计划调查的类别都返回了带引用的证据、有记录的零结果,或者明确的访问缺口。
5. Synthesize with calibrated confidence
5. 以校准后的置信度进行综合分析
Read references/epistemics.md and references/synthesizer-prompt.md. Synthesize directly or delegate to one read-only synthesizer with access to all findings and the code anchor.
Classify each claim:
- Direct: a source explicitly states the rationale.
- Supported: multiple indirect sources converge.
- Inferred: a reasonable interpretation with a visible inference chain.
- Speculative: a plausible hypothesis with thin or competing evidence.
- Unknown: the search did not answer the question.
Spot-check citations before presenting them. Surface contradictions instead of resolving them for narrative neatness. Preserve confidence language during any final edit.
Complete when: every rationale claim has a confidence tier, tier-appropriate phrasing, and adjacent evidence or an explicit gap.
阅读 references/epistemics.md 和 references/synthesizer-prompt.md。可以直接进行综合分析,也可以委托给一个有权访问所有调查结果和代码锚点的只读综合分析器。
对每个结论进行分类:
- 直接: 有来源明确说明了该决策依据。
- 有支撑: 多个间接来源的结论相互印证。
- 推断: 合理的解读,且有清晰的推断链条。
- 推测: 看似合理的假设,但证据薄弱或存在相反证据。
- 未知: 本次搜索未能回答该问题。
在展示引用前进行抽查验证。主动呈现矛盾之处,不要为了叙事通顺而强行消解矛盾。在最终编辑时保留体现置信等级的措辞。
完成条件: 每个关于决策依据的结论都有对应的置信等级、符合等级的措辞,以及相关证据或明确的缺口说明。
6. Present the lineage
6. 呈现溯源脉络
Use this structure, omitting only sections that truly have no content:
- Question
- Code anchor
- Direct and supported findings
- Reasonable inferences
- Competing hypotheses
- Unknowns and gaps
- Sources consulted
- Confidence summary
For each source, state what was searched and what was found, including null results and skip reasons. A reader should be able to verify a cited claim quickly and judge the investigation's coverage.
When the investigation precedes a code change, add a concise constraint set:
- Preserve: behavior or rationale still supported by evidence.
- Change: assumptions the evidence shows are obsolete.
- Avoid: rejected paths whose failure still applies.
- Risk: gaps or uncertainty the plan must protect against.
Complete when: the answer distinguishes knowledge from inference, exposes the search boundary, and leaves the user with verifiable evidence rather than a plausible story.
使用以下结构,仅省略完全没有内容的章节:
- 问题
- 代码锚点
- 直接及有支撑的发现
- 合理推断
- 对立假设
- 未知项与缺口
- 参考来源
- 置信度总结
对于每个来源,说明搜索了哪些内容、发现了哪些内容,包括零结果的情况和跳过的原因。读者应能够快速验证引用的结论,并判断调查的覆盖范围。
如果本次调查是为代码变更做准备,请添加一组简明的约束集:
- 保留: 仍有证据支撑的行为或决策依据。
- 变更: 证据表明已过时的假设。
- 避免: 已被否决且其失败原因仍然适用的技术路径。
- 风险: 方案必须防范的缺口或不确定性。
完成条件: 答案能够区分已知事实与推断,明确展示搜索边界,为用户提供可验证的证据,而非仅仅是看似合理的说法。