본문 바로가기
C.W.K.
Stream
Lesson 03 of 05 · published

Context Layer: Prompt, Memory, Retrieval, Tool

~25 min · memory, retrieval, tools

Level 0Window Watcher
0 XP0/50 lessons0/13 achievements
0/100 XP to next level100 XP to go0% complete

layer마다 수명이 다르다

instruction은 잘 안 바뀌는 의도고, 대화는 최근 작업 상태야. retrieval은 필요할 때만 꺼내 쓰는 배경지식이고, tool은 바깥 세계로 나가는 통로지. 오래 남는 memory는 window가 닫혀도 살아 있어야 하는 사실이고. 이걸 다 한 덩어리로 뭉개면, 비싸고 낡았는데 그러면서 빠진 것도 있는 거대한 prompt가 나와.

언제나 적용되는 규칙이면 오래 남는 프로젝트 지시문에 둬. 답변 하나에만 필요한 사실은 그때그때 retrieval이나 tool로 읽어오면 그만이고. 지금 세운 계획은 handoff board에 적어. 한 번 보고 만 stack trace는 원인 찾고 나면 session 밖으로 밀어내도 돼.

사실을 제 수명 자리로 옮기기

context 관리는 요약을 더 빡세게 하는 일이 아니야. 어떤 사실을 window 밖 제자리로 올려보내고, 어떤 잡음을 attention 밖으로 내릴지 정하는 일이지. 대화 시작할 때마다 같은 영구 규칙을 복붙하는 건 예산 낭비고, 마지막 메시지에만 얹혀 있는 handoff는 compaction 한 번에 날아가.

습관이 될 질문 하나

대화에 중요한 게 튀어나올 때마다 수명을 물어봐. 이게 다음 session까지 가야 하나, 다음 주까지 가야 하나, 아니면 다음 답변까지만 있으면 되나? 긴 프로젝트 내내 이 질문을 하느냐 마느냐가, 정돈된 AI 워크플로랑 prompt 무덤을 가른다.

Code

수명에 맞는 자리 고르기·python
fact_lifetime = {
  "forever rule":         "project/vault instruction file (.md / CLAUDE.md)",
  "team policy":          "shared system prompt block",
  "current task state":   "handoff board (committed file)",
  "source material":      "indexed file or retrieval corpus",
  "one command result":   "current session only",
  "human decision":       "explicit note before compaction",
  "transient noise":      "drop on next checkpoint",
}
올릴 것, 내릴 것, 버릴 것·yaml
lifetime_actions:
  promote_to_durable:
    - "do not push without human approval"
    - "always run pytest before commit"
  keep_in_session:
    - latest tool result waiting for review
    - draft answer being refined
  drop_after_use:
    - one-time stack trace once root cause is found
    - banner timestamps from the system

External links

Exercise

어수선한 AI session 하나 떠올려봐. 거기 나온 사실 10개를 system 규칙 / 프로젝트 규칙 / handoff 상태 / 참고자료 / 그냥 버릴 잡음으로 나눠봐.
Hint
다음 agent가 반드시 지켜야 할 거면 대화 기록에만 남겨두면 안 돼.

Progress

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

댓글 0

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

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