| name | stage6-alf-document-export |
| description | Split rules_draft.md into individual rule files and expand rag_items.md into standalone RAG knowledge documents for direct ALF registration. |
Stage 6: ALF ๋ฌธ์ ๊ฐ๋ณ ํ์ผ ๋ถ๋ฆฌ
Overview
Stage 5์์ ์์ฑ๋ rules_draft.md(๊ท์น ์ด์)์ rag_items.md(RAG ํญ๋ชฉ ๋ชฉ๋ก)๋ฅผ ALF์ ๋ฐ๋ก ๋ฑ๋ก ๊ฐ๋ฅํ ๊ฐ๋ณ ํ์ผ๋ก ๋ถ๋ฆฌํฉ๋๋ค.
- ๊ท์น ๋ถ๋ฆฌ:
rules_draft.md์ 9๊ฐ ์น์
โ ๊ฐ๋ณ .md ํ์ผ
- RAG ๋ฌธ์ ์์ฑ:
rag_items.md์ ๊ฐ ํญ๋ชฉ โ SOP/FAQ ๊ธฐ๋ฐ ํ์ฅ๋ ์ง์ ๋ฌธ์
Language: Detect the language from the user's first message and respond in that language throughout. Support Korean (ํ๊ตญ์ด) and Japanese (ๆฅๆฌ่ช). Default to Korean if language is unclear.
์
๋ ฅ ํ์ผ:
05_sales_report/alf_setup/rules_draft.md โ ๊ท์น ์ด์ (9๊ฐ ์น์
)
05_sales_report/alf_setup/rag_items.md โ RAG ์ง์ ํญ๋ชฉ ๋ชฉ๋ก
03_sop/*.sop.md โ ์๋ณธ SOP (RAG ๋ฌธ์ ํ์ฅ ์ฐธ์กฐ)
02_extraction/faq.json โ FAQ ์๋ณธ ๋ฐ์ดํฐ (RAG ๋ฌธ์ ํ์ฅ ์ฐธ์กฐ)
์ฐ์ถ๋ฌผ:
results/{company}/
โโโ 06_alf_documents/
โโโ rules/ โ ๊ฐ๋ณ ๊ท์น ํ์ผ (์ ๊ท)
โ โโโ 01_tone_manner.md
โ โโโ 02_empathy_rules.md
โ โโโ 03_escalation_conditions.md
โ โโโ 04_issue_response_flow.md
โ โโโ 05_knowledge_reference.md
โ โโโ 06_feedback_collection.md
โ โโโ 07_repeated_question.md
โ โโโ 08_special_rules.md
โ โโโ 09_non_automatable.md
โโโ rag/ โ ๊ฐ๋ณ RAG ์ง์ ๋ฌธ์ (์ ๊ท)
โโโ {ํ ํฝ1_ํ๊ธ๋ช
}.md
โโโ {ํ ํฝ2_ํ๊ธ๋ช
}.md
โโโ ...
Parameters
Required
- company: ํ์ฌ ์๋ณ์ (์:
kmong_v2, usimsa)
Optional
- output_dir (๊ธฐ๋ณธ๊ฐ:
results/{company}): ์ถ๋ ฅ ๊ธฐ๋ณธ ๋๋ ํ ๋ฆฌ
Steps
1. Validate Input Files
Actions:
- Scan
results/ for company directories containing 05_sales_report/alf_setup/rules_draft.md
- Use
AskUserQuestion to confirm the target company
- Verify all input files exist:
results/{company}/05_sales_report/alf_setup/rules_draft.md
results/{company}/05_sales_report/alf_setup/rag_items.md
results/{company}/03_sop/ (at least 1 .sop.md file)
results/{company}/02_extraction/faq.json
Constraints:
- If
rules_draft.md or rag_items.md is missing, STOP and inform the user to run Stage 5 first
- SOP and FAQ files are optional for rule splitting but required for RAG document generation
Expected Output:
โ
์
๋ ฅ ํ์ผ ํ์ธ ์๋ฃ
- rules_draft.md: โ
(9๊ฐ ์น์
๊ฐ์ง)
- rag_items.md: โ
(Priority 1: Xํญ๋ชฉ / Priority 2: Xํญ๋ชฉ)
- SOP ๋๋ ํ ๋ฆฌ: โ
(X๊ฐ SOP)
- faq.json: โ
2. Split rules_draft.md into Individual Files
Actions:
- Read
rules_draft.md and identify all top-level sections (## 1. through ## 9.)
- Create
results/{company}/06_alf_documents/rules/ directory
- For each section, extract the full content (including all sub-sections) and write to an individual file
File naming convention:
| Section | File Name |
|---|
| 1. Tone & Manner | 01_tone_manner.md |
| 2. ๊ณต๊ฐ ํํ ๊ท์น | 02_empathy_rules.md |
| 3. Escalation Conditions | 03_escalation_conditions.md |
| 4. ์ด์ ๋ฌธ์ ์๋ ํ๋ฆ | 04_issue_response_flow.md |
| 5. ์ง์ ์ฐธ์กฐ ์์น | 05_knowledge_reference.md |
| 6. ํผ๋๋ฐฑ ์์ง ๊ท์น | 06_feedback_collection.md |
| 7. ๋ฐ๋ณต ์ง๋ฌธ ๋์ | 07_repeated_question.md |
| 8. ๊ณ ๊ฐ์ฌ๋ณ ํน์ ๊ท์น | 08_special_rules.md |
| 9. Non-automatable Situations | 09_non_automatable.md |
Each file format:
# {์น์
์ ๋ชฉ}
> ์๋ณธ: rules_draft.md โ ์น์
{N}
> ํ์ฌ: {company_name}
---
{ํด๋น ์น์
์ ์ ์ฒด ๋ด์ฉ โ ์๋ธ์น์
, ํ
์ด๋ธ, ์์ ๋ชจ๋ ํฌํจ}
Constraints:
- 2,000์ ์ ํ (ํ์): ์ฑ๋ํก ALF Rules API์
instruction ํ๋๋ ์ต๋ 2,000์. ๋ชจ๋ ๊ท์น ํ์ผ์ ์ ๋ชฉ ํ์ ์ ์ธํ๊ณ 2,000์ ์ด๋ด์ฌ์ผ ํ๋ค.
- ๋ถ๋ฆฌ ํ ๊ฐ ํ์ผ์ ๊ธ์ ์๋ฅผ
wc -m์ผ๋ก ๊ฒ์ฆ
- 2,000์๋ฅผ ์ด๊ณผํ๋ ํ์ผ์ ์๋ธ ์น์
๋จ์๋ก ์ถ๊ฐ ๋ถํ (์:
08_special_rules.md โ 08a_*.md + 08b_*.md)
- ๊ฐ๊ฒฐํ ํฌ๋งท: ๋ถํ์ํ ๋งํฌ๋ค์ด ํ
์ด๋ธ, ์ด๋ฏธ์ง ์ฐธ์กฐ, ์ฅํฉํ ์์๋ฅผ ์ ๊ฑฐํ๊ณ ์์ ํ
์คํธ/๋ถ๋ ํํ๋ก ์์ถ
- ํ
์ด๋ธ โ ๋ถ๋ ๋ฆฌ์คํธ๋ก ๋ณํ
- ๊ธด ๋ธ๋ก ์ธ์ฉ โ ํต์ฌ๋ง 1-2์ค๋ก ์ถ์ฝ
- ์์๋ 1๊ฐ๋ง ์ ์ง (๋ณต์ ์์ ์ ๊ฑฐ)
- If a section does not exist in the source file, skip it and note in the verification report
- Sub-section numbering (### 1.1, ### 1.2, etc.) MUST be preserved
Expected Output:
โ
๊ท์น ํ์ผ ๋ถ๋ฆฌ ์๋ฃ
- ์์ฑ ํ์ผ: {N}๊ฐ
- ๊ฑด๋๋ด ์น์
: {์์ผ๋ฉด ๋ชฉ๋ก, ์์ผ๋ฉด "์์"}
3. Generate Individual RAG Knowledge Documents
Actions:
- Read
rag_items.md and parse each knowledge item (Priority 1 + Priority 2)
- For each item, read the relevant SOP files and FAQ entries referenced in
rag_items.md
- Write an expanded knowledge document for each item to
results/{company}/06_alf_documents/rag/
File naming: Use the Korean topic name with underscores (e.g., ์ธ๊ธ๊ณ์ฐ์_์์๋ฃ_๊ตฌ์กฐ_์๋ด.md)
Each RAG document format:
# {ํ ํฝ ํ๊ธ ์ ๋ชฉ}
{ํ ํฝ์ ๋ํ 1-2๋ฌธ์ฅ ์๊ฐ}
---
## {ํ์ ์ฃผ์ 1}
{FAQ ๋ฐ์ดํฐ์ SOP ๋ด์ฉ์ ๊ฒฐํฉํ ์์ธ ์ค๋ช
}
{๊ณ ๊ฐ์ด ์ค์ ๋ก ๋ฌผ์ด๋ณด๋ ํํ๋ก ๊ตฌ์กฐํ}
- ์ ์ฐจ๋ **์์๋๋ก** ๋จ๊ณ๋ณ ์๋ด
- ์กฐ๊ฑด/์ ํ์ฌํญ ๋ฐ๋์ ํฌํจ
- ์์น/๊ธฐํ์ ์ ํํ๊ฒ ๋ช
์
> ๐ก {ํต์ฌ ํ ๋๋ ์ฐธ๊ณ ์ฌํญ}
---
## {ํ์ ์ฃผ์ 2}
...
Content generation rules:
- Each document MUST be self-contained โ a reader should understand the topic without referring to other files
- Include ALL FAQ Q/A pairs from
faq.json that belong to this topic
- Include relevant procedure steps, conditions, and exceptions from the SOP
- Use customer-friendly language (not internal/technical terms)
- Include tips (๐ก) for commonly confused points
- Include warnings (โ ๏ธ) for irreversible actions or important conditions
- Do NOT fabricate information not present in the source SOP/FAQ data
- Priority 2 (Fallback) items: Write the fallback guidance as a standalone document
Constraints:
- Every Priority 1 and Priority 2 item from
rag_items.md MUST have a corresponding file
- "๊ณ ๊ฐ์ฌ ์ถ๊ฐ ๊ถ์ฅ ํญ๋ชฉ" from
rag_items.md are NOT generated as files โ they are noted in the verification report as items the client needs to provide
Expected Output:
โ
RAG ๋ฌธ์ ์์ฑ ์๋ฃ
- Priority 1 ๋ฌธ์: {X}๊ฐ
- Priority 2 ๋ฌธ์: {X}๊ฐ
- ๊ณ ๊ฐ์ฌ ์ถ๊ฐ ๊ถ์ฅ: {X}๊ฐ (ํ์ผ ๋ฏธ์์ฑ, ํด๋ผ์ด์ธํธ ์ ๊ณต ํ์)
4. Verification โ Completeness & Quality Check
After generating all files, perform a systematic verification.
4-A. Completeness Check (๋๋ฝ ๊ฒ์ฆ)
- ๊ท์น ํ์ผ: Compare section count in
rules_draft.md vs generated file count in rules/
- RAG ๋ฌธ์: Compare item count in
rag_items.md vs generated file count in 06_alf_documents/rag/
- List any gaps found
4-B. Content Quality Check (ํ์ง ๊ฒ์ฆ)
For each RAG document, verify:
- FAQ ์ปค๋ฒ๋ฆฌ์ง: All referenced FAQ IDs from
rag_items.md are covered in the document
- ์ ์ฐจ ์์ ์ฑ: Multi-step procedures include all steps (not truncated)
- ์์น ์ ํ์ฑ: Numbers/dates match the source SOP exactly
- ์๊ธฐ์๊ฒฐ์ฑ: Document makes sense without referring to other files
4-C. Verification Report
Present the verification results to the user:
๐ ๊ฒ์ฆ ๊ฒฐ๊ณผ
[๊ท์น ํ์ผ]
์๋ณธ ์น์
: {N}๊ฐ โ ์์ฑ ํ์ผ: {N}๊ฐ โ {โ
์ผ์น / โ ๏ธ ๋ถ์ผ์น}
{๋ถ์ผ์น ์ ์์ธ ๋ด์ญ}
[RAG ๋ฌธ์]
rag_items ํญ๋ชฉ: {N}๊ฐ โ ์์ฑ ๋ฌธ์: {N}๊ฐ โ {โ
์ผ์น / โ ๏ธ ๋ถ์ผ์น}
FAQ ์ปค๋ฒ๋ฆฌ์ง: {covered}/{total} ({%})
{๋ถ์ผ์น ์ ์์ธ ๋ด์ญ}
[๊ณ ๊ฐ์ฌ ์ถ๊ฐ ๊ถ์ฅ ํญ๋ชฉ] (ํ์ผ ๋ฏธ์์ฑ)
- {ํญ๋ชฉ 1}: {ํ์ ์ฌ์ ์์ฝ}
- {ํญ๋ชฉ 2}: {ํ์ ์ฌ์ ์์ฝ}
...
์์ ์ด ํ์ํ ๋ถ๋ถ์ด ์์ผ๋ฉด ๋ง์ํด์ฃผ์ธ์.
Constraints:
- You MUST present the verification report to the user and wait for feedback before declaring completion
- If the user requests changes, apply them and re-run the verification for the changed files only
5. Summary
After user approval, present the final summary:
โ
Stage 6 ์๋ฃ โ ALF ๋ฌธ์ ๊ฐ๋ณ ํ์ผ ๋ถ๋ฆฌ
[๊ท์น ํ์ผ] results/{company}/06_alf_documents/rules/
{ํ์ผ ๋ชฉ๋ก}
[RAG ์ง์ ๋ฌธ์] results/{company}/06_alf_documents/rag/
{ํ์ผ ๋ชฉ๋ก}
[๋ค์ ๋จ๊ณ]
1. 06_alf_documents/rules/ ํ์ผ โ ALF ์์คํ
ํ๋กฌํํธ์ ๊ท์น๋ณ๋ก ๋ฑ๋ก
2. 06_alf_documents/rag/ ํ์ผ โ ALF RAG ์ง์ DB์ ๋ฑ๋ก
3. ๊ณ ๊ฐ์ฌ ์ถ๊ฐ ๊ถ์ฅ ํญ๋ชฉ {X}๊ฑด โ ํด๋ผ์ด์ธํธ์๊ฒ ์์ฑ ์์ฒญ
Notes
Relationship to Stage 5
This skill is a post-processing step after Stage 5's Step 2. It takes the monolithic outputs (rules_draft.md, rag_items.md) and converts them into granular, directly-usable files.
When to use:
- After Stage 5 has completed successfully
- When the client needs individual files for ALF system registration
- When rules or RAG items need to be updated independently
RAG Document Quality Principles
Following the 6 knowledge reference principles from rules_draft.md:
- Only include content confirmed in the data
- Procedures in complete sequential order
- Conditions and limitations always included
- Exact numbers and deadlines
- Role distinction (if applicable, e.g., seller vs buyer)
- Honest about gaps โ mark missing info as "(ํ์ธ ํ์)"