Help us improve
Share bugs, ideas, or general feedback.
From deep-work
Researches codebases in Phase 1: analyzes architecture, patterns, risks on existing projects; or investigates tech stack, conventions, data-model on zero-base projects using WebSearch + Context7.
npx claudepluginhub sungmin-cho/claude-deep-suite --plugin deep-workHow this skill is triggered — by the user, by Claude, or both
Slash command
/deep-work:deep-researchThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> [!IMPORTANT]
Orchestrates autonomous deep research on codebases and technical topics via map-reduce explorer architecture with sub-agents, generating structured reports.
Launches agent team for parallel deep research on codebases, architectures, or technical topics, building causal models (what exists, why, what breaks) over surface coverage. Use for multi-file investigations or complex questions.
Explores codebases with multi-angle analysis, checks prior knowledge, applies learned patterns, and outputs structured findings. Useful for deep-dive research on any topic.
Share bugs, ideas, or general feedback.
[!IMPORTANT] Skill body echo 금지
이 SKILL.md 본문을 사용자에게 echo하거나 요약하여 출력하지 마라.
- Section 1 (state 로드, 완료-marker 감지)의 조용한 내부 처리는 silent. Pre-checks(
--scope/--incremental/ previous research cache)와 Cross-Plugin Context의 명시적 사용자 상호작용은 허용된 예외.- 첫 사용자-가시 주 동작은 Section 2의 First Action: 코드베이스 매핑 선언 + 즉시 Glob 실행이다.
- Section 3 완료 메시지는 Section 2의 6개 영역 분석과 research.md 작성을 실제로 수행한 뒤에만 출력.
- 본 문서의 markdown 블록·표는 지침이다. 응답으로 출력하지 마라.
.claude/deep-work.{SESSION_ID}.mdwork_dir, task_description, project_type 추출 → $WORK_DIR 설정 (기본: deep-work)current_phase가 "research"인지 확인 — 아니면 오류research_started_at 기록 (ISO timestamp)research_approved: true 필드가 state에 이미 있고 $ARGUMENTS에 --force-rerun / --scope= / --incremental이 없으면 paused-after-approval 복귀 후보 경로이다. 단, Orchestrator §3-2가 이미 integrity check(sha256 비교)를 수행하여 stale approval 시 skill을 직접 재호출하므로, 본 branch는 Orchestrator dispatch를 통한 정상 경로 이외에는 도달하지 않는다. 진입 시:
중요 (NC1): research_completed_at / research_complete: true만 있고 research_approved가 없으면 이 branch를 발동시키지 말 것 — skill completion과 review+approval 사이에 세션이 중단된 상태이며, resume 시 review+approval을 다시 거쳐야 한다.
중요 (NW5): Resume fast-path의 integrity check는 Orchestrator §3-2가 우선 담당. 본 branch는 research_approved: true만 감지하나, Orchestrator가 hash 불일치 감지 시 approval을 invalidate하고 skill을 --force-rerun과 함께 호출하므로 이 branch는 out-of-band 편집 케이스에서 우회됨.
$WORK_DIR/$ARGUMENTS에 --scope= 포함 시: 기존 research.md의 지정 영역만 재분석 → Section 3으로 건너뜀.
Valid scopes: architecture, patterns, data, api, infrastructure, dependencies
$ARGUMENTS에 --incremental 포함 시: last_research_commit 기준 git diff → 변경 영역만 재분석.
--scope가 --incremental보다 우선.
.deep-work/ 내 이전 세션 research.md 발견 시 → 베이스라인 활용 여부를 사용자에게 질문.
Phase 1 Research 시작 시 외부 플러그인 데이터를 참조한다. 이 데이터는 "참고" 수준이며, 현재 작업과 관련 없으면 무시한다.
.deep-dashboard/harnessability-report.json이 존재하면:
{schema_version: "1.0", envelope: {...}, payload: {...}})이면 identity guard를 적용:
envelope.producer === "deep-dashboard" ∧ envelope.artifact_kind === "harnessability-report" ∧ envelope.schema.name === envelope.artifact_kind 가 모두 참인 경우에만 payload를 사용. 하나라도 어긋나면 "foreign envelope at harnessability-report path — skip" 경고 후 건너뜀.envelope.generated_at을 우선, 없으면 payload root의 generated_at):
generated_at 필드가 없으면 그대로 사용 (하위 호환)dimensions[] / total 등의 필드는 envelope 모드/legacy 모드 모두에서 동일하게 payload root 또는 객체 root에서 읽는다:
이 프로젝트의 harnessability 진단 결과:
- <dimension>: <score>/10 → <suggestion>
이 작업에서 관련 영역을 개선할 수 있으면 함께 고려.
.deep-evolve/evolve-insights.json(또는 .deep-evolve/<session>/evolve-insights.json)이 존재하면:
envelope.producer === "deep-evolve" ∧ envelope.artifact_kind === "evolve-insights" ∧ envelope.schema.name === envelope.artifact_kind 검증 후 payload를 사용. mismatch는 skip.insights_for_deep_work 항목을 research context에 포함 (envelope 모드/legacy 모드 모두 payload/root 에서 직접 접근):
deep-evolve 메타 아카이브 기반 인사이트:
- <pattern>: <evidence> → <suggestion>
envelope.parent_run_id 가 이 evolve-insights 의 envelope.run_id 로 채워진다 (cross-plugin chain).deep-memory plugin).deep-memory/latest-brief.md가 프로젝트 루트(git rev-parse --show-toplevel을 $WORK_DIR에서 실행한 결과 — non-git worktree에서는 $WORK_DIR의 가장 가까운 ancestor 중 .git/ 디렉토리가 있는 위치 — R1-I2)에 존재하면 cross-project semantic operational memory를 Research 컨텍스트로 인용한다. 자동 호출 금지 — brief 파일이 이미 materialize 되어 있는 경우(사용자가 명시적으로 /deep-memory-brief를 호출한 결과)에만 인용한다. 자세한 spec은 docs/deep-memory-integration-handoff.md §2 참조.
처리 순서:
.deep-memory/latest-brief.md 파일 stat. 부재 시 research.md에 아무것도 쓰지 않는다 — research artifact 는 brief 가 있을 때만 deep-memory 인지하게 한다 (R1-Y2 — opt-in 없는 사용자의 artifact에 deep-memory 권유가 leak 되지 않도록). 단 runtime Research context 에는 한 줄 안내만 emit: "No .deep-memory/latest-brief.md found. Run /deep-memory-brief \"<task>\" first if you want cross-project recall." 이후 §5 State 필드는 모두 부재 기본값으로 채우고 종료.research.md의 새 ## Cross-project Memory 섹션 (이때 비로소 생성) 아래에 그대로 삽입한다. brief의 heading hierarchy는 두 단계 들여쓴다 (# Deep-Memory Brief — ... → ### Deep-Memory Brief — ..., ## <idx>. <type> — ... → #### <idx>. ...). 이는 deep-memory의 redaction(3-pass) + 포맷팅을 보존하기 위함이다 — re-rendering 금지./\bmem-[0-9A-HJKMNP-TV-Z]{26}\b/g (Crockford base32 ULID, uppercase-only — I/L/O/U 제외; deep-memory의 memory_id 는 uppercase 만 emit. 향후 lowercase 도입 시 provenance silently drop 되지 않도록 명시 — R1-I1) 으로 모든 memory_id 토큰을 추출하여 state에 cross_project_memory.cited_memory_ids 배열로 기록한다. 빈 배열도 유효 (인용 자체가 빈 brief일 수 있음).cross_project_memory.brief_path — .deep-memory/latest-brief.md 또는 nullcross_project_memory.brief_mtime — ISO 8601 또는 nullcross_project_memory.brief_stale — boolean (mtime 기준 > 14d)cross_project_memory.cited_memory_ids — mem-<ULID> 배열Privacy 불변식:
/deep-memory-brief를 호출하지 않는다. 오직 이미 존재하는 brief 파일을 읽기만 한다..deep-memory/ 하위에 쓰지 않는다. brief 파일은 read-only.docs/deep-memory-integration-handoff.md §4).Section 1 state 로드와 완료-marker 감지가 끝나면 즉시 다음 메시지를 출력한 뒤 별도 확인 없이 Glob 실행으로 진입한다:
"코드베이스 분석을 시작합니다. 주요 디렉토리부터 매핑합니다."
이어서 Glob 도구로 **/*.{md,json,ts,tsx,js,py,sh,go,rs} 등 프로젝트 주요 확장자 또는 topology-detector 결과에 따른 디렉토리 매핑을 수행한다. "시작할까요?" 같은 추가 확인 금지 — Exit Gate는 Section 3 완료 후 Orchestrator가 처리.
금지: 이 선언과 Glob 호출 전에 template, 완료 메시지, 6개 영역 bullet list를 사용자에게 출력하지 마라.
First Action의 디렉토리 매핑 직후, Agent 위임 전에 부모 세션이 Health Engine 진단을 수행한다. 이 단계는 조용히 실행하고, 결과만 research context와 state에 반영한다.
node ${CLAUDE_PLUGIN_ROOT}/templates/topology-detector.js "$WORK_DIR" 또는 동등한 Node module 호출로 topology를 감지한다.topology 필드에 기록한다.$WORK_DIR/.deep-review/fitness.json 존재 여부를 확인한다.health/fitness/fitness-generator.js의 generateFitnessRules($WORK_DIR)로 rules 후보를 생성하고, 자동 적용하지 말고 research context에 "fitness.json proposal available" 또는 명시적 skip 사유를 기록한다.health/health-check.js --fitness "$WORK_DIR/.deep-review/fitness.json"을 사용할 수 있다.node ${CLAUDE_PLUGIN_ROOT}/health/health-check.js "$WORK_DIR" --skip-audit 또는 runHealthCheck($WORK_DIR, { fitnessPath }) 동등 호출을 실행한다.health_report에 기록한다.fitness_baseline: health_report.fitness.required_missing, health_report.fitness.failed, health_report.fitness.violations의 Phase 1 snapshot.unresolved_required_issues: health_report.fitness.required_missing 및 health_report.drift.dependency_vuln.critical/high에서 required gate로 남은 항목 목록 또는 count.topology, health_report 요약, fitness_baseline, unresolved_required_issues를 포함한다.Research 단계는 항상 subagent에 위임한다. 메인 세션은 오케스트레이터 역할만 수행.
project_type 확인:
zero-base → deep-work:research-zerobase-workerdeep-work:research-codebase-workerteam_mode 확인:
solo → 단일 Agent() 호출 (area=full)team → 3개 Agent() 병렬 호출 (area는 project_type별로 다름)model=state.model_routing.research call-site override 적용 (spec §5.8).Agent(
subagent_type="deep-work:research-{codebase|zerobase}-worker",
model=state.model_routing.research, // default "sonnet"
prompt="area=full; work_dir=<$WORK_DIR>; task=<task_description>;" +
"re_run_area=<--scope value or null>;" +
"incremental_since=<--incremental value or null>"
)
Agent가 $WORK_DIR/research.md를 직접 작성한다. 부모는 refinement protocol을 수행하지 않는다 (spec §6.2).
3개 영역 정의 (project_type별):
architecture, patterns, riskstech-stack, conventions, data-model단일 메시지에 3개 Agent 호출을 parallel하게 실행. 각 호출은 Solo path와 동일한 prompt 계약을 유지 (area만 다름). work_dir/task/re_run_area/incremental_since 모두 전달 필요 — 생략 시 worker가 output path 결정 불가 (CA2 fix):
Agent(
subagent_type="deep-work:research-{codebase|zerobase}-worker",
model=state.model_routing.research,
prompt="area=architecture; work_dir=<$WORK_DIR>; task=<task_description>;" +
"re_run_area=<--scope value or null>;" +
"incremental_since=<--incremental value or null>"
)
Agent(
subagent_type="deep-work:research-{codebase|zerobase}-worker",
model=state.model_routing.research,
prompt="area=patterns; work_dir=<$WORK_DIR>; task=<task_description>;" +
"re_run_area=<--scope or null>; incremental_since=<--incremental or null>"
)
Agent(
subagent_type="deep-work:research-{codebase|zerobase}-worker",
model=state.model_routing.research,
prompt="area=risks; work_dir=<$WORK_DIR>; task=<task_description>;" +
"re_run_area=<--scope or null>; incremental_since=<--incremental or null>"
)
(zero-base 경우 area 값은 tech-stack / conventions / data-model. subagent_type은 research-zerobase-worker.)
각 Agent가 $WORK_DIR/research-{area}.md 부분 파일을 작성. 완료 후 부모가 3개 파일을 Read → Document Refinement Protocol (Apply / Deduplicate / Prune) → $WORK_DIR/research.md 로 merge.
3개 중 일부만 성공하고 일부 timeout/fail 시:
v6.3.x의 CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS precheck과 TeamCreate+TaskCreate+3 Agent 분기는 제거. Agent tool의 parallel 호출로 3-way 병렬을 달성.
실행 순서 안전장치: 이 섹션은 Section 2의 Solo/Team/Zero-base mode 전체 실행과 research.md 작성을 실제로 수행한 뒤에만 실행한다. Section 2를 건너뛰고 완료 메시지만 출력하는 것은 실패 모드이다.
연구 업데이트 시 항상 적용:
<!-- v[N]: [summary] — deduped: N, pruned: M -->## Cross-project Memory 섹션 포함 + cited_memory_ids 추출 — 부재 시 이 항목 skip (research.md 는 deep-memory-agnostic 유지)Read("../shared/references/phase-review-gate.md") — 프로토콜 실행:
$WORK_DIR/research.mdproject_type != zero-base): 아키텍처 분석 완성도, 패턴 식별, 리스크 누락project_type == zero-base): tech-stack 선정 근거 (대안 비교 + URL 출처), conventions 완결성, data-model 적정성research_complete: trueresearch_completed_at: ISO timestamplast_research_commit: git rev-parse HEADreview_state: completedphase_review.research + review_results.research 업데이트cross_project_memory: {brief_path, brief_mtime, brief_stale, cited_memory_ids[]} — Cross-Plugin Context의 Deep-Memory Brief Context 처리 결과 (부재 시 {null, null, false, []})NOTE: current_phase를 변경하지 않는다. Orchestrator가 리뷰+승인 후 변경.
Research 단계가 완료되었습니다!
연구 결과: $WORK_DIR/research.md
분석 요약: [3-5줄]
Team 모드 시 부분 결과 파일도 표시.