Skip to content

One rules file for every agent on the team - #223

Merged
henriqueaklein merged 3 commits into
developfrom
chore/ai-agent-rules
Aug 6, 2026
Merged

One rules file for every agent on the team#223
henriqueaklein merged 3 commits into
developfrom
chore/ai-agent-rules

Conversation

@braianxde

@braianxde braianxde commented Aug 5, 2026

Copy link
Copy Markdown

We drive this repo with several different AI agents and they don't all read the same file, so rules drift and each of us gets a different answer. This makes AGENTS.md the one file anyone edits, and gets it in front of every tool.

What each agent needs to do to pick up the rules

Agent What it reads What you have to do
Claude Code CLAUDE.md → already one line, @AGENTS.md Nothing. Works on clone.
opencode AGENTS.md directly, in preference to CLAUDE.md Nothing. Works on clone.
Codex AGENTS.md directly Nothing. Works on clone.
Copilot coding agent / code review AGENTS.md directly Nothing. Works on clone.
Copilot in VS Code .github/copilot-instructions.md, auto-detected Nothing. Optionally flip the experimental AGENTS.md setting to read the source instead.
Copilot for Xcode .github/copilot-instructions.md Nothing. Same generated file.
Cursor, Cline, Gemini CLI, Continue Their own directory formats Not generated today — instructions for adding a target are in docs/ai-agents.md.

Most of them read AGENTS.md already. Copilot's editor integrations are the exception — AGENTS.md support in VS Code is experimental and off by default, while .github/copilot-instructions.md is picked up automatically.

So the whole gap is one file, generated verbatim from AGENTS.md with a do-not-edit header.

Changing a rule

# edit AGENTS.md, then:
bash tool/check_agent_rules_sync.sh --fix

Without --fix it verifies and fails on drift, so Copilot users can't quietly end up on different rules. It's the sixth gate in tool/, same shape as check_brace_style.sh.

Shared skills

.claude/skills/ is read natively by both Claude Code and opencode — opencode loads it alongside its own .opencode/skills/. Copilot's agent mode reads SKILL.md too. One directory, no sync, nothing to configure. If your agent supports skills but looks elsewhere, point it at that path rather than copying.

  • open-pr — branch off develop, the checks that must pass first, what the description should say, open as draft
  • merge-pr — rebase first, --force-with-lease, and when rebase is the wrong tool
  • review-pr — what a reviewer checks, ordered by consequence: wallet safety, then correctness the tests miss, then accessibility, then the design system

One thing to agree on

merge-pr writes down rebase-first as the default, and that's a change: #217 through #221 all landed as merge commits, and all three merge methods are still enabled on the repo. The convention is what enforces this, not a setting — so if we'd rather flip the repo settings too, or don't want rebase-first at all, this is the PR to say so on.

Deliberately not here

  • No rules-sync package. Ruler, rulesync and AgentSync all solve this properly, and all are the wrong size for generating one file in a repo with no JS toolchain. docs/ai-agents.md records where that tips: if we get past two or three generated targets, switch.
  • No symlink. A checkout without core.symlinks turns it into a text file containing a path, which Copilot reads as a literal string and applies no rules at all. A copy plus a failing check is louder.
  • GSD skills not vendored. 59 of its 69 skills load workflows from $HOME/.claude/gsd-core/, so copying them here gives everyone else skills that reference files they don't have. Anyone who wants that workflow installs it themselves.
  • Nothing for Xcode's built-in Coding Intelligence — it has no repo-level rules convention, so there's no file to generate. Copilot for Xcode is covered by the generated file.

Verification

All six gates pass, flutter analyze clean, 1000 tests passing. The sync gate was confirmed both ways: it fails on drift and --fix repairs it.

…eads

The team drives this repo with four agents and they do not read the same file.
Claude Code reads CLAUDE.md (already one line: @AGENTS.md), opencode reads
AGENTS.md directly and prefers it over CLAUDE.md, and Copilot's coding agent
reads AGENTS.md too. Only Copilot's EDITOR integrations - VS Code and Copilot
for Xcode - do not: AGENTS.md support there is experimental and off by
default, while .github/copilot-instructions.md is picked up automatically.

So exactly one derived file is needed, and it is generated verbatim from
AGENTS.md with a do-not-edit header. tool/check_agent_rules_sync.sh fails when
the two drift and regenerates with --fix, matching the five gates already in
tool/.

Not a package: Ruler, rulesync and AgentSync all do this, and all would add a
Node dependency and a build step to produce one file in a repo with no JS
toolchain. Not a symlink either - a checkout without core.symlinks turns it
into a text file containing a path, which Copilot would read as the literal
string and apply no rules at all.
.claude/skills/ is read natively by BOTH Claude Code and opencode, so one
directory serves two of the four harnesses with no sync at all. Copilot's
agent mode reads SKILL.md too.

Three skills, all self-contained:
- open-pr:   branch off develop, the checks that must pass, what the
             description should say, and open as a draft
- merge-pr:  rebase first, --force-with-lease, and the cases where rebase is
             the wrong tool. Recorded as a change: #217..#221 all landed as
             merge commits, and all three merge methods are still enabled, so
             the convention is what enforces this rather than a setting
- review-pr: what a reviewer checks, ordered by consequence - wallet safety,
             then correctness tests miss, then accessibility, then the design
             system

Self-contained is the hard requirement. The GSD skills are NOT vendored here:
59 of the 69 load workflows from $HOME/.claude/gsd-core/, so copying them
would give everyone else skills that silently reference files they do not
have.

docs/ai-agents.md is the page a human reads to find which file their tool
looks at.
The table named who uses what, which goes stale the moment somebody switches
tools or joins. It now says what each agent reads and what you have to do to
use it - which for most of them is nothing.

Adds an "Adding an agent" section: where to put a new target in the sync
script, and the point at which a purpose-built tool beats another hand-rolled
target.
@braianxde
braianxde marked this pull request as ready for review August 5, 2026 21:43
@henriqueaklein
henriqueaklein merged commit 5c190fc into develop Aug 6, 2026
8 checks passed
@henriqueaklein
henriqueaklein deleted the chore/ai-agent-rules branch August 6, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants