docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
@@ -0,0 +1,202 @@
|
||||
---
|
||||
id: wiki-2026-0508-자연어-아티팩트-natural-language-artifa
|
||||
title: 자연어 아티팩트 (Natural Language Artifacts)
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [Natural Language Artifacts, NL Artifacts, 자연어 산출물, Prompt Artifacts]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [llm, prompt-engineering, artifacts, knowledge-management, ai]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: markdown
|
||||
framework: llm-agnostic
|
||||
---
|
||||
|
||||
# 자연어 아티팩트 (Natural Language Artifacts)
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 prompt 는 source code 다 — version, review, test 가 필요한 first-class artifact"**. 2026 production AI 에서 prompt, system instruction, eval set, persona spec 은 모두 git-tracked, schema-validated, CI-tested artifact 로 다뤄진다. NL artifact 의 lifecycle (author → review → eval → deploy → monitor) 가 코드와 동일한 rigor 로 운영되어야 한다.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 NL artifact 의 종류
|
||||
- **System prompt**: agent persona, behavior contract.
|
||||
- **Few-shot examples**: in-context demonstration.
|
||||
- **Eval set**: input/expected pairs, rubric.
|
||||
- **Tool spec**: function description, parameter schema.
|
||||
- **Memory document**: long-term context, RAG-ingested.
|
||||
- **Output template**: structured response scaffold.
|
||||
|
||||
### 매 lifecycle
|
||||
- **Author**: structured markdown, frontmatter metadata.
|
||||
- **Review**: PR review, lint (length, banned terms).
|
||||
- **Eval**: regression suite — golden set, LLM-as-judge.
|
||||
- **Deploy**: versioned, A/B routed.
|
||||
- **Monitor**: drift, refusal rate, latency.
|
||||
|
||||
### 매 응용
|
||||
1. Agent system prompt 의 versioned management.
|
||||
2. RAG knowledge base 의 chunk metadata.
|
||||
3. LLM eval framework 의 test artifact.
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### Prompt as artifact (frontmatter + body)
|
||||
```markdown
|
||||
---
|
||||
id: prompt-customer-support-v3
|
||||
version: 3.2.1
|
||||
model: claude-opus-4-7
|
||||
owner: support-team
|
||||
eval_set: ./evals/customer-support.jsonl
|
||||
last_reviewed: 2026-05-09
|
||||
---
|
||||
|
||||
# Customer Support Agent
|
||||
|
||||
You are a senior support agent for {{product}}.
|
||||
Tone: empathetic, concise.
|
||||
|
||||
## Rules
|
||||
- Never make refund decisions over $500 — escalate.
|
||||
- Cite KB article IDs in [KB-1234] format.
|
||||
|
||||
## Output format
|
||||
Return JSON:
|
||||
```json
|
||||
{ "reply": "...", "escalate": false, "kb_refs": [] }
|
||||
```
|
||||
```
|
||||
|
||||
### Versioned prompt registry (Python)
|
||||
```python
|
||||
from pathlib import Path
|
||||
import yaml, frontmatter
|
||||
|
||||
class PromptRegistry:
|
||||
def __init__(self, root="prompts/"):
|
||||
self.root = Path(root)
|
||||
self._cache = {}
|
||||
|
||||
def get(self, prompt_id: str, version: str = "latest") -> str:
|
||||
path = self.root / f"{prompt_id}.md"
|
||||
if version != "latest":
|
||||
path = self.root / "history" / f"{prompt_id}@{version}.md"
|
||||
post = frontmatter.load(path)
|
||||
return post.content, post.metadata
|
||||
|
||||
text, meta = PromptRegistry().get("customer-support", "3.2.1")
|
||||
```
|
||||
|
||||
### Eval set format
|
||||
```jsonl
|
||||
{"id":"refund-large","input":"I want $800 refund","expected":{"escalate":true,"reply_contains":"escalate"}}
|
||||
{"id":"polite-greet","input":"hi","expected":{"reply_contains":"hello","escalate":false}}
|
||||
{"id":"kb-cite","input":"how to reset password","expected":{"kb_refs_min":1}}
|
||||
```
|
||||
|
||||
### CI: prompt regression test
|
||||
```python
|
||||
# tests/test_prompts.py
|
||||
import pytest, json
|
||||
from anthropic import Anthropic
|
||||
from prompts import PromptRegistry
|
||||
|
||||
client = Anthropic()
|
||||
registry = PromptRegistry()
|
||||
|
||||
@pytest.mark.parametrize("case", load_jsonl("evals/customer-support.jsonl"))
|
||||
def test_customer_support(case):
|
||||
sys, _ = registry.get("customer-support")
|
||||
resp = client.messages.create(
|
||||
model="claude-opus-4-7",
|
||||
system=sys,
|
||||
max_tokens=512,
|
||||
messages=[{"role":"user","content":case["input"]}],
|
||||
)
|
||||
out = json.loads(resp.content[0].text)
|
||||
if "escalate" in case["expected"]:
|
||||
assert out["escalate"] == case["expected"]["escalate"]
|
||||
if "reply_contains" in case["expected"]:
|
||||
assert case["expected"]["reply_contains"].lower() in out["reply"].lower()
|
||||
```
|
||||
|
||||
### LLM-as-judge eval
|
||||
```python
|
||||
JUDGE_PROMPT = """Rate the response 1-5 on:
|
||||
- helpfulness, - tone (empathetic), - rule adherence (no refund > $500)
|
||||
Return JSON: {"helpfulness":N,"tone":N,"rule":N,"reasoning":"..."}"""
|
||||
|
||||
def judge(input_text, response):
|
||||
resp = client.messages.create(
|
||||
model="claude-opus-4-7",
|
||||
system=JUDGE_PROMPT,
|
||||
max_tokens=400,
|
||||
messages=[{"role":"user",
|
||||
"content":f"INPUT:{input_text}\nRESPONSE:{response}"}],
|
||||
)
|
||||
return json.loads(resp.content[0].text)
|
||||
```
|
||||
|
||||
### Prompt diff for review
|
||||
```bash
|
||||
# Custom git driver for prompt diff
|
||||
git diff prompts/customer-support.md
|
||||
# Visualizes: section moved, rule changed, version bumped
|
||||
```
|
||||
|
||||
### Memory document 의 RAG ingest
|
||||
```python
|
||||
import frontmatter
|
||||
from langchain.text_splitter import MarkdownHeaderTextSplitter
|
||||
|
||||
def ingest(path):
|
||||
post = frontmatter.load(path)
|
||||
splitter = MarkdownHeaderTextSplitter([("#","h1"),("##","h2")])
|
||||
chunks = splitter.split_text(post.content)
|
||||
for c in chunks:
|
||||
c.metadata.update(post.metadata) # propagate id, version, owner
|
||||
vector_store.upsert(c)
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| 1-shot script | inline string OK |
|
||||
| production agent | versioned registry |
|
||||
| changes 잦음 | feature flag + A/B |
|
||||
| critical correctness | eval set + CI gate |
|
||||
| domain knowledge | memory doc + RAG |
|
||||
| structured output | JSON schema in prompt |
|
||||
|
||||
**기본값**: markdown + frontmatter + git + eval CI.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Prompt Engineering]]
|
||||
- 응용: [[Agent Architecture]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: prompt scaffold authoring, eval set bootstrapping, judge rubric design, memory doc summarization.
|
||||
**언제 X**: legal/safety-critical prompt 의 final approval — human review 필수.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **String literal in code**: untracked, untestable, untraceable.
|
||||
- **No version pinning**: silent prompt drift breaks production.
|
||||
- **Eval set as afterthought**: write evals AFTER bug — by definition incomplete.
|
||||
- **Mixed concerns**: persona + tool spec + RAG context 매 single prompt 에 dump.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Anthropic prompt engineering docs 2025, OpenAI evals repo, LangSmith patterns).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — NL artifact lifecycle + eval CI patterns. |
|
||||
Reference in New Issue
Block a user