A model does not remember a project between sessions. Four kinds of files give that context back.
Four layers of context
| Layer | What goes in | When in context | Files |
|---|---|---|---|
| Spec | requirements, plan, steps of one task | for one task | spec.md · plan.md · tasks.md |
| Bible | product goal, users, decisions | at task start | projectbrief.md · productContext.md |
| Rules | commands, style, prohibitions | every session | CLAUDE.md · AGENTS.md · .cursor/rules |
| Skill | procedure with examples and scripts | description always, body on call | SKILL.md |
Spec: one task before the code
A spec describes the task before work starts: first what and why, then how.
Main steps of GitHub Spec Kit. How to split a large spec into parts: Specs by aggregates
Project bible: what the product is
The bible is a standing description of the product: why it exists, who it serves, how it works and what has been decided. The term comes from practice; the closest documented analogue is Cline’s Memory Bank.
projectbrief.mdgoals and requirementsproductContext.mdwhy it exists, what it solvessystemPatterns.mdarchitecture and patternstechContext.mdstack and constraintsactiveContext.mdcurrent focus and next stepsprogress.mdwhat works, what is leftRules: in every session
Rules are instructions the harness puts at the start of every session.
An AGENTS.md example for a web project. The file holds only what the agent cannot learn from the code: commands, style and prohibitions. CLAUDE.md for Claude Code works the same way.
AGENTS.md example
# AGENTS.md
## Commands
- Install: npm ci
- Tests: npm test
- Type check: npx tsc --noEmit
## Style
- Strict TypeScript, no any
- kebab-case file names
## Don't
- Don't change migrations/ without a task for it
- Don't commit .env or keys
## Before finishing
- Run the tests and the type checkWhich agent reads which file
The table was checked against vendor docs on 15.11.2026. A cell marked “not confirmed” means the docs do not describe it.
| Agent | AGENTS.md | CLAUDE.md | Own files | Source · checked 15.11.2026 |
|---|---|---|---|---|
| Claude Code | yes when there is no CLAUDE.md (v2.1.277+); otherwise via an @AGENTS.md line inside CLAUDE.md | the main file | .claude/rules/ | code.claude.com/docs/en/memory |
| Codex | yes; in each folder AGENTS.override.md goes first; 32 KiB limit by default | only if the name is added to project_doc_fallback_filenames | AGENTS.override.md | learn.chatgpt.com · agents-md |
| Cursor | yes, in the root and in subfolders | yes, applied in every chat | .cursor/rules/*.mdc | cursor.com/help/customization/rules · docs/context/rules |
| GitHub Copilot | yes, the nearest file in the directory tree | yes, repository root only (together with GEMINI.md) | .github/copilot-instructions.md, .github/instructions/*.instructions.md | docs.github.com · repository instructions |
| Gemini CLI | only if the name is added to the context.fileName setting | not confirmed | GEMINI.md | geminicli.com/docs/cli/gemini-md |
| Windsurf | yes, in the root and every folder down to the working one; always on | not confirmed | .windsurf/rules/, .devin/rules/ | docs.devin.ai · cascade/agents-md |
| OpenCode | yes, checked first | fallback when there is no AGENTS.md | global ~/.config/opencode/AGENTS.md | opencode.ai/docs/rules |
@AGENTS.md line.@AGENTS.md line in CLAUDE.md plus whatever only Claude Code needs.Cursor rules and AGENTS.md
Cursor accepts two formats: AGENTS.md is plain markdown with no metadata, and rules in .cursor/rules have apply modes.
Four modes per the Cursor docs.
| AGENTS.md | .cursor/rules/*.mdc | |
|---|---|---|
| Format | plain markdown | a file with the .mdc extension; a .md in this folder is ignored |
| When it applies | always | always, by description, by file pattern or manually |
| Folders | root and nested; the nearest file takes precedence | .cursor/rules |
| Size | no number in the docs | under 500 lines per rule |
Cursor docs call the root .cursorrules legacy and to be deprecated. The Always Apply mode matches the old behavior of the file.
.cursor/rules.Example: a real CLAUDE.md
An excerpt from the CLAUDE.md of this site’s repository: only what the agent cannot learn from the code, such as where the game version comes from and a rule about dates. For Cursor, Codex and Copilot the same text moves to AGENTS.md.
CLAUDE.md
## Games: version pinned in games.lock
- The site is built from the commit recorded in games.lock
- For a new game version: push to games main and wait
## Creation and update dates
- On any edit of an article, set updated to today, in ru and en
- The build fails if the text changed after updatedSkills: a procedure on call
A skill is a folder with a SKILL.md instruction, examples and scripts for a recurring procedure.
SKILL.mdinstructions, examples, scriptsThe same in a chat: projects and skills
What goes where
| If it is… | Where |
|---|---|
| a command, style or prohibition needed in every task | Rules |
| a multi-step procedure needed now and then | Skill |
| requirements for one task | Spec |
| product knowledge and decisions made | Bible |
| an agent error that keeps coming back | rule or check · HDD |