Blog
The Handoff · No. 04 · Workflows

Stop re-explaining yourself: give your AI a memory file

Every AI session starts from zero unless you hand it a file to read first. What goes in a memory file, what never does and a starter template to copy.

An index-card file box with one card lifted out, its tab marked in orange, and loose cards beside it on a light background.

Every AI session starts from zero. The assistant that drafted a great newsletter on Monday has no idea on Tuesday who you are, how you write or which rules it must never break, so you explain it all again. A memory file ends that loop: a short plain text file the AI reads before it does anything else. Write it once, in about 10 minutes, and you stop re-explaining yourself.

Two weeks ago, at the end of your first afternoon with Claude Code, I had you run /init and add two rules to a CLAUDE.md, and I promised to show you what belongs in a good one. Last week's Codex post touched on its cousin, AGENTS.md. Here's the full version: where the file lives in each tool, what goes in, what stays out and a template you can copy today.

Why the AI forgets, and what the file fixes

An AI model doesn't carry yesterday into today. Everything it can see at once is called its context window, and each new session starts with an empty one. Think of a desk that gets cleared every night. Anthropic's memory docs for Claude Code open with exactly that point.

A memory file is the note you leave on that desk. The tool loads it at the start of every session, before your first prompt, the way a good office manager hands a temp a one-page binder: who we are, how we do things here, where the keys hang, what never to touch.

One caveat. The AI treats the file as guidance, not as a lock; Claude Code's docs call it context, not enforced configuration. A line that says "never send email" makes sending very unlikely, but the real guarantee is not giving the assistant a way to send in the first place. Guardrails get their own post later in the series.

Claude Code also keeps notes of its own when you correct it, which it calls auto memory, and you can browse them with /memory. Handy, but the file you write yourself is the one you control.

Where the file lives in each tool

Every major tool has a version of this. The names differ; the idea doesn't.

Tool What it's called Where it goes
Claude Code CLAUDE.md ~/.claude/CLAUDE.md for all your work, plus one in any project folder
Codex AGENTS.md ~/.codex/AGENTS.md for all your work, plus one in any project folder
Claude app Instructions for Claude Settings, plus instructions on each project
ChatGPT Custom instructions Settings, under Personalization, plus each project's settings

The ~ means your home folder (on Windows, that's C:\Users\yourname).

Claude Code. Start a session in a folder, type /init, and Claude Code drafts a starting CLAUDE.md from what it finds there. If one already exists, it suggests improvements instead of overwriting yours. It was built with software projects in mind, so in a folder of documents the draft will be thin. Treat it as a first draft. Type /memory to open the file, /context to confirm it loaded, or just say "add this to CLAUDE.md."

Codex. Codex reads the AGENTS.md in its home folder first, then any AGENTS.md files from the top of your project down to the folder you're working in. Files closer to your work come later, so they win. The combined files have a default cap of 32 KiB (about 32,000 characters), far more than a good memory file needs (OpenAI's AGENTS.md guide).

AGENTS.md is also an open format, now stewarded by the Agentic AI Foundation under the Linux Foundation, and agents.md lists more than 20 tools that read it, from Cursor to GitHub Copilot's coding agent. Claude Code reads an AGENTS.md on its own when the project has no CLAUDE.md. If you use both tools, keep one file: write AGENTS.md, and if you also need a CLAUDE.md, make its first line @AGENTS.md so it pulls the shared file in.

Chat apps. The Claude app has "Instructions for Claude" in Settings, applied to every chat, and each project has its own instructions. ChatGPT keeps custom instructions in Settings under Personalization, capped at 1,500 characters on Free and Go and 5,000 on Plus and higher plans, and a project's instructions override them inside that project. Those fields are short, so put only your top rules there.

What goes in: five kinds of lines

Good memory files hold the same five things, one fact per line.

  1. Who you are. Your role, your organization and who you serve. Two lines, not your life story.
  2. Voice rules. How you sound and what you never do. One of mine: "no em dashes in anything written for me."
  3. Tools and where things live. Which folder holds client files, which app is the source of truth for tasks, where the brand assets are. Write pointers, not secrets: "the API key is in the private .env file as NEWSLETTER_KEY," never the key itself.
  4. Standing rules. "Drafts only. Never send email." "Work on a copy; never delete originals." "Ask before spending money."
  5. Gotchas learned the hard way. This is where the file earns its keep.

Two real lines from my memory file show what I mean. The first: "this API returns 404 for any wrong path, so a 404 says nothing about whether your key works." (An API is the official way one program talks to another, and 404 is its "not found" error.) The second: "strip the query string from image links or the newsletter tool rejects the email." The query string is the part of a web address after the question mark. Each line is a mistake nobody has to make twice.

