From stock-consultation
Defines file saving protocol for stock/ETF analysis agents using Write tool. Specifies path conventions under output_path, JSON/MD formats, and failure responses to ensure persistence and prevent hallucinations.
npx claudepluginhub orientpine/honeypot --plugin stock-consultationThis skill uses the workspace's default tool permissions.
이 스킬은 주식/ETF 분석 에이전트가 결과를 파일로 저장할 때 따라야 하는 규칙을 정의합니다.
Defines file-saving protocol for analysis agents using Write tool: mandates JSON/MD outputs, numbered path conventions under output_path, and FAIL responses on errors to ensure persistence.
Saves completed analysis to the knowledge archive. Embedded functionality in run-analysis skill; do not invoke separately.
Saves business analysis state to disk capturing confirmed conclusions, ruled-out directions, open hypotheses, and next skill for future Claude Code sessions. Use after /money-discover conclusions or via 'save this', 'checkpoint'.
Share bugs, ideas, or general feedback.
이 스킬은 주식/ETF 분석 에이전트가 결과를 파일로 저장할 때 따라야 하는 규칙을 정의합니다.
핵심 목표: 분석 결과의 영속성 보장 및 환각 방지
환각 방지의 핵심: 분석 결과를 반드시 파일로 저장해야 합니다. 프롬프트로만 반환하면 데이터 손실 및 환각 발생 위험이 있습니다.
| 문제 | 설명 |
|---|---|
| 컨텍스트 손실 | 긴 대화에서 이전 분석 결과가 잘릴 수 있음 |
| 재현 불가 | 파일 없이는 분석 결과를 재검증할 수 없음 |
| 환각 위험 | 저장 없이 "저장됨"이라고 응답하면 환각 |
| 워크플로우 중단 | 다음 에이전트가 입력 파일을 찾지 못함 |
Write 도구로 파일 저장output_path 사용output_path 무시하고 임의 경로 사용JSON 저장은 항상 필수이며, 사람이 읽기 위한 Markdown 요약도 반드시 저장합니다.
{output_path}/{NN}-{base}.md (base = JSON 파일명에서 .json 제거)Step 1: 분석 완료 후 JSON 객체 생성
Step 2: Write 도구로 파일 저장
Write(
file_path="{output_path}/{filename}.json",
content=JSON.stringify(analysis_result, null, 2)
)
Step 3: 저장 성공 확인
└─ 성공: 정상 응답 반환
└─ 실패: FAIL 응답 반환 (환각 데이터 생성 금지)
coordinator(stock-consultant)가 제공하는 output_path를 사용합니다:
consultations/{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 | 01-stock-screening.json | O (포트폴리오 요청 시) |
| stock-valuation | 02-valuation-report.json | O |
| bear-case-critic | 03-bear-case.json | O |
| stock-critic | 04-final-verification.json | O |
| 에이전트 | 출력 파일 | 필수 |
|---|---|---|
| index-fetcher | index-data.json | O |
| rate-analyst | rate-analysis.json | O |
| sector-analyst | sector-analysis.json | O |
| risk-analyst | risk-analysis.json | O |
| leadership-analyst | leadership-analysis.json | O |
| material-organizer | material-summary.md | X (옵셔널) |
| macro-synthesizer | macro-outlook.json, 00-macro-outlook.md | O |
저장이 실패하면 절대 "저장됨"으로 응답하지 않습니다:
{
"status": "FAIL",
"error": "FILE_SAVE_FAILED",
"detail": "{filename} 저장 실패",
"attempted_path": "{output_path}/{filename}",
"action": "재시도 필요"
}
| 실패 유형 | 코드 | 대응 |
|---|---|---|
| 경로 없음 | PATH_NOT_FOUND | coordinator에 경로 확인 요청 |
| 권한 오류 | PERMISSION_DENIED | 경로 권한 확인 |
| 디스크 공간 | DISK_FULL | 공간 확보 후 재시도 |
| 알 수 없음 | UNKNOWN_ERROR | 에러 메시지 포함하여 보고 |
Write(
file_path="consultations/{session_folder}/02-valuation-report.json",
content="{\"status\": \"PASS\", \"ticker\": \"005930\", ...}"
)
# 들여쓰기 2칸으로 포맷팅
JSON.stringify(analysis_result, null, 2)
| 데이터 유형 | 확장자 |
|---|---|
| 구조화된 분석 데이터 | .json |
| 마크다운 보고서 | .md |
| 원시 텍스트 | .txt |
output_path가 coordinator로부터 전달되었는가?{
"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}/"