AGENTS.md for marketing
CLAUDE.md and AGENTS.md for marketing: the instruction file your AI agent reads first
What the two files are, which tool reads which, where they go, a complete file for one ad account, and the settings that enforce what a file can only ask for.

Short answer
- CLAUDE.md and AGENTS.md are plain Markdown files an AI agent reads at the start of a session. Anthropic says Claude treats CLAUDE.md as context, not enforced configuration.
- Claude Code reads CLAUDE.md and Codex reads AGENTS.md. Keep the rules in AGENTS.md and put the single line @AGENTS.md in CLAUDE.md, and both tools read one file.
- For an ad account, write down the account, naming, approval lines, a never-change list and where changes are logged. Keep the change history and the keys out of the file.
- Keep each CLAUDE.md under 200 lines. Codex stops adding AGENTS.md files once they reach 32 KiB combined by default.
- Back every never-change rule with a setting: a hook in Claude Code, Always ask on a connector's apply tools in Claude, or a connector account set to read only.
Preview and approve every ad-account change in Claude or ChatGPT
Start free3-day free trial · no card needed
A CLAUDE.md or AGENTS.md file sits in the folder it applies to, and your AI agent reads it first. For marketing, it holds the account's rules: naming, approvals, what never changes, where changes are logged. Claude Code reads CLAUDE.md, Codex reads AGENTS.md, and one file can serve both. The file only asks, so hard limits go in your tool's settings.
My own agency runs every client folder from an AGENTS.md. I also build AdCtrl, which connects Claude or ChatGPT to Google Ads, Meta Ads, GA4, Tag Manager and Search Console. It doesn't read either file; it prepares each ad-account change as a before-and-after preview you approve in Claude or ChatGPT.
Checked 28 November 2026 against Anthropic's and OpenAI's docs1, 2.
- 200 lines Anthropic's target for each CLAUDE.md file1
- 32 KiB Codex's default cap for all AGENTS.md files combined2
- 1 line all a CLAUDE.md needs when AGENTS.md holds the rules1
What is a CLAUDE.md file, and what is AGENTS.md?
A CLAUDE.md file is a plain Markdown file that Claude reads at the start of every session in that folder. Anthropic's docs describe it as "the place you write down what you'd otherwise re-explain". In ad work, that's the naming pattern, the campaigns nobody touches and who signs off on a budget.
AGENTS.md is the same idea in an open format. Codex reads AGENTS.md files "before doing any work", and the format's own site calls it "a README for agents" and says over 60k open-source projects use it3. There are no required fields: it's standard Markdown with any headings you like.
Both files are text the model reads. Anthropic's memory docs say: "Claude treats CLAUDE.md files and auto memory as context. They aren't enforced configuration." So write the file as rules for the agent to follow, and set the hard limits somewhere else, as the enforcement section below shows.
Is AGENTS.md the same as CLAUDE.md?
AGENTS.md and CLAUDE.md do the same job under different names: Claude Code reads CLAUDE.md, and Codex reads AGENTS.md. Claude Code can also read AGENTS.md, but by default only when there is no CLAUDE.md or CLAUDE.local.md in the working folder or any folder above it.
| Tool | File it reads | When it reads AGENTS.md | One file for both |
|---|---|---|---|
| Claude Code | CLAUDE.md, CLAUDE.local.md | Only when no CLAUDE.md or CLAUDE.local.md is in the folder or above it, from v2.1.277 | A CLAUDE.md with the line @AGENTS.md, or the Project instructions setting in /config set to claude-md-and-agents-md |
| Codex | AGENTS.override.md, then AGENTS.md, then any fallback names you list | Always, before doing any work | AGENTS.md holds the rules |
| Claude and ChatGPT projects | No instruction file documented | Not documented | Paste the rules into the project's instructions |
Keep the rules in AGENTS.md and give Claude Code a one-line CLAUDE.md that imports it. Codex ignores CLAUDE.md unless you add it to its fallback list.
Source: Anthropic's memory docs and OpenAI's Codex docs, read 28 November 20261, 2
The one-line CLAUDE.md is the safer route. Anthropic notes that "In some sessions Claude can't read AGENTS.md, so import it from a CLAUDE.md there instead", and Claude reads the imported file first, then anything you write below the import. That's where Claude-only notes go. A CLAUDE.local.md counts as well: add one to a folder that only has AGENTS.md, and Claude Code stops reading AGENTS.md there.
Codex won't pick up a CLAUDE.md by accident. It reads only AGENTS.override.md, AGENTS.md and the names in its project_doc_fallback_filenames setting, and "Filenames not on this list are ignored for instruction discovery". How both tools then share skills and folders is in Claude Code vs Codex for marketing.
Where does the file go?
An instruction file goes in the folder it should apply to, and both tools also read a personal file in your home folder. For an agency that means three levels: rules for you on every project, shared rules at the agency's root folder and account rules in each client folder.
| Level | Claude Code | Codex | What a marketer puts there |
|---|---|---|---|
| You, everywhere | ~/.claude/CLAUDE.md | ~/.codex/AGENTS.md (or AGENTS.override.md) | How you want approvals asked and changes logged |
| Agency or team folder | CLAUDE.md in that folder | AGENTS.md in the project root, usually the Git root | Rules every client shares |
| Client folder | CLAUDE.md in the client folder | AGENTS.md in the client folder | The account, naming, never-change list |
| Just you, or a temporary override | CLAUDE.local.md, added to .gitignore | AGENTS.override.md, read in place of AGENTS.md in its folder | Personal notes, or a rule you're trying out |
Both tools read from the top level down to the folder you start in, so the client folder's rules come on top of the shared ones.
Source: Anthropic's memory docs and OpenAI's Codex docs, read 28 November 20261, 2
For both tools, start the session in the client folder. Claude Code then loads the client's file and every file above it, and Codex walks from the project root down to the client's AGENTS.md.
OpenAI's docs say the project root is typically the Git root. If each client folder is its own Git repository, Codex never reaches an agency file above it, so put agency-wide rules in ~/.codex/AGENTS.md, which lives on each person's machine and isn't shared through Git.

