How to give an AI assistant memory that lasts between sessions
An AI model does not remember you. Each session starts blank. Anything it seems to "remember" was handed back to it at the start of the conversation.
That is the whole trick. Memory is text that gets loaded before you type. So the question is where that text lives and who controls it.
ChatGPT and Claude both have a memory feature now, and it is useful. You manage it through their settings, and it lives in their account. This page shows the other way: memory as plain files in a folder on your computer. You can open them, edit them, back them up, and take them to a different model.
No database. No coding. You need an agent app that can read and write files. Plan for roughly 30 minutes the first time. That is an estimate. For comparison, the Level 1 kit install, where your agent does the setup from a zip, was timed at under 10 minutes on a fresh host.
What you need
- A Mac, Windows or Linux computer.
- An agent app: Claude Code or OpenCode. Both have a desktop app, so the terminal is optional. Claude Code needs a paid Claude plan or an Anthropic API account. OpenCode is free and comes with free models for a limited time. OpenCode says it stores your data on them, so keep private notes for a local or paid model.
- A folder you are willing to let the agent read and write.
A chat window in a browser will not work for this. It cannot open files on your computer. An agent app can.
Step 1: Make a workspace folder
Create a folder called assistant somewhere you will find it again. Open that folder in your agent app. Everything below happens inside it.
Step 2: Create the memory files
Ask your agent to do this. Paste:
Create a folder called memory. Inside it create:
- decisions.md (a dated list of decisions I have made, newest first)
- projects.md (one short section per active project: goal, state, next step)
- a folder called daily
Do not put anything in them yet except a one-line heading.
Three kinds of memory, three places:
- Decisions. Things you settled and do not want to re-argue.
- Project state. Where each piece of work stands.
- Daily notes. One file per day, named by date, like
2026-11-13.md. What you worked on and what is still open.
The assistant I built uses the same three. They cover most of what you would otherwise re-explain every morning.
Step 3: Tell the agent when to read and write
Files do nothing until the agent is told to use them. That instruction goes in a file the app loads at the start of every session.
- OpenCode reads a file called
AGENTS.mdin your workspace folder. - Claude Code reads
CLAUDE.md. If there is noCLAUDE.md, current versions (2.1.277 or later; to check, open a terminal and runclaude --version) readAGENTS.mdinstead.
So one AGENTS.md covers both. Create it in the assistant folder with this in it:
# How to work with me
## At the start of every session
1. Read memory/decisions.md and memory/projects.md.
2. Read the two most recent files in memory/daily/.
3. Tell me in three lines where things stand. Then wait.
## During a session
- When I make a decision, add it to the top of memory/decisions.md
with today's date.
- When a project's state changes, update its section in memory/projects.md.
## When I say "wrap up"
1. Write memory/daily/YYYY-MM-DD.md for today: what we did,
what was decided, what is still open.
2. Confirm the file name you wrote.
## Rules
- Never delete a memory file. Ask first.
- If two notes disagree, tell me. Do not pick one silently.
Plain English is the right format. There is no special syntax.
Step 4: Use it for one real session
Do a piece of actual work. Make at least one decision out loud, like "we are sending the newsletter on Thursdays from now on." When you are done, type wrap up.
Open memory/daily/ yourself and read the note. If it is wrong, fix it by hand. It is your file.
Step 5: Test that it remembers
Close the session. Start a new one in the same folder. Do not explain anything. Ask:
What did I decide last session, and what is still open?
If it answers from the notes, you have persistent memory. If it does not, the usual causes are:
- The instruction file is not in the folder you opened.
- You are in Claude Code and there is a
CLAUDE.mdnext to yourAGENTS.md. In that case Claude Code reads onlyCLAUDE.md. Put the line@AGENTS.mdat the top ofCLAUDE.mdso it pulls the other file in. - The agent skipped the wrap-up, so there is no note to read.
Keep it small
More memory is not better memory. Every line you load costs attention. Anthropic's own guidance is to keep an instruction file under about 200 lines, because longer files are followed less reliably.
Two habits keep it working:
- One workspace per area of your life. Work notes next to travel plans make both worse.
- Prune monthly. Move finished projects out of
projects.md. Old daily notes can stay on disk. The agent only reads the two most recent unless you ask.
What about built-in memory?
Claude Code also keeps its own notes, called auto memory. It is on by default. It saves things like your preferences and corrections to ~/.claude/projects/<project>/memory/, and loads the first 200 lines at the start of each session. Those are plain files too, and you can read them.
It is a good layer to have. It is not a replacement for the files above, because Claude decides what goes in it. Your decision log should be something you control.
The honest limit
This setup depends on the agent following instructions. Most of the time it does. Sometimes it forgets to write the daily note.
The fix is to stop relying on the model for that step. A hook is a small script the app runs for you at a fixed moment, like session start or session end, whether or not the model remembers. That is the next thing to add once the files are working.
When plain files stop being enough
Plain files carry you a long way. You will know you have outgrown them when the agent needs a note from four months ago and cannot find it by reading the two most recent files. The next step up is search across the folder, and after that a proper retrieval system. Do not start there. Start with three files and a wrap-up habit.
If you want the thinking behind this before you build anything, the free primer covers it in five short modules: AI Beyond the Chatbot. When you want the whole system built step by step, Level 1 is the full path.
New to agents entirely? Start with the free primer. Ready to build the assistant whose memory is yours? Level 1 builds the file-based system end to end, no coding required. Not sure it fits: the compare page covers what Dark Factory is not.
Level 1 is $79 one-time, covered by the 30-day Read Before You Build guarantee.