A bigger example. I created 31 recurring monthly events through a platform's API, one for each day of a ministry's 31-day prayer calendar. They showed up a day early, because the site displays times in a fixed timezone. One patch script fixed all 31. Separately, a church planning tool's API ignored the timezone I sent and stored 9 a.m. as 4 a.m. The fix was sending the time in UTC, the world's reference clock. Both gotchas now live in my memory file, where every new session reads them first.

When should you add a line? The Claude Code docs offer a good test: when the AI makes the same mistake a second time, or when you catch yourself typing a correction you already typed last session.

What never goes in

Never put passwords, API keys, tokens or account numbers in a memory file. These files get synced, copied and shared. A project CLAUDE.md is designed to be shared with a team, and you don't want a key riding along. Write down where the key lives instead.

Keep out private details about clients, staff, family or health, and anything you wouldn't pin to the wall of a shared office. Chat-app instructions also live on someone else's servers. ChatGPT's help center notes that custom instructions can be used to improve its models unless you opt out, so check your data controls before you write anything personal there.

Long procedures stay out too. They belong in a skill, which I'll get to in a minute.

Keep it short, dated and pruned

A memory file works best when it's boring to read.

  • One fact per line. Short lines are easy to find and easy to delete.
  • Concrete beats vague. "Sign emails as Pat" works. "Be professional" doesn't.
  • Date your gotchas. Six months from now you'll want to know whether a quirk is still true.
  • Stay under 200 lines. That's Claude Code's own guidance: longer files take up more of the model's working space and get followed less reliably.
  • Prune once a month. If two lines contradict each other, the AI may follow either one, so delete the old line when you add the new one.

When a rule becomes a procedure, make it a skill

Some things you re-explain aren't facts. They're jobs with steps, and those belong in a skill: a saved procedure in its own folder, written in a file called SKILL.md. The top of the file holds a name and a short description of when to use it, and the rest is the steps. The assistant loads a skill only when that job comes up, so it can be long without crowding your memory file.

In Claude Code, personal skills live in ~/.claude/skills/<skill-name>/SKILL.md. You run one by typing / and its name, or Claude picks it up when your request matches the description (Claude Code skills docs). In Codex, personal skills live in ~/.agents/skills, you call one with $ and its name, and the built-in $skill-creator builds one when you describe the job. The Claude app has skills too, and both companies build on the same Agent Skills open format.

I have a skill that turns one approved logo into a full delivery package: every lockup and color version in several file formats, social icons, a favicon and a usage guide. None of those steps belong in a memory file. The skill holds them, and it loads only when there's a logo to package.

The rule of thumb: the memory file holds facts and rules for every session. A skill holds the steps for one kind of job.

A starter memory file you can copy

Fill in the brackets, delete what doesn't fit and save it as CLAUDE.md or AGENTS.md. If you only use a chat app, paste the voice section and the standing rules into its instructions.

Memory file
### Who I am
- I run [organization], serving [who]. Team: [names and roles, or "just me"].
- My readers are [audience]. Plain English, no jargon.

### Voice
- Write as me, in first person. Warm, direct, short paragraphs.
- No em dashes. Use periods, commas or parentheses.
- Never invent quotes, numbers, prices or stories.

### Where things live
- Client files: Documents\Clients, one folder per client.
- Logos and brand colors: Documents\Brand.
- Keys are in .env in this folder. Never print or copy them.

### Standing rules
- Drafts only. Never send email or publish anything.
- Work on copies. Never delete or overwrite originals.
- Ask before spending money or changing what a customer sees.
- For anything over three steps, show me a plan first.

### Gotchas (dated, newest first)
- [date] [app]: [what went wrong]. Fix: [what to do instead].

Last reviewed: [date]

Try this this week

  • Copy the template, fill in at least 15 lines and save it as ~/.claude/CLAUDE.md or ~/.codex/AGENTS.md. If you only use a chat app, paste your top five rules into its instructions.
  • Open a fresh session and ask, "What are my standing rules?" If it can't answer, the file isn't loading. In Claude Code, /context shows what loaded.
  • Scroll back through last week's chats. Anything you typed twice becomes a line.
  • Add one gotcha you hit this month, with the date.
  • Pick one job you repeat every week and write its steps down. That list is your first skill.

A memory file is the cheapest upgrade in this series: no new subscription, no setup, just writing down what you already know. If you'd rather not start from a blank page, book a free Discovery Call and we'll write your first memory file together. Bring the rules you're tired of repeating.

Keep reading
No. 01 · Getting started

Claude Code and Codex aren't just for programmers

The word 'code' scares off the people who'd get the most out of these tools. Here's what an AI agent actually does, where Claude Code and Codex live now and a safe first job to hand one.