Illustration of the folder levels: agency-wide rules in each tool's home file, the account's rules in the client folder's AGENTS.md, and a session started in the client folder reads both.
What goes in a marketing CLAUDE.md?
A marketing CLAUDE.md holds the rules an agent needs in every session on that account: which account it is, how things are named, what needs a yes, what never changes and where changes get written down. Anthropic's Help Center lists "Hard constraints" as worth including and "Changelogs or history" as not worth including4.
Keep each line a rule the agent can act on. Anthropic's advice is to hold "facts Claude should hold in every session", and to move a multi-step procedure into a skill instead1. A weekly search term review is a skill; "never exclude competitor names in the Competitor campaign" is a line in the file.

Screenshot of Anthropic's Help Center page on CLAUDE.md, read 28 November 2026, with "Changelogs or history" highlighted under Not worth including. The history belongs in its own file.
Where do the change log and account IDs go?
The change log and the account IDs go in their own files, and the instruction file points to them. My own agency keeps four kinds of record per client folder, each with one job, so the instruction file stays short and the history stays complete5. This split is my agency's own convention. Neither Anthropic nor OpenAI defines it, so copy it only if it fits how you work.

Illustration of the four records: rules in the instruction file, connection details in CONNECTION.md, every live change in one changelog per platform, findings in analysis files.
- AGENTS.md: the rules; the file below is a full example. CLAUDE.md holds only
@AGENTS.md. - CONNECTION.md: how to connect and nothing else: status, account IDs, where the credentials come from, scopes, the date it was last checked.
- One changelog per platform, such as
internal/google-ads/CHANGELOG.md, newest first. Each entry has the approval, what changed from what to what, the state before, how it was checked, how to roll it back and the status, failed batches included. - One analysis file per workstream, with a Current State section at the top that gets rewritten when the picture changes.
The instruction file carries one line that ties the records together: before changing a live platform, read the latest entries of its changelog. My agency's onboarding rules set it up in every client folder. The agent reads what was done last before it changes anything, and the file itself stays short.
A CLAUDE.md template for an ad account
The file below is a complete AGENTS.md for one example account, Harbor Bikes, an invented online bike shop running Google Ads and Meta Ads. Copy the lines in the first column in order into a file named AGENTS.md, then swap in your own account; the second column says why each line is there.
| Line to paste | Why it's there |
|---|---|
# Harbor Bikes (example account) | Names the client the folder is for |
## The account | Any heading works; AGENTS.md has no required fields |
Online bike shop. Google Ads and Meta Ads, reporting in DKK. Purchase is the main conversion. | The facts the agent needs in every session |
Account IDs and how to connect are in CONNECTION.md. | Keeps IDs and credential sources out of the rules |
## Account rules | |
Judge campaigns on purchases and revenue, not clicks. Use the last 30 complete days unless I name dates. | How you read the numbers, so every answer uses the same yardstick |
## Naming | |
Campaigns follow HB_Channel_Type_Market, for example HB_Search_Brand_DK. Flag any name that doesn't. | One pattern with a concrete example is easier to follow than a description |
## Approval | |
Ask me before any change to a budget, bid, bidding strategy or status, and show the value before and after. | The approval line; back it with a setting, as the section below shows |
## Never change | |
Never change conversion actions or the Brand campaign's bidding strategy. Never delete anything; propose a pause instead. | A hard constraint, the kind Anthropic says belongs in the file |
## Changes | |
Before any change, read the latest entries in internal/google-ads/CHANGELOG.md or internal/meta-ads/CHANGELOG.md. | The read-first line that ties the file to the history |
Log every live change there, newest first: approval, old and new value, how you checked it, how to roll it back. | The history goes in the changelog, not in this file |
No keys or passwords in this file. Credentials come from the source named in CONNECTION.md. | The file loads into every session, so a key would too |
A complete instruction file for one example account, one line per row. The example lines are invented; your account's rules replace them.
Source: the split into rules, a connection file and changelogs follows my own agency's client folders5; the example lines are invented, with Anthropic's Help Center advice on what to include
Then set it up in six steps. The file route needs someone comfortable creating files in a folder and opening Claude Code or Codex in a terminal; the chat route, covered further down, needs only a Claude or ChatGPT project.
Make the client folder and its AGENTS.md.
Manual: create a folder such as
harbor-bikes/and a file namedAGENTS.mdin it, and paste the lines from the table.Add a CLAUDE.md that imports it.
Manual: create
CLAUDE.mdin the same folder with the single line@AGENTS.md. Claude-only notes go below that line.Replace the example lines with your own.
Manual: one rule per line, in plain sentences. Leave out anything you would only need once.
Add the connection file and the first changelog.
Manual: create
CONNECTION.mdwith how to connect, andinternal/google-ads/CHANGELOG.mdwith a first entry for today's setup.Check that the file loaded.
Manual: in Claude Code, run
/context alland look for the file under Memory files. In Codex, runcodex --ask-for-approval never "Summarize the current instructions."from the client folder (the repository root); OpenAI's docs give this command to confirm the file loads, and Codex answers with a summary of what it read.Test it on a question with a known answer.
Manual: in Claude Code or Codex, type: "Read the instructions for this folder and list the changes you would ask me about before making them." With the example file, a pass names budget, bid, bidding strategy and status changes, and says it won't touch conversion actions.
With AdCtrl: in a Claude or ChatGPT project with these rules in the project instructions and AdCtrl connected, write: "Which of my campaigns don't follow the naming pattern in my project instructions? Don't change anything."
How does the agent reach the ad account?
An instruction file gives the agent rules, not access to Google Ads or Meta. Access comes from somewhere else: a connector that gives Claude or ChatGPT tools for the account, a script that calls the platform's API with credentials you set up in Claude Code or Codex, or an export you save into the folder.
Reads are the safe place to start, since a report changes nothing. Writes need the approval and never-change lines, and the settings in the enforcement section. The difference between a connector and a direct API script is in MCP vs API, and setting up connectors in Claude is in Claude connectors for marketing.
Where do the same rules go in Claude and ChatGPT chats?
In Claude and ChatGPT chats, the same rules go into a project's instructions, since neither app documents reading a CLAUDE.md or AGENTS.md. Claude projects have a "Set project instructions" field, and "Claude will use these instructions for all the chats within the project".
| If you work in | Put the rules in | Worth knowing |
|---|---|---|
| A Claude project | Set project instructions | Used for every chat in that project |
| Claude Cowork | Global instructions, and folder instructions for a local folder | Claude can update folder instructions on its own during a session |
| A ChatGPT project | Project settings, then Instructions | Applies only in that project and overrides your global custom instructions |
| Claude Code or Codex | CLAUDE.md or AGENTS.md in the folder | Read at the start of each session |
One project per client keeps each account's rules apart. In ChatGPT, the project's instructions win over your global ones.
Source: Anthropic's and OpenAI's Help Centers, read 28 November 20266, 7, 8
One project per client account is the chat version of one folder per client. In Cowork, folder instructions add context "when you select a local folder on desktop", and "Claude can also update these on its own during a session", so reread them now and then.
To try the same rules in a chat, open a Claude or ChatGPT project with AdCtrl connected, paste the template's account, naming, approval and never-change lines into the project instructions, and start with a read that changes nothing:
Which of my campaigns don't follow the naming pattern in my project instructions? Don't change anything.When the list looks right, ask for the change itself:
Rename the paused campaign Spring sale test to HB_Search_SpringSale_DK, following the naming pattern in my project instructions. Change nothing else, and show me the before and after first.
Example data: a change preview in the invented Harbor Bikes account, renaming the paused campaign Spring sale test to HB_Search_SpringSale_DK. It's a preview, so nothing has changed yet.
Nothing is sent until the change is approved. Claude or ChatGPT asks before applying it when its permission setting says to (per tool in Claude, one setting for the whole app in ChatGPT), and after the apply AdCtrl reads the account back and tells you what Google actually saved9.
Which rules can't an instruction file enforce?
An instruction file can't enforce any rule that must hold every time, such as never changing a budget without a yes. For that, Anthropic's memory docs point to a hook: "To block an action regardless of what Claude decides, use a PreToolUse hook instead."1
A PreToolUse hook, a tool set to Always ask, or an account the connector keeps read only holds no matter what the model decides.
So every never-change and approval line in the template needs a setting behind it, and each tool has its own:
- Claude Code: a PreToolUse hook, a script that runs before a tool is used and can block it. Hooks "apply regardless of what Claude decides to do".
- Codex: its approval settings for tools, compared side by side in Claude Code vs Codex for marketing.
- Claude chats and Cowork: give every connector tool that applies a change Always ask. In Auto mode, a tool on Needs approval "Runs without asking you, unless an automated check flags the action as risky"; where Always ask isn't on your plan yet, use Manual mode6.
A Claude Code hook has three parts, all set out in Anthropic's hooks guide. It needs someone comfortable writing a short shell script, and Anthropic's example matches file edits with the matcher Edit|Write:
| Part | What to set | From Anthropic's hooks guide |
|---|---|---|
| Where | A PreToolUse entry under hooks in .claude/settings.json | The event that runs "Before a tool call executes" and "Can block it" |
| Which tools | A matcher naming the tools: Edit and Write for file edits, or mcp__<server>__.* for every tool of one connector | MCP tool names follow mcp__<server>__<tool> |
| What it does | A script that checks the call and exits with code 2 to block it, or returns "ask" to show the normal permission prompt | Anthropic's example blocks edits to .env and other protected files this way |
A PreToolUse hook is a setting plus a script. Anthropic's own example protects files; the same shape can stop a connector's write tools, but Claude can still reach some things another way, such as a shell command.
Source: Anthropic's hooks guide, read 28 November 202610

