Your AI agent refactors a method and leaves the old one behind. You tell it to delete what it replaced. Next week, in another repository, it does the same thing and you tell it again. Some corrections have nothing to do with the project. They are about how you expect any agent to work on any code.
If these corrections stay in your head, you repeat them forever. If you copy them into every project's AGENTS.md, you maintain the same paragraph in ten places.
Every major AI coding agent reads a global instructions file from your home folder, in every session, in every repository. Write your universal rules there once.
| Tool | Global instructions file |
|---|---|
| Claude Code | ~/.claude/CLAUDE.md, plus rule files in ~/.claude/rules/ |
| OpenAI Codex | ~/.codex/AGENTS.md |
| GitHub Copilot CLI | ~/.copilot/copilot-instructions.md |
| GitHub Copilot on GitHub.com | Personal instructions in the Copilot Chat settings |
The agent loads the global file together with the project's own instructions, so the two add up.
| File | What goes in it | Who gets it |
|---|---|---|
| Global file | How you expect any agent to work, in any project | You, everywhere |
| Project AGENTS.md | Build commands, architecture and conventions of this repository | The whole team |
| Scoped rule files | Conventions for one part of the repository | The whole team |
| CLAUDE.local.md | Your personal overrides for this repository | You, in this repository |
A good test for the global file: would this instruction still be true in a project written in a different language? "No dead code" passes. "Use FluentValidation" doesn't.
The best ones come from a correction you gave more than once. Three examples that pay off in every project:
Agents add things "for later" and forget to remove what they replaced. Each leftover looks harmless, and after a month the codebase is full of methods nobody calls.
- Leave no dead code. Everything you add must have a caller by the end of the change.When you replace one approach with another, delete the old one in the same change.Read your own diff before you commit and remove anything nothing uses.
An agent fixes the caller you pointed at and ignores the other five. Changing what a shared method returns, or how it fails, can quietly break every other place that uses it.
- When you change what a shared method returns or how it fails, find every callerand check each one, not only the caller you are editing. If you make the same editin several places, extract a shared helper.
An agent states a guess in the same confident voice as a fact it checked. You can't tell "I ran the tests and they pass" from "the tests should pass". See Do you handle AI Hallucinations the right way?
- Label every factual claim as one of: observed in this session (say where),documented (cite it), or inferred. Repeating a claim doesn't upgrade it.An inference stays an inference until you check it.
Monday, repository A: "You left the old GetPrice method behind. Delete what you replace."
Thursday, repository B: "You left the old validator behind. Delete what you replace."
Next Tuesday, repository C: "You left the old..."
❌ Figure: Bad example - The same correction typed again in every repository
~/.claude/CLAUDE.md
# How I expect you to work- Leave no dead code. When you replace one approach with another,delete the old one in the same change.- When you change what a shared method returns or how it fails,check every caller.- Label every factual claim as observed, documented or inferred.
✅ Figure: Good example - The correction is written once in the global file and applies in every repository
The global file is on your machine. Your colleague's agent has never seen it, and neither has an agent running in CI or in the cloud. If the team depends on a rule, it belongs in the project's AGENTS.md. If every project in the company should follow it, share it centrally. See Do you centralize your team's AI workflows?
When your global file says one thing and the project file says another, the agent may follow either one. Keep global rules about how to work, and leave the choice of tools and patterns to each project.
If you use more than one agent, each reads its own global file. Keep one source file and link or copy it to the others, the same way you share one AGENTS.md across AI tools in a repository.