C.W.K.
Stream
Lesson 02 of 06 · published

시스템 프롬프트: 가장 큰 단일 레버

~16 min · system-prompt, instructions, persona

Level 0Observer
0 XP0/64 lessons0/13 achievements
0/150 XP to next level150 XP to go0% complete

System이 계약을 정해

system 필드는 모델의 역할, 제약, 출력 포맷, 톤을 잡는 곳. '응답 전에 X 해'로 평소 쓰는 모든 instruction이 여기 들어가. 시스템 프롬프트는 user/assistant 교차 흐름의 일부 아니야 — 대화 위에 서서 모든 턴에 적용돼.

구조가 prose를 이긴다

능력, 제약, 출력 모양, 거부 행동을 명확한 섹션으로 나열한 시스템 프롬프트가 한 단락으로 쓴 것보다 잘 통해. Claude는 구조를 따라. 헤딩, 불릿, 짧은 명령형 문장 써. 페르소나 자체가 핵심인 케이스에만 narrative 남겨.

200KB 시스템 프롬프트는 진짜

Anthropic은 매우 큰 시스템 프롬프트 지원 — long-context 모델에서 200K 토큰까지. cwkPippa의 피파는 자기 정체성, vault 인덱스, 운영 룰을 통째로 시스템 프롬프트에 로드하고 prompt caching으로 반복 호출을 싸게 만들어. 긴 시스템 프롬프트는 hack 아니라 stable 페르소나·행동을 위한 supported 패턴이야.

원칙: 정책은 system, 콘텐츠는 user, 완성은 assistant. 섞으면 행동 들쭉날쭉.

Code

구조화된 시스템 프롬프트 (Python)·python
SYSTEM = """
You are a code-review assistant.

CAPABILITIES
- Review pull request diffs.
- Suggest concrete changes with file:line citations.
- Flag security issues with severity tags.

CONSTRAINTS
- Do not invent file paths or line numbers; only cite what appears in the diff.
- If the diff is too small to judge, say so explicitly.

OUTPUT FORMAT
- Markdown.
- One section per file changed.
- Conclude with a one-line verdict: APPROVE, REQUEST_CHANGES, or COMMENT.
""".strip()

response = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=2048,
    system=SYSTEM,
    messages=[{"role": "user", "content": diff_text}],
)
거대 페르소나·정책에 cache_control 부여·python
# 길고 안정적인 시스템 프롬프트 → cacheable 표시 → 첫 호출 비용, 이후 싸짐.
response = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=1024,
    system=[
        {
            "type": "text",
            "text": LONG_PIPPA_PERSONA + LONG_VAULT_INDEX,  # 수십 KB
            "cache_control": {"type": "ephemeral"},
        }
    ],
    messages=[{"role": "user", "content": user_msg}],
)
print(response.usage)  # cache_creation_input_tokens, cache_read_input_tokens

External links

Exercise

Claude한테 프롬프트한 기능 하나 골라. 'X 해 / Y 하지 마 / Z처럼 포맷' 모든 instruction을 user 턴에서 빼서 구조화된 시스템 프롬프트로 다시 써. 같은 user 입력 before vs after 응답 두 개를 비교.
Hint
옛 프롬프트가 user 메시지에 800자였다면, 시스템 버전은 1200자일 수 있지만 user 메시지는 진짜 입력만큼 줄어.

Progress

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

댓글 0

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

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