Search Blog

Knowledge · Codex

Stop Repeating Instructions to Codex — AGENTS.md and Feature-Specific Markdown Docs

Managing project rules, feature specifications, status, roadmaps, and work records

How to separate AGENTS.md project-wide instructions from feature documents, architecture notes, status updates and roadmaps when working with Codex.

When I began coding with Codex, a message in the chat often seemed sufficient. Adding a button or changing a screen did not require a separate design document.

As the projects grew, decisions made earlier were sometimes interpreted differently. Previously fixed behavior could regress, and I found myself repeating context from earlier conversations.

I started writing development rules and feature designs into Markdown files in the repository.

AGENTS.md holds shared project rules

Codex recognizes an optional instruction file named AGENTS.md. It can describe the project's purpose, technology choices, coding conventions, tests, and restrictions.

For example, a project might use rules such as:

  • Do not rebuild the existing project structure without a clear need.
  • Do not edit unrelated files.
  • Run relevant tests after implementing a feature.
  • Never put secrets or credentials in source code.
  • Do not report a failed validation as a completed change.
  • Use the approved Git-based process for production deployment.

Instead of pasting these requirements into every chat, I keep the common rules in the repository.

The recognized filename is AGENTS.md, not AGENT.md. It is not a security boundary, however: actual permissions, source changes, and tests still need review.

Should everything go into AGENTS.md?

It is tempting to put the entire architecture, feature requirements, APIs, historical bug reports, and future plans into one file.

That can become counterproductive. A change to dividend calculations does not require a tour of blog publication policy. An old design decision may also conflict with a more recent one.

I find it clearer to put shared rules in AGENTS.md and detailed feature decisions in ordinary Markdown files.

An example of splitting feature documentation

Imagine a personal investment app covering assets, dividends, prices, and alerts.

FilePurpose
AGENTS.mdShared rules and restrictions
README.mdProject overview and how to run it
PROJECT_STATUS.mdWhat currently works and what remains unresolved
docs/ARCHITECTURE.mdSystem components and data flows
docs/features/assets.mdAsset-management requirements
docs/features/dividends.mdDividend lookup and calculation
docs/features/market-data.mdMarket data sources and retrieval
docs/features/alerts.mdAlert conditions and delivery
docs/ROADMAP.mdFuture priorities and milestones

These names are examples, not a Codex-mandated standard. The important distinction is between rules that apply to the entire project and specifications that evolve with a particular feature.

For a dividend change, refer to dividends.md. For a quote provider change, refer to market-data.md.

What belongs in a feature document?

A feature document is most useful when it describes more than a one-line goal.

1. Purpose. What user problem is this feature solving? A dividend feature might need to show expected payments and dates for held U.S. stocks and ETFs.

2. Current implementation. Distinguish working functions from work in progress. Separate dividend lookup, monthly totals, after-tax calculations, and known missing cases.

3. Data flow. Where does the data come from, how is it transformed, and where is it stored?

4. Constraints and failures. Record API errors, invalid values, privacy rules, and behavior when services are unavailable.

5. Validation criteria. What measurable result counts as success?

6. Future changes. Keep known issues, next steps, and deferred ideas distinct.

Long-lived specifications and temporary work logs can be split if a document becomes too large.

Separate current status from the roadmap

Projects accumulate ideas faster than implementations. If PROJECT_STATUS.md includes every planned feature, a reader may confuse an idea with a working capability.

  • PROJECT_STATUS.md: What has been implemented, tested, or left unresolved?
  • ROADMAP.md: What should be developed next, in what order and under what conditions?

For chart analysis, a roadmap might plan trendline detection, patterns, and validation criteria. Only after implementation and tests should the status document reflect the completed work.

Documenting a plan does not make the plan complete.

Will Codex automatically read every Markdown file?

No. Codex recognizes AGENTS.md as a special instruction file. Documents like ARCHITECTURE.md, ROADMAP.md, or dividends.md are ordinary files and are not guaranteed to be read simply because they exist.

I point to the relevant documents in the task or link them from the project instructions. For example:

Improve the dividend lookup feature. First read AGENTS.md and docs/features/dividends.md. Compare the specification with the current code, describe the scope and tests, then implement the change. Update the related documentation only with results you have verified.

The aim is not to load every document into every task, but to help the agent find the right information when needed.

When should the docs change?

Written documents can become inaccurate as the code evolves.

ChangeDocument to revisit
Shared security or testing policyAGENTS.md
Dividend logicdividends.md
Market data source or storagemarket-data.md and possibly ARCHITECTURE.md
Implemented and tested featurePROJECT_STATUS.md
Development prioritiesROADMAP.md
An important design decisionFeature specification or decision record

I also distinguish implemented, tests passed, and verified in production. Changing code does not automatically prove the production environment works.

More documents do not automatically mean better documentation

I do not need a separate document for every button or field. Related features can share one document. Unused documents increase maintenance work and may contradict the actual code.

Markdown documentation is not a substitute for tests. The intended behavior in a document must still match the application's real behavior.

What changed about working with Codex

Early on, I explained a change in chat and checked the outcome. As the projects expanded, separating shared rules, current status, and feature designs became more valuable.

Instead of assuming Codex remembers every previous discussion, I can return to the repository, its documentation, and the source code.

AGENTS.md supplies the shared rules; feature Markdown files record the design and current state of specific capabilities. The goal is not to make Codex read more text, but to make the right context easy to find.

An earlier article describes how I preserved testing and permission rules while improving Codex's Android verification workflow.

Related readingAutomating Codex Android Checks Without Always Approve

A real Android Gradle troubleshooting case: move caches inside the workspace, scope tests to Debug, and use a project verification script instead of broad approval rules.

The next article looks at applying project-specific rules across multiple repositories.

Related readingUsing Codex Across Multiple GitHub Repositories — Keeping Work Separate

A practical look at using Codex across GitHub repositories without mixing project rules, changes, verification, and deployment dependencies.

References

CodexDeveloper toolsCodexAGENTS.mdMarkdowndocumentationarchitectureROADMAPPROJECT_STATUS
Connected projectsBLOG