Author SHA1 Message Date
donghyeon.kang 2cd6a01363 Merge pull request 'fix(harness): main checkout 안 worktree를 통째로 지우는 rm을 막는다' (#11) from fix/h12-nested-worktree-rm into main 2026-11-12 22:10:13 +00:00
DongHyeonka 327800798a fix(harness): main checkout 안 worktree를 통째로 지우는 rm을 막는다
문제: H12는 cwd의 main checkout도 rm 허용 폴더에 넣는다. 그래서
main checkout 안 worktree(.claude/worktrees/…)에서 worktree 자신
(`rm -rf ./*`), 옆 worktree(`rm -rf ../w2`), 그 안(`../w2/src`)을
지우는 것이 통과한다(docs/retro/2026-11-08.md C6). 앱은 worktree
세션의 CLAUDE_PROJECT_DIR를 main checkout으로 주므로 실제 세션이 이
경우다.

고친 방법: 허용 폴더는 그대로 두고 지킬 checkout을 따로 센다. 작업
폴더와 그 repo에 `git worktree list`로 등록된 모든 worktree다. /tmp·앱
임시 작업 폴더 밖에서는 checkout 자신이나 그것을 품은 폴더를 통째로
지우면 막는다. 이 세션 작업 폴더와 같지도, 품지도, 그 안에 있지도
않은 checkout(옆 worktree)은 그 안을 지워도 막는다. 「이 세션 작업
폴더」는 cwd의 checkout을 먼저 본다. 프로젝트 폴더를 먼저 보면 main
checkout이 내 것이 되어 옆 worktree 안이 열린다(실제 세션에서 확인).
main checkout 안 다른 자리(worktree 밖)와 main checkout 세션이
worktree 안을 치우는 일은 전처럼 통과한다.
버린 대안: worktree 세션에서 main checkout을 허용 폴더에서 빼기(설계
문구에는 맞지만 지금 통과하는 일을 더 많이 막는다. 근거 없이 넓히지
않았다), `.claude/worktrees` 이름으로 판정(다른 곳에 둔 worktree를
놓친다).

위험: 판정마다 git을 한 번 더 부른다(`worktree list`, 시간 제한
5초). 등록되지 않은 폴더(지운 worktree의 남은 폴더)는 지켜지지
않는다. /tmp 아래 worktree는 일부러 그대로 허용한다. 훅 동작이 바뀌어
harness 0.3.1로 올린다. 같은 판정이 전역 ~/.claude/hooks/guard_bash.py
에도 있어 같이 고쳤다. 이 repo가 병합되고 main checkout을 받고 플러그인을
0.3.1로 올리기 전까지 전역 훅 시험의 사본 비교 2줄은 다르다고 나온다.

검증: 새 시험을 main 훅에 돌려 실패를 먼저 봤다(worktree `./*`,
main checkout `.claude/worktrees`, 프로젝트 폴더가 main일 때
`../w2/src`). 고친 뒤 scripts/check.sh 통과(harness 28·redteam 21·
템플릿 11, expectedFailure 없음). 새 규칙 둘을 하나씩 끄면 각각 시험이
실패한다. 소유자 기계 세션 기록의 rm -r 647개를 프로젝트 폴더 없이,
또 main checkout으로 주고 옛·새 판정을 비교해 바뀐 것은 이 작업의
확인 명령 1개뿐이었다.

Refs: docs/retro/2026-11-08.md C6
2026-11-13 07:05:04 +09:00
donghyeon.kang 7bb2b88857 Merge pull request 'test(harness): rm 가드 시험이 checkout 위치와 상관없이 같은 판정을 낸다' (#10) from test/rm-guard-test-location-independent into main 2026-11-12 21:51:45 +00:00
DongHyeonka 63b3f50e48 test(harness): rm 가드 시험이 checkout 위치와 상관없이 같은 판정을 낸다
문제: test_rm_whole_checkout_or_sibling_is_blocked가 이 repo의 checkout을
cwd로 쓴다. H12는 /tmp 아래 rm을 일부러 허용하므로, checkout이 /tmp
아래(scratchpad worktree)에 있으면 `rm -rf ./*`가 통과해 main에서도
시험이 실패한다. main checkout 안의 worktree에서는 main checkout 허용
때문에 통과해 expectedFailure로 돌렸다. 같은 코드가 놓인 자리에 따라
통과·실패·예상 실패로 갈린다.

고른 방법: 시험이 /tmp 밖(/var/tmp, 못 쓰면 HOME)에 빈 checkout과 그
안의 worktree(.claude/worktrees/w)를 직접 만들어 cwd로 넘긴다.
checkout에서는 자신·옆 폴더 삭제가 막히는지 보고, worktree의 알려진
빈틈은 늘 expectedFailure로 둔다. 두 곳에서 `rm -rf build`가 통과하는
시험을 더해, 막히는 이유가 위치를 몰라서가 아님을 확인한다. /tmp 밖
폴더를 못 찾으면 건너뛰지 않고 오류로 멈춘다.
버린 대안: /tmp 아래면 건너뛰기(/tmp에서 이 판정을 시험하지 못한다),
H12 허용 폴더를 환경 변수로 바꾸게 하기(시험 때문에 훅 입력을 늘린다).

위험: 시험이 /var/tmp(또는 HOME)에 h12-test-* 임시 폴더를 만들고 끝나면
지운다. 시험 프로세스가 중간에 죽으면 그 폴더가 남을 수 있다. 훅
동작은 바꾸지 않아 플러그인 버전은 그대로 둔다.

검증: main(8583353)을 /tmp 아래 worktree에서 돌리면 이 시험이 실패하는
것을 먼저 봤다. 고친 뒤 /tmp 아래 worktree와 원래 위치 아래 worktree
두 곳에서 scripts/check.sh 통과. 훅을 두 가지로 망가뜨리면(허용 폴더
자신 허용, cwd 상위 폴더 허용) 새 시험이 실패한다.
2026-11-13 01:53:43 +09:00
donghyeon.kang 8583353c3e Merge pull request 'fix(redteam): 비밀 값 원문과 ZAP 사용 정보를 밖에 남기지 않는다' (#9) from fix/redteam-scan-no-secret-egress into main 2026-11-12 16:48:58 +00:00
DongHyeonka 0bca43ed95 fix(redteam): 비밀 값 원문과 ZAP 사용 정보를 밖에 남기지 않는다
문제: redteam-scan.sh secrets 모드가 gitleaks를 --redact 없이 불러,
찾은 비밀 값 원문이 secrets.json에 그대로 남는다. 이 파일은 redteam
스킬이 다음 단계에서 읽으므로 비밀 값이 에이전트 컨텍스트에 들어간다.
또 ZAP(dast-baseline·dast-api)은 기본으로 call home(텔레메트리·업데이트
확인·뉴스)을 한다. semgrep에는 --metrics=off를 걸었지만 ZAP에는 같은
장치가 없었다. NVIDIA SkillSpector 2.13.4 정적 스캔(PE3 secrets.json)과
그 뒤 의미 검토에서 찾았다.

고른 방법: gitleaks에 --redact를 더한다. 위치(파일·줄·커밋·규칙)는
남으니 고칠 곳 찾기에는 지장이 없다. ZAP 두 모드에 -z "-silent"를
더한다(ZAP FAQ: -silent는 call home을 막는다). 가짜 docker로 실제로
넘기는 인자를 확인하는 시험을 더했다(semgrep --metrics=off도 함께 고정).
버린 대안: 결과 파일 이름 secrets.json 바꾸기(스캐너 경고만 줄고 결과를
읽는 문서·에이전트 계약이 깨진다), -notel(텔레메트리만 끄고 업데이트
확인은 남는다).

위험: docker로 실제 이미지를 돌려 보지 않았다. 고정 digest의 ZAP
2.16.1에서 'ZAP is Out of Date' 규칙이 -silent 아래서도 업데이트 확인을
한 적이 있다(ZAP 블로그 2025-10-21). schemathesis 4의 원격 전송 여부는
확인하지 못했다. 플러그인 동작이 바뀌어 redteam 버전을 0.1.2로 올린다.

검증: 고치기 전 스크립트에서 새 시험 2개 실패(RED), 고친 뒤
scripts/check.sh 통과(harness 24·redteam 21·템플릿 11, 매니페스트 3개).

Refs: design-docs harness/2026-11-12-skill-specter-audit.md
2026-11-12 22:11:59 +09:00
donghyeon.kang 69b32eae30 Merge pull request 'docs(experts): 프론트 디자인 시스템 설계서의 옮긴 경로를 적는다' (#8) from donghyeon.kang/harness-v2-experts into main 2026-11-11 22:13:23 +00:00
DongHyeonka 1a7f817fd6 docs(experts): 프론트 디자인 시스템 설계서의 옮긴 경로를 적는다
프론트 repo #15가 docs/styling/design-system-platform.md를 docs/design/의 설계 기록으로 옮겼다. 7.4절이 옛 경로를 가리키고 이 repo 문서처럼 읽혀서, 프론트 repo의 새 경로로 바꿨다. 검증: scripts/check.sh 통과.
2026-11-12 06:59:46 +09:00
donghyeon.kang 3683839a13 Merge pull request 'chore(ledger): 프론트 템플릿 상태의 실제 세션 시작 비용을 남긴다' (#7) from donghyeon.kang/harness-v2-experts into main 2026-11-11 21:52:25 +00:00
DongHyeonka 5c36e8b470 docs(experts): 분야 스킬 호출률을 올린 규칙과 프론트 구현 과제 결과를 더한다
문제: 템플릿 상태 실측(7.3)에서 분야 스킬이 목록에 떠도 부른 세션은 셋 중
하나였다. 설계 9절 F1의 "절반 아래"에 걸렸다. 프론트 구현 과제(B)는 아직
돌리지 않았다.

고른 방법: 두 템플릿 규칙에 "처음 Edit·Write 전에 Skill 도구로, 문서를 읽었어도"와
고칠 것 → 스킬 짝을 적고(백엔드 5feb5a1b, 프론트 6805ed62) 실제 세션으로 다시
쟀다. 7.4절에 결과를, 9절에 과다 호출을 볼 F7을 더했다. 장부에 eval 12줄.
버린 대안: leaf AGENTS.md마다 한 줄(파일 수십 개), 강조어(과다 호출).

위험: 프론트 과제 B는 세 판 모두 9/9라 정답률 차이를 보여 주지 못한다. 프론트
채점 검사 둘은 첫 결과를 본 뒤 넓혔다(세 판에 같게 적용).

검증: scripts/check.sh 통과, ledger.py compare --task harness-v2-eval-real로 표 값 대조.
2026-11-12 05:34:13 +09:00
DongHyeonka b67d5343c4 chore(ledger): 프론트 템플릿 상태의 실제 세션 시작 비용을 남긴다
문제: 백엔드만 실제 세션 시작 비용을 쟀다. 프론트에 지식 스킬 9개와
reviewer를 넣은 뒤의 값이 장부에 없다.

고른 방법: 프론트 main 38c0dc7d와 그 위 분야 전문가 커밋 b5e7f54b를
scratchpad에 복제해 같은 짧은 질문으로 opus-5-5 세션을 두 번씩 열고 첫 호출
입력 토큰을 eval 줄 4개로 남긴다. 47,424 → 47,891(+1.0%).

위험: 없음(장부만). 첫 측정은 v1 복제가 로컬의 낡은 main(d1b9c087)에서
떠져 버렸다.

검증: ledger.py compare --task harness-v2-eval-real에 start-context-fe 줄이 보인다.
2026-11-12 04:24:02 +09:00
donghyeon.kang 3da02e571f Merge pull request 'docs(redteam): 수정 커밋 전 포맷 게이트 단계를 더한다' (#6) from claude/redteam-spotless-step into main 2026-11-11 17:43:21 +00:00
DongHyeonka b8cf1b2e91 docs(redteam): 수정 커밋 전 포맷 게이트 단계를 더한다
red team 수정 절차에 "커밋 전 바뀐 파일에 대상 repo 포맷터를 돌린다"
단계가 없었다. 그래서 백엔드 템플릿 수정 PR에서 모듈 시험만 돌리고
push했다가 runner pr / gradle의 :app-bootstrap:spotlessJavaCheck에서
깨졌다. 같은 실수가 반복되지 않게 절차에 못 박는다.

skills/redteam SKILL.md §6(고침과 재실행)과 CAMPAIGN.md §4(발견 처리)에
각각 한 줄을 더한다: 자바 템플릿은 ./gradlew spotlessApply 뒤
spotlessCheck. 스킬 지시가 바뀌므로 plugin.json version 0.1.0 → 0.1.1
(받는 쪽은 버전이 바뀌어야 갱신된다).

위험·한계: 문서·버전만 바뀐다. 훅·스크립트 동작 변화 없음.

검증: scripts/check.sh 통과(harness·redteam·template 시험, manifest validate).
2026-11-12 02:37:18 +09:00
donghyeon.kang 06121f4995 Merge pull request 'docs(experts): 템플릿에 적용한 상태를 실제 세션으로 잰 결과를 더한다' (#4) from donghyeon.kang/harness-v2-experts into main 2026-11-11 15:44:23 +00:00
donghyeon.kang 90c5b2ea92 Merge pull request 'chore(redteam): tools.lock 도구 digest를 모두 고정한다' (#5) from claude/redteam-pin-digests into main 2026-11-11 15:44:17 +00:00
DongHyeonka 82a6098b9b docs(experts): 템플릿에 적용한 상태를 실제 세션으로 잰 결과를 더한다
문제: 7.2의 실제 평가는 평가용 플러그인으로 판을 만들어, 지식 스킬이
플러그인 스킬(paths가 있어도 시작 목록에 듦)로 실렸다. 실제 템플릿은
프로젝트 스킬이라 시작 비용과 발동이 다를 수 있다.

고른 방법: 백엔드에 적용한 브랜치(c611b06f)와 그 기준(relayout 123fc0bf)을
scratchpad에 복제해 실제 세션(claude -p, opus-5-5, 사용자 전역 설정 그대로,
Slack 도구 막음)으로 시작 컨텍스트 2번과 구현 과제 3번씩을 돌렸다.
결과: 시작 47,689 → 48,088(+0.8%), 규칙 검사 v1 6/8 ×3, v2 8/8 ×3, 동시
인덱스 규칙 0/3 → 3/3. v2는 호출 1.35배·출력 1.5배를 썼다. 장부 eval 줄 10개.
버린 대안: 원래 worktree 경로에서 재기. 그 경로에 걸린 프로젝트 메모리가 한
쪽에만 실려 +4.7%로 잘못 나왔다.

위험: 판마다 3번이다. 사용자 전역 설정(superpowers 등)이 양쪽에 같이 실려
절대값은 이 기계 기준이다.

검증: plugins·template 시험은 바뀐 것이 없다(문서·장부만). ledger.py compare
--task harness-v2-eval-real로 표를 다시 뽑았다.
2026-11-12 00:05:29 +09:00
14 changed files with 271 additions and 37 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ claude-harness ─┬─ 플러그인 harness ──(claude plugin install)─
| 장치 | 때 | 하는 일 |
|---|---|---|
| H12 차단 | Bash 실행 직전 | 되돌릴 수 없는 명령을 막는다: 호스팅 원격으로 force push·`--mirror`·보호 브랜치 지우기, 작업 폴더·/tmp 밖이나 너무 넓은 `rm -r`, DB·볼륨·migration 삭제(DROP·TRUNCATE, flyway clean, `-p` 없는 `compose down -v`, `volume rm`, `kubectl delete pvc·ns`). `ssh '…'` 안도 본다 |
| H12 차단 | Bash 실행 직전 | 되돌릴 수 없는 명령을 막는다: 호스팅 원격으로 force push·`--mirror`·보호 브랜치 지우기, 작업 폴더·/tmp 밖이나 너무 넓은 `rm -r`, 작업 폴더 안이라도 git checkout(등록된 worktree 포함)을 통째로 지우거나 옆 worktree 안을 지우는 `rm -r`, DB·볼륨·migration 삭제(DROP·TRUNCATE, flyway clean, `-p` 없는 `compose down -v`, `volume rm`, `kubectl delete pvc·ns`). `ssh '…'` 안도 본다 |
| N4 알림 | 파일을 쓴 직후 | 비밀 값처럼 보이는 것(개인 키, 토큰, 값이 있는 password 등)을 몇 줄로 알린다. 막지 않는다 |
| 장부 기록 | 세션 시작·턴 끝 | 세션 id와 기록 경로를 `~/.claude/harness/sessions.jsonl`에, 누적 실측(시간·호출·토큰)을 `~/.claude/harness/usage/<세션>.json`에 쓴다. 출력이 없어 컨텍스트 비용이 0이다 |
| 회고 넛지 | 세션 시작 | repo 장부에 회고 안 한 빗나간 예측이나 효과 판정할 개선이 있으면, repo마다 하루 한 번 한 줄로 알린다. 없으면 출력이 없다 |
+1
View File
@@ -18,6 +18,7 @@
| 12 | 플러그인은 분야 전문가 협업 장치(`lead`·`new-expert`·`harness-eval`, 장부 `eval`)만 싣고, 분야 전문가(스킬·서브에이전트)는 각 템플릿 `.claude/`에 둔다 | 설계(v1)에 없음. v2 설계는 `docs/experts.md` | 기준이 스택마다 다르다. 플러그인 에이전트는 `harness:` 아래 이름이라 템플릿 것과 둘 다 목록에 떠 설명 비용과 고르기 혼란만 는다 |
| 13 | 새 스킬 셋(`lead`·`new-expert`·`harness-eval`)도 모델 호출형이고 설명에 발동 조건을 쓴다. `harness-eval`은 설명에 "시킬 때만"을 쓴다 | 13절 Q9와 같음 | 비싼 평가가 저절로 돌지 않게 하는 것은 설명 문장이다. 사용자 호출 전용으로 바꾸려면 Q9를 다시 정해야 한다 |
| 14 | `ledger.py usage`의 `agent_return_chars`는 Agent 도구 결과와, 대기열로 들어온 백그라운드 결과(`queued_command`의 `<agent-message`·`<task-notification` 머리)를 센다 | 설계에 없음 | 백그라운드 서브에이전트의 결과는 tool_result가 아니라 알림으로 온다(2026-11-11 세션 기록에서 확인). 기록 모양이 바뀌면 이 값이 0으로 떨어진다(시험이 모양을 고정한다) |
| 15 | `rm -r`은 허용 폴더 안이라도 git checkout(등록된 worktree 포함)이나 그것을 품은 폴더를 통째로 지우거나, 옆 worktree 안을 지우면 막는다. /tmp·앱 임시 작업 폴더 아래는 예외 | 설계는 「이 worktree·scratchpad·`/tmp/claude-<uid>` 밖」을 막는다. 구현이 main checkout도 허용 폴더에 넣어서 그 안의 worktree 자신·옆 worktree가 열려 있었다 | `docs/retro/2026-11-08.md` C6. main checkout 안을 치우는 일(main checkout 세션이 worktree 안을 비우기 등)은 그대로 둔다. 「이 세션 작업 폴더」는 cwd의 checkout으로 먼저 잡는다. 앱이 worktree 세션의 프로젝트 폴더(`CLAUDE_PROJECT_DIR`)를 main checkout으로 주므로, 프로젝트 폴더를 먼저 보면 옆 worktree 안이 열린다(실제 세션에서 확인). 소유자 기계 세션 기록의 `rm -r` 647개(지금 있는 worktree 35곳에서 실행한 338개 포함)를 프로젝트 폴더 없이, 또 main checkout으로 주고 옛 판정과 새 판정으로 돌렸다. 바뀐 것은 이 작업의 확인 명령 1개뿐이었다 |
## 확인한 것과 못 한 것
+45 -4
View File
@@ -252,7 +252,47 @@
- **`lead`**: 다분야 PR 리뷰 요청 4번 모두 불리지 않았고 서브에이전트도 0이었다(규칙상 남의 작은 변경은 0명이라 결과는 맞다). 단순 질문·한 파일 판정 4번에서도 불리지 않았다(과다 호출 없음).
- **시작 비용**: 샌드박스에서 v2가 v1보다 13% 컸다(+2.7k). 이 평가에서는 `be-*`가 **플러그인** 스킬이라 `paths`가 있어도 목록에 다 들어갔다. 실제 템플릿에서는 **프로젝트** 스킬이고, 헤드리스 실제 세션에서 프로젝트의 `paths` 스킬은 시작 목록에 없고 `paths` 없는 스킬은 있는 것을 확인했다(haiku, 2026-11-11). 템플릿 적용 때 실제 세션으로 다시 잰다.
- **기준 대조**: 리뷰 +2 → 못 넘음(천장). 시작 비용 5% 이하 → 샌드박스에서 못 넘음(위 이유로 실제 값은 적용 때). 구현 과제(돌리기 전에 채점기를 정함) → v2 +7검사/40.
- **결정**: 설계는 그대로 간다(소유자 승인 2026-11-11). 다음 두 가지를 템플릿 적용 때 고친다. (1) 분야 스킬 호출률: 마이그레이션 leaf `AGENTS.md`나 `.claude/rules/`에 "쓰기 전에 그 분야 스킬" 한 줄을 넣고 호출률을 다시 잰다. (2) 프로젝트 스킬로 둔 상태의 시작 비용과 구현 과제를 실제 세션으로 다시 잰다. 서브에이전트 방식은 v2가 못한 지표가 없어 다시 시험하지 않는다. 장부 `harness-v2-eval-real` 줄 24개.
### 7.3 실제 템플릿 상태 (2026-11-12, 백엔드)
7.2는 평가용 플러그인이라 지식 스킬이 플러그인 스킬로 실렸다. 템플릿에 적용한 상태(프로젝트 `be-*` 스킬, `reviewer`, `.claude/rules/expert-skills.md`)를 실제 세션(`claude -p`, opus-5-5, 사용자 전역 설정 그대로)으로 다시 쟀다. v1 = 백엔드 relayout 브랜치, v2 = 그 위 분야 전문가 커밋. 둘 다 scratchpad 복제에서 돌렸다.
| 지표 | v1 | v2 |
|---|---|---|
| 시작 컨텍스트(첫 호출, 2번) | 47,689 | 48,088 (+0.8%) |
| 구현 과제 규칙 검사 8개(3번) | 6/8 ×3 | **8/8 ×3** |
| 그중 동시 인덱스 규칙 | 0/3 | **3/3** |
| 작업 중 분 · 호출 · 출력 토큰(중앙값) | 21 · 158 · 11.9만 | 22 · 214 · 17.9만 |
- 프로젝트 `paths` 스킬은 시작 목록에 들지 않아 시작 비용이 0.8%만 늘었다(기준 5% 안).
- 7.2와 합치면 동시 인덱스 규칙은 v2 6/8(+1 절반), v1 0/8이다(한쪽 정확 검정 p≈0.004).
- v2는 더 넓게 확인해 호출 1.35배, 출력 1.5배를 썼다. 한 번은 40분 제한에 걸렸다(파일은 8/8).
- v2 세션 둘 다 `expert-skills.md` 규칙이 읽혔고, 셋 중 하나가 `be-persistence`·`be-api-contract`를 불렀다.
- 사용자 전역 설정의 `slack-briefing` 스킬이 두 판 모두에서 불렸다. 평가 실행에서는 Slack 도구를 막아 올라간 것이 없다(평가할 때는 `--disallowedTools "mcp__slack__*"`를 붙인다).
- **결정**: 설계는 그대로 간다(소유자 승인 2026-11-11). 다음 두 가지를 템플릿 적용 때 고친다. (1) 분야 스킬 호출률: `.claude/rules/expert-skills.md`에 "고치기 전에 그 분야 스킬" 두 줄을 넣었다(7.3: 규칙은 읽히지만 스킬 호출은 셋 중 하나). (2) 프로젝트 스킬 상태의 시작 비용과 구현 과제는 7.3에서 다시 쟀다. 서브에이전트 방식은 v2가 못한 지표가 없어 다시 시험하지 않는다. 장부 `harness-v2-eval-real` 줄 24개.
### 7.4 분야 스킬 호출률을 올린 뒤 (2026-11-12, 두 템플릿)
7.3에서 규칙은 읽혀도 분야 스킬을 부른 세션은 셋 중 하나였다. 9절 F1의 "절반 아래"에 걸린다. 두 템플릿의 `.claude/rules/expert-skills.md`를 고쳤다(백엔드 `5feb5a1b`, 프론트 `6805ed62`). 분야 파일을 처음 Edit·Write하기 전에 Skill 도구로 부르고, 관련 문서를 읽었어도 부른다. 고칠 것 → 스킬 짝을 한 줄로 적어 `docs/work/experts.md` 표를 다시 읽지 않아도 되게 했다. 7.3과 같은 방식(`claude -p`, opus-5-5, 사용자 전역 설정, Slack 도구 막음)으로 다시 쟀다.
프론트는 이번에 구현 과제 B를 처음 돌렸다. 디자인 시스템에 지울 수 있는 필터 칩 `Chip`을 더하는 일이고, repo 규칙 검사는 9개다(primitive 한 파일, 배럴 export, 아이콘 facade, 지우기 버튼 이름, 날 색 없음, 닫힌 API, 갤러리 story, 컴포넌트 시험, 골든을 다시 찍지 않고 안내).
| 판 | 규칙 검사(3번) | 첫 편집 전에 분야 스킬 | 세션별 분야 스킬 호출 수 | 작업 중 분 · 호출 · 출력(중앙값) |
|---|---|---|---|---|
| 백엔드 v2(이전 규칙, 7.3) | 8/8 ×3 | 1/3 | 0 · 2 · 0 | 22 · 214 · 17.9만 |
| 백엔드 v2r(새 규칙) | 8/8 ×3 | **3/3** | 3 · 6 · 7 | 27 · 222 · 18.6만 |
| 프론트 v1(main, 분야 스킬 없음) | 9/9 ×3 | — | 0 · 0 · 0 | 15 · 121 · 7.9만 |
| 프론트 v2(이전 규칙) | 9/9 ×3 | 1/3 | 0 · 4 · 0 | 15 · 143 · 13.1만 |
| 프론트 v2r(새 규칙) | 9/9 ×3 | **3/3** | 5 · 4 · 5 | 13 · 133 · 10.8만 |
- 호출률은 두 템플릿 모두 1/3에서 3/3이 됐다. 여섯 번 모두 첫 Edit·Write 전에 불렀다.
- 정답률: 백엔드는 v2와 같은 8/8이다(나빠지지 않음). 프론트 과제 B는 세 판 모두 9/9라 변별력이 없다. 프론트 repo의 디자인 시스템 설계 기록(`docs/design/2026-07-26-design-system-platform-design.md`) 11절 「컴포넌트 추가 Recipe」가 자세해서, 스킬 없이 문서를 따라가도 맞는다. 7.2의 리뷰 과제와 같은 천장이다.
- 시작 컨텍스트(프론트): v1 49,152 → v2 49,612(+0.9%) → v2r 49,645(+1.0%). 규칙은 `paths`가 맞는 파일을 열 때만 실린다.
- 비용: 프론트 출력은 v1 대비 v2 1.65배, v2r 1.37배다. 백엔드 v2r은 v2보다 작업 시간이 5분 길고 출력은 4% 많다. 새 규칙은 과제와 먼 분야(마이그레이션 과제에 `be-security`·`be-performance`)까지 부르게 한다. 9절 F7로 지켜본다.
- 채점기: 프론트 검사 둘을 첫 결과를 본 뒤 넓혔다. `IconButton` primitive로 만든 지우기 버튼과, CHANGELOG에 적은 골든 안내를 맞는 답인데도 떨어뜨렸기 때문이다. 세 판 모두에 같게 적용했다.
- `claude -p`는 백그라운드 서브에이전트를 600초 뒤 끊는다(5개 세션 stderr). 결과 JSON의 시간·토큰에는 그 뒤 일이 빠진다. 장부 값은 세션 기록에서 `ledger.py eval`로 다시 계산했다.
- **결정**: 새 규칙 문구로 간다. 분야 스킬 호출률은 9절 F1 기준을 넘었다. 프론트의 변별력 있는 구현 과제(문서에 recipe가 없는 규칙을 건드리는 일)는 아직 없다. 장부 `harness-v2-eval-real`에 12줄을 더했다(case `impl-priority-real-be-r2`, `impl-chip-real-fe`).
---
@@ -275,17 +315,18 @@
| # | 가정 | 틀렸다면 보이는 곳 |
|---|---|---|
| F1 | `paths` 지식 스킬은 그 파일을 만질 때 목록에 뜨고, 메인이 그것을 부른다 | 적용 뒤 세션 기록에서 그 분야 파일을 고친 세션의 `Skill` 호출이 절반 아래다 → 설명의 말을 고치거나 rules에 "이 스킬을 부른다" 한 줄 |
| F1 | `paths` 지식 스킬은 그 파일을 만질 때 목록에 뜨고, 메인이 그것을 부른다 | 적용 뒤 세션 기록에서 그 분야 파일을 고친 세션의 `Skill` 호출이 절반 아래다 → 설명의 말을 고치거나 rules에 "이 스킬을 부른다" 한 줄. 7.3에서 1/3로 드러났고, 7.4에서 규칙을 고쳐 3/3이 됐다 |
| F2 | 렌즈(스킬 경로를 읽게 함)가 분야 정의를 미리 싣는 것만큼 판정을 좁힌다 | 과제 A·B에서 v2 리뷰어 발견이 렌즈 분야 밖으로 흩어지거나 렌즈 분야 결함을 놓친다 |
| F3 | 넘김 한 번이면 충분하다 | 보고 「남은 문제」의 넘김이 큰 일마다 2건 넘게 남는다 |
| F4 | 시작 비용 증가가 작다 | 과제 C에서 `start_context` 증가가 5%를 넘는다 |
| F5 | 지식 스킬이 리뷰보다 먼저 결함을 막는다 | 적용 뒤 2주의 확인 리뷰·게이트 실패 중 그 분야 함정에 이미 적힌 것이 되풀이된다 |
| F6 | 리뷰-수정 세 번 상한이 품질을 해치지 않는다 | 세 번째에서 멈춘 일의 다음 확인 리뷰에서 High가 나온다 |
| F7 | 규칙이 과제에 걸리는 분야 스킬만 부르게 한다 | 장부 eval에서 세션별 분야 스킬 호출 수 중앙값이 5를 넘거나 출력이 v1의 1.5배를 넘는다 → 규칙의 짝 줄을 좁힌다(7.4: 백엔드 6, 프론트 5·1.37배) |
## 10. 확인 못 한 것
- ~~`paths` 스킬이 목록에서 빠지는지~~ → 확인함(7.2절): 프로젝트 스킬은 빠지고, 플러그인 스킬은 `paths`가 있어도 목록에 든다(CLI 2.1.287).
- 서브에이전트 `skills:`가 `paths`가 걸린 스킬도 싣는지(`arch-reviewer`·`verify-app`에 쓴다).
- 데스크톱 앱(2.1.321)과 노트북 CLI(2.1.287)의 동작 차이.
- 프론트 과제 B와 프론트 지식 스킬(초안 없음).
- 실제 템플릿(프로젝트 스킬) 상태의 시작 비용과 스킬 호출률.
- ~~프론트 과제 B~~ → 돌림(7.4절). 다만 세 판 모두 9/9라 변별력 있는 프론트 구현 과제는 아직 없다.
- ~~실제 템플릿(프로젝트 스킬) 상태의 시작 비용과 스킬 호출률~~ → 확인함(7.3·7.4절).
+26
View File
@@ -35,3 +35,29 @@
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v2", "case": "impl-priority", "run": 3, "active_minutes": 3, "calls": 32, "output_tokens": 16621, "start_context": 24000, "max_context": 124385, "agent_calls": 0, "findings": 6, "false_findings": null, "note": "구현 과제(우선순위 컬럼·인덱스·설정 키를 repo 규칙대로). findings = repo 규칙 검사 8개 중 통과 수(정규식 채점: 잠금 상한, 인덱스를 ALTER 파일 밖에, .sql.conf 동시 빌드 파일, 적용 해시 줄, env 레지스트리, .env.example, 설정 키, V9 그대로). 놓친 검사 ['concurrent-index-conf', 'index-not-in-alter-file']. 비용 $1.81. be-persistence 스킬 호출 안 함. 같은 묶음 안의 실행 번호와 기록 짝은 동시 실행이라 바뀌었을 수 있다(판별 합계는 맞다)", "recorded_at": "2026-11-11T23:09+09:00"}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v2", "case": "impl-priority", "run": 2, "active_minutes": 4, "calls": 35, "output_tokens": 21063, "start_context": 24066, "max_context": 128180, "agent_calls": 0, "findings": 8, "false_findings": null, "note": "구현 과제(우선순위 컬럼·인덱스·설정 키를 repo 규칙대로). findings = repo 규칙 검사 8개 중 통과 수(정규식 채점: 잠금 상한, 인덱스를 ALTER 파일 밖에, .sql.conf 동시 빌드 파일, 적용 해시 줄, env 레지스트리, .env.example, 설정 키, V9 그대로). 놓친 검사 []. 비용 $1.98. be-persistence 스킬 호출 안 함. 같은 묶음 안의 실행 번호와 기록 짝은 동시 실행이라 바뀌었을 수 있다(판별 합계는 맞다)", "recorded_at": "2026-11-11T23:09+09:00"}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v2", "case": "impl-priority", "run": 1, "active_minutes": 6, "calls": 55, "output_tokens": 29695, "start_context": 23995, "max_context": 194340, "agent_calls": 0, "findings": 7, "false_findings": null, "note": "구현 과제(우선순위 컬럼·인덱스·설정 키를 repo 규칙대로). findings = repo 규칙 검사 8개 중 통과 수(정규식 채점: 잠금 상한, 인덱스를 ALTER 파일 밖에, .sql.conf 동시 빌드 파일, 적용 해시 줄, env 레지스트리, .env.example, 설정 키, V9 그대로). 놓친 검사 ['index-not-in-alter-file']. 비용 $3.55. be-persistence 스킬 호출 함. 같은 묶음 안의 실행 번호와 기록 짝은 동시 실행이라 바뀌었을 수 있다(판별 합계는 맞다)", "recorded_at": "2026-11-11T23:09+09:00"}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v1", "case": "start-context-be", "run": 1, "active_minutes": 0, "start_context": 47687, "note": "실제 세션(claude -p, opus-5-5, CLI 2.1.287, 사용자 전역 설정 그대로) 첫 호출 입력 토큰. v1 = 백엔드 relayout 브랜치 123fc0bf, v2 = 그 위 분야 전문가 커밋 c611b06f. 둘 다 scratchpad 복제에서 돌려 프로젝트 메모리가 섞이지 않게 함. 세션 33c28f46. v2의 be-* 10개는 시작 목록에 없음(paths), 더해진 것은 reviewer 설명·CLAUDE.md·AGENTS.md 줄", "recorded_at": "2026-11-11T23:23+09:00"}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v2", "case": "start-context-be", "run": 1, "active_minutes": 0, "start_context": 48090, "note": "실제 세션(claude -p, opus-5-5, CLI 2.1.287, 사용자 전역 설정 그대로) 첫 호출 입력 토큰. v1 = 백엔드 relayout 브랜치 123fc0bf, v2 = 그 위 분야 전문가 커밋 c611b06f. 둘 다 scratchpad 복제에서 돌려 프로젝트 메모리가 섞이지 않게 함. 세션 d7eb69c8. v2의 be-* 10개는 시작 목록에 없음(paths), 더해진 것은 reviewer 설명·CLAUDE.md·AGENTS.md 줄", "recorded_at": "2026-11-11T23:23+09:00"}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v1", "case": "start-context-be", "run": 2, "active_minutes": 0, "start_context": 47691, "note": "실제 세션(claude -p, opus-5-5, CLI 2.1.287, 사용자 전역 설정 그대로) 첫 호출 입력 토큰. v1 = 백엔드 relayout 브랜치 123fc0bf, v2 = 그 위 분야 전문가 커밋 c611b06f. 둘 다 scratchpad 복제에서 돌려 프로젝트 메모리가 섞이지 않게 함. 세션 76d256bb. v2의 be-* 10개는 시작 목록에 없음(paths), 더해진 것은 reviewer 설명·CLAUDE.md·AGENTS.md 줄", "recorded_at": "2026-11-11T23:23+09:00"}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v2", "case": "start-context-be", "run": 2, "active_minutes": 0, "start_context": 48087, "note": "실제 세션(claude -p, opus-5-5, CLI 2.1.287, 사용자 전역 설정 그대로) 첫 호출 입력 토큰. v1 = 백엔드 relayout 브랜치 123fc0bf, v2 = 그 위 분야 전문가 커밋 c611b06f. 둘 다 scratchpad 복제에서 돌려 프로젝트 메모리가 섞이지 않게 함. 세션 5ba54c04. v2의 be-* 10개는 시작 목록에 없음(paths), 더해진 것은 reviewer 설명·CLAUDE.md·AGENTS.md 줄", "recorded_at": "2026-11-11T23:23+09:00"}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v1", "case": "impl-priority-real-be", "run": 1, "active_minutes": 12, "calls": 80, "output_tokens": 56051, "input_tokens_total": 13823532, "start_context": 49512, "max_context": 266372, "subagents": 0, "agent_calls": 0, "findings": 6, "false_findings": null, "note": "실제 템플릿 상태 실제 세션(claude -p, opus-5-5, 사용자 전역 설정 그대로, Slack 도구 막음). v1 = relayout 123fc0bf, v2 = c611b06f(프로젝트 be-* 스킬·reviewer·expert-skills 규칙). repo 규칙 검사 8개 중 통과 6, 놓친 것 ['index-not-in-alter-file', 'concurrent-index-conf']. 부른 스킬 ['slack-briefing']. 비용 $5.7827844", "recorded_at": "2026-11-12T00:05+09:00"}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v1", "case": "impl-priority-real-be", "run": 2, "active_minutes": 25, "calls": 158, "output_tokens": 136937, "input_tokens_total": 32964698, "start_context": 49515, "max_context": 369258, "subagents": 1, "agent_calls": 1, "findings": 6, "false_findings": null, "note": "실제 템플릿 상태 실제 세션(claude -p, opus-5-5, 사용자 전역 설정 그대로, Slack 도구 막음). v1 = relayout 123fc0bf, v2 = c611b06f(프로젝트 be-* 스킬·reviewer·expert-skills 규칙). repo 규칙 검사 8개 중 통과 6, 놓친 것 ['index-not-in-alter-file', 'concurrent-index-conf']. 부른 스킬 ['supabase-postgres-best-practices', 'slack-briefing']. 비용 $12.680666399999996", "recorded_at": "2026-11-12T00:05+09:00"}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v1", "case": "impl-priority-real-be", "run": 3, "active_minutes": 21, "calls": 169, "output_tokens": 118939, "input_tokens_total": 31738305, "start_context": 49512, "max_context": 345894, "subagents": 1, "agent_calls": 1, "findings": 6, "false_findings": null, "note": "실제 템플릿 상태 실제 세션(claude -p, opus-5-5, 사용자 전역 설정 그대로, Slack 도구 막음). v1 = relayout 123fc0bf, v2 = c611b06f(프로젝트 be-* 스킬·reviewer·expert-skills 규칙). repo 규칙 검사 8개 중 통과 6, 놓친 것 ['index-not-in-alter-file', 'concurrent-index-conf']. 부른 스킬 ['supabase-postgres-best-practices', 'slack-briefing']. 비용 $12.235069000000005", "recorded_at": "2026-11-12T00:05+09:00"}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v2", "case": "impl-priority-real-be", "run": 1, "active_minutes": 28, "calls": 214, "output_tokens": 183616, "input_tokens_total": 51734893, "start_context": 49918, "max_context": 425866, "subagents": 1, "agent_calls": 1, "findings": 8, "false_findings": null, "note": "실제 템플릿 상태 실제 세션(claude -p, opus-5-5, 사용자 전역 설정 그대로, Slack 도구 막음). v1 = relayout 123fc0bf, v2 = c611b06f(프로젝트 be-* 스킬·reviewer·expert-skills 규칙). repo 규칙 검사 8개 중 통과 8, 놓친 것 []. 부른 스킬 ['slack-briefing']. 비용 $18.782086799999995", "recorded_at": "2026-11-12T00:05+09:00"}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v2", "case": "impl-priority-real-be", "run": 2, "active_minutes": 20, "calls": 113, "output_tokens": 99475, "input_tokens_total": 29713150, "start_context": 49919, "max_context": 411491, "subagents": 0, "agent_calls": 0, "findings": 8, "false_findings": null, "note": "실제 템플릿 상태 실제 세션(claude -p, opus-5-5, 사용자 전역 설정 그대로, Slack 도구 막음). v1 = relayout 123fc0bf, v2 = c611b06f(프로젝트 be-* 스킬·reviewer·expert-skills 규칙). repo 규칙 검사 8개 중 통과 8, 놓친 것 []. 부른 스킬 ['be-persistence', 'be-api-contract', 'slack-briefing']. 비용 $10.961340399999997", "recorded_at": "2026-11-12T00:05+09:00"}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v2", "case": "impl-priority-real-be", "run": 3, "active_minutes": 22, "calls": 257, "output_tokens": 179053, "input_tokens_total": 64290729, "start_context": 49919, "max_context": 416710, "subagents": 1, "agent_calls": 1, "findings": 8, "false_findings": null, "note": "실제 템플릿 상태 실제 세션(claude -p, opus-5-5, 사용자 전역 설정 그대로, Slack 도구 막음). v1 = relayout 123fc0bf, v2 = c611b06f(프로젝트 be-* 스킬·reviewer·expert-skills 규칙). repo 규칙 검사 8개 중 통과 8, 놓친 것 []. 부른 스킬 []. 비용 $None (40분 제한에 걸려 결과 JSON 없음, 파일로 채점)", "recorded_at": "2026-11-12T00:05+09:00"}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v1", "case": "start-context-fe", "run": 1, "active_minutes": 0, "start_context": 47425, "note": "실제 세션(claude -p, opus-5-5) 첫 호출 입력 토큰. v1 = 프론트 main 38c0dc7d, v2 = 그 위 b5e7f54b. 둘 다 scratchpad 복제. 세션 12e7113f. fe-* 9개는 시작 목록에 없음", "recorded_at": "2026-11-12T00:08+09:00"}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v2", "case": "start-context-fe", "run": 1, "active_minutes": 0, "start_context": 47891, "note": "실제 세션(claude -p, opus-5-5) 첫 호출 입력 토큰. v1 = 프론트 main 38c0dc7d, v2 = 그 위 b5e7f54b. 둘 다 scratchpad 복제. 세션 19891dbb. fe-* 9개는 시작 목록에 없음", "recorded_at": "2026-11-12T00:08+09:00"}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v1", "case": "start-context-fe", "run": 2, "active_minutes": 0, "start_context": 47424, "note": "실제 세션(claude -p, opus-5-5) 첫 호출 입력 토큰. v1 = 프론트 main 38c0dc7d, v2 = 그 위 b5e7f54b. 둘 다 scratchpad 복제. 세션 04328a44. fe-* 9개는 시작 목록에 없음", "recorded_at": "2026-11-12T00:08+09:00"}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v2", "case": "start-context-fe", "run": 2, "active_minutes": 0, "start_context": 47891, "note": "실제 세션(claude -p, opus-5-5) 첫 호출 입력 토큰. v1 = 프론트 main 38c0dc7d, v2 = 그 위 b5e7f54b. 둘 다 scratchpad 복제. 세션 1d028a6d. fe-* 9개는 시작 목록에 없음", "recorded_at": "2026-11-12T00:08+09:00"}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v2r", "case": "impl-priority-real-be-r2", "recorded_at": "2026-11-12T05:32+09:00", "transcript": "dffb4c40-ebc3-4d0c-ba27-ee89f150ff19", "active_minutes": 27, "calls": 150, "output_tokens": 127096, "input_tokens_total": 52773209, "start_context": 49925, "max_context": 550020, "subagents": 0, "subagent_calls": 0, "agent_calls": 0, "agent_return_chars": 0, "findings": 8, "false_findings": null, "result": "done", "note": "2차 실제 세션(claude -p, opus-5-5, 사용자 전역 설정, Slack 도구 막음). 판 5feb5a1b(c611b06f + 규칙에 파일→스킬 짝). repo 규칙 검사 8개 중 통과 8, 놓친 것 []. 분야 스킬 ['be-persistence', 'be-api-contract', 'be-docs'](첫 Edit·Write 전). 그 밖 스킬 [].", "run": 1}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v2r", "case": "impl-priority-real-be-r2", "recorded_at": "2026-11-12T05:32+09:00", "transcript": "80f7a06f-b562-42fd-92c9-6a601d5c36c3", "active_minutes": 28, "calls": 222, "output_tokens": 194020, "input_tokens_total": 57892175, "start_context": 49923, "max_context": 479912, "subagents": 1, "subagent_calls": 95, "agent_calls": 1, "agent_return_chars": 6369, "findings": 8, "false_findings": null, "result": "done", "note": "2차 실제 세션(claude -p, opus-5-5, 사용자 전역 설정, Slack 도구 막음). 판 5feb5a1b(c611b06f + 규칙에 파일→스킬 짝). repo 규칙 검사 8개 중 통과 8, 놓친 것 []. 분야 스킬 ['be-persistence', 'be-persistence', 'be-api-contract', 'be-performance', 'be-testing', 'be-docs'](첫 Edit·Write 전). 그 밖 스킬 ['slack-briefing'].", "run": 2}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v2r", "case": "impl-priority-real-be-r2", "recorded_at": "2026-11-12T05:32+09:00", "transcript": "f0f157e3-2424-4b5a-8996-13e124454de8", "active_minutes": 23, "calls": 272, "output_tokens": 186371, "input_tokens_total": 62867645, "start_context": 49920, "max_context": 450604, "subagents": 2, "subagent_calls": 123, "agent_calls": 2, "agent_return_chars": 13150, "findings": 8, "false_findings": null, "result": "done", "note": "2차 실제 세션(claude -p, opus-5-5, 사용자 전역 설정, Slack 도구 막음). 판 5feb5a1b(c611b06f + 규칙에 파일→스킬 짝). repo 규칙 검사 8개 중 통과 8, 놓친 것 []. 분야 스킬 ['be-persistence', 'be-api-contract', 'be-persistence', 'be-api-contract', 'be-testing', 'be-security', 'be-docs'](첫 Edit·Write 전). 그 밖 스킬 [].", "run": 3}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v1", "case": "impl-chip-real-fe", "recorded_at": "2026-11-12T05:32+09:00", "transcript": "d45e36da-aeb8-40fa-bfe5-27a06fa95bdf", "active_minutes": 17, "calls": 125, "output_tokens": 96949, "input_tokens_total": 17389284, "start_context": 49154, "max_context": 250386, "subagents": 1, "subagent_calls": 38, "agent_calls": 1, "agent_return_chars": 1213, "findings": 9, "false_findings": null, "result": "done", "note": "2차 실제 세션(claude -p, opus-5-5, 사용자 전역 설정, Slack 도구 막음). 판 main 38c0dc7d. repo 규칙 검사 9개 중 통과 9, 놓친 것 []. 분야 스킬 [](안 부름). 그 밖 스킬 ['slack-briefing'].", "run": 1}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v1", "case": "impl-chip-real-fe", "recorded_at": "2026-11-12T05:32+09:00", "transcript": "af9177ba-0974-42b6-9f76-900c46ec3c27", "active_minutes": 11, "calls": 75, "output_tokens": 56041, "input_tokens_total": 12082282, "start_context": 49150, "max_context": 225442, "subagents": 0, "subagent_calls": 0, "agent_calls": 0, "agent_return_chars": 0, "findings": 9, "false_findings": null, "result": "done", "note": "2차 실제 세션(claude -p, opus-5-5, 사용자 전역 설정, Slack 도구 막음). 판 main 38c0dc7d. repo 규칙 검사 9개 중 통과 9, 놓친 것 []. 분야 스킬 [](안 부름). 그 밖 스킬 ['slack-briefing'].", "run": 2}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v1", "case": "impl-chip-real-fe", "recorded_at": "2026-11-12T05:32+09:00", "transcript": "89d465e8-c84a-43ea-9d31-eaeeda0a88c3", "active_minutes": 15, "calls": 121, "output_tokens": 79329, "input_tokens_total": 15247684, "start_context": 49153, "max_context": 225456, "subagents": 1, "subagent_calls": 44, "agent_calls": 1, "agent_return_chars": 1213, "findings": 9, "false_findings": null, "result": "done", "note": "2차 실제 세션(claude -p, opus-5-5, 사용자 전역 설정, Slack 도구 막음). 판 main 38c0dc7d. repo 규칙 검사 9개 중 통과 9, 놓친 것 []. 분야 스킬 [](안 부름). 그 밖 스킬 ['slack-briefing'].", "run": 3}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v2", "case": "impl-chip-real-fe", "recorded_at": "2026-11-12T05:32+09:00", "transcript": "b495a3a7-25db-4f28-95e7-db996a15222f", "active_minutes": 20, "calls": 146, "output_tokens": 138496, "input_tokens_total": 22691156, "start_context": 49610, "max_context": 293994, "subagents": 2, "subagent_calls": 59, "agent_calls": 2, "agent_return_chars": 2426, "findings": 9, "false_findings": null, "result": "done", "note": "2차 실제 세션(claude -p, opus-5-5, 사용자 전역 설정, Slack 도구 막음). 판 b5e7f54b(fe-* 스킬·reviewer·이전 규칙). repo 규칙 검사 9개 중 통과 9, 놓친 것 []. 분야 스킬 [](안 부름). 그 밖 스킬 ['desktop-gates', 'slack-briefing'].", "run": 1}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v2", "case": "impl-chip-real-fe", "recorded_at": "2026-11-12T05:32+09:00", "transcript": "4a3e15f1-f7e3-4d9f-92ce-451ce598b788", "active_minutes": 13, "calls": 143, "output_tokens": 109081, "input_tokens_total": 21674589, "start_context": 49614, "max_context": 252278, "subagents": 1, "subagent_calls": 59, "agent_calls": 1, "agent_return_chars": 1213, "findings": 9, "false_findings": null, "result": "done", "note": "2차 실제 세션(claude -p, opus-5-5, 사용자 전역 설정, Slack 도구 막음). 판 b5e7f54b(fe-* 스킬·reviewer·이전 규칙). repo 규칙 검사 9개 중 통과 9, 놓친 것 []. 분야 스킬 ['fe-design-system', 'fe-design-system', 'fe-a11y', 'fe-testing'](첫 Edit·Write 전). 그 밖 스킬 ['slack-briefing'].", "run": 2}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v2", "case": "impl-chip-real-fe", "recorded_at": "2026-11-12T05:32+09:00", "transcript": "8bc51348-ecee-401d-87b8-becceeaff0f3", "active_minutes": 15, "calls": 131, "output_tokens": 130941, "input_tokens_total": 22150117, "start_context": 49611, "max_context": 273671, "subagents": 1, "subagent_calls": 60, "agent_calls": 1, "agent_return_chars": 1213, "findings": 9, "false_findings": null, "result": "done", "note": "2차 실제 세션(claude -p, opus-5-5, 사용자 전역 설정, Slack 도구 막음). 판 b5e7f54b(fe-* 스킬·reviewer·이전 규칙). repo 규칙 검사 9개 중 통과 9, 놓친 것 []. 분야 스킬 [](안 부름). 그 밖 스킬 [].", "run": 3}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v2r", "case": "impl-chip-real-fe", "recorded_at": "2026-11-12T05:32+09:00", "transcript": "3b808129-48b3-4f7d-a502-05b942d5760e", "active_minutes": 13, "calls": 127, "output_tokens": 107342, "input_tokens_total": 20439452, "start_context": 49643, "max_context": 247357, "subagents": 1, "subagent_calls": 54, "agent_calls": 1, "agent_return_chars": 1214, "findings": 9, "false_findings": null, "result": "done", "note": "2차 실제 세션(claude -p, opus-5-5, 사용자 전역 설정, Slack 도구 막음). 판 6805ed62(규칙에 파일→스킬 짝). repo 규칙 검사 9개 중 통과 9, 놓친 것 []. 분야 스킬 ['fe-design-system', 'fe-design-system', 'fe-a11y', 'fe-react', 'fe-testing'](첫 Edit·Write 전). 그 밖 스킬 ['desktop-gates'].", "run": 1}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v2r", "case": "impl-chip-real-fe", "recorded_at": "2026-11-12T05:32+09:00", "transcript": "c21d1f4c-378c-43c7-ba8e-1f2b70007aab", "active_minutes": 20, "calls": 162, "output_tokens": 143817, "input_tokens_total": 28628034, "start_context": 49647, "max_context": 296851, "subagents": 1, "subagent_calls": 71, "agent_calls": 1, "agent_return_chars": 4855, "findings": 9, "false_findings": null, "result": "done", "note": "2차 실제 세션(claude -p, opus-5-5, 사용자 전역 설정, Slack 도구 막음). 판 6805ed62(규칙에 파일→스킬 짝). repo 규칙 검사 9개 중 통과 9, 놓친 것 []. 분야 스킬 ['fe-design-system', 'fe-a11y', 'fe-design-system', 'fe-react'](첫 Edit·Write 전). 그 밖 스킬 ['desktop-gates', 'slack-briefing'].", "run": 2}
{"schema": 1, "kind": "eval", "task": "harness-v2-eval-real", "arm": "v2r", "case": "impl-chip-real-fe", "recorded_at": "2026-11-12T05:32+09:00", "transcript": "8f26b150-3b34-48e5-a453-8ba169008b7c", "active_minutes": 13, "calls": 133, "output_tokens": 108073, "input_tokens_total": 19774466, "start_context": 49644, "max_context": 247277, "subagents": 1, "subagent_calls": 48, "agent_calls": 1, "agent_return_chars": 1214, "findings": 9, "false_findings": null, "result": "done", "note": "2차 실제 세션(claude -p, opus-5-5, 사용자 전역 설정, Slack 도구 막음). 판 6805ed62(규칙에 파일→스킬 짝). repo 규칙 검사 9개 중 통과 9, 놓친 것 []. 분야 스킬 ['fe-design-system', 'fe-design-system', 'fe-a11y', 'fe-react', 'fe-testing'](첫 Edit·Write 전). 그 밖 스킬 [].", "run": 3}
+1 -1
View File
@@ -133,7 +133,7 @@
| C3 | architecture | 사용자 전역 설정 | 응답 언어를 설정으로 고정할 수 있는지 확인한다. H11 뒤에도 영어 초안이 9번 막혔다 | 5절 |
| C4 | user(권한) | 소유자 권한 설정 | 리뷰를 마친 PR 병합, 공개 repo 만들기처럼 분류기가 막는 일을 소유자가 미리 허락하는 규칙. 총괄 세션의 승인은 하위 세션에 넘어가지 않는다 | h2 약 10시간 대기, p1 소유자 개입 2, x2 PR 병합 막힘 |
| C5 | instructions | 백엔드 템플릿 장부 | 아래 7절의 retro 줄 3개를 더한다. 그래야 그 repo의 넛지가 멈추고 `calib-median` 판정이 그 장부에서도 돈다 | 3절 |
| C6 | gate | 사용자 전역 훅과 이 repo `guard_bash.py`(둘을 같이) | main checkout 안 worktree(`.claude/worktrees/…`)에서 `rm -rf ./*`(worktree 자신)와 `rm -rf ../옆-worktree`가 통과한다. H12 허용 폴더에 main checkout이 들어가서다. 이 repo 시험에 알려진 빈틈(`expectedFailure`)으로 표시했다. 고치면 그 시험이 「뜻밖의 통과」로 실패해 표시를 지우게 한다 | 이번 `check.sh` |
| C6 | gate | 사용자 전역 훅과 이 repo `guard_bash.py`(둘을 같이) | main checkout 안 worktree(`.claude/worktrees/…`)에서 `rm -rf ./*`(worktree 자신)와 `rm -rf ../옆-worktree`가 통과한다. H12 허용 폴더에 main checkout이 들어가서다. 이 repo 시험에 알려진 빈틈(`expectedFailure`)으로 표시했다. 고치면 그 시험이 「뜻밖의 통과」로 실패해 표시를 지우게 한다. **2026-11-13 고침**: 등록된 worktree를 통째로 지우거나 옆 worktree 안을 지우면 막는다(플러그인 0.3.1과 전역 훅의 같은 절, `docs/README.md` 15번) | 이번 `check.sh` |
| C7 | instructions | design-docs 위임 매뉴얼 8절 | 위임 장부에는 회고했는지 적는 자리가 없다. `estimate_ref`가 있는 줄은 그 repo 장부의 retro 줄로, 없는 줄은 이 문서 같은 회고 기록으로 닫는다고 한 줄 | 회고 0 |
## 7. 백엔드 장부에 더할 retro 줄 (C5)
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "harness",
"displayName": "Harness",
"version": "0.3.0",
"version": "0.3.1",
"description": "프로젝트와 상관없는 공통 하네스: 되돌릴 수 없는 명령 차단(H12), 비밀 값 알림(N4), 예측·실측 장부 훅, 회고 넛지, estimate·retro·techdebt 스킬, 분야 전문가 협업(lead·new-expert)과 하네스 판 비교(harness-eval)",
"author": {
"name": "donghyeon.kang"
+42 -5
View File
@@ -7,6 +7,9 @@
보내는 force push는 운반이라 통과하되, 보호 브랜치를 덮거나 대상 ref가 없으면 막는다.
- `rm -r`: 대상이 이 세션의 git 작업 폴더·/tmp·앱 임시 작업 폴더 밖이거나, 너무 넓다
(`/`, `~`, `~/workspace/<묶음>`, `.git`, 빈 변수로 `/`가 되는 경로, `폴더/*`로 작업 폴더를 통째 비움).
작업 폴더 안이라도 git checkout(등록된 worktree 포함)이나 그것을 품은 폴더를 통째로 지우거나, 옆 worktree
안을 지우면 막는다(main checkout 안 worktree에서 `rm -rf ./*`, `rm -rf ../옆-worktree`, `rm -rf ../옆-worktree/src`).
/tmp·앱 임시 작업 폴더 아래는 예외다.
- DB·볼륨·migration 삭제: SQL 클라이언트의 DROP DATABASE·SCHEMA·TABLE·TRUNCATE, redis FLUSHALL·FLUSHDB,
flyway clean·flywayClean, liquibase drop-all, `-p` 없는 compose `down -v`, `volume rm|prune`,
`system prune --volumes`, `kubectl delete pvc|pv|ns`.
@@ -410,6 +413,7 @@ VAR_RE = re.compile(r"\$(?:\{([A-Za-z_][A-Za-z0-9_]*)([^}]*)\}|([A-Za-z_][A-Za-z
OPAQUE = "\x00" # 명령 치환처럼 값을 알 수 없지만 비지 않는 값
H12_HOME = os.path.expanduser("~")
H12_TMP = "/tmp/claude-%d" % os.getuid()
H12_TEMP_ROOTS = ("/tmp", os.path.join(H12_HOME, ".config", "Claude", "scratch-workspaces"))
H12_HOME_KEEP = {".ssh", ".config", ".local", ".claude", ".gradle", ".m2", ".cache", ".kube", ".docker",
"workspace", "Documents", "Desktop", "Downloads"}
@@ -517,10 +521,12 @@ class H12Visitor:
remote가 참이면 ssh 원격 명령이다. 원격은 작업 폴더를 모르므로 너무 넓은 대상만 막는다.
"""
def __init__(self, cwd, roots, remote=False):
def __init__(self, cwd, roots, checkouts=(), foreign=(), remote=False):
self.home = "~" if remote else H12_HOME
self.cwd = cwd
self.roots = roots
self.checkouts = checkouts
self.foreign = foreign
self.remote = remote
self.vars = {}
self.raw = self.remember
@@ -586,6 +592,16 @@ class H12Visitor:
return "rm -r %s(너무 넓은 대상: %s)" % (t, path)
if not self.remote and not any(under_root(path, r) for r in self.roots):
return "rm -r %s(이 작업 폴더·scratchpad 밖: %s)" % (t, path)
if not any(under_root(path, r) for r in H12_TEMP_ROOTS):
# 허용 폴더(main checkout) 안이라도 checkout 자신이나 그것을 품은 폴더는 통째로 지우지 않고,
# 옆 worktree 안도 지우지 않는다. main checkout 안 worktree에서 worktree 자신(`./*`),
# 옆 worktree(`../x`), 그 안(`../x/src`)을 지우는 것을 막는다
hit = next((c for c in self.checkouts if path == c or under_root(c, path)), None)
if hit:
return "rm -r %s(git checkout 통째: %s)" % (t, hit)
hit = next((c for c in self.foreign if under_root(path, c)), None)
if hit:
return "rm -r %s(다른 worktree 안: %s)" % (t, hit)
return None
def __call__(self, argv, heredocs):
@@ -656,8 +672,15 @@ def data_violation(argv, heredocs):
def h12_roots(cwd):
"""rm -r을 허용하는 폴더: 프로젝트와 cwd의 git 작업 폴더(와 그 main checkout), /tmp, 앱 임시 작업 폴더."""
roots = ["/tmp", os.path.join(H12_HOME, ".config", "Claude", "scratch-workspaces")]
"""(rm -r을 허용하는 폴더, 지킬 checkout, 옆 worktree).
허용 폴더: 프로젝트와 cwd의 git 작업 폴더(와 그 main checkout), /tmp, 앱 임시 작업 폴더.
지킬 checkout: 그 작업 폴더들과, 그 repo에 등록된 모든 worktree. 허용 폴더 안에 있어도 통째로 지우지 못한다.
옆 worktree: 지킬 checkout 중 이 세션 작업 폴더와 같지도, 그것을 품지도, 그 안에 있지도 않은 것. 그 안도 못 지운다.
이 세션 작업 폴더는 cwd의 checkout이고, cwd가 git 밖일 때만 프로젝트 폴더의 checkout이다. 세션의 프로젝트 폴더가
main checkout이고 cwd가 그 안 worktree일 때 옆 worktree를 남의 것으로 보기 위해서다.
"""
roots, checkouts, tops = list(H12_TEMP_ROOTS), set(), {}
for start in {os.environ.get("CLAUDE_PROJECT_DIR"), cwd} - {None, ""}:
if not os.path.isdir(start):
continue
@@ -671,7 +694,20 @@ def h12_roots(cwd):
out = os.path.dirname(out)
if out and not too_broad(os.path.realpath(out), H12_HOME):
roots.append(os.path.realpath(out))
return roots
checkouts.add(os.path.realpath(out))
if args[-1] == "--show-toplevel":
tops[start] = os.path.realpath(out)
try:
r = subprocess.run(["git", "-C", start, "worktree", "list", "--porcelain"],
capture_output=True, text=True, timeout=5)
except (OSError, subprocess.SubprocessError):
continue
if r.returncode == 0:
checkouts.update(os.path.realpath(line[len("worktree "):]) for line in r.stdout.splitlines()
if line.startswith("worktree "))
mine = tops.get(cwd) or tops.get(os.environ.get("CLAUDE_PROJECT_DIR"))
foreign = [c for c in checkouts if mine and not (c == mine or under_root(mine, c) or under_root(c, mine))]
return roots, sorted(checkouts), sorted(foreign)
H12_HINTS = {
@@ -694,7 +730,8 @@ def check_h12(command, cwd=None):
"""H12 막을 이유(메시지). 통과면 None."""
if not re.search(r"(?i)push|rm|drop|truncate|flush|clean|down|volume|prune|delete", command):
return None
what = walk(command, H12Visitor(os.path.realpath(cwd) if cwd else None, h12_roots(cwd)))
roots, checkouts, foreign = h12_roots(cwd)
what = walk(command, H12Visitor(os.path.realpath(cwd) if cwd else None, roots, checkouts, foreign))
if not what:
return None
return H12_MESSAGE.format(what=what, hint=H12_HINTS[what.split(":", 1)[0]])
+82 -16
View File
@@ -6,6 +6,7 @@
"""
import json
import os
import shutil
import subprocess
import sys
import tempfile
@@ -13,11 +14,8 @@ import unittest
SCRIPTS = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "scripts")
REPO = os.path.dirname(os.path.dirname(os.path.dirname(SCRIPTS)))
_COMMON = subprocess.run(["git", "-C", REPO, "rev-parse", "--path-format=absolute", "--git-common-dir"],
capture_output=True, text=True).stdout.strip()
# main checkout 안에 만든 worktree(.claude/worktrees/…)에서 도는가. 이때 H12 허용 폴더에 main checkout이 들어가
# worktree 자신(`rm -rf ./*`)이나 옆 worktree(`../x`)를 지우는 것이 통과한다(알려진 빈틈, 전역 훅과 같이 고친다)
NESTED_WORKTREE = bool(_COMMON) and os.path.realpath(REPO).startswith(os.path.dirname(os.path.realpath(_COMMON)) + "/")
# 시험용 checkout을 둘 /tmp 밖 후보. H12는 /tmp 아래 rm을 일부러 허용하므로 /tmp 안에서는 작업 폴더 판정이 안 보인다
OUTSIDE_TMP_BASES = ("/var/tmp", os.path.expanduser("~"))
def run(script, args=(), payload=None, env=None, cwd=None):
@@ -33,20 +31,38 @@ def bash(command, cwd=REPO):
"tool_input": {"command": command}, "cwd": cwd}
class GuardBashTest(unittest.TestCase):
"""H12. 여기 사례는 판정의 대표만 둔다. 많은 사례는 소유자 기계 전역 훅 시험에 있다."""
def git(cwd, *args):
"""시험용 git. 사용자 설정(서명·훅·기본 브랜치)에 따라 결과가 달라지지 않게 부른다."""
subprocess.run(["git", "-c", "user.name=t", "-c", "user.email=t@example.com", "-c", "commit.gpgsign=false",
"-c", "core.hooksPath=/dev/null", "-c", "init.defaultBranch=main", "-C", cwd, *args],
check=True, capture_output=True, text=True, timeout=30)
def outside_tmp_base():
"""OUTSIDE_TMP_BASES 중 쓸 수 있는 첫 폴더. 없으면 시험을 건너뛰지 않고 오류로 멈춘다."""
for base in OUTSIDE_TMP_BASES:
real = os.path.realpath(base)
if os.path.isdir(real) and os.access(real, os.W_OK) and not (real + "/").startswith("/tmp/"):
return real
raise RuntimeError("/tmp 밖에 시험용 checkout을 만들 곳이 없다: %s" % ", ".join(OUTSIDE_TMP_BASES))
class H12Asserts:
ALWAYS = {"HARNESS_H12": "always"}
def assert_blocked(self, command, cwd=REPO):
r = run("guard_bash.py", payload=bash(command, cwd), env=self.ALWAYS)
def assert_blocked(self, command, cwd=REPO, env=None):
r = run("guard_bash.py", payload=bash(command, cwd), env={**self.ALWAYS, **(env or {})})
self.assertEqual(r.returncode, 2, "막혀야 한다: %s\n%s" % (command, r.stderr))
self.assertIn("[H12", r.stderr)
def assert_passed(self, command, cwd=REPO):
r = run("guard_bash.py", payload=bash(command, cwd), env=self.ALWAYS)
def assert_passed(self, command, cwd=REPO, env=None):
r = run("guard_bash.py", payload=bash(command, cwd), env={**self.ALWAYS, **(env or {})})
self.assertEqual(r.returncode, 0, "통과해야 한다: %s\n%s" % (command, r.stderr))
class GuardBashTest(H12Asserts, unittest.TestCase):
"""H12. 여기 사례는 판정의 대표만 둔다. 많은 사례는 소유자 기계 전역 훅 시험에 있다."""
def test_force_push_to_hosting_remote_is_blocked(self):
for c in ("git push --force origin main", "git push -f", "git push origin +feature/x",
"git push --force-with-lease origin claude/x", "git push --mirror origin",
@@ -67,11 +83,6 @@ class GuardBashTest(unittest.TestCase):
"ssh build 'rm -rf ~/workspace/some-repo'"):
self.assert_blocked(c)
@(unittest.expectedFailure if NESTED_WORKTREE else (lambda f: f))
def test_rm_whole_checkout_or_sibling_is_blocked(self):
for c in ("rm -rf ./*", "rm -rf ../other-repo/src"):
self.assert_blocked(c)
def test_rm_inside_project_tmp_and_known_vars_pass(self):
for c in ("rm -rf build dist", "rm -rf /tmp/some-build-x", 'T=$(mktemp -d) && rm -rf "$T"',
"S=/tmp/x; rm -rf $S/out", 'rm -rf "${OUT:?}/build"', "ssh build 'rm -rf ~/x-logs'"):
@@ -109,6 +120,61 @@ class GuardBashTest(unittest.TestCase):
self.assertEqual(r.returncode, 1)
class GuardRmCheckoutTest(H12Asserts, unittest.TestCase):
"""H12가 작업 폴더 안 삭제는 통과시키고 작업 폴더 자신·옆 폴더 삭제는 막는지.
이 repo의 checkout을 cwd로 쓰면 결과가 checkout 위치에 따라 달라진다(/tmp 아래면 /tmp 허용에 걸려 통과하고,
main checkout 안의 worktree면 main checkout 허용에 걸려 통과한다). 그래서 /tmp 밖에 checkout과 그 안의
worktree를 직접 만들어 cwd로 넘긴다.
"""
@classmethod
def setUpClass(cls):
base = tempfile.mkdtemp(prefix="h12-test-", dir=outside_tmp_base())
cls.addClassCleanup(shutil.rmtree, base, True)
cls.checkout = os.path.join(base, "repo")
git(base, "init", "-q", cls.checkout)
git(cls.checkout, "commit", "-q", "--allow-empty", "-m", "init")
cls.worktree = os.path.join(cls.checkout, ".claude", "worktrees", "w")
cls.sibling = os.path.join(cls.checkout, ".claude", "worktrees", "w2")
for wt in (cls.worktree, cls.sibling):
git(cls.checkout, "worktree", "add", "-q", "--detach", wt)
# scratchpad처럼 /tmp 아래 둔 worktree. /tmp 아래는 일부러 허용하므로 통째로 지워도 통과해야 한다
cls.tmp_worktree = os.path.join(tempfile.mkdtemp(prefix="h12-test-", dir="/tmp"), "wt")
cls.addClassCleanup(shutil.rmtree, os.path.dirname(cls.tmp_worktree), True)
git(cls.checkout, "worktree", "add", "-q", "--detach", cls.tmp_worktree)
def test_rm_inside_checkout_and_worktree_passes(self):
# 둘 다 허용 폴더로 잡힌다. 아래 시험이 막히는 것은 위치를 몰라서가 아니라 대상이 넓어서다
for cwd in (self.checkout, self.worktree):
for c in ("rm -rf build", "rm -rf build dist node_modules/.cache", "rm -rf ./out/*"):
self.assert_passed(c, cwd=cwd)
self.assert_passed("rm -rf ../../build", cwd=self.worktree) # main checkout 안, worktree 밖(.claude/build)
self.assert_passed("rm -rf .claude/worktrees/w/build", cwd=self.checkout) # main checkout이 worktree 안을 치운다
def test_rm_tmp_worktree_passes(self):
for cwd in (self.checkout, self.worktree):
self.assert_passed("rm -rf %s" % self.tmp_worktree, cwd=cwd)
def test_rm_whole_checkout_or_sibling_is_blocked(self):
for c in ("rm -rf ./*", "rm -rf ../other-repo/src", "rm -rf .claude/worktrees", "rm -rf .claude/worktrees/w"):
self.assert_blocked(c, cwd=self.checkout)
def test_rm_nested_worktree_itself_or_sibling_is_blocked(self):
"""main checkout 안 worktree에서 worktree 자신, 옆 worktree, 그 안, 둘을 품은 폴더를 지우지 못한다."""
for c in ("rm -rf ./*", "rm -rf ../w2", "rm -rf ../w2/src", "rm -rf ..", "rm -rf ../.."):
self.assert_blocked(c, cwd=self.worktree)
def test_project_dir_main_checkout_still_guards_nested_worktree(self):
"""앱이 worktree 세션의 CLAUDE_PROJECT_DIR를 main checkout으로 줄 때도 같은 판정이다(세션 cwd가 먼저다)."""
env = {"CLAUDE_PROJECT_DIR": self.checkout}
for c in ("rm -rf ./*", "rm -rf ../w2", "rm -rf ../w2/src"):
self.assert_blocked(c, cwd=self.worktree, env=env)
for c in ("rm -rf build", "rm -rf ../../build"):
self.assert_passed(c, cwd=self.worktree, env=env)
self.assert_passed("rm -rf .claude/worktrees/w/build", cwd=self.checkout, env=env)
class NudgeSecretsTest(unittest.TestCase):
def nudge(self, content, tool="Write"):
key = "content" if tool == "Write" else "new_string"
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "redteam",
"displayName": "Red Team",
"version": "0.1.0",
"version": "0.1.2",
"description": "두 템플릿을 공격하는 red team 장치: 역할별 서브에이전트(정찰·인증/인가·입력·의존성·설정·프론트), 발동 스킬, 핀 고정 오픈소스 도구 실행 래퍼와 발견 수집 도구. 훅은 두지 않는다(요청할 때만 돈다).",
"author": {
"name": "donghyeon.kang"
+2 -1
View File
@@ -28,7 +28,8 @@
1. **근본 원인**을 적는다.
2. **전 코드에서 같은 모양**을 찾는다(한 곳의 버그는 보통 한 부류다).
3. **막는 시험**: 재현(RED) → 고침 → 통과(GREEN). 재분류(오탐·by-design)면 근거를 적고 의도를 시험/주석으로 고정한다.
4. 보고서는 각 템플릿 `docs/reviews/<날짜>-redteam-*.md`에.
4. **커밋 전 포맷 게이트**: 바뀐 파일에 대상 repo의 포맷터를 돌린다(자바 템플릿은 `./gradlew spotlessApply` → `spotlessCheck`). 시험만 돌리고 포맷 검사를 건너뛰면 CI `pr / gradle`(spotlessCheck)에서 깨진다.
5. 보고서는 각 템플릿 `docs/reviews/<날짜>-redteam-*.md`에.
## 5. 재실행 — 두 회차 연속 0
회차마다 **무엇을 새로 봤는지** 적는다(새 capability·새 벡터·수정 뒤 재공격). red team 장치를 다시 돌려 고친 발견이 다시 안 나옴을 보이고, **두 회차 연속 새 발견이 0일 때** 끝.
+2 -2
View File
@@ -19,13 +19,13 @@
## 도구와 라이선스
| 도구 | 라이선스 | 비고 |
|---|---|---|
| gitleaks | MIT | 비밀 값 |
| gitleaks | MIT | 비밀 값(`--redact`로 결과 파일에 값 원문을 남기지 않음) |
| semgrep CE | 엔진 LGPL-2.1 | SAST(공식 이미지, 룰은 런타임·`--metrics=off`로 코드 안 보냄) |
| trivy | Apache-2.0 | 의존성/이미지 — 기존 게이트와 공유 |
| osv-scanner | Apache-2.0 | lockfile 교차검증 |
| checkov | Apache-2.0 | IaC·compose·Dockerfile |
| hadolint | GPL-3.0 | Dockerfile(실행만) |
| OWASP ZAP | Apache-2.0 | DAST baseline·api |
| OWASP ZAP | Apache-2.0 | DAST baseline·api(`-z "-silent"`로 텔레메트리·업데이트 확인을 끔) |
| nuclei | MIT | 노출 템플릿(로컬 대상만) |
| schemathesis | MIT | OpenAPI 퍼징 |
| trufflehog | AGPL-3.0 | 심층 비밀 값(실행만, 배포 안 함) |
+8 -5
View File
@@ -4,11 +4,12 @@
# bash redteam-scan.sh <mode> --target <소스경로|URL> --out <결과폴더> [옵션]
#
# 모드:
# secrets gitleaks: 소스·git 히스토리의 비밀 값
# secrets gitleaks: 소스·git 히스토리의 비밀 값(--redact로 결과에 값 원문을 남기지 않음)
# sast semgrep CE: 정적 분석(룰은 런타임에 레지스트리에서, --metrics=off로 코드 안 보냄)
# deps trivy fs: 의존성 취약점(HIGH/CRIT 요약)
# config checkov + hadolint: compose·Dockerfile·IaC 오구성
# dast-baseline OWASP ZAP baseline: 띄운 앱에 수동(passive) 스캔(헤더·쿠키·CSP)
# dast-baseline OWASP ZAP baseline: 띄운 앱에 수동(passive) 스캔(헤더·쿠키·CSP). ZAP은 -silent로
# call home(텔레메트리·업데이트 확인·뉴스)을 끈다(dast-api도 같다)
# dast-api ZAP api-scan + schemathesis: OpenAPI 기반 능동·퍼징 (--api 필요)
# nuclei nuclei: 알려진 노출·오구성 템플릿 (대상은 내 로컬 URL만)
# pin tools.lock의 모든 도구를 받아 실제 digest를 출력(고정에 붙여 쓴다)
@@ -89,9 +90,11 @@ case "${MODE}" in
do_pin
;;
secrets)
# --redact: 찾은 값 원문 대신 REDACTED를 쓴다. 이 결과를 읽는 에이전트 컨텍스트에 비밀 값이 들어가지 않게.
# 위치(파일·줄·커밋·규칙)는 그대로 남으니 고칠 곳을 찾는 데는 모자라지 않다.
ref="$(image_ref gitleaks)"; ensure_image "${ref}"
docker run --rm -v "${TARGET}:/repo:ro" "${ref}" \
detect --source=/repo --no-banner --report-format json --report-path /dev/stdout \
detect --source=/repo --no-banner --redact --report-format json --report-path /dev/stdout \
> "${OUT}/secrets.json" 2> "${OUT}/secrets.log" || true
echo "→ ${OUT}/secrets.json"
;;
@@ -126,7 +129,7 @@ case "${MODE}" in
[ -n "${TARGET}" ] || { echo "--target <URL> 필요" >&2; exit 2; }
ref="$(image_ref zap)"; ensure_image "${ref}"
docker run --rm "${netarg[@]}" -v "${OUT}:/zap/wrk:rw" "${ref}" \
zap-baseline.py -t "${TARGET}" -J dast-baseline.json -r dast-baseline.html \
zap-baseline.py -t "${TARGET}" -J dast-baseline.json -r dast-baseline.html -z "-silent" \
> "${OUT}/dast-baseline.log" 2>&1 || true
echo "→ ${OUT}/dast-baseline.json"
;;
@@ -134,7 +137,7 @@ case "${MODE}" in
[ -n "${API}" ] || { echo "--api <OpenAPI URL|파일> 필요" >&2; exit 2; }
ref="$(image_ref zap)"; ensure_image "${ref}"
docker run --rm "${netarg[@]}" -v "${OUT}:/zap/wrk:rw" "${ref}" \
zap-api-scan.py -t "${API}" -f openapi -J dast-api.json -r dast-api.html \
zap-api-scan.py -t "${API}" -f openapi -J dast-api.json -r dast-api.html -z "-silent" \
> "${OUT}/dast-api.log" 2>&1 || true
st="$(image_ref schemathesis)"; ensure_image "${st}"
docker run --rm "${netarg[@]}" "${st}" \
+1
View File
@@ -66,6 +66,7 @@ python3 "${CLAUDE_PLUGIN_ROOT}/scripts/finding.py" summary findings.jsonl # o
## 6. 고침과 재실행
- 발견마다 **막는 시험**을 더한다: 재현(RED) → 고침 → 통과(GREEN). 템플릿 게이트 rc=0.
- **커밋 전 포맷 게이트:** 바뀐 파일에 대상 repo의 포맷터를 돌린다(자바 템플릿은 `./gradlew spotlessApply` 뒤 `spotlessCheck`). 모듈 시험만 돌리고 포맷 게이트를 건너뛰면 runner `pr / gradle`의 spotlessCheck에서 깨진다.
- 고치지 않는 것은 근거를 적고 `status: accepted|wontfix`로 소유자 결정 칸에.
- 끝에 red team 장치를 **다시 돌려** open 발견이 다시 나오지 않음을 보인다(회귀 0).
+58
View File
@@ -6,6 +6,7 @@ finding.py의 정규화·검사·정렬·보고 로직과, tools.lock·redteam-s
"""
import json
import os
import shutil
import subprocess
import sys
import tempfile
@@ -150,5 +151,62 @@ class ScanScriptTest(unittest.TestCase):
self.assertIn(mode, r.stdout + r.stderr, "help에 모드 없음: %s" % mode)
FAKE_DOCKER = """#!/usr/bin/env bash
# 시험용 docker: 받은 인자를 한 줄(\\x1f로 구분)로 남기고, 이미지가 이미 있다고 답한다.
printf '%s\\x1f' "$@" >> "$FAKE_DOCKER_LOG"; printf '\\n' >> "$FAKE_DOCKER_LOG"
exit 0
"""
class ScanEgressTest(unittest.TestCase):
"""도구가 찾은 비밀 값 원문을 결과 파일에 남기지 않고, 밖으로 사용 정보를 보내지 않게 부르는지 본다.
가짜 docker로 redteam-scan.sh가 실제로 넘기는 인자를 받아 확인한다(docker를 띄우지 않는다).
"""
def setUp(self):
self.dir = tempfile.mkdtemp()
os.makedirs(os.path.join(self.dir, "bin"))
docker = os.path.join(self.dir, "bin", "docker")
with open(docker, "w", encoding="utf-8") as fh:
fh.write(FAKE_DOCKER)
os.chmod(docker, 0o755)
self.log = os.path.join(self.dir, "docker.log")
def tearDown(self):
shutil.rmtree(self.dir, ignore_errors=True)
def run_calls(self, *args):
"""모드를 돌리고 `docker run` 호출마다 인자 목록을 돌려준다."""
# 필요한 값만 넘긴다: 가짜 docker가 먼저 잡히는 PATH와 기록 파일.
env = {"PATH": os.path.join(self.dir, "bin") + os.pathsep + os.defpath, "FAKE_DOCKER_LOG": self.log}
r = subprocess.run(["bash", os.path.join(SCRIPTS, "redteam-scan.sh"), *args,
"--out", os.path.join(self.dir, "out")],
capture_output=True, text=True, timeout=30, env=env)
self.assertEqual(r.returncode, 0, r.stderr)
with open(self.log, encoding="utf-8") as fh:
calls = [line.rstrip("\n").rstrip("\x1f").split("\x1f") for line in fh if line.strip()]
return [c for c in calls if c[:1] == ["run"]]
def test_secrets_redacts_values_in_report(self):
calls = self.run_calls("secrets", "--target", self.dir)
self.assertEqual(len(calls), 1)
self.assertIn("--redact", calls[0], "gitleaks 결과 파일에 비밀 값 원문이 남는다")
def test_sast_keeps_metrics_off(self):
calls = self.run_calls("sast", "--target", self.dir)
self.assertIn("--metrics=off", calls[0])
def test_zap_runs_silent(self):
for args, script in ((("dast-baseline", "--target", "http://127.0.0.1:9"), "zap-baseline.py"),
(("dast-api", "--api", "http://127.0.0.1:9/openapi.json"), "zap-api-scan.py")):
open(self.log, "w").close()
zap = [c for c in self.run_calls(*args) if script in c]
self.assertEqual(len(zap), 1, script)
c = zap[0]
self.assertIn("-z", c, "%s에 ZAP 옵션(-z)이 없다" % script)
self.assertIn("-silent", c[c.index("-z") + 1].split(), "%s가 ZAP call home(텔레메트리·업데이트 확인)을 끄지 않는다" % script)
if __name__ == "__main__":
unittest.main()