fix(install): tell aider users when their CONVENTIONS.md is our stale roster

#871 shrank the aider integration from 3.8M characters of concatenated agents
to a 97K roster index, because aider keeps a conventions file in context for a
whole session. The fix only reached new installs.

install_aider refuses to overwrite an existing CONVENTIONS.md, which is right —
it is aider's own user-authored file and the one on disk may be the reader's.
But "already exists (remove to reinstall)" says nothing about which file it is,
so anyone holding the pre-index roster re-ran the installer, read that, and
kept the broken file. The people the fix was written for were the ones it could
not reach.

Our generated file has always opened with "# The Agency — AI Agent
Conventions", so the installer can now tell its own stale copy from someone
else's conventions and say which it is. Neither branch writes anything.

Verified in a container, all three cases:
  stale Agency roster   -> names it, reports 3800039 bytes, says to delete and re-run
  user's own file       -> "leaving your file alone", file intact
  no file               -> installs, 97065 bytes

Windsurf has the same guard and the same gap; #870 already handles it there, so
this leaves that path alone rather than colliding with it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Michael Sitarzewski
2026-09-20 20:29:21 -05:00
co-authored by Claude Opus 5
parent 87f8301cad
commit 8333d995ef
+16 -1
View File
@@ -921,7 +921,22 @@ install_aider() {
local dest="${PWD}/CONVENTIONS.md"
[[ -f "$src" ]] || { err "integrations/aider/CONVENTIONS.md missing. Run convert.sh first."; return 1; }
if [[ -f "$dest" ]]; then
warn "Aider: CONVENTIONS.md already exists at $dest (remove to reinstall)."
# Never overwrite: CONVENTIONS.md is aider's own user-authored file, and the
# one sitting here may well be the reader's rather than ours. But the guard
# used to strand the very users this integration was fixed for — anyone
# holding the pre-index roster (3.8M characters, far past what aider can keep
# in context for a session) re-ran the installer, read "already exists", and
# kept the broken file. Our generated file has always opened with the same
# marker, so tell our stale copy apart from someone else's conventions.
if head -n 1 "$dest" | grep -q 'The Agency'; then
local bytes; bytes="$(wc -c < "$dest" | tr -d ' ')"
warn "Aider: $dest is an Agency roster index from an earlier install ($bytes bytes)."
dim " The roster is an index now, not the agents themselves. Delete it and"
dim " re-run this installer to pick up the smaller file."
else
warn "Aider: CONVENTIONS.md already exists at $dest — leaving your file alone."
dim " Remove it and re-run to install the Agency roster index instead."
fi
return 0
fi
install_file "$src" "$dest"