Skip to content

chore(scripts): add cross-layer frontmatter parity check to check_agents#741

Merged
kcenon merged 1 commit into
developfrom
chore/issue-738-frontmatter-parity-gate
Jun 13, 2026
Merged

chore(scripts): add cross-layer frontmatter parity check to check_agents#741
kcenon merged 1 commit into
developfrom
chore/issue-738-frontmatter-parity-gate

Conversation

@kcenon

@kcenon kcenon commented Jun 13, 2026

Copy link
Copy Markdown
Owner

변경 내용

scripts/check_agents.sh와 PowerShell twin scripts/check_agents.ps1에 레이어 간 frontmatter parity 검사를 추가했다. 두 레이어(plugin/agents/project/.claude/agents/)의 동작 관련 frontmatter 필드 tools / permissionMode가 다르면 실패(exit 2)한다.

배경

기존 check_agents는 frontmatter를 strip하고 에이전트 본문만 비교했다. 그래서 #729에서 고친 permissionMode 레이어 drift(plugin 사본 누락)가 CI에서 잡히지 않고 조용히 출하되었다. 동작 필드의 정합성 게이트를 추가해 같은 유형의 silent capability drift 재발을 차단한다.

구현

  • --- frontmatter 블록에서 지정 키의 값을 추출하는 헬퍼(frontmatter_field / Get-FrontmatterField)를 추가.
  • 각 에이전트에 대해 toolspermissionMode 값을 두 레이어에서 비교, 불일치(한쪽에만 존재 포함) 시 FAIL: frontmatter '<field>' drift for <agent> 출력 + exit 2.
  • tools / permissionMode 비교한다. color(project 전용, 의도된 차이)와 그 외 필드는 비교하지 않아 향후 의도된 per-layer diff를 막지 않는다.
  • 기존 본문 비교 로직·set -euo pipefail·exit 코드(0/2)는 그대로 유지.
  • tests/scripts/test-check-agents.sh에 회귀 케이스 3건 추가: tools drift → exit 2, permissionMode drift → exit 2, color만 다름 → exit 0(의도된 제외 검증). macOS BSD / Linux GNU 호환을 위해 portable replace_in_file 헬퍼 사용.
  • docs/CUSTOM_EXTENSIONS.md의 CI enforcement 단락에 frontmatter parity 검사 추가 사실을 명문화.

검증

  • bash scripts/check_agents.shOK (8 agent pairs: bodies + behavioral frontmatter in sync), exit 0 (현재 상태 — fix(agents): permissionMode acceptEdits missing from plugin copies of write agents #729 정렬 후 통과)
  • 음성 테스트: qa-reviewertools를 한 레이어에서만 바꾸면 exit 2 + drift FAIL, 복구 후 다시 OK
  • bash tests/scripts/test-check-agents.sh7 passed, 0 failed
  • 에이전트 정의 파일은 변경하지 않음
  • pwsh 미설치 환경이라 .ps1은 로직 미러링만(로컬 실행 검증 생략)

비고

적대적 검토 반영: 전체 frontmatter blanket 비교가 아니라 tools / permissionMode 두 동작 필드로 한정하고 color는 allowlist로 제외하여, false positive와 향후 의도된 차이 차단을 모두 피했다.

Closes #738
Part of #726

check_agents.sh and its PowerShell twin previously stripped frontmatter and compared only the agent bodies, so the permissionMode layer drift fixed in #729 shipped silently. Add a parity check on the behavioral frontmatter fields tools and permissionMode across the plugin and project copies (fail with exit 2 on mismatch); color stays exempt as an intended project-only field. Adds regression cases (tools drift, permissionMode drift, color-only diff) and updates the CUSTOM_EXTENSIONS.md CI-enforcement note.
@kcenon kcenon merged commit 9c13ad1 into develop Jun 13, 2026
1 check passed
@kcenon kcenon deleted the chore/issue-738-frontmatter-parity-gate branch June 13, 2026 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant