Loading...
Loading...
주식/ETF 분석 결과 파일 저장 프로토콜. Write 도구 사용 규칙, 저장 경로 컨벤션, 실패 시 응답 형식을 정의합니다.
npx skill4agent add orientpine/honeypot file-save-protocol-stock환각 방지의 핵심: 분석 결과를 반드시 파일로 저장해야 합니다. 프롬프트로만 반환하면 데이터 손실 및 환각 발생 위험이 있습니다.
| 문제 | 설명 |
|---|---|
| 컨텍스트 손실 | 긴 대화에서 이전 분석 결과가 잘릴 수 있음 |
| 재현 불가 | 파일 없이는 분석 결과를 재검증할 수 없음 |
| 환각 위험 | 저장 없이 "저장됨"이라고 응답하면 환각 |
| 워크플로우 중단 | 다음 에이전트가 입력 파일을 찾지 못함 |
Writeoutput_pathoutput_path{output_path}/{NN}-{base}.md.jsonStep 1: 분석 완료 후 JSON 객체 생성
Step 2: Write 도구로 파일 저장
Write(
file_path="{output_path}/{filename}.json",
content=JSON.stringify(analysis_result, null, 2)
)
Step 3: 저장 성공 확인
└─ 성공: 정상 응답 반환
└─ 실패: FAIL 응답 반환 (환각 데이터 생성 금지)output_pathconsultations/{session_folder}/{filename}
예시:
consultations/2026-01-14-TSLA-abc123/
├── index-data.json # index-fetcher 출력
├── rate-analysis.json # rate-analyst 출력
├── sector-analysis.json # sector-analyst 출력
├── risk-analysis.json # risk-analyst 출력
├── leadership-analysis.json # leadership-analyst 출력
├── material-summary.md # material-organizer 출력 (옵셔널)
├── macro-outlook.json # macro-synthesizer 출력
├── 00-macro-outlook.md # macro-synthesizer 출력
├── 00-materials-summary.md # 자료 정리 (materials_path 제공 시)
├── 01-stock-screening.json # stock-screener 출력
├── 02-valuation-report.json # stock-valuation 출력
├── 03-bear-case.json # bear-case-critic 출력
├── 04-final-verification.json # stock-critic 출력
└── 05-consultation-summary.md # 최종 상담 보고서| 에이전트 | 출력 파일 | 필수 |
|---|---|---|
| stock-screener | | O (포트폴리오 요청 시) |
| stock-valuation | | O |
| bear-case-critic | | O |
| stock-critic | | O |
| 에이전트 | 출력 파일 | 필수 |
|---|---|---|
| index-fetcher | | O |
| rate-analyst | | O |
| sector-analyst | | O |
| risk-analyst | | O |
| leadership-analyst | | O |
| material-organizer | | X (옵셔널) |
| macro-synthesizer | | O |
{
"status": "FAIL",
"error": "FILE_SAVE_FAILED",
"detail": "{filename} 저장 실패",
"attempted_path": "{output_path}/{filename}",
"action": "재시도 필요"
}| 실패 유형 | 코드 | 대응 |
|---|---|---|
| 경로 없음 | | coordinator에 경로 확인 요청 |
| 권한 오류 | | 경로 권한 확인 |
| 디스크 공간 | | 공간 확보 후 재시도 |
| 알 수 없음 | | 에러 메시지 포함하여 보고 |
Write(
file_path="consultations/{session_folder}/02-valuation-report.json",
content="{\"status\": \"PASS\", \"ticker\": \"005930\", ...}"
)# 들여쓰기 2칸으로 포맷팅
JSON.stringify(analysis_result, null, 2)| 데이터 유형 | 확장자 |
|---|---|
| 구조화된 분석 데이터 | |
| 마크다운 보고서 | |
| 원시 텍스트 | |
output_path{
"status": "PASS",
"output_file": "{output_path}/{filename}.json",
"summary": {
// 분석 결과 요약
}
}{
"status": "FAIL",
"error": "FILE_SAVE_FAILED",
"detail": "02-valuation-report.json 저장 실패",
"attempted_path": "consultations/2026-01-14-TSLA-abc123/02-valuation-report.json",
"action": "재시도 필요"
}version: "1.0"
created: "2026-01-20"
purpose: "파일 저장 프로토콜 통합 - 코드 중복 제거"
based_on: "investments-portfolio/skills/file-save-protocol"
consumers:
- stock-screener
- stock-valuation
- bear-case-critic
- stock-critic
extracted_from:
- "파일 저장 필수 섹션 (investments-portfolio)"
- "저장 프로세스 섹션"
- "저장 실패 시 응답 형식"
dependencies:
- Write
output_path_pattern: "consultations/{YYYY-MM-DD}-{ticker}-{session_id}/"