memory-curatorlisted
Install: claude install-skill gagip/gagip-dev
# memory-curator
## 모드 판별
인자가 없으면 **기본 모드**, `review` 인자가 있으면 **리뷰 모드**로 실행한다.
---
## 기본 모드: 세션 메모리 추출 및 저장
> **retrospective와의 관계**: 이 기본 모드는 `retrospective` 회고가 넘긴 메모리 후보를 받는 **단일 관문**이기도 하다. retrospective는 "무엇을 어디에 남길지"(볼트·스킬·문서화·CLAUDE.md)를 넓게 분배하고, 그중 **메모리는 여기로 위임**한다. 직접 호출되든 retrospective에서 이어지든 절차는 같다 — 핵심은 아래 4번 **중복 방지 필터**로 메모리가 비대해지지 않게 막는 것이다.
### 1. 현재 세션 JSONL 파일 찾기
```bash
# 현재 작업 디렉토리로 프로젝트 슬러그 계산
# 예: /Users/gagip/workspace/myproject/my-wear-app-issue18
# → -Users-gagip-workspace-myproject-my-wear-app-issue18
cwd=$(pwd)
slug=$(echo "$cwd" | sed 's|/|-|g' | sed 's|^-||')
project_dir="$HOME/.claude/projects/$slug"
# 가장 최근 JSONL 파일
ls -t "$project_dir"/*.jsonl 2>/dev/null | head -1
```
### 2. 세션 내용 추출
JSONL에서 `type=user`와 `type=assistant` 메시지를 읽어 대화 흐름을 파악한다.
```bash
python3 - <<'EOF'
import json, sys
path = "<위에서 찾은 JSONL 경로>"
lines = [json.loads(l) for l in open(path)]
for l in lines:
if l.get('type') in ('user', 'assistant'):
role = l['type']
content = l.get('message', {}).get('content', '')
if isinstance(content, list):
text = ' '.join(c.get('text','') for c in content if c.get('type')=='text')
else:
text = str(content)
if text.strip() and not text.startswith('<system-reminder'):
print(f"[{role}] {text[:300]}")
EOF
```
### 3. 기존 메모리 파일 읽기
```bash
memory_dir="$HOME/.claude/projects/$slug/memory"
cat "$memory_dir/MEMORY.md" 2>/dev/null
# 각 메모리 파일도 필요 시 읽기
```
전역 메모리