From 217a63b8b6b6ea5752fd436a05996c796ba0ec66 Mon Sep 17 00:00:00 2001 From: Michael Sitarzewski Date: Sun, 5 Jul 2026 12:52:12 -0500 Subject: [PATCH] Derive originality check's division set from divisions.json (#659) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- scripts/check-agent-originality.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/check-agent-originality.sh b/scripts/check-agent-originality.sh index 39b030a5..e55e4570 100755 --- a/scripts/check-agent-originality.sh +++ b/scripts/check-agent-originality.sh @@ -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.