From 5edd1bc39b5197bdb37b099bda45d55a5e28ff13 Mon Sep 17 00:00:00 2001 From: Enrico Piovesan Date: Tue, 7 Jul 2026 18:20:46 -0600 Subject: [PATCH] Gate hygiene warning: accept declared-canonical AGENTS.md A coordination-only AGENTS.md that declares CLAUDE.md canonical is compliant regardless of size; warn only when neither file defers. --- .github/workflows/reusable-governance.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/reusable-governance.yml b/.github/workflows/reusable-governance.yml index 359e13d..f37e626 100644 --- a/.github/workflows/reusable-governance.yml +++ b/.github/workflows/reusable-governance.yml @@ -61,10 +61,13 @@ jobs: echo "::warning file=$f::hardcoded '$stale' but .governance-version is $ver — never write version numbers in prose, point at .governance-version" fi done + # A substantial AGENTS.md is fine when it declares CLAUDE.md canonical + # (coordination-only content); warn only when neither file defers. if [ -e CLAUDE.md ] && [ -e AGENTS.md ]; then c=$(wc -c < CLAUDE.md); a=$(wc -c < AGENTS.md) - if [ "$c" -gt 2000 ] && [ "$a" -gt 2000 ]; then - echo "::warning::CLAUDE.md (${c}B) and AGENTS.md (${a}B) are both substantial — one must be canonical, the other a pointer plus tool-specific coordination only (docs/ai-agent-hardening.md)" + if [ "$c" -gt 2000 ] && [ "$a" -gt 2000 ] \ + && ! grep -qiE "canonical.*(CLAUDE|AGENTS)\.md" CLAUDE.md AGENTS.md; then + echo "::warning::CLAUDE.md (${c}B) and AGENTS.md (${a}B) are both substantial and neither declares the other canonical — one must be canonical, the other a pointer plus tool-specific coordination only (docs/ai-agent-hardening.md)" fi fi if [ -e CLAUDE.md ] && [ "$(wc -c < CLAUDE.md)" -gt 8192 ]; then