Your AI's memory sits in one company's account. Keep it in a folder every AI can read
If you pay 20 dollars a month for an AI and it still opens every morning by asking who your clients are, you are paying for a capable stranger. Most people fix that with the memory switch inside the app. It helps, and its cost shows up later: everything the assistant has learned about you sits inside that one company's account, and the assistant you open next month starts from zero.
There is a second way to give an AI a memory. You keep it as plain text files in a folder on your own computer. A rules file called CLAUDE.md says how the assistant should work with you. A one-page map called MEMORY.md says where each kind of information is. A folder called .memory holds the notes themselves: your clients, your projects, your decisions. The assistant reads these when a session starts and writes to them when the work ends.
Ordinary files belong to no product. Claude looks for CLAUDE.md. Codex, the work tool that comes with a ChatGPT plan, looks for AGENTS.md. A single sentence in the second file sends it to the first, and both assistants then answer from the same memory. I run Claude and Codex on the same folders this way.
You do not need to program to do this. The files are sentences in your own language, and the assistant writes most of them for you. What you do need is the version of the AI that can open a folder on your computer: Claude Code or Claude Cowork on the Claude side, Codex on the ChatGPT side. The chat page in a browser cannot read or write your files.
The four sections below explain why the built-in memory holds you in place, what goes in each file, how one line makes two assistants share a memory, and what "local" does and does not protect. The copy block at the end builds the whole folder for you after five questions.
Follow for more:
Course Registration: https://halaqa.app/enrollment?course=start-with-ai
The memory inside the app stays inside the app
Claude's chat apps keep a memory of you that is on by default, and Anthropic documents how to view it, edit it and export it or paste in memories from another AI. ChatGPT keeps its own memory in its own account. Each one works well for the product it lives in. The trouble starts when you use two assistants, or when you switch. A year of corrections ("write shorter", "this client pays late", "never promise delivery on a Friday") is stored as that product's summary of you. Moving it means exporting, pasting and hoping the next assistant reads it the same way, and you repeat the move every time the first one learns something new. You also cannot open that memory the way you open a document. You cannot keep one page per client, see what changed last week, or hand the same page to a second assistant while the first is still working. A memory you cannot organize yourself grows into a pile of loose facts, and nobody checks which of them stopped being true.
Three plain files do the same job in a folder you own
CLAUDE.md holds rules and nothing else: who you are in three lines, the language and length you want in replies, what the assistant must ask before doing, and the instruction to read the map before any real task. Claude Code loads this file at the start of every session, so every line in it is read on every request. Keep it short. Anthropic's own guidance is to stay under 200 lines.
MEMORY.md is the map. It holds no facts. Each row says "when the task is about this, read that file": a task about a client named Leen points to .memory/people/leen.md, a task about the shop's new season points to .memory/projects/winter-collection.md. The map is why the assistant opens two files for a task and leaves the other sixty closed.
The .memory folder holds the notes. One file per person, with their role and what they have asked for, each line dated. One file per project, with the goal, the current status, the decisions and a short work log. One file about you. A designer and a shop owner will fill these with different things, and the shape stays the same.
A note on names: Claude Code also keeps its own automatic notes in a file called MEMORY.md, stored under its settings folder in your home directory. That one belongs to Claude alone and no other tool reads it. The MEMORY.md in this article is the one you keep inside your work folder.
One line makes Claude and ChatGPT read the same memory
Codex reads a file named AGENTS.md from the folder it is opened in. AGENTS.md is an open format that more than twenty tools read, now looked after by a foundation under the Linux Foundation. Gemini CLI reads GEMINI.md by default and can be set to read AGENTS.md as well.
Recent versions of Claude Code read AGENTS.md too, but only in a folder that has no CLAUDE.md. When both files exist, Claude follows CLAUDE.md alone. So choose one file to hold the rules and make the other a pointer. In my folders CLAUDE.md holds the rules, and AGENTS.md is one sentence telling the assistant to read CLAUDE.md in full and follow it. The opposite arrangement works equally well: rules in AGENTS.md, and a CLAUDE.md whose only line is @AGENTS.md, which Claude treats as an import.
Do not keep two full copies. My AGENTS.md used to be a complete copy of CLAUDE.md. I changed a rule in one, the other kept the old wording, and two assistants in the same folder followed two different sets of instructions. It has been a one-line pointer since 2026-09-24.
To check the setup, close the session, open the same folder in the second tool and ask: "What are my active projects, and how do I like replies written?" Both answers should come from the files and match.
The memory is stored on your disk, and what the assistant opens is still sent
Be exact about what "local" means here. The model runs on the provider's servers. When the assistant opens a file to answer you, that text travels with your request. Anthropic's documentation says Claude Code sends your prompts and the model's outputs over the network, encrypted in transit. On Claude's personal plans a setting decides whether your chats and Claude Code sessions may be used to train future models: Anthropic keeps the data for 5 years with the setting on and 30 days with it off. ChatGPT has its own data controls in its settings. Check them before you put client material in the folder. What you gain is ownership of the stored memory. It is a folder you can read, correct, back up and open with any assistant, and the map keeps each request down to the few files the task needs. Passwords, API keys and card numbers never go in it. The memory stays alive only if the assistant writes to it. Put these lines in the rules file: when you say "remember this", it writes the fact to the right file and names the file; when a block of work ends, it adds one dated line to the month's work log without being asked; dates are written in full, such as 2026-11-20, because "next week" means nothing a month later. When a fact changes, the old line is rewritten where it lives. Cost is the last check. Claude Code and Cowork are included in the Pro plan, which is 20 dollars a month when billed monthly. Codex is included in ChatGPT plans, with limited use on the free plan and full access from Plus at 20 dollars a month. The memory itself costs nothing: it is text files, and any future assistant that reads a folder can use them.
ذاكرة مساعدك تسكن في حساب شركة واحدة: انقلها إلى مجلد يقرؤه أي مساعد
تدفع 20 دولارًا في الشهر لمساعد ذكي، ومع ذلك يسألك كل صباح من هم عملاؤك وماذا تعمل. زر الذاكرة داخل التطبيق يخفف المشكلة، لكن ثمنه خفي: ما يعرفه المساعد عنك يبقى مخزّنًا عند الشركة، وكلما جرّبت مساعدًا آخر بدأت من الصفر.
هذا هو الأمر الثالث الذي وعدت بتفصيله لمن ردّ على قصتي في Instagram. الأمران الآخران، أن يستعمل المساعد متصفحك وأن يستعمل حاسوبك، جميلان. أما هذا فهو الذي أقول فيه: إن كنت تدفع 20 دولارًا ولا تفعله، فألغِ الاشتراك.
الحل أن تنقل الذاكرة إلى ملفات في مجلد على جهازك. تحتاج ثلاثة أجزاء: ملف قواعد اسمه CLAUDE.md، وصفحة واحدة هي الخريطة واسمها MEMORY.md، ومجلد ملاحظات اسمه .memory. تقرؤها بنفسك وتصحح فيها ما شئت، ويقرؤها Claude وCodex وGemini CLI فيعملون بالسياق نفسه.
لا تحتاج إلى برمجة. يعمل هذا لمن يدير متجرًا أو يقدّم خدمات لعملاء أو يدرس أو يعمل موظفًا، لأن الملفات جمل مكتوبة بلغتك والمساعد يكتب أكثرها. وفيه أمثلة من حياة صاحب متجر ومستقلة تدير عملاءها، وشرح لما تحميه كلمة "محلي" وما لا تحميه، وللقواعد التي تبقي الذاكرة حية بعد الأسبوع الأول.
في آخر الصفحة مربع نسخ بالإنجليزية. الصقه في Claude Code أو Cowork أو Codex داخل مجلد فارغ، فيسألك خمسة أسئلة، وينشئ الملفات كلها، ثم يختبر نفسه.
تابعني على Instagram:
التسجيل في الدورة: https://halaqa.app/enrollment?course=start-with-ai
الخطوات
الذاكرة داخل التطبيق تبقى داخل التطبيق
في تطبيقات الدردشة ذاكرة مدمجة، وهي في Claude مفعّلة افتراضيًا. تلخص ما عرفته عنك وتستعمله في محادثاتك التالية، وتفيدك فعلًا في الأسابيع الأولى. وتشرح Anthropic في صفحة الدعم كيف تعرضها وتعدّلها وتصدّرها، وكيف تلصق فيها ذكريات جاءت من مساعد آخر. المشكلة عملية. هذه الذاكرة ملخص كتبه المنتج عنك، ونقلها يدوي: تصدّر ثم تلصق، وتكرر ذلك كلما انتقلت. وهي كتلة واحدة، فلا تستطيع أن تجعل لكل عميل صفحة ولكل مشروع صفحة. ولا يتشاركها مساعدان يعملان معًا على مجلدك. أما ChatGPT فيحتفظ بذاكرته الخاصة داخل حسابك عنده. وصفحة الدردشة في المتصفح لا تقرأ ملفات جهازك ولا تكتب فيها، فتحتاج للطريقة التالية إلى Claude Code أو Claude Cowork من جهة Claude، أو إلى Codex من جهة ChatGPT.
ثلاثة ملفات عادية في مجلد تملكه تؤدي العمل نفسه
الأول CLAUDE.md، وفيه القواعد وحدها: من أنت في ثلاثة أسطر، وبأي لغة وبأي طول تريد الردود، وما الذي يجب أن يسألك عنه المساعد قبل أن ينفذه، وسطر يقول "اقرأ الخريطة قبل أي مهمة جدية". يحمّل Claude Code هذا الملف في بداية كل جلسة، أي أن كل سطر فيه يُقرأ مع كل طلب. لذلك تنصح Anthropic في توثيق الذاكرة بإبقائه دون 200 سطر.
الثاني MEMORY.md، صفحة واحدة هي خريطة بلا معلومات. كل صف فيها يقول: حين تكون المهمة عن كذا، اقرأ الملف كذا. مهمة عن عميلة اسمها لين تقود إلى .memory/people/leen.md، ومهمة عن موسم الشتاء في متجرك تقود إلى .memory/projects/winter-collection.md. بهذه الخريطة يفتح المساعد ملفين ويترك الملفات الأخرى، وقد تبلغ 60 ملفًا، مغلقة.
الثالث مجلد .memory، وفيه الملاحظات نفسها. لكل شخص ملف: دوره، وما طلبه، وكل سطر عنه مؤرخ. ولكل مشروع ملف: الهدف، والحالة، والقرارات، وسجل عمل قصير. وملف واحد عنك أنت.
انتبه إلى تشابه الأسماء. يحتفظ Claude Code أيضًا بملاحظاته التلقائية في ملف اسمه MEMORY.md، لكنه مخزّن تحت مجلد إعداداته في مجلد المستخدم، وهو لـClaude وحده ولا تقرؤه أداة أخرى. أما ملف الخريطة هنا فيعيش في مجلد عملك.
سطر واحد يجعل مساعدين مختلفين يقرآن الذاكرة نفسها
كل أداة تبحث عن اسم ملف محدد. Claude Code يقرأ CLAUDE.md. وCodex يقرأ AGENTS.md من المجلد الذي فُتح فيه. وصيغة AGENTS.md مفتوحة تقرؤها أكثر من عشرين أداة، وترعاها الآن مؤسسة تابعة لـLinux Foundation. أما Gemini CLI فيقرأ GEMINI.md افتراضيًا، ويمكن ضبطه ليقرأ AGENTS.md أيضًا.
الإصدارات الحديثة من Claude Code تقرأ AGENTS.md كذلك، لكن في مجلد ليس فيه CLAUDE.md. إذا وُجد الملفان اتبع Claude CLAUDE.md وحده. لذلك لا تكتب القواعد في ملفين. أمامك طريقتان: أن تضع القواعد في CLAUDE.md وتكتب في AGENTS.md جملة واحدة تطلب قراءة ذلك الملف كاملًا واتباعه، أو أن تضعها في AGENTS.md ويكون في CLAUDE.md سطر وحيد هو @AGENTS.md، وهذا السطر يستورد الملف المذكور.
أنا أشغّل Claude وCodex على المجلدات نفسها بهذه الطريقة. عندي CLAUDE.md يحمل القواعد، وAGENTS.md جملة واحدة تطلب من المساعد أن يقرأ CLAUDE.md كاملًا ويتبعه. وكان AGENTS.md عندي نسخة كاملة من الأول. غيّرت قاعدة في ملف فبقيت صيغتها القديمة في الآخر، فصار مساعدان في مجلد واحد يتبعان تعليمات مختلفة. وهو منذ 2026-09-24 جملة واحدة تحيل إلى الملف الأول.
وللتأكد من أن الأمر يعمل: أغلق الجلسة، وافتح المجلد نفسه في الأداة الثانية، واسألها "ما مشاريعي الحالية وكيف أحب أن تُكتب الردود؟". يجب أن يأتي الجوابان من الملفات، وأن يتطابقا.
الذاكرة تُخزَّن عندك، لكن النموذج يعمل على خوادم الشركة
كلمة "محلي" هنا تعني أن الذاكرة مخزنة على قرصك. النموذج نفسه يعمل على خوادم الشركة. يرسل Claude Code طلباتك ومخرجات النموذج عبر الشبكة بتشفير أثناء النقل، كما يوضح توثيق استخدام البيانات، وكل ملف يفتحه المساعد ليجيبك يسافر مع الطلب. فكّر قبل أن تضع في المجلد ما لا تريد أن يصل إلى الشركة. في الخطط الشخصية من Claude إعداد يقرر هل يجوز استخدام المحادثات وجلسات Claude Code في تدريب نماذج قادمة. وبحسب سياسة الخصوصية تحتفظ Anthropic بالبيانات 5 سنوات والإعداد مفعّل، و30 يومًا والإعداد مغلق. وفي ChatGPT ضوابط بيانات في الإعدادات، فراجعها قبل أن تضع مواد العملاء في المجلد. ولا تضع في المجلد كلمات سر ولا مفاتيح API ولا أرقام بطاقات، وخذ منه نسخة احتياطية. الذاكرة لا تبقى حية إلا إذا كتب فيها المساعد، فضع في ملف القواعد أربع قواعد. حين تقول "تذكّر هذا" يكتب المعلومة في الملف المناسب ويذكر اسمه. وفي نهاية كل فترة عمل يضيف سطرًا مؤرخًا واحدًا إلى سجل الشهر دون أن تطلب. ويكتب التواريخ كاملة مثل 2026-11-20، لأن "الأسبوع القادم" لا يعني شيئًا بعد شهر. وإذا تغيّرت معلومة أُعيدت كتابة سطرها القديم في مكانه. التكلفة معروفة. Claude Code وCowork مضمّنان في خطة Pro بسعر 20 دولارًا في الشهر عند الدفع الشهري. وCodex مضمّن في خطط ChatGPT، باستخدام محدود في الخطة المجانية ووصول كامل من Plus بسعر 20 دولارًا في الشهر. أما الذاكرة نفسها فملفات نصية مجانية.
Prompt
# Build a memory your AI reads from your own folder, on any provider.
# Where: open an empty folder (or your work folder) in Claude Code, Claude
# Cowork or Codex, then paste everything below. It does not work in a
# browser chat, because a browser chat cannot write files on your computer.
# Review every file it writes. Nothing here needs a paid add-on.
Set up a file-based memory in this folder. Work in this order.
1. Before you write anything, ask me these questions one at a time and wait
for each answer:
- What is your name, what do you do, and who do you do it for?
- Which 2 to 5 projects or clients are active right now?
- Who are the people you deal with most (name and role)?
- How do you want me to write and reply (language, length, tone)?
- What must I never do without asking you first?
2. Create CLAUDE.md. It holds rules only, no facts:
- who I am in three lines;
- how to reply to me;
- "Before any real task, read MEMORY.md, then open only the files it
points to for this task.";
- "When I say 'remember this', write it to the right file under .memory/
and tell me which file in one sentence.";
- "At the end of a work block, add one dated line to this month's work
log without being asked.";
- "Dates are written as YYYY-MM-DD, never 'tomorrow' or 'next week'.";
- "One fact lives in one file. When a fact changes, rewrite it where it
lives, then add a dated line saying what changed.";
- "Never store passwords, API keys or card numbers in this folder.";
- the list of things I said you must never do without asking.
3. Create AGENTS.md with exactly this content and nothing else:
"The instructions for this folder are in CLAUDE.md. Read that file in
full and follow it. Do not keep a second copy of its rules here."
4. Create MEMORY.md as a map, not a notebook. One table with two columns,
"When the task is about" and "Read this file", one row per file you
create in step 5. Add one line at the top: "This file holds no facts.
Add a row whenever a new memory file is created."
5. Create the folder .memory/ with:
- .memory/people/ : one file per person I named, with role, how I work
with them, and a "Stated preferences" list with dates;
- .memory/projects/ : one file per project I named, with goal, current
status, decisions with dates, and a "Work log" section;
- .memory/context/about-me.md : my answers to question 1 and 4;
- .memory/context/work-log/<this year>-<this month>.md : starts with
one line describing today's setup.
6. Show me the folder tree and read each file back to me in two lines.
Then ask me for one real task and do it using only this memory, so I
can see whether you found what you needed without my retelling it.
# Completion check: close the session, open the same folder in a second
# AI tool (Codex if you used Claude, or the reverse), and ask "what are my
# active projects and how do I like replies written?". Both tools must
# answer the same from the files. If one cannot, the pointer in step 3 or
# the map in step 4 is the part to fix.
# Keep a backup: the folder is the memory. Copy it to a drive or a private
# cloud folder you trust.