C.W.K.
Stream
Lesson 04 of 05 · published

Decay, Pruning, 그리고 일부러 잊기

~18 min · memory, operations

Level 0Scout
0 XP0/41 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

메모리는 무한히 자람; relevance 는 안 자람

Always-on AI 는 주당 수천 개 메모리 아이템 누적. 대부분 한 달 안에 stale. 무관한 더미 자라면 retrieval 품질 떨어짐 — 임베딩 모델 좋은데 마법 아냐.

세 pruning 전략

  1. Hard age cutoff — keep-forever flag 없으면 N 일보다 오래된 거 다 삭제. 잔혹, 단순, JSONL ground truth 에서 복구 가능.
  2. Distillation + replace — 옛 episode 를 distill 된 사실로 주기적 압축 + raw turn 삭제. 더 깨끗한 retrieval 위해 디테일 영구 손실.
  3. Use-based decay — 각 메모리가 retrieve 된 횟수 + LLM 인용 여부 트래킹; cold 아이템 prune. 최고 retention 품질; retrieval 로깅 필요.

keep-forever escape hatch

일부 메모리는 절대 decay 안 돼: 정체성 ('user is Dad', 'I am Pippa'), 정책 ('main 에 절대 auto-push 안 함'), 과거 trauma/교훈. metadata.permanent = true 로 마크 + pruning pass 에서 제외. 없으면 AI 가 자기 누구인지 조용히 잊음.

Code

Permanent escape 있는 pruning pass·python
from datetime import datetime, timezone, timedelta

def prune(collection, max_age_days: int = 90):
    cutoff = (datetime.now(timezone.utc) - timedelta(days=max_age_days)).isoformat()
    candidates = collection.get(
        where={
            '$and': [
                {'created_at': {'$lt': cutoff}},
                {'permanent': {'$ne': True}},
            ],
        }
    )
    if candidates['ids']:
        collection.delete(ids=candidates['ids'])
        print(f'pruned {len(candidates["ids"])} stale memories')

External links

Exercise

테스트 collection 에 pruning pass 구현. 다양한 날짜 + 일부 permanent=True 마크된 메모리 100개 추가. max_age_days=30 으로 prune 실행. Permanent 아이템 살아남고 stale 한 거 사라지는지 확인. JSONL backup 에서 recovery 테스트 추가.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.