BurningTimesAi/scripts/skill_trigger_audit.sh

57 lines
2.3 KiB
Bash
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# skill_trigger_audit.sh — BurningTimes SKILL 동적 로딩 트리거 감사 hook
# 2026-05-07 SKILL 동적 로딩 분할 Phase D-2 신설
# PostToolUse (Edit/Write/MultiEdit) — 작업 영역 키워드 감지 + SKILL 활성화 권고 환기
# 목적: false negative 차단 안전망 (SKILL description 매칭 누락 시 환기)
# 토큰 비용: 0
INPUT=$(cat 2>/dev/null)
BODY=$(echo "$INPUT" | grep -oE '"(new_string|content)"[[:space:]]*:[[:space:]]*"[^"]*"' | head -3)
FILE_PATH=$(echo "$INPUT" | grep -oE '"file_path"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/.*"\([^"]*\)"$/\1/')
[ -z "$BODY" ] && exit 0
SUGGESTED=""
# bt-commit-rules 영역
if echo "$BODY" | grep -qE '(commit|push|main|merge|rebase|force[[:space:]]*push|tag[[:space:]]*release)' \
&& ! echo "$FILE_PATH" | grep -qE '(\.gitignore|\.git/)'; then
SUGGESTED="${SUGGESTED}bt-commit-rules, "
fi
# bt-data-protection 영역
if echo "$BODY" | grep -qE '(백업|backup|복원|복구|롤백|rollback|프로덕션|production|밸런싱[[:space:]]*수치|\.csv|\.xlsm|\.json[[:space:]])' \
&& ! echo "$FILE_PATH" | grep -qE 'SKILL\.md'; then
SUGGESTED="${SUGGESTED}bt-data-protection, "
fi
# bt-task-delegation 영역
if echo "$BODY" | grep -qE '(Task[[:space:]]*위임|서브에이전트|sub-agent|팀장[[:space:]]*호출|delegation)'; then
SUGGESTED="${SUGGESTED}bt-task-delegation, "
fi
# bt-pd-tracking 영역
if echo "$BODY" | grep -qE '(PD[[:space:]]*지시[[:space:]]*로그|활성[[:space:]]*지시[[:space:]]*테이블|완료[[:space:]]*아카이브[[:space:]]*이동|현황[[:space:]]*보고)'; then
SUGGESTED="${SUGGESTED}bt-pd-tracking, "
fi
[ -z "$SUGGESTED" ] && exit 0
cat >&2 <<EOF
[BurningTimes SKILL 트리거 감사 — 활성화 권고]
감지 영역 SKILL: ${SUGGESTED%, }
본 작업이 위 SKILL 영역에 해당. 응답에서 해당 SKILL 본문 인용 흔적 미발견 시:
- description 매칭 false negative 가능성
- 헌법급 의무 누락 위험 (특히 C6-1 백업·C19-2 보수적 해석 등)
권고:
- 응답 시작 시 활성 SKILL 식별 + 본문 인용 의도적 적용
- 매칭 누락 발견 시 자진 고지 + description 키워드 보강 안건 상신
근거: BurningTimes Phase 5 운영 측정 메트릭 — false negative율 < 10% 목표
EOF
exit 0