Illustration of what holds each rule. A line in the file is context; a hook, Codex's approval settings, a tool set to Always ask or an account kept read only is what stops the change.
A connector can add limits of its own: in the one I build, a change goes to Google or Meta only after it's approved, "either by you in your AI app or under a rule you saved in AdCtrl"11, and new campaigns are created paused. How the approval layers stack is in AI agents for marketing.
How long should the file be, and what are the limits?
An instruction file should stay under 200 lines, Anthropic's target for each CLAUDE.md, because "Longer files consume more context and reduce adherence". Anthropic's Help Center adds that every line loads on every request, so keep only the lines the agent needs every time.
The other limits matter mostly once you have several files:
| Limit | Claude Code | Codex |
|---|---|---|
| Size | Target under 200 lines per file; a file over 4 MiB is skipped entirely | Stops adding files once all of them reach 32 KiB combined, by default |
| Splitting a file | @path imports, and an imported file can import another, up to four levels deep; imports don't reduce what loads | One file per folder, joined from the root down |
| Two files disagree | All files are joined; if two rules contradict, Claude "may pick one arbitrarily" | The closer file appears later and overrides earlier guidance |
| Subfolders | Load when Claude reads a file in that subfolder | Only folders between the project root and where you start |
The advanced part. Codex fills its 32 KiB from the root down, so once the files pass 32 KiB, the client file is the one cut short or left out: keep the shared files short.
Source: Anthropic's memory docs and OpenAI's Codex docs, read 28 November 20261, 2
For your own notes inside the file, Anthropic strips block-level HTML comments before the content reaches the model, so a line like <!-- edit AGENTS.md, not this file --> costs nothing.
How do you keep the file current?
Keep the file current by adding a rule when the agent gets something wrong and deleting rules that no longer apply. Anthropic's Help Center treats a mistake Claude makes twice as the signal that a rule is missing, and suggests a quarterly skim, "since outdated instructions are worse than none"4.
Date every rule you add. In the repository behind this blog, the instruction file ends with a rule-changes list in which every rule has a date and the reason it was added, and quotes my words when the rule came from me12. When a rule looks odd six months later, the entry says why it exists, and you can tell whether the reason still holds.
| Part of the entry | What it says |
|---|---|
| Date and rule | 2026-11-05: fewer footnotes, at most 3 citation markers per section, every source still listed |
| My words it quotes | "there's many footnotes and sources and stuff … tone it a bit down" |
| The failure behind it | 61 to 68 footnote markers per article under the old one-per-paragraph rule |
One real entry from the rule-changes list in this blog's instruction file, shortened. When the rule looks odd later, the entry gives the reason.
Source: the blog's own instruction file, read 28 November 202612
Before you trust the file on a live account, it should pass these checks:
- The file is under 200 lines.
- It holds no keys, passwords or tokens.
- Account IDs sit in the connection file, not in the rules.
- Every never-change rule also has a setting behind it.
- The changelog path is named, with the read-first rule.
- The load check passed:
/context allin Claude Code, the summary in Codex. - No two rules contradict each other.
- Every rule added after setup has a date and the reason it was added.
Should a rule go in CLAUDE.md or in a skill?
A rule that applies in every session goes in CLAUDE.md, and a procedure you run for one job goes in a skill. Anthropic says rules "load into context every session", while skills "only load when you invoke them or when Claude determines they're relevant to your prompt"1.
So "never touch the Brand campaign" is a rule, and your monthly audit is a skill. Writing a skill from your own playbook is covered in Claude skills for marketing.
Frequently asked questions
Does AdCtrl read CLAUDE.md or AGENTS.md?
No. Its docs describe connecting Claude or ChatGPT to your ad accounts, not reading instruction files. Paste the rules into the project's instructions, where Claude or ChatGPT reads them; approval then runs through the AI app's own permission settings.
Does Codex read CLAUDE.md?
Not by default. Codex reads AGENTS.override.md, AGENTS.md and the names in project_doc_fallback_filenames, and ignores every other filename2. A fallback name is used only in a folder with no AGENTS.md, so for one set of rules keep AGENTS.md and import it from CLAUDE.md.
Do I need both files?
Only if you use both tools or want Claude-only notes. Claude Code alone works with just CLAUDE.md, and Codex alone with just AGENTS.md. With both, the one-line CLAUDE.md that imports AGENTS.md keeps a single copy of the rules.
What is CLAUDE.local.md for?
CLAUDE.local.md holds your own notes for one project. Add it to .gitignore so it isn't committed and colleagues working in the same folder don't get it. Use it for personal preferences, not for account rules the whole team needs.
Will Claude follow the file every time?
Usually, not always. Claude reads the file as guidance rather than a setting it must obey, longer files reduce adherence, and Claude may pick one of two contradicting rules arbitrarily. Anything that must hold every time needs a hook or a permission setting.
Can I write notes in the file that the agent doesn't see?
Yes, in Claude Code. Block-level HTML comments in a CLAUDE.md are stripped before the content reaches Claude. A good use is a comment at the top of a one-line CLAUDE.md telling editors to change AGENTS.md instead.
What to do next
Write one AGENTS.md for one account this week: the account, naming, approval lines, never-change list and the changelog path, with a one-line CLAUDE.md that imports it. Check that it loaded, then put a setting behind every rule that has to hold.
Learn more: Claude Code vs Codex for marketing covers which tool takes which job, and Claude connectors for marketing covers the permission settings that back your approval lines.
Try it: connect AdCtrl with the getting started steps, paste your account rules into the project's instructions, then in AdCtrl, write: "Which of my campaigns don't follow the naming pattern in my project instructions? Don't change anything." Try Solo free for 3 days, no card needed9.
Sources
- How Claude remembers your project, Anthropic. Accessed 28 November 2026.
- Custom instructions with AGENTS.md, OpenAI. Accessed 28 November 2026.
- AGENTS.md, Agentic AI Foundation (AGENTS.md project). Accessed 28 November 2026.
- Give Claude context: CLAUDE.md and better prompts, Anthropic. Accessed 28 November 2026.
- Own data: Observed on 2026-11-28 in Kaan's agency workspace and in the agency's own client-onboarding skill that sets it up: each client folder has AGENTS.md as the source of truth, a CLAUDE.md whose content is the import line @AGENTS.md (plus an HTML comment telling editors to edit AGENTS.md), a CONNECTION.md that says only how to connect (status, account IDs, credential sources, scopes, last validated date, API quirks; no change history), one internal/{platform}/CHANGELOG.md per platform that gets live writes (newest first; account/object, approval, what changed with old and new values, why, before state, verification, rollback, evidence, status; failed and partial batches included), and one internal/analysis/{workstream}.md per workstream with a Current State section at the top. The onboarding skill's rules include 'do not modify live accounts/sites without explicit approval' and 'Before changing a live platform, read the latest entries of its changelog'.. Sample: All client folders in the agency's Clients directory had AGENTS.md and an @AGENTS.md CLAUDE.md; folders without them were the agency's own non-client folders. Counts withheld (no client counts in public text).. Period: 2026-11-28 (point-in-time file check). Measure: count (file listing and grep), plus the convention as written in the skill. No client named, no client count, no account IDs; only the file layout and the rule wording, which contain no client data. Source files: ~/.claude/skills/client-onboarding/SKILL.md and the agency's global instruction file (paraphrase only; the skill's example rows name a real client and must never be quoted)..
- Get started with Claude Cowork, Anthropic. Accessed 28 November 2026.
- How can I create and manage projects?, Anthropic. Accessed 28 November 2026.
- Projects in ChatGPT, OpenAI. Accessed 28 November 2026.
- AdCtrl docs, AdCtrl. Accessed 28 November 2026.
- Automate actions with hooks, Anthropic. Accessed 28 November 2026.
- AdCtrl terms of service, AdCtrl. Accessed 28 November 2026.
- Own data: Observed in the AdCtrl repository on 2026-11-28: AGENTS.md at the root (50 lines), in socials/ (37), ads/ (37) and socials/blog/ (142); socials/blog/CLAUDE.md and ads/CLAUDE.md contain only the line @AGENTS.md; there is no CLAUDE.md at the root or in socials/. socials/blog/AGENTS.md ends with a 'Rule changes' list in which every rule is dated and gives the reason or failure behind it; entries Kaan set quote his words, and coordinator changes say 'no quote from Kaan'.. Sample: One repository (AdCtrl's own), 4 AGENTS.md and 2 CLAUDE.md files; the 2026-11-05 entry (socials/blog/AGENTS.md lines 87–98) is the one shown in the article's table.. Period: 2026-11-28. Measure: count (wc -l, file listing). Own product repository; no client data.





