Skip to content

AGENTS.md: repository context for coding agents

Prepare AGENTS.md with a repository map, verified commands and clear boundaries. Includes a template and checks for stale or conflicting instructions.

A maintainer and small robot use an open map whose paths lead to a reference binder, feature cards and a tool station.
Give contributors a route to conventions, feature context and usable tools. AI-generated conceptual illustration.

A coding agent starts a frontend build command in a repository that has no frontend build. Another change uses the default login guard inside an admin module with a separate guard. Both mistakes are easier to review when the repository states those constraints before work begins. An AGENTS.md file gives repository context for coding agents a durable home, with a route to the conventions and feature documents that matter for the task.

Start with the mistakes a new contributor could plausibly make. Record the actual commands, the code worth copying and the decisions that need an owner. Then check how your chosen tool discovers those instructions.

Give AGENTS.md a clear job

We recommend separating three kinds of context. The orientation file helps a contributor find relevant material. Canonical conventions explain how the repository works. A feature spec settles what a particular change must do.

ContextWhat belongs thereUpdate it when
OrientationModule locations, read-before-change links, worked examples and unusual constraints.A path, responsibility or entry point changes.
Canonical conventionsVerified setup and check commands, architecture rules, access boundaries and delivery conventions.The accepted way of working changes.
Feature specActors, scope, decisions, acceptance examples, failure behaviour and approval.The intended behaviour of that feature changes.

A small repository may keep orientation and conventions in one file. Splitting them is useful when the map can stay short while specialised guidance lives elsewhere. The trade-off is another document to open and another link to maintain. Choose the arrangement your team can keep accurate.

A task prompt should name the requested change and its approved spec. Putting a temporary feature requirement into root instructions makes it look like a permanent rule for later work.

A worked repository map

In Phuongnamsoft's website repository, checked on 3 November 2026, AGENTS.md is the orientation map and CLAUDE.md holds canonical working conventions. That division is our repository choice. The filename alone does not establish which document another tool will load.

The map points an admin change to module conventions and an existing contact-submission implementation. A blog change points to its feature spec and editorial guide. It also records constraints with concrete consequences:

  • Separate authentication guards: admin code uses the admin guard. Inspect that boundary before reusing code from the public application.
  • Static frontend assets: this checkout has no package.json or Vite pipeline. A generic suggestion to run an npm build does not fit it.
  • Portable admin module: application-specific dependencies need a deliberate home and a recorded trade-off.

These entries explain where a familiar default would be wrong. A directory listing would not explain those consequences. Keep each useful warning near a link to the code or convention that establishes it.

Adapt this short orientation template

This illustrative template uses that arrangement. Replace its paths and commands with verified equivalents. The blog check is specific to this application; it is not a complete test command for every change.

# AGENTS.md

## Start here
Read CLAUDE.md for canonical working conventions.
Read the relevant approved feature spec before changing behaviour.

## Find the work
- Admin: app/Admin/; follow the documented module pattern.
- Public site: app/Portal/; read its design and asset conventions.
- Blog: read docs/marketing/blog-writing.md.
- Specs: docs/features/specs/.
- Plans: docs/features/plans/.

## Constraints that are easy to miss
- Admin uses a separate authentication guard.
- Frontend assets are static; there is no npm build in this checkout.
- Keep the reusable admin module's application coupling deliberate.

## Verification
Use the commands in CLAUDE.md for the changed area.
For blog content: php artisan test --filter=Blog
Report checks run, their results and checks that could not run.

## When sources disagree
Identify the conflicting instructions and their scope.
Check current code and the canonical convention.
Ask the responsible owner to settle unresolved behaviour decisions.

Keep secrets, customer exports and personal machine credentials out of shared instructions. Point to an approved setup process where access is required. Describe expected configuration by key or purpose.

Check what the tool actually loads

Tool details below were checked on 3 November 2026. Discovery depends on the product, version, working directory and configuration. Recheck official documentation when those change.

Codex

Codex documents a global instruction layer and a project chain from the repository root to the working directory. Within each directory, AGENTS.override.md takes priority over AGENTS.md, followed by configured fallback names; at most one file is included per directory. More local guidance overrides earlier guidance in that chain. See the official OpenAI documentation on AGENTS.md.

