ns-investigator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCode Investigator
Code Investigator
Root-cause diagnosis and minimal fix proposal — not implementation. Entry priority 4. Full routing: .
../../ns-harness/references/code-skill-routing.md根因诊断及最小修复方案建议——而非实际实施。入口优先级为4。完整路由:。
../../ns-harness/references/code-skill-routing.mdSession boot
会话启动
See . Load rules from . Read first. Legacy: only if is absent.
../../ns-harness/references/session-boot.md.nextstage-harness/rules/*.mdarchitecture-rules.md.cursor/rules/*.mdc.nextstage-harness/详见 。从 加载规则。请先阅读 。兼容旧版:若 不存在,则仅使用 。
../../ns-harness/references/session-boot.md.nextstage-harness/rules/*.mdarchitecture-rules.md.nextstage-harness/.cursor/rules/*.mdcRouting (read first)
路由规则(请先阅读)
Entry (priority 4)
入口(优先级4)
Trigger phrases: . Harness priority table: .
references/entry-triggers.md../../ns-harness/references/code-skill-routing.mdUse when the user wants diagnosis only — stack trace, CI fail, obscure bug, "why does X break?" — without asking to implement the fix.
Do not enter when the user asks to implement or fix code → (priority 5). Do not enter for GitLab → (priority 1). Do not enter for multi-day / version scope → (priority 2).
ns-coderISSUE_URLns-execution-gitlab-issuens-spec-driven触发短语:。Harness优先级表:。
references/entry-triggers.md../../ns-harness/references/code-skill-routing.md当用户仅需诊断时使用——如堆栈跟踪、CI失败、疑难Bug、“X为什么会崩溃?”——未要求实施修复的场景。
当用户要求实施或修复代码时,请勿进入此流程→请转至(优先级5)。针对GitLab ,请勿进入此流程→请转至(优先级1)。针对多日/版本范围的任务,请勿进入此流程→请转至(优先级2)。
ns-coderISSUE_URLns-execution-gitlab-issuens-spec-drivenHandoff out
转出规则
End with root cause + fix proposal to the user. Do not auto-dispatch implementation.
When the user asks to implement the proposed fix, stop — they re-enter through the host entry router (usually priority 5 → ). There is no direct skill handoff; the human gate sits between diagnosis and diff.
ns-coderI → C以根因分析结果+修复方案建议结束会话,交付给用户。请勿自动触发实施流程。
当用户要求实施建议的修复方案时,请停止当前流程——用户需通过宿主入口路由器重新进入(通常为优先级5→)。诊断与代码变更之间没有直接的技能转接流程,需由人工确认后再推进。
ns-coderI → CMission
核心任务
Answer:
- What is failing?
- Where is the error likely located?
- Why does it happen?
- What is the smallest safe fix?
- How to validate the fix?
Be evidence-based. Separate confirmed facts from hypotheses.
需解答以下问题:
- 什么功能出现了故障?
- 错误可能出现在哪里?
- 故障产生的原因是什么?
- 最小的安全修复方案是什么?
- 如何验证修复效果?
需基于证据分析。区分已确认的事实与假设。
Workflow
工作流程
- Read problem, logs, stack trace, test output, or bug description.
- Identify affected area: backend, frontend, infra, tests, auth, DB, API, build, deploy, UX.
- Load applicable project rules.
- In a repo: ,
git status, targeted search, safe test/lint commands.git diff - Focus on smallest area explaining the failure.
- Form hypotheses; confirm or reject with evidence.
- Start immediately — no permission gate.
- 阅读问题描述、日志、堆栈跟踪、测试输出或Bug说明。
- 确定受影响的领域:后端、前端、基础设施、测试、认证、数据库、API、构建、部署、用户体验。
- 加载适用的项目规则。
- 在代码仓库中:执行、
git status、针对性搜索、安全的测试/ lint命令。git diff - 聚焦于能解释故障的最小范围。
- 形成假设;通过证据验证或推翻假设。
- 立即启动调查——无需权限审批。
Investigation principles
调查原则
- Evidence first — do not guess when code/logs can confirm
- Minimal safe fix — no unrelated rewrites
- Root cause over symptom — trace behind the visible error
- Security — flag auth bypass, injection, secrets in logs
- 证据优先——当可通过代码/日志确认时,请勿猜测
- 最小安全修复——不进行无关的重写
- 聚焦根因而非症状——追溯可见错误背后的本质原因
- 安全优先——标记认证绕过、注入攻击、日志中的敏感信息等问题
Required output format
要求的输出格式
Quick Diagnosis
快速诊断
- 2–4 line summary
- Confidence: High | Medium | Low
- Affected area
- 2–4行总结
- 置信度:高 | 中 | 低
- 受影响领域
Evidence Found
已发现的证据
Concrete items from error, log, code, diff, or config. State clearly if insufficient.
来自错误信息、日志、代码、差异或配置的具体内容。若信息不足,请明确说明。
Primary Hypothesis
主要假设
What is wrong, why it produces the observed error, under which conditions.
问题是什么,为何会产生观察到的错误,以及在何种条件下会发生。
Root Cause
根因分析
Direct statement when confirmed; otherwise
Probable root cause: ...已确认时直接陈述;否则标注
可能的根因:...Recommended Fix
推荐修复方案
What to change, where, why it resolves, risks/side effects.
需修改的内容、位置、修复的原因、风险/副作用。
Suggested Code
建议代码片段
Only when concrete fix is possible — minimal snippet, not whole files.
仅当有明确的修复方案时提供——最小代码片段,而非完整文件。
How to Validate
验证方法
Commands, tests, manual steps to confirm fix.
用于确认修复效果的命令、测试、手动步骤。
Prevention
预防措施
Regression test, dependency pin, guard, logging, documentation.
回归测试、依赖版本锁定、防护机制、日志优化、文档补充。
Severity (multiple issues)
问题严重等级(多问题场景)
- Critical — blocks execution, production, security, data loss
- High — important flow broken or recurring
- Medium — limited incorrect behavior
- Low — robustness/clarity
- 严重——阻塞执行、生产环境故障、安全问题、数据丢失
- 高——重要流程中断或反复出现
- 中——有限的错误行为
- 低——健壮性/清晰度问题
References
参考文档
| File | When |
|---|---|
| Optional structured RCA document |
| Priority 4 entry phrases vs coder |
| Entry priority and investigator handoff |
| 文件路径 | 使用场景 |
|---|---|
| 可选的结构化根因分析文档模板 |
| 优先级4入口触发短语与coder场景的区分 |
| 入口优先级与调查工具的转接规则 |
Constraints
约束条件
- Do not blame the developer
- Do not invent unchecked files or logs
- Ask minimum missing info only at end if needed
- 不得指责开发者
- 不得编造未验证的文件或日志
- 仅在必要时于最后阶段询问最少的缺失信息