fix(aider): CONVENTIONS.md is a roster index, not 3.8 million characters of agents (#871)

Aider loads a conventions file into context and keeps it there for the whole
session — that is what the file is for, and the docs say to load it with
--read so prompt caching can hold it. This integration concatenated every
agent body into it. At 279 agents that is 3,816,372 characters, roughly a
million tokens. No model takes that. Anyone who ran

    ./scripts/install.sh --tool aider

got a CONVENTIONS.md that either blows the context window on the first turn
or bills for a million tokens trying.

CONVENTIONS.md is now the roster index it was described as: one entry per
agent with the name, the description, the division, and the path to the
agent file. 96,823 characters, down from 3.8 million. The header explains
how to pull a single agent's full instructions into the session:

    /read-only /path/to/agency-agents/engineering/engineering-frontend-developer.md

Naming an agent in a prompt still works the way it did — the description is
what the model needed for that, and it is still there.

test-convert-outputs.sh now holds the index to being an index: it fails if
CONVENTIONS.md grows past 250,000 characters, if it does not list exactly
one path per roster agent, or if any path it prints does not resolve. The
existing round-trip check on the accumulated file still covers the names and
descriptions.
This commit is contained in:
Hotragn Pettugani
2026-09-20 18:35:10 -05:00
committed by GitHub
parent ad9264e309
commit d3a3f573e3
6 changed files with 89 additions and 22 deletions
+23 -8
View File
@@ -14,7 +14,7 @@
# gemini-cli — Gemini CLI subagent files (~/.gemini/agents/*.md)
# opencode — OpenCode agent files (.opencode/agents/*.md)
# cursor — Cursor rule files (.cursor/rules/*.mdc)
# aider — Single CONVENTIONS.md for Aider
# aider — Single CONVENTIONS.md roster index for Aider
# windsurf — Single .windsurfrules for Windsurf
# openclaw — OpenClaw workspaces (integrations/openclaw/<agent>/SOUL.md)
# qwen — Qwen Code SubAgent files (~/.qwen/agents/*.md)
@@ -568,11 +568,21 @@ trap 'rm -f "$AIDER_TMP" "$WINDSURF_TMP"' EXIT
cat > "$AIDER_TMP" <<'HEREDOC'
# The Agency — AI Agent Conventions
#
# This file provides Aider with the full roster of specialized AI agents from
# The Agency (https://github.com/msitarzewski/agency-agents).
# The roster of specialized AI agents from The Agency
# (https://github.com/msitarzewski/agency-agents): each one's name, what it is
# for, and where its full instructions live.
#
# To activate an agent, reference it by name in your Aider session prompt, e.g.:
# "Use the Frontend Developer agent to review this component."
# Aider keeps a conventions file in context for the whole session, so this is an
# index and not the agents themselves. Inlining every body would make this file
# about 3.8 million characters, which no model will take.
#
# To use an agent:
# 1. Name it in your prompt — "Use the Frontend Developer agent to review
# this component." The description below is usually enough for that.
# 2. For its full instructions, pull the agent file into the session:
# /read-only /path/to/agency-agents/engineering/engineering-frontend-developer.md
#
# Paths below are relative to an agency-agents checkout.
#
# Generated by scripts/convert.sh — do not edit manually.
@@ -590,12 +600,16 @@ HEREDOC
accumulate_aider() {
local file="$1"
local name description body
local name description source division
name="$(get_field "name" "$file")"
description="$(get_field "description" "$file")"
body="$(get_body "$file")"
source="${file#"$REPO_ROOT"/}"
division="${source%%/*}"
# One index entry per agent, not the agent. A conventions file is read into
# every request; the bodies together are 3.8 million characters and this
# index is about 90,000.
cat >> "$AIDER_TMP" <<HEREDOC
---
@@ -604,7 +618,8 @@ accumulate_aider() {
> ${description}
${body}
Division: ${division}
Full instructions: ${source}
HEREDOC
}