Derive originality check's division set from divisions.json (#659)

check-agent-originality.sh hardcoded its own copy of the division list
(AGENT_DIRS) in the Python heredoc — a 5th copy that check-divisions.sh's
bash-array parser never saw, so it drifted: it was missing `gis` and
`security` and still carried the retired `strategy`. The practical effect
was that every gis/ and security/ agent — including newly added ones —
skipped the duplicate-detection scan entirely.

Read divisions.json directly instead of hardcoding, so this check can
never drift from the catalog again. Now scans all 16 divisions; verified
green in full-audit mode.

Supersedes #649/#650, which patch the hardcoded constants rather than
removing them.


Claude-Session: https://claude.ai/code/session_01WKnDRWM4izsB8WAXKszhsq

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Michael Sitarzewski
2026-07-05 12:52:12 -05:00
committed by GitHub
parent 384dbbd2a8
commit 217a63b8b6
+7 -4
View File
@@ -41,15 +41,18 @@ ORIGINALITY_FAIL="${ORIGINALITY_FAIL:-40}" \
ORIGINALITY_WARN="${ORIGINALITY_WARN:-20}" \
REPO_ROOT="$REPO_ROOT" \
python3 - "$@" <<'PYEOF'
import os, re, sys, glob
import os, re, sys, glob, json
REPO_ROOT = os.environ["REPO_ROOT"]
FAIL = float(os.environ["ORIGINALITY_FAIL"])
WARN = float(os.environ["ORIGINALITY_WARN"])
AGENT_DIRS = ("academic design engineering finance game-development marketing "
"paid-media product project-management sales spatial-computing "
"specialized strategy support testing").split()
# Division set — divisions.json (repo root) is the single source of truth, and
# scripts/check-divisions.sh (CI) enforces it against the directories on disk.
# Read it directly rather than hardcoding the list here so this check can never
# drift out of sync with the catalog the way a copied literal silently would.
with open(os.path.join(REPO_ROOT, "divisions.json")) as _fh:
AGENT_DIRS = sorted(json.load(_fh)["divisions"].keys())
# Proper nouns we neutralize so a find-replace re-skin (swap the country/platform
# and little else) still scores as a near-duplicate. Extend as new markets appear.