| description | Use when Ground Truth alignment finds memory contamination and the user explicitly requests scoped cleanup with /cleanse. |
| name | cleanse-memory |
cleanse-memory Skill
Quick Reference
- Use when: GT ์์ค ๋๋น ๋ฉ๋ชจ๋ฆฌ ์ค์ผ ์์ฌ ์ โ
/cleanse <gt-id> ๋๋ /cleanse --all
- ํธ๋ฆฌ๊ฑฐ: ์ฌ์ฉ์ ๋ช
์ ํธ์ถ๋ง (์๋ sweep ์์)
- ์ญ์ ์ ์ฑ
: HITL ํ์ ํ ์๊ตฌ ์ญ์ +
.hxsk/.purge-log.tsv append
- ์ฐํ:
HXSK_CONTRADICTION_CHECK=0์ผ๋ก ์ ๊ท ์ ์ฅ ์ contradiction check ๋นํ์ฑํ
- audit:
.purge-log.tsv (git ์ถ์ ) + git history๋ก ์ญ์ ์ด๋ ฅ ๋ณต๊ตฌ ๊ฐ๋ฅ
๋ช
๋ น ํ์
/cleanse <gt-source-id> # ํน์ GT ์์ค scope ๋ด ๋ฉ๋ชจ๋ฆฌ๋ง ๊ฒ์ฌ
/cleanse --all # sources.yaml ๋ด ๋ชจ๋ GT ์์ค ์ํ
/cleanse --dry-run <gt-id> # ์ญ์ ์์ด ํ๋ณด ๋ชฉ๋ก๋ง ์ถ๋ ฅ
gt-source-id๋ .hxsk/ground-truth/sources.yaml์ id ํ๋๊ฐ.
์์: /cleanse hxsk-spec, /cleanse anthropic-sdk-docs
์ฒ๋ฆฌ ํ๋ฆ
Step 1: GT ์์ค ๋ก๋
cat .hxsk/ground-truth/sources.yaml
<gt-id>์ ํด๋นํ๋ ํญ๋ชฉ์ scope, authority, type, path/url ์ถ์ถ
type: docs์ด๊ณ url: ""์ด๋ฉด โ HITL ์ฌ์ง๋ฌธ: "GT URL์ ์
๋ ฅํด์ฃผ์ธ์. ์์ผ๋ฉด Skip."
scope: []์ด๋ฉด โ HITL ์ฌ์ง๋ฌธ: "scope๊ฐ ๋น์ด์์ต๋๋ค. ์ ์ฉ ๋ฒ์๋ฅผ ์ง์ ํด์ฃผ์ธ์."
Step 2: scope ๋ด ๋ฉ๋ชจ๋ฆฌ ๊ฒ์ (โค20๊ฐ ์ ํ)
bash .hxsk/hooks/md-recall-memory.sh "<scope_tag>" "." 20 full 1
- scope ํ๊ทธ๋ฅผ ์์๋๋ก ๊ฒ์ํ์ฌ ๊ด๋ จ ๋ฉ๋ชจ๋ฆฌ ํ์ผ ์์ง
- ์ค๋ณต ์ ๊ฑฐ ํ ์ต๋ 20๊ฐ
Step 3: ์ธ๋ผ์ธ Claude ํ๋จ (๊ฐ ๋ฉ๋ชจ๋ฆฌ ํ์ผ)
๊ฐ ํ์ผ์ ๋ํด GT ์ฌ์ค๊ณผ ๋น๊ต:
- ์ผ์น (no conflict): ํจ์ค โ ๋ค์ ํ์ผ
- ๋ชจ์ ์์ฌ (contradiction suspected): HITL โ 4์ง ์ ํ
HITL ์ ํ์ง:
[D] ์ญ์ โ ํ์คํ ์ค์ผ, ์๊ตฌ ์ญ์ + purge-log ๊ธฐ๋ก
[K] ๋ณด๊ด โ ๋ค๋ฅธ scope๋ก ์ด๋ ๋๋ ํ๊ทธ ๋ถ๋ฆฌ ํ ๋ณด์กด
[G] GT ์ค๋ฅ โ ์ด ๋ฉ๋ชจ๋ฆฌ๊ฐ ๋ง๊ณ GT๊ฐ ์ค๋ฅ, Skip (๋ฉ๋ชจ๋ฆฌ ์ ์ง)
[S] Skip โ ํ๋จ ๋ณด๋ฅ, ์ด๋ฒ sweep์์ ์ ์ธ
Step 4: ์ญ์ ํ์ ์ ์ฒ๋ฆฌ
rm "<memory_filepath>"
echo "$(date -u +%Y-%m-%dT%H:%M:%SZ)\t<memory_id>\t<reason>\t<gt-id>\t<summary_โค200chars>\t<hitl_choice>" \
>> .hxsk/.purge-log.tsv
purge-log ์ปฌ๋ผ ํ์:
| ์ปฌ๋ผ | ์ค๋ช
|
|---|
| deleted_at | ISO-8601 UTC |
| memory_id | ํ์ผ basename |
| reason | 1์ค ์ญ์ ์ฌ์ (โค80์) |
| gt_source | GT id (sources.yaml id ๊ฐ) |
| original_summary | contextual_description โค200์ |
| hitl_decision | D / K / G / S |
Step 5: ์ ํ ๋ณด๊ณ ์ ์ถ๋ ฅ
๐ Cleanse Report: <gt-id>
๊ฒ์ฌ: N๊ฑด | ์ญ์ : M๊ฑด | ๋ณด๊ด: K๊ฑด | Skip: S๊ฑด
purge-log: .hxsk/.purge-log.tsv (Mํ ์ถ๊ฐ)
Scope ๊ฒฝ๊ณ ๊ท์น
- scope ์ธ ๋ฉ๋ชจ๋ฆฌ๋ ์ ๋ ์ญ์ ๊ธ์ง
--all ๋ชจ๋๋ ๊ฐ GT์ scope ๊ฒฝ๊ณ ์ค์ (GT๋ณ ๋
๋ฆฝ sweep)
- scope๊ฐ ๊ฒน์น๋ GT ์ฌ๋ฌ ๊ฐ ์์ ๊ฒฝ์ฐ, ์ฒซ ๋ฒ์งธ GT ๊ธฐ์ค ํ๋จ ํ ๋๋จธ์ง GT์ ๋์ผ ๊ฒฐ์ ์ ํ
์ ์ฝ ์กฐ๊ฑด
type: docs์ด๊ณ url: ""์ธ GT โ ์๋ fetch ๊ธ์ง, HITL๋ก URL ์์ฒญ
- scope ์ธ ํ์ผ ์ญ์ ๊ธ์ง โ scope ๊ฒฝ๊ณ ์๋ฐ ์ ์ฆ์ ์ค๋จ
- purge-log.tsv๋ฅผ gitignore ๋์์ผ๋ก ๋ง๋ค์ง ๋ง ๊ฒ (audit trail์ git ์ถ์ ํ์)
--dry-run ์ ์ค์ ์ญ์ ยทpurge-log ๊ธฐ๋ก ๊ธ์ง, ํ๋ณด ๋ชฉ๋ก๊ณผ ์์ ์ญ์ ์๋ง ์ถ๋ ฅ
Iron Laws
- NO CLEANSE WITHOUT GT SOURCE LOAD FIRST
- NO DELETE WITHOUT HITL CONFIRMATION FIRST
- NO PURGE-LOG SKIP ON DELETE
- NO SCOPE BOUNDARY VIOLATION
๊ด๋ จ ํ์ผ
.hxsk/ground-truth/sources.yaml โ GT ์์ค ์นดํ๋ก๊ทธ
.hxsk/.purge-log.tsv โ ์ญ์ audit trail (git ์ถ์ )
.hxsk/hooks/md-recall-memory.sh โ ๋ฉ๋ชจ๋ฆฌ ๊ฒ์ (provenance ์ฐ์ ์์ ์ ์ฉ)
.hxsk/hooks/md-store-memory.sh โ ์ ์ฅ ์ contradiction check (ADR-007)
.hxsk/adapters/hitl/ โ HITL ์ด๋ํฐ (ํ๋ค์ค๋ณ)