Files
recordingtest/historyhooks/session-context.sh
minsung 5ac612f373 Add history tracking hooks and project structure
- Add docs/history/ directory for work history files
- Add PROGRESS.md for project status tracking
- Add .claude/settings.json with Gitea MCP permissions
- Gitea issue #1: 히스토리 및 AI 사용량 추적 시스템 설정

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 11:47:14 +09:00

30 lines
1.0 KiB
Bash

#!/usr/bin/env bash
# UserPromptSubmit 훅: 프로젝트 컨텍스트 주입
# path.json 의 history_path 아래 최근 작업 문서를 읽어 출력
set -euo pipefail
HOOKS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PATH_JSON="$HOOKS_DIR/path.json"
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(cd "$HOOKS_DIR/../.." && pwd)}"
if command -v jq &>/dev/null && [[ -f "$PATH_JSON" ]]; then
history_rel=$(jq -r '.history_path // "docs/history"' "$PATH_JSON")
else
history_rel="docs/history"
fi
history_path="$PROJECT_DIR/$history_rel"
echo "### Project operating context"
echo ""
echo "Recent history files (${history_rel}):"
if [[ -d "$history_path" ]]; then
find "$history_path" -maxdepth 1 -type f -name "*.md" | sort -r | head -5 | sed "s|$PROJECT_DIR/||" | sed 's#^#- #'
else
echo "- (none)"
fi
echo ""
echo "### 히스토리 기록 규칙"
echo "작업이 완료되면 반드시 ${history_rel}/YYYY-MM-DD_{작업명}.md 파일을 작성하라."
echo "필수 항목: **소요 시간**, **Context 사용량** (누락 시 저장 차단됨)"