For this layout, the root map explicitly asks the agent to read CLAUDE.md. Treat that as a reading instruction to verify, rather than assuming the name makes it an automatically discovered Codex file. Check active sources from the directory where you will start the task.

Claude Code

Claude Code documents direct AGENTS.md support from v2.1.277. By default it uses those files when no qualifying CLAUDE.md or CLAUDE.local.md exists in the working directory or above it. Settings can change that choice, and some sessions lack direct support. Use /context to inspect loaded memory files and consult its instruction-loading documentation.

Our repository has both filenames. When canonical conventions load first, a task can still require reading the orientation map for its feature links. A normal Markdown link is a pointer for the reader; verify that the linked document was opened before relying on its contents.

Find stale and conflicting instructions

Audit the map against the checkout you are about to change. A document describing last month's structure can send an agent towards a removed module or a command that no longer exists.

A maintainer removes an old sign beside two maps, comparing a broken route with a real bridge leading to a workshop.
Compare instructions with the current checkout before following their route. AI-generated conceptual illustration; the checklist defines the actual checks.
  1. Open the linked files. Confirm that each exists and describes the current feature. Mark missing guidance as missing; do not infer its contents from an old filename.
  2. Compare commands with manifests and configuration. Here, composer dev references an unavailable npm script. The conventions flag that mismatch and point to usable development commands. A copied quick-start command needs the same scrutiny.
  3. Check the examples. An older controller may predate the accepted module pattern. Name the implementation contributors should follow and explain which part is representative.
  4. Separate plans from shipped behaviour. A roadmap for a future platform does not mean its jobs, policies or client workspace already exist.
  5. Resolve duplicate rules. If two files prescribe different commands or access behaviour for the same scope, record the conflict. Use the applicable instruction hierarchy, inspect the implementation and ask the owner to settle any unresolved product decision.

Record a finding precisely: the two sources, the affected scope, what the checkout shows and who can resolve the disagreement. “Documentation is outdated” gives the next contributor little to act on.

Try a fresh-session reading exercise

Before delegating implementation, start a fresh session in the intended directory. Ask for a read-only preparation pass:

Prepare to work on the contact-submission admin screen.
Do not edit files or run commands that change data.

List the instruction sources you loaded or explicitly opened.
Find the applicable feature spec and the worked implementation.
Identify the authentication guard and the relevant test command.
Report missing links, conflicting rules and unavailable tooling.
Explain which decisions still need the feature owner.

Compare the answer with actual files and the tool's available instruction diagnostics. A confident summary is insufficient evidence that every source loaded. This exercise checks the preparation path; it does not prove that implementation will follow every rule.

When a source is missing, fix the path or loading arrangement and repeat the affected check. When a command is unsafe for the current environment, verify its configuration before running it. Keep actual command output and any limitation in the task record.

Maintain the map with the change

Include instruction updates in the same review that moves a module, changes a command or replaces a convention. Remove superseded guidance and check incoming links. Keep feature progress and approval evidence beside the feature documents, where another session can find their current state.

For your next change, ask a teammate to follow the map to one convention, one representative implementation and one relevant check. Repair the first point that requires guessing. Then use the brief-to-release workflow to connect repository context to the task's specification, implementation and review. Our AI-assisted development process describes where a person approves those delivery decisions.

For task-specific context, the worked feature-spec guide shows how to record scope, access rules and acceptance examples before handing over a change.

Working on something like this?

Start with a paid Blueprint, not a guess

One to two weeks to agree the scope, the risks and the measure of success — then a fixed price for the Build.

A note clipped to a notebook sits beside an open laptop and an empty desk chair.
AI workflow Engineering

Resume an AI coding task after a session ends

Resume an AI coding task with a handoff template, read-only Git checks and an example of testing an old completion claim against a new requirement.

4 min read
An engineer studies a blueprint between one robot working on a linked assembly and two robots working at separate benches.
AI workflow Engineering

Single-agent vs multi-agent coding

Choose single-agent vs multi-agent coding with two worked examples and a worksheet for dependencies, ownership and integration checks.

4 min read
A human engineer inspects software blocks at a desk while a small AI assistant offers a block beside an inspection gate.
AI workflow Engineering Delivery

AI-generated code review checklist before merge

Use an AI-generated code review checklist to inspect scope, access, failure paths and test evidence, with a worked diff before merging.

7 min read