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

Spine: 안정적 Rule과 Tool Schema

~24 min · system-prompt, tools, stability

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

Spine이 짐을 진다

오래 도는 prompt는 크게 세 구역으로 나뉘어. spine은 안 변하는 데고, body는 골라 담는 데고, tail은 지금 살아 있는 데야. spine에는 turn이 바뀌어도 그대로여야 하는 것들이 들어가. system 규칙, tool schema, 두고두고 쓰는 example, role 정의 같은 거. 자리는 맨 위 — system prompt나 첫 user message. 그리고 요청마다 byte 하나까지 똑같아야 cache가 맞아.

Spine이 안 흔들리면 뭐가 좋냐면

cache가 훨씬 잘 맞아. attention이 앞으로 몰리는 성질 덕에 규칙이 먼저 눈에 들어오고. 요청끼리 뭐가 달라졌는지 비교하는 것도 쉬워져. 모형이 예측 가능하게 굴고 — 운영 context 자체가 예측 가능하니까. 근데 turn마다 timestamp나 지금 상태를 넣어서 system prompt를 새로 만들면 이 이득이 통째로 날아가.

Spine에도 버전을 붙여

spine을 코드처럼 다뤄. 버전 딱지를 붙이고, 바뀐 내역을 적어두고, 규칙을 고치면 버전을 올려. 기록에는 요청마다 어떤 spine 버전이었는지 남기고. 동작이 달라졌을 때 모형 탓인지, input 탓인지, 규칙 탓인지 가려낼 수 있어야 하거든.

Code

Spine 배치·markdown
<!-- SPINE v3 -->
# Role
You are an AI assistant for project X.

# Rules (do not modify between turns)
- Always validate before commit.
- Never push without human confirmation.

# Tool schemas
- search(query: string) -> list[doc]
- read(path: string) -> string
- write(path: string, content: string) -> void

# Reusable examples
... (stable few-shots) ...
요청마다 남기는 기록·json
{
  "spine_version": "rules-v3",
  "tool_schema_version": "tools-v2",
  "cached_input_tokens": 28401,
  "fresh_input_tokens": 1230
}

External links

Exercise

오래 도는 prompt 하나 골라봐. spine이 어디까지인지 가려내고, turn마다 바뀌는 건 전부 spine에서 확실히 떼어낸 tail 구획으로 빼. spine에는 버전 주석을 달고.
Hint
오늘 날짜, request id, 사용자가 방금 친 말 — 이런 건 다 tail 몫이야.

Progress

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

댓글 0

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

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