| name | history-insight |
| description | This skill should be used when user wants to access, capture, or reference Claude Code session history. Trigger when user says "capture session", "save session history", or references past/current conversation as a source - whether for saving, extracting, summarizing, or reviewing. This includes any mention of "what we discussed", "today's work", "session history", or when user treats the conversation itself as source material (e.g., "from our conversation"). |
| version | 1.1.0 |
| user-invocable | true |
History Insight
Claude Code ์ธ์
ํ์คํ ๋ฆฌ๋ฅผ ๋ถ์ํ๊ณ ์ธ์ฌ์ดํธ๋ฅผ ์ถ์ถํฉ๋๋ค.
Data Location
~/.claude/projects/<encoded-cwd>/*.jsonl
Path Encoding: /Users/foo/project โ -Users-foo-project
์์ธ ํ์ผ ํฌ๋งท: ${baseDir}/references/session-file-format.md
Execution Algorithm
Step 1: Ask Scope [MANDATORY]
์ค์ฝํ ๊ฒฐ์ :
-
๋ช
์๋ ๊ฒฝ์ฐ (AskUserQuestion ์๋ต ๊ฐ๋ฅ):
- "ํ์ฌ ํ๋ก์ ํธ๋ง" / "์ด ํ๋ก์ ํธ" โ
current_project
- "๋ชจ๋ ์ธ์
" / "์ ์ฒด" โ
all_sessions
-
๋ช
์๋์ง ์์ ๊ฒฝ์ฐ - AskUserQuestion ํธ์ถ:
question: "์ธ์
๊ฒ์ ๋ฒ์๋ฅผ ์ ํํ์ธ์"
options:
- "ํ์ฌ ํ๋ก์ ํธ๋ง" โ ~/.claude/projects/<encoded-cwd>/*.jsonl
- "๋ชจ๋ Claude Code ์ธ์
" โ ~/.claude/projects/**/*.jsonl
Step 2: Find Session Files
find ~/.claude/projects/<encoded-cwd> -name "*.jsonl" -type f
find ~/.claude/projects -name "*.jsonl" -type f
๋ ์ง ํํฐ๋ง: ํ์ผ์ mtime(์์ ์๊ฐ) ํ์ธ ํ ํํฐ. OS๋ณ stat ์ต์
๋ค๋ฆ:
- macOS:
stat -f "%Sm" -t "%Y-%m-%d" <file>
- Linux:
stat -c "%y" <file>
Step 3: Process Sessions
Decision Tree
Session files found?
โโ No โ Error: "No sessions found"
โโ Yes โ How many files?
โโ 1-3 files โ Direct Read + parse
โโ 4+ files โ Batch Extract Pipeline
1-3 Files
์ง์ Read๋ก JSONL ํ์ฑ. ํ์ผ์ด ํฌ๋ฉด(โฅ5000 tokens) extract-session.sh ์ฌ์ฉ:
${baseDir}/scripts/extract-session.sh <session.jsonl>
4+ Files: Batch Extract Pipeline
- ์บ์ ๋๋ ํ ๋ฆฌ ์์ฑ (
/tmp/cc-cache/<analysis-name>/)
- ์ธ์
๋ชฉ๋ก ์ ์ฅ (
sessions.txt)
- jq๋ก ๋ฉ์์ง ์ผ๊ด ์ถ์ถ (
user_messages.txt)
- ์ ๋ฆฌ ๋ฐ ํํฐ๋ง (
clean_messages.txt)
- Task(opus)๋ก ์ข
ํฉ ๋ถ์
ํ์ผ์ด ๋๋ฌด ํด ๋: ๋ณ๋ ฌ ๋ฐฐ์น ๋ถ์
clean_messages.txt๊ฐ ๋๋ฌด ์ปค์ Read ์คํจ ์:
-
ํ์ผ ๋ถํ :
split -l 2000 clean_messages.txt /tmp/cc-cache/<name>/batch_
-
๋ณ๋ ฌ Task(opus) ํธ์ถ:
Task(subagent_type="general-purpose", model="opus", run_in_background=true)
prompt: "batch_XX ํ์ผ์ ์ฝ๊ณ ์ฃผ์ /ํจํด ์์ฝํด์ค"
-
๊ฒฐ๊ณผ ๋ณํฉ: Task(opus)๋ก ์ข
ํฉ
Step 4: Report Results
## Session Capture Complete
- **Sessions:** N files processed
- **Messages:** X total, Y after filter
### Extracted Insights
[๋ถ์ ๊ฒฐ๊ณผ]
Error Handling
| Scenario | Response |
|---|
| No session files found | "No session files found for this project." |
| File too large | Auto-preprocess with extract-session.sh |
| jq not installed | "Error: jq is required. Install with: brew install jq" |
| Task failed | "Warning: Could not process [file]. Skipping." |
| 0 relevant sessions | "No sessions matched your criteria." |
Security Notes
- ์ถ๋ ฅ์ ์ ์ฒด ๊ฒฝ๋ก ๋
ธ์ถ ๊ธ์ง (
~ prefix ์ฌ์ฉ)
Related Resources
${baseDir}/scripts/extract-session.sh - JSONL ์์ถ (thinking, tool_use ์ ๊ฑฐ)
${baseDir}/references/session-file-format.md - JSONL ๊ตฌ์กฐ ๋ฐ ํ์ฑ