/cc-dev:session:wrap — 작업 마무리 정리#
| 항목 | 내용 |
|---|---|
| 실행 명령 | /cc-dev:session:wrap |
| 분류 | 자동화 |
| 난이도 | ●●○ 보통 |
한마디로#
오늘 작업하면서 새로 배운 규칙과 팁을 AI가 알아서 정리해 매뉴얼 문서에 적어두는 단계입니다. 회의가 끝난 뒤 누군가 회의록을 정리해 다음 사람도 볼 수 있게 남겨두는 것과 같아요.
누가·언제 쓰나요#
- 한 번의 작업(세션)을 마칠 때, 끝내기 직전에
- 작업 중 중요한 패턴이나 규칙을 새로 발견했을 때
- 반복되는 일이라 "이건 자동화하면 좋겠다" 싶은 게 보였을 때
- 매뉴얼 문서를 최신 상태로 갱신하고 싶을 때
무엇을 해주나요#
작업 내용을 분석해서, 프로젝트의 안내 문서들을 자동으로 업데이트해 줍니다. 주로 손대는 곳은:
CLAUDE.md— 프로젝트의 기본 안내서 (규칙·구조 변경 반영).claude/rules/— 코딩 규칙 문서 (새 규칙 추가).claude/commands/— 새 기능(스킬/에이전트) 정의 추가.claude/session-logs/— 작업 요약 보관 (선택)
또한 자동화하면 좋을 반복 작업, 다음에 이어서 할 후속 작업도 함께 정리해 보여줍니다.
어떻게 쓰나요#
# 전체 작업 분석 후 문서 업데이트
/cc-dev:session:wrap
# 특정 영역만 갱신
/cc-dev:session:wrap --scope rules # 규칙만
/cc-dev:session:wrap --scope commands # 명령(스킬)만
/cc-dev:session:wrap --scope agents # 에이전트만
# 미리보기 (실제 수정 없이 바뀔 내용만 확인) - 추천
/cc-dev:session:wrap --dry-run
처음 쓸 때는 --dry-run으로 먼저 미리보기 하는 것을 권장합니다. 실제 파일을 고치기 전에 어떤 내용이 추가/수정될지 확인할 수 있어요.
안에서 무슨 일이 벌어지나요#
크게 두 단계로 진행됩니다.
- 여러 관점에서 동시에 분석 (4가지) — ① 문서 업데이트할 내용 찾기, ② 자동화하면 좋을 반복 패턴 찾기, ③ 이번에 배운 규칙·패턴 뽑아내기, ④ 다음에 이어서 할 후속 작업 제안하기. 네 가지를 한꺼번에 살펴봅니다.
- 중복 정리 후 마무리 (1가지) — 앞에서 모은 결과 중 겹치거나 충돌하는 내용을 정리하고, 기존 문서와 일관성을 맞춰 최종 반영합니다. 마지막에 무엇이 바뀌었는지 요약해서 보여줍니다.
기존 내용을 함부로 지우지 않고 더하거나 고치는 식으로만 바꾸며, 중요한 변경은 사용자 확인을 받은 뒤 적용합니다.
⚙️ 상세 옵션·실행 명세 (개발자 / AI 에이전트용)
Triggers#
- Just before session end
- After discovering important patterns/rules
- When new automatable tasks are discovered
- When document updates are needed
Usage#
# Full session analysis and document update
/cc-dev:session:wrap
# Update specific area only
/cc-dev:session:wrap --scope rules # Rules only
/cc-dev:session:wrap --scope commands # Commands only
/cc-dev:session:wrap --scope agents # Agents only
# Dry run (preview changes) - recommended
/cc-dev:session:wrap --dry-runRecommended: Use
--dry-runon first use to preview changes. You can review what content will be added/modified before actual file modification.
Execution Flow (2 Phases)#
┌─────────────────────────────────────────────────────────────────┐
│ /cc-dev:session:wrap │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ═══════════════════════════════════════════════════════════ │
│ ║ Phase 1: Parallel Analysis (4 Agents) ║ │
│ ═══════════════════════════════════════════════════════════ │
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌────────────┐│
│ │ doc-updater │ │ automation │ │ learning │ │ followup ││
│ │ Agent │ │ -scout │ │ -extractor │ │ -suggester ││
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ └─────┬──────┘│
│ │ │ │ │ │
│ ▼ ▼ ▼ ▼ │
│ ┌────────────────────────────────────────────────────────────┐│
│ │ Collect Analysis Results ││
│ └────────────────────────────────────────────────────────────┘│
│ │
│ ═══════════════════════════════════════════════════════════ │
│ ║ Phase 2: Sequential Processing (1 Agent) ║ │
│ ═══════════════════════════════════════════════════════════ │
│ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ duplicate-checker Agent │ │
│ │ - Duplicate content check │ │
│ │ - Conflict resolution │ │
│ │ - Final document cleanup │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Output Result Summary │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘Phase 1: Parallel Analysis Agents#
1. doc-updater Agent#
Update CLAUDE.md and related documents based on session content
Analysis Targets:
- Newly discovered coding conventions
- Added project settings
- Changed architecture patterns
- New dependencies/packages
Output:
updates:
- file: CLAUDE.md
section: " ## Architecture and Structure "
action: append
content: " New architecture pattern description... "
- file: .claude/rules/naming.md
section: " ### Naming Rules "
action: update
content: " Updated naming rules... "2. automation-scout Agent#
Detect new automatable patterns
Analysis Targets:
- Repetitively performed tasks
- Manually handled tasks that could be pattern-ized
- Tasks that could become new skills
Output:
automatable_patterns:
- pattern: " Always add State when adding BLoC event "
frequency: 3
suggestion: " Recommend creating bloc-event-state-pair skill "
- pattern: " Always add same imports after test file creation "
frequency: 5
suggestion: " Add auto-import to test-template skill "3. learning-extractor Agent#
Extract rules/patterns learned during the session
Analysis Targets:
- Modified code patterns
- Resolved errors and their solutions
- Preferences learned from user feedback
- Project-specific rules
Output:
learnings:
- type: rule
category: " Code style "
content: " Actively use dot shorthand (.start, .center, etc.) "
evidence: " User pointed out unnecessary full type name usage "
- type: pattern
category: " BLoC "
content: " isClosed check required after await "
evidence: " Fixed multiple times due to lint errors "4. followup-suggester Agent#
Suggest follow-up tasks
Analysis Targets:
- Incomplete TODOs
- Mentioned improvements
- Discovered technical debt
- Tasks for next session
Output:
followups:
- priority: high
task: " Achieve 80% test coverage for console_author_management "
reason: " Currently 45% - missing tests for key features "
- priority: medium
task: " Optimize author search API "
reason: " Takes 2+ seconds for 100+ records "Phase 2: Sequential Processing Agent#
5. duplicate-checker Agent#
Duplicate content check and cleanup
Processing Content:
- Duplicate check of Phase 1 results
- Conflict resolution with existing documents
- Consistency verification
- Apply final changes
Output:
deduplication_result:
removed_duplicates: 2
merged_entries: 1
conflicts_resolved: 0
final_changes:
- file: CLAUDE.md
lines_added: 15
lines_removed: 3
- file: .claude/rules/bloc-patterns.md
lines_added: 8
lines_removed: 0Detailed Implementation#
Main Execution Logic#
async function sessionWrap(options: WrapOptions) {
// Phase 1: Parallel analysis
const [docUpdates, automations, learnings, followups] = await Promise.all([
Task({
subagent_type: " session-doc-updater " ,
prompt: " Analyze session conversation content to suggest document updates " ,
}),
Task({
subagent_type: " session-automation-scout " ,
prompt: " Detect automatable patterns " ,
}),
Task({
subagent_type: " session-learning-extractor " ,
prompt: " Extract learned rules/patterns " ,
}),
Task({
subagent_type: " session-followup-suggester " ,
prompt: " Suggest follow-up tasks " ,
}),
]);
// Phase 2: Sequential processing
const finalResult = await Task({
subagent_type: " session-duplicate-checker " ,
prompt: `
Review the following Phase 1 results and resolve duplicates/conflicts:
## Doc Updates
${JSON.stringify(docUpdates)}
## Automations
${JSON.stringify(automations)}
## Learnings
${JSON.stringify(learnings)}
## Followups
${JSON.stringify(followups)}
`,
});
// Output results
displayWrapSummary(finalResult);
}Output Format#
Progress#
╔════════════════════════════════════════════════════════════════╗
║ /cc-dev:session:wrap Progress ║
╠════════════════════════════════════════════════════════════════╣
║ ║
║ Phase 1: Parallel Analysis [████████████░░░░] 75% ║
║ ║
║ ✅ doc-updater: 3 document updates suggested ║
║ ✅ automation-scout: 2 automation patterns found ║
║ 🔄 learning-extractor: Analyzing... ║
║ ⏳ followup-suggester: Waiting ║
║ ║
╚════════════════════════════════════════════════════════════════╝On Completion#
╔════════════════════════════════════════════════════════════════╗
║ Session Wrap Complete ║
╠════════════════════════════════════════════════════════════════╣
║ ║
║ 📝 Document Updates ║
║ ├── CLAUDE.md: +15 lines (coding conventions added) ║
║ ├── .claude/rules/bloc-patterns.md: +8 lines ║
║ └── .claude/commands/session/wrap.md: newly created ║
║ ║
║ 🤖 Automation Suggestions ║
║ ├── Recommend creating bloc-event-state-pair skill ║
║ └── Recommend adding test-template auto-import ║
║ ║
║ 📚 Learned Content ║
║ ├── [Rule] Actively use dot shorthand ║
║ ├── [Rule] isClosed check required after await ║
║ └── [Pattern] ZenHub issueTypeId must be specified ║
║ ║
║ 📋 Follow-up Tasks ║
║ ├── [High] Achieve 80% test coverage ║
║ └── [Medium] Optimize author search API ║
║ ║
║ 🔄 Duplicates removed: 2 ║
║ ⚠️ Conflicts resolved: 0 ║
║ ║
╚════════════════════════════════════════════════════════════════╝Target Files#
Analysis Targets#
| Path | Description |
|---|---|
CLAUDE.md | Project main guide |
.claude/rules/**/*.md | Coding rules |
.claude/commands/**/*.md | Skill/agent definitions |
.claude/settings.local.json | Local settings |
Output Targets#
| Path | Description |
|---|---|
CLAUDE.md | Convention, architecture updates |
.claude/rules/ | New rule file creation |
.claude/commands/ | New skill/agent creation |
.claude/session-logs/ | Session summary storage (optional) |
Options#
| Option | Default | Description |
|---|---|---|
--scope | all | Analysis scope (all/rules/commands/agents) |
--dry-run | false | Preview changes only |
--auto-commit | false | Auto-commit changes |
--skip-duplicates | false | Skip duplicate check |
Related Agents#
session-doc-updater- Document update analysissession-automation-scout- Automation pattern detectionsession-learning-extractor- Learned content extractionsession-followup-suggester- Follow-up task suggestionssession-duplicate-checker- Duplicate check and cleanup
Context Passing#
How sub-agents access session conversation content — read this before wiring up the 5-agent flow, since the wrong assumption here silently degrades every agent's output to whatever it can infer from repo files alone.
⚠️ Named subagent_types start with ZERO context — always pass it explicitly#
session-doc-updater / session-automation-scout / session-learning-extractor
/ session-followup-suggester / session-duplicate-checker are not
general-purpose and do not auto-receive the conversation. Only
subagent_type: "fork" inherits the calling session's full context; every
other subagent_type — named or general-purpose — starts fresh with no memory
of what happened in this session (confirmed against actual Task/Agent tool
behavior, 2026-08). A prompt like "Extract rules learned during session" with
no session content attached gives the agent nothing to analyze — it can only
read files via Read/Glob/Grep, which is why these agents are scoped to
those tools.
// ❌ WRONG — this agent has no idea what happened in the session
Task({
subagent_type: " session-learning-extractor " ,
prompt: " Extract rules learned during session " ,
});
// ✅ CORRECT — write a concrete summary of what happened and hand it over
Task({
subagent_type: " session-learning-extractor " ,
prompt: `
## Session summary (this agent has no access to the conversation — this is the only source)
${sessionSummary}
Extract learned rules/patterns from the above.
`,
});If you want an agent that genuinely inherits the conversation (e.g. for a
quick one-off analysis instead of the 5-agent flow), use subagent_type: "fork"
instead of a named session-* agent — that is the only path that gets automatic
context.
Explicit Context Passing (the only correct method for the 5 named agents)#
Always pass session content explicitly — do not rely on it being inferred:
Task({
subagent_type: " session-learning-extractor " ,
prompt: `
## Session Info to Analyze
### Modified Files
- ${modifiedFiles.join( ' \n- ' )}
### User Feedback
- ${userFeedbacks.join( ' \n- ' )}
### Errors Encountered
- ${errors.join( ' \n- ' )}
Extract learned rules/patterns based on the above information.
`,
});Context Limitations#
| Item | Accessible to the 5 named session-* agents | Notes |
|---|---|---|
| Current session conversation | X (unless explicitly written into the prompt) | Not auto-passed — see warning above |
| Previous session conversation | X | Isolated between sessions, even for fork |
| File system | O | Via Read, Glob, Grep tools |
| Git history | X | None of the 5 agents declare Bash in their tools: frontmatter (all are Read, Glob, Grep; session-duplicate-checker adds Edit, Write) — pass relevant git log/git diff output in the prompt if an agent needs it |
Key Rules#
- Non-destructive Updates: Prefer additions/modifications over deleting existing content
- Evidence-based: State session-based evidence for all changes
- Maintain Consistency: Maintain consistency with existing document style
- Prevent Duplicates: Prevent duplicate content additions
- User Confirmation: Apply important changes only after user confirmation