Repository setup guide · sources checked Nov 3, 2026
How to share repository context across coding agents
Compare how Codex, Claude Code, Cursor, and Copilot CLI discover repository instructions, then verify context behavior with one repeatable local trial.
What is the most portable starting point for coding-agent repository context?
Start with a short, version-controlled root `AGENTS.md` for project facts that apply to every task: where key code lives, the commands that validate changes, and durable constraints. It is a useful shared baseline, but do not assume every product surface or version loads it the same way. Confirm each agent actually reads the file, then add a small product-specific instruction file only where a documented difference requires one. Keep task-specific context in the prompt instead of making every session load a large repository tour.
How do Codex, Claude Code, Cursor, and Copilot CLI load instructions?
Codex reads `AGENTS.md` from its global location and from the repository path down to the working directory; nested overrides can replace broader guidance. Claude Code supports `AGENTS.md` in current versions, but by default a project `CLAUDE.md` can take precedence unless it imports `AGENTS.md` or the Project instructions setting is changed. Cursor documents a root `AGENTS.md` as a simple alternative to `.cursor/rules`; its current page describes that file as root-only and not path-scoped. Copilot CLI documents `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, and Copilot-specific instruction files; it says there is no general precedence order across these files. These behaviors are product-surface and version specific, so use the linked docs and inspect the active session.
Does a shared instruction file give an agent access to other repositories?
No. An instruction file describes a project; it does not mount another repository, grant credentials, or create a cross-repository workspace. First confirm which files and repositories the execution environment can actually read and edit. The GitHub Community thread cited below records a user asking specifically about poly-repository context in a cloud coding-agent task; replies distinguish that cloud setup from local multi-folder editor workflows. Treat the thread as evidence of a real setup question, not a guarantee about current product limits. For Cloud or CI agents, verify repository access and setup in that agent’s own current documentation.
How can I compare context setup fairly across agents?
Use the same repository, working directory, task, and clean session for each agent. Put one harmless, distinctive “context check” value in the root instruction file, ask the agent to report which instruction files it loaded, and have it locate the same known source file and explain which command checks that area. Then ask it to make the same small change on a disposable branch and inspect the diff and validation command. Record the product/version, interface (CLI, editor, or cloud), working directory, files actually loaded, files it could read, and result. This checks setup and discovery; it is not a coding-quality benchmark.
What should go in a shared instruction file?
Keep only information that is stable, useful across tasks, and hard for an agent to infer safely: the repository’s test command, important ownership boundaries, naming conventions, and links to deeper docs when a task touches them. Prefer scoped instructions for a subdirectory over a long global list. Anthropic describes `CLAUDE.md` as behavioral context rather than enforced configuration, and OpenAI recommends keeping repository instructions relevant to the work. Treat instructions as guidance; permissions and environment controls must enforce access boundaries.
What evidence supports this guide?
We checked the linked vendor documentation and two public discussions on November 3, 2026. GitHub Community discussion #190627 asks about poly-repository context for a cloud coding-agent workflow; Codex discussion #12668 asks what repository instruction files are loaded at session start. These discussions show qualitative setup questions only. We did not collect GSC or Google Suggest evidence, measure search demand, or run a cross-agent coding benchmark. Product behavior can change, so verify the version and active interface before relying on a setup.
Sources
- OpenAI Codex Docs: Custom instructions with AGENTS.md · checked Nov 3, 2026
- Anthropic Claude Code Docs: How Claude remembers your project · checked Nov 3, 2026
- Cursor Docs: Rules for AI · checked Nov 3, 2026
- GitHub Docs: Adding custom instructions for Copilot CLI · checked Nov 3, 2026
- GitHub Community: Guidance on Copilot Coding Agents with Poly Repo structure? · discussion #190627 · observed Nov 3, 2026
- OpenAI Codex: What’s pulled into context when a new session starts? · discussion #12668 · observed Nov 3, 2026
- Reddit r/cursor: discussion about repo maps and repeated repository discovery · observed Nov 3, 2026