Files
DefVideo/docs/history/2026-04-01_history-hooks-적용.md
한성일 82662d417d 초기 커밋: DefVideo 소스 등록
abcVideo 플레이어 소스 (client / server / shared / pythonsource / docs / .claude).
.gitignore 적용으로 node_modules·storage·samplevideo·미디어 등 대용량 일괄 제외.
103 files, ~964K.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 03:20:27 +00: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/ 디렉토리