| ํญ๋ชฉ | ๋ด์ฉ |
|---|---|
| Invoke | /session:wrap |
| Aliases | /wrap, /sw |
| Category | kobic-automation |
| Complexity | moderate |
/session:wrap โ ์์ ๋ง๋ฌด๋ฆฌ ์ ๋ฆฌ#
ํ๋ง๋๋ก#
์ค๋ ์์ ํ๋ฉด์ ์๋ก ๋ฐฐ์ด ๊ท์น๊ณผ ํ์ AI๊ฐ ์์์ ์ ๋ฆฌํด ๋งค๋ด์ผ ๋ฌธ์์ ์ ์ด๋๋ ๋จ๊ณ์ ๋๋ค. ํ์๊ฐ ๋๋ ๋ค ๋๊ตฐ๊ฐ ํ์๋ก์ ์ ๋ฆฌํด ๋ค์ ์ฌ๋๋ ๋ณผ ์ ์๊ฒ ๋จ๊ฒจ๋๋ ๊ฒ๊ณผ ๊ฐ์์.
๋๊ฐยท์ธ์ ์ฐ๋์#
- ํ ๋ฒ์ ์์ (์ธ์ )์ ๋ง์น ๋, ๋๋ด๊ธฐ ์ง์ ์
- ์์ ์ค ์ค์ํ ํจํด์ด๋ ๊ท์น์ ์๋ก ๋ฐ๊ฒฌํ์ ๋
- ๋ฐ๋ณต๋๋ ์ผ์ด๋ผ "์ด๊ฑด ์๋ํํ๋ฉด ์ข๊ฒ ๋ค" ์ถ์ ๊ฒ ๋ณด์์ ๋
- ๋งค๋ด์ผ ๋ฌธ์๋ฅผ ์ต์ ์ํ๋ก ๊ฐฑ์ ํ๊ณ ์ถ์ ๋
๋ฌด์์ ํด์ฃผ๋์#
์์ ๋ด์ฉ์ ๋ถ์ํด์, ํ๋ก์ ํธ์ ์๋ด ๋ฌธ์๋ค์ ์๋์ผ๋ก ์ ๋ฐ์ดํธํด ์ค๋๋ค. ์ฃผ๋ก ์๋๋ ๊ณณ์:
CLAUDE.mdโ ํ๋ก์ ํธ์ ๊ธฐ๋ณธ ์๋ด์ (๊ท์นยท๊ตฌ์กฐ ๋ณ๊ฒฝ ๋ฐ์).claude/rules/โ ์ฝ๋ฉ ๊ท์น ๋ฌธ์ (์ ๊ท์น ์ถ๊ฐ).claude/commands/โ ์ ๊ธฐ๋ฅ(์คํฌ/์์ด์ ํธ) ์ ์ ์ถ๊ฐ.claude/session-logs/โ ์์ ์์ฝ ๋ณด๊ด (์ ํ)
๋ํ ์๋ํํ๋ฉด ์ข์ ๋ฐ๋ณต ์์ , ๋ค์์ ์ด์ด์ ํ ํ์ ์์ ๋ ํจ๊ป ์ ๋ฆฌํด ๋ณด์ฌ์ค๋๋ค.
์ด๋ป๊ฒ ์ฐ๋์#
# ์ ์ฒด ์์
๋ถ์ ํ ๋ฌธ์ ์
๋ฐ์ดํธ
/session:wrap
# ํน์ ์์ญ๋ง ๊ฐฑ์
/session:wrap --scope rules # ๊ท์น๋ง
/session:wrap --scope commands # ๋ช
๋ น(์คํฌ)๋ง
/session:wrap --scope agents # ์์ด์ ํธ๋ง
# ๋ฏธ๋ฆฌ๋ณด๊ธฐ (์ค์ ์์ ์์ด ๋ฐ๋ ๋ด์ฉ๋ง ํ์ธ) - ์ถ์ฒ
/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
/session:wrap
# Update specific area only
/session:wrap --scope rules # Rules only
/session:wrap --scope commands # Commands only
/session:wrap --scope agents # Agents only
# Dry run (preview changes) - recommended
/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)#
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ /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#
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ /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:
Auto Context (default)#
Claude Code's Task tool auto-passes current conversation context to general-purpose agents.
Sub-agents analyze by referencing previous conversation content.
// Context auto-included on agent call
Task({
subagent_type: " Explore " , // general-purpose type
prompt: " Extract rules learned during session " ,
// Previous conversation content auto-passed to agent
});Explicit Context Passing#
When specific information needs to be explicitly passed:
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 | Notes |
|---|---|---|
| Current session conversation | O | Auto-passed |
| Previous session conversation | X | Isolated between sessions |
| File system | O | Via Read, Glob, Grep tools |
| Git history | O | Via Bash tool |
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