/research - Project & Technical Investigation
Investigate the codebase and record findings with sources, without implementation.
Input
The research subject is taken from $ARGUMENTS, a free-text topic or question. If empty, prompt via AskUserQuestion.
Source notation
Facts are file:line or command output, inferences inferred from X, unverified unknown, requires X. This is the source notation the Phases and the report template refer to; no other form is accepted.
Phase 1: Outcome Anchor
Read .claude/OUTCOME.md. If absent, generate the stub via /outcome. If the investigation steps into Non-goals, confirm with the user before proceeding.
Phase 2: Prior Research Scan
Derive the lowercase hyphenated subject slug from $ARGUMENTS and run ${CLAUDE_SKILL_DIR}/scripts/find-prior-research.ts <slug> .claude/workspace/research. Parse the JSON { candidates: [{file, shared}, ...], slug_words: int } (shared descending) from stdout.
- No candidates: set the report's Prior research to
none foundand move on - A candidate with shared >= 2, or with shared equal to
slug_words: carry forward per the table below - A candidate with shared == 1 left after that: the slug runs two words or more, so the filename overlap is all it rests on. It is excluded from the carry-over table below and lands only in the report's References, with its path and shared count
| Extract | Carry to | Handling |
|---|---|---|
| Key Findings table | Phase 7 | Re-verify or supersede as baseline |
| Constraints table | Phase 4 | Use as input only while its Domain matches the current one, otherwise return it to re-discovery |
| Disconfirmation results | Phase 7 | Reference |
Phase 3: Intent and Domain Clarification
Skip if $ARGUMENTS clearly indicates both. Otherwise ask via AskUserQuestion. Intent is chosen from Feature planning / Bug investigation / Understanding; Domain from Data model / API / Infrastructure / General.
Phase 4: Domain-Scoped Parallel Investigation
Two inputs arrive here. The intent and domain Phase 3 settled pick the row of the domain table below, and the Constraints table Phase 2's handoff table passes is taken as input only when the handoff's Domain matches the current one.
Launch Explore / ugrep / bfs / Read in parallel. Append each command and its raw output verbatim to the scratch. This is the audit trail; Phase 7 Disconfirmation quotes it directly and does not reconstruct. State the source for each finding in place.
For Feature planning or Bug investigation intent, also invoke Agent(subagent_type: explorer-feature). The spawn runs in the background, so keep the other searches going while its completion notification is pending. Take the result as a single JSON object { findings: [{ statement: string, source: string }] }, and do not move to the next Phase before it arrives. When that trigger fires, or when a .codegraph/ index exists, read ${CLAUDE_SKILL_DIR}/references/tactics.md and apply the tactics whose trigger matches.
With a Domain other than General, read ${CLAUDE_SKILL_DIR}/references/domain-scope.md and scope the searches by its roots and words.
Once the findings are in, read ${CLAUDE_SKILL_DIR}/references/verification.md and apply the verification matching the finding's kind. This read happens on every run, whatever the intent and the domain.
Phase 5: Strong Inference (Bug investigation only)
Apply ${CLAUDE_SKILL_DIR}/../../rules/core/OPERATION.md § Debug Investigation Protocol to eliminate the bug, then once the root cause is confirmed, run ${CLAUDE_SKILL_DIR}/references/verification.md § Same-origin sweep.
Phase 6: Advisor Pre-Synthesis Check
Invoke advisor() with no parameters. Advisor sees the full conversation history. If it flags a missed area or weak inference, return to Phase 4 to narrow the scoping.
Skip the invocation only when all conditions hold, and record the skip reason in the output.
- Phase 2 hit prior research, and no Phase 4 finding falls outside its Key Findings
- Intent is Understanding and Domain is General
- No claim crosses a repository boundary or drives PR scope
Phase 7: Synthesis
- If Phase 2 found prior research, integrate the inherited findings / constraints into Key Findings, marking each re-verified or superseded
- Confirm each finding carries a source in the source notation. Mark gaps
unknown, requires X - Triage each finding. A Next Action goes only to a finding tied to a direct answer to the
$ARGUMENTSquestion, to advancing or protecting an OUTCOME.md Behavior / Constraint, or to handling a real incident (issue / bug report). Such a finding states its linkage in the action cell. Every other finding gets Next Actionrecord only. Either way, all findings stay listed - Record Disconfirmation. If Phase 5 ran, write
Covered by Phase 5 elimination; if skipped, quote the command and raw output from the scratch verbatim. Treat 0 hits as possible tool misuse before absence - Confirm every Phase 3 question is answered or recorded as
unknown, requires X
Phase 8: Output
Generate the report following the skeleton in ${CLAUDE_SKILL_DIR}/templates/research.md, fill in ${CLAUDE_SESSION_ID}, and save to .claude/workspace/research/YYYY-MM-DD-<slug>.md.
After saving, propose the destination from the template's Next Steps table in the conversation, and run none of them. Attach the saved report's path and the words the slug came from, verbatim. /think builds its slug from those words and pulls this report with the same script, so a word that drifts leaves the report unreachable.
Completion Criteria
Not done until all are satisfied. An item whose Condition carries "(...)" is required only when applicable.
| Item | Phase | Condition |
|---|---|---|
| OUTCOME | Phase 1 | .claude/OUTCOME.md present |
| Prior research | Phase 2 | Prior research field filled with the slug or none found |
| Audit trail | Phase 4 | Scratch captured with commands and raw output verbatim |
| Cross-method | Phase 4 | Cross-method verification performed for exhaustiveness claims (when such a claim exists) |
| Primary source | Phase 4 | Primary-source verification run on load-bearing external claims, or marked unverified (when present) |
| Same-origin sweep | Phase 5 | Sweep performed when Bug intent confirmed a root cause (when applicable) |
| advisor | Phase 6 | advisor invoked, or skip reason recorded |
| Source | Phase 7 | Every finding has an explicit source or an unknown, requires X note |
| Triage | Phase 7 | Every Next Action states its linkage (question / OUTCOME / incident) or reads record only |
| Save | Phase 8 | Output saved to .claude/workspace/research/ |
| Handoff | Phase 8 | Destination proposed from the Next Steps table, with the report path and the slug's words attached |