Compare commits

...

2 Commits

Author SHA1 Message Date
Michael Sitarzewski 3f78a30bb2 Exclude integrations/ from the source-agent scan (it's convert.sh output) (#593)
#592 added `integrations` to AGENT_DIRS in convert.sh and lint-agents.sh and to
the lint workflow paths, to make those lists match divisions.json. That was
wrong: integrations/ is not a source-agent category — it's where convert.sh
WRITES per-tool conversions (e.g. openclaw output → integrations/openclaw/<agent>/SOUL.md).
It holds 957 conversion outputs across openclaw/opencode/qwen/antigravity, vs
248 real source agents in the 17 genuine categories.

Scanning integrations/ as source made the toolchain re-convert its own outputs:
the same agent appears under every tool (brand-guardian ×5), output slugs
collide, and convert.sh's last-writer-wins corrupts the catalog — which broke
downstream parity checks. convert.sh originally omitted integrations on purpose;
#592 misread that deliberate exclusion as drift.

Fix: drop integrations from convert.sh / lint-agents.sh AGENT_DIRS and the lint
workflow, remove it from divisions.json (it's not a division), and add it to
NON_DIVISION_DIRS in check-divisions.sh so the guard's canonical set is the real
17 source categories. The `strategy` additions from #592 were correct and stay.

check-divisions.sh now PASSES at 17 divisions consistent across divisions.json,
directories, scripts, and CI.

Note: integrations/mcp-memory holds 2 real source agents stranded in the output
tree; relocating them to a real category is left as separate follow-up.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 21:52:08 -05:00
Michael Sitarzewski a5688be6cc Add divisions.json — division presentation metadata (label, icon, color) (#592)
* Add divisions.json — presentation metadata (label, icon, color) per division

Establishes a source of truth for how each division (top-level agent directory)
is presented: a display label, a Lucide icon name, and a brand color. Lets the
Agency Agents app (and any other tooling) render divisions consistently —
including fixing "GIS" (was title-cased to "Gis") and covering `gis` +
`integrations`, which had no metadata before.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Make divisions.json the source of truth + enforce in CI

divisions.json now drives the division set. Add scripts/check-divisions.sh
(CI: check-divisions.yml, runs on every PR with no path filter) which fails
if divisions.json disagrees with the directories on disk, the AGENT_DIRS
arrays in convert.sh / lint-agents.sh, or the lint-agents.yml path filters,
or if any entry lacks label/icon/color.

Fixes pre-existing drift surfaced by the new check: integrations was missing
from convert.sh and lint-agents.sh; integrations and strategy were missing
from lint-agents.sh and the lint workflow (so those agents weren't being
linted at all).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 15:13:33 -05:00
5 changed files with 160 additions and 1 deletions
+20
View File
@@ -0,0 +1,20 @@
name: Check Divisions Consistency
# Runs on every PR (no path filter on purpose): a new division directory must
# trip this check even when nobody touched divisions.json or the lint config.
on:
pull_request:
push:
branches: [main]
jobs:
check-divisions:
name: divisions.json is the single source of truth
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate division set
run: |
chmod +x scripts/check-divisions.sh
./scripts/check-divisions.sh
+2 -1
View File
@@ -19,6 +19,7 @@ on:
- "support/**"
- "spatial-computing/**"
- "specialized/**"
- "strategy/**"
jobs:
lint:
@@ -35,7 +36,7 @@ jobs:
FILES=$(git diff --name-only --diff-filter=ACMR origin/${{ github.base_ref }}...HEAD -- \
'academic/**/*.md' 'design/**/*.md' 'engineering/**/*.md' 'finance/**/*.md' 'game-development/**/*.md' 'gis/**/*.md' 'marketing/**/*.md' 'paid-media/**/*.md' 'sales/**/*.md' 'security/**/*.md' 'product/**/*.md' \
'project-management/**/*.md' 'testing/**/*.md' 'support/**/*.md' \
'spatial-computing/**/*.md' 'specialized/**/*.md')
'spatial-computing/**/*.md' 'specialized/**/*.md' 'strategy/**/*.md')
{
echo "files<<ENDOFLIST"
echo "$FILES"
+22
View File
@@ -0,0 +1,22 @@
{
"_note": "Source of truth for the agent division set. Each division (a top-level agent directory) maps to a display label, a Lucide icon name (PascalCase), and a brand color (hex). Consumed by the Agency Agents app and any other catalog tooling. scripts/check-divisions.sh (CI: check-divisions.yml) fails the build if this list disagrees with the directories on disk, the AGENT_DIRS arrays in scripts/convert.sh and scripts/lint-agents.sh, or the path filters in lint-agents.yml. To add a division: create its directory, add an entry here, then run scripts/check-divisions.sh and update wherever it points. NOT every top-level directory is a division: integrations/ holds per-tool conversion OUTPUTS written by scripts/convert.sh (not source agents) and is excluded via NON_DIVISION_DIRS in check-divisions.sh; examples/ and scripts/ are likewise excluded.",
"divisions": {
"academic": { "label": "Academic", "icon": "GraduationCap", "color": "#8B5CF6" },
"design": { "label": "Design", "icon": "PenTool", "color": "#EC4899" },
"engineering": { "label": "Engineering", "icon": "Code", "color": "#3B82F6" },
"finance": { "label": "Finance", "icon": "DollarSign", "color": "#22C55E" },
"game-development": { "label": "Game Development", "icon": "Gamepad2", "color": "#A855F7" },
"gis": { "label": "GIS", "icon": "Map", "color": "#14B8A6" },
"marketing": { "label": "Marketing", "icon": "Megaphone", "color": "#F97316" },
"paid-media": { "label": "Paid Media", "icon": "Target", "color": "#EAB308" },
"product": { "label": "Product", "icon": "Box", "color": "#D946EF" },
"project-management": { "label": "Project Management", "icon": "ClipboardList", "color": "#0EA5E9" },
"sales": { "label": "Sales", "icon": "TrendingUp", "color": "#10B981" },
"security": { "label": "Security", "icon": "ShieldCheck", "color": "#EF4444" },
"spatial-computing": { "label": "Spatial Computing", "icon": "Boxes", "color": "#06B6D4" },
"specialized": { "label": "Specialized", "icon": "Sparkles", "color": "#6366F1" },
"strategy": { "label": "Strategy", "icon": "Network", "color": "#F43F5E" },
"support": { "label": "Support", "icon": "LifeBuoy", "color": "#84CC16" },
"testing": { "label": "Testing", "icon": "FlaskConical", "color": "#F59E0B" }
}
}
+115
View File
@@ -0,0 +1,115 @@
#!/usr/bin/env bash
#
# check-divisions.sh — enforce a single source of truth for the division set.
#
# divisions.json (repo root) is canonical. This script fails if any of the
# following disagree with it:
# 1. The actual top-level agent directories on disk
# 2. AGENT_DIRS in scripts/convert.sh
# 3. AGENT_DIRS in scripts/lint-agents.sh
# 4. The path filters in .github/workflows/lint-agents.yml
# 5. Every divisions.json entry has label, icon, and color
#
# Add a division: create its directory, add an entry to divisions.json, then
# this script tells you every other place that must be updated. No deps beyond
# bash 3.2 + coreutils (no jq) so it runs the same on macOS and CI.
#
# Usage: ./scripts/check-divisions.sh
set -euo pipefail
cd "$(dirname "$0")/.."
JSON="divisions.json"
# Top-level directories that are NOT divisions. Everything else at the repo
# root that is a directory is treated as a division (so a new division dir is
# caught even if nobody remembered to register it).
# integrations/ is convert.sh's OUTPUT tree (per-tool conversions written back
# into the repo), not a source-agent category — it must never be scanned as one.
NON_DIVISION_DIRS=(examples scripts integrations)
errors=0
fail() { echo "ERROR $*"; errors=$((errors + 1)); }
# --- sorted, newline-delimited helpers -------------------------------------
# Canonical set: object-valued keys inside the "divisions" object. Scoping to
# lines after the `"divisions": {` opener excludes both the wrapper key itself
# and the string-valued "_note" key.
canonical() {
awk '/"divisions"[[:space:]]*:[[:space:]]*\{/{f=1; next} f' "$JSON" \
| grep -oE '"[a-z0-9-]+"[[:space:]]*:[[:space:]]*\{' \
| sed -E 's/"([a-z0-9-]+)".*/\1/' | sort -u
}
# Actual division directories on disk (top-level dirs minus the excludes and
# anything dot-prefixed).
actual_dirs() {
local d base
for d in */; do
base="${d%/}"
[[ "$base" == .* ]] && continue
case " ${NON_DIVISION_DIRS[*]} " in *" $base "*) continue ;; esac
echo "$base"
done | sort -u
}
# Contents of a bash AGENT_DIRS=( ... ) array in the given file, one per line.
agent_dirs_array() {
awk '/AGENT_DIRS=\(/{f=1; next} f && /^\)/{exit} f{print}' "$1" \
| tr ' \t' '\n\n' | grep -E '^[a-z0-9-]+$' | sort -u
}
# Compare canonical vs a candidate set; report both directions.
compare() {
local label="$1" candidate="$2" canon
canon="$(canonical)"
local missing extra
missing="$(comm -23 <(echo "$canon") <(echo "$candidate"))"
extra="$(comm -13 <(echo "$canon") <(echo "$candidate"))"
if [[ -n "$missing" ]]; then
fail "$label is missing division(s) present in $JSON: $(echo "$missing" | tr '\n' ' ')"
fi
if [[ -n "$extra" ]]; then
fail "$label has division(s) not in $JSON: $(echo "$extra" | tr '\n' ' ')"
fi
}
# --- checks ----------------------------------------------------------------
[[ -f "$JSON" ]] || { echo "ERROR $JSON not found at repo root"; exit 1; }
compare "the agent directories on disk" "$(actual_dirs)"
compare "scripts/convert.sh AGENT_DIRS" "$(agent_dirs_array scripts/convert.sh)"
compare "scripts/lint-agents.sh AGENT_DIRS" "$(agent_dirs_array scripts/lint-agents.sh)"
# Workflow path filters: every canonical division must appear as `<div>/` in
# the lint workflow, or new divisions silently skip CI.
WF=".github/workflows/lint-agents.yml"
if [[ -f "$WF" ]]; then
while IFS= read -r div; do
grep -qE "\b${div}/" "$WF" || fail "$WF has no path filter for division '$div'"
done < <(canonical)
else
fail "$WF not found"
fi
# Every entry must have label, icon, and color.
while IFS= read -r div; do
block="$(awk -v d="\"$div\"" '$0 ~ d"[[:space:]]*:[[:space:]]*\\{" {print; found=1; next} found && /\}/ {print; exit} found {print}' "$JSON")"
for field in label icon color; do
echo "$block" | grep -qE "\"$field\"[[:space:]]*:" \
|| fail "division '$div' in $JSON is missing \"$field\""
done
done < <(canonical)
# --- result ----------------------------------------------------------------
count="$(canonical | wc -l | tr -d ' ')"
if [[ $errors -gt 0 ]]; then
echo ""
echo "FAILED: $errors divisions consistency error(s). $JSON is the source of truth."
exit 1
fi
echo "PASSED: $count divisions consistent across $JSON, directories, scripts, and CI."
+1
View File
@@ -26,6 +26,7 @@ AGENT_DIRS=(
security
spatial-computing
specialized
strategy
support
testing
)