Files
GhiVideo_v4/docs/history/2026-04-01_history-hooks-적용.md
T
b23042andClaude Fable 5 d38b842e8d GhiVideo 소스 복제 — v4 작업 시작 기준
기존 GhiVideo 저장소 HEAD의 트래킹 소스 362개 파일을 복제.
(node_modules·storage·빌드 산출물·대용량 미디어는 .gitignore 규칙대로 제외)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 14:32:51 +09:00

1.7 KiB

history-hooks 적용 및 토큰 사용량 집계

소요 시간: 약 40분
Context 사용량: input ~13k / output ~142k tokens (cache 포함)
이슈: #0


작업 내용

1. history_hooks 리뷰 및 프로젝트 적용

  • history_hooks/ 디렉토리의 5개 파일 분석
  • .claude/hooks/에 복사: guard-history-fields.py, guard-history-fields.sh, guard-history-reminder.sh, session-context.sh, path.json
  • session-context.sh, guard-history-reminder.sh$CLAUDE_PROJECT_DIR 기반 절대경로로 수정
  • .claude/settings.json에 3개 훅 이벤트 등록:
    • PostToolUse(Edit|Write)guard-history-fields.sh
    • Stopguard-history-reminder.sh
    • UserPromptSubmitsession-context.sh
  • docs/history/ 디렉토리 생성

2. 일자별 토큰 사용량 집계

  • ~/.claude/projects/d--MYCLAUDE-PROJECT-abcvideo/*.jsonl 파싱
  • requestId 중복 제거 후 날짜별 집계
  • 결과: 총 974 요청, input 12,556 / output 135,445 / cache_create 3,655,924 / cache_read 91,618,473

3. Gitea 이슈 코멘트 등록

  • kimminsung/dronevideoplayer#1에 일자별 토큰 사용량 테이블 코멘트 추가

4. guard-history-reminder.sh 수정

  • 기존: exit 0 → stderr 메시지만 출력, Claude 그냥 종료
  • 변경: 오늘 날짜 히스토리 파일 없으면 exit 2로 Claude 종료 차단 → 히스토리 작성 강제

산출물

  • .claude/hooks/guard-history-fields.py
  • .claude/hooks/guard-history-fields.sh
  • .claude/hooks/guard-history-reminder.sh (수정)
  • .claude/hooks/session-context.sh
  • .claude/hooks/path.json
  • .claude/settings.json (Stop, UserPromptSubmit 훅 추가)
  • docs/history/ 디렉토리