Config File Memory
Config Files as Persistent Memory
Section titled “Config Files as Persistent Memory”In the previous lesson, you learned that AI agents have three layers of memory: the context window, conversation history, and configuration files. Of these three, configuration files are the only layer that survives when you close the conversation and start a new one.
This makes configuration files the AI agent’s long-term memory. They are simple text files (usually Markdown files ending in .md) that the AI reads at the beginning of every session. Whatever is written in these files shapes the agent’s behavior from the very first message.
The beauty of this approach is its simplicity. There is no database, no special memory system, no complicated technology. It is just a text file that the AI reads. You can open it, read it, edit it, and understand exactly what your agent “knows.” There is nothing hidden.
The Accumulation Pattern
Section titled “The Accumulation Pattern”The most powerful way to use configuration files is through accumulation: each session adds new rules, corrections, and lessons to the file. Over time, the file grows from a simple set of instructions into a comprehensive guide that reflects everything the agent has learned from working with you.
Here is what this looks like in practice.
Week 1: Starting Out
Section titled “Week 1: Starting Out”You create a new CLAUDE.md file for a project. It starts small:
# Email Assistant
## RoleYou are a professional email writing assistant for a small marketing agency.
## Rules- Use a professional but warm tone.- Keep emails under 200 words unless otherwise specified.At this point, the agent knows its basic role and has two rules. It will do a reasonable job, but it knows nothing about your specific preferences, your clients, or your workflow.
Week 2: Learning From Feedback
Section titled “Week 2: Learning From Feedback”After a week of use, you have corrected the agent several times. Each correction became a new rule:
# Email Assistant
## RoleYou are a professional email writing assistant for a small marketing agency.
## Rules- Use a professional but warm tone.- Keep emails under 200 words unless otherwise specified.- Always address recipients by their first name, not "Dear Sir/Madam."- Sign off with "Best regards" followed by the sender's name. Never use "Sincerely" or "Yours truly."- When declining a request, always offer an alternative or a future date.
## Client Preferences- Client: Cafe del Sol — prefers casual, friendly language. Use "you" and "your" often.- Client: ParaTech Solutions — prefers formal, technical language. Avoid casual phrases.The agent now has five rules and knows how to adapt its style for two different clients.
Month 2: A Mature Agent
Section titled “Month 2: A Mature Agent”After two months of daily use, the configuration file has grown substantially:
# Email Assistant
## RoleYou are a professional email writing assistant for a small marketing agencycalled Bright Ideas Marketing, based in Asuncion, Paraguay.
## Core Rules- Use a professional but warm tone.- Keep emails under 200 words unless otherwise specified.- Always address recipients by their first name, not "Dear Sir/Madam."- Sign off with "Best regards" followed by the sender's name.- When declining a request, always offer an alternative or a future date.- Never promise specific delivery dates without checking with the user first.- Always include a clear call to action in the final sentence.
## Client Preferences- Cafe del Sol — casual, friendly language. Owner: Maria. Monthly reports due on the 5th.- ParaTech Solutions — formal, technical language. Main contact: Carlos. Prefers bullet-point summaries.- Green Garden Nursery — warm, nature-themed language. Owner: Ana. Responds slowly; always follow up after 3 days.
## Formatting Rules- Use bold text for deadlines and important dates.- When listing multiple items, use numbered lists, not bullet points.- Include the subject line suggestion at the top of every email draft.
## Common Mistakes to Avoid- Do not use the word "synergy." The user hates it.- Do not suggest meetings before 10 AM. The agency starts at 10.- Do not reference pricing in emails unless the user explicitly provides the numbers.
## Lessons Learned- The user prefers shorter paragraphs (2-3 sentences max) — learned 2025-01-20.- Always double-check client names before using them. A misspelling caused issues — learned 2025-02-03.- When the user says "follow up," they mean a gentle reminder, not a demanding email — learned 2025-02-15.This agent is now remarkably effective. It knows the agency’s name, its clients, their preferences, the user’s pet peeves, and dozens of specific rules that prevent past mistakes from recurring. All of this came from simple feedback accumulated over time.
Global vs. Project-Specific Config Files
Section titled “Global vs. Project-Specific Config Files”Most platforms support two levels of configuration files:
Global Config Files
Section titled “Global Config Files”A global configuration file contains rules that apply to everything you do with the AI, regardless of the project. These are your universal preferences and standards.
Where they go:
- Claude:
~/.claude/CLAUDE.md(your home directory) - ChatGPT: Custom Instructions (applies to all conversations)
- Gemini: Default Gem settings
What to put in them:
- Your preferred language (e.g., “Always respond in Spanish”)
- Your general tone preferences
- Universal formatting rules
- Your name and basic context about you
- Any rules that should always apply
Example global config:
# Global Preferences
- My name is Sofia. Address me by name occasionally.- I am based in Asuncion, Paraguay. Use local time (PYT) for all time references.- I prefer responses in Spanish unless I write in English.- Use the metric system for all measurements.- When I say "keep it short," I mean under 100 words.Project-Specific Config Files
Section titled “Project-Specific Config Files”A project-specific configuration file contains rules that only apply to one particular project, task, or domain.
Where they go:
- Claude:
CLAUDE.mdin the project folder - ChatGPT: Custom GPT instructions for that specific GPT
- Ollama: A project-specific Modelfile
What to put in them:
- The agent’s specific role for this project
- Project-specific rules and constraints
- Client or stakeholder information
- Lessons learned that are specific to this project
When both a global and a project-specific config file exist, the AI reads both. The global rules provide a foundation, and the project-specific rules add details. If there is a conflict, the project-specific rule usually takes priority.
Best Practices for Organizing Config Files
Section titled “Best Practices for Organizing Config Files”As your configuration file grows, keeping it organized becomes important. A messy config file is harder for the AI to follow and harder for you to maintain. Here are proven strategies.
Use Clear Section Headings
Section titled “Use Clear Section Headings”Group related rules under descriptive headings. The AI scans the headings to find relevant rules, so clear headings help it apply the right rules at the right time.
## Role## Core Rules## Formatting## Client Information## Common Mistakes## Lessons LearnedPut the Most Important Rules First
Section titled “Put the Most Important Rules First”The AI pays more attention to content that appears earlier in the file. Put your most critical, non-negotiable rules at the top. Put nice-to-have preferences further down.
Date Your Lessons
Section titled “Date Your Lessons”Adding a date to each lesson helps you review the file later and remove rules that are no longer relevant.
- Always double-check pricing before including it in proposals — learned 2025-02-10.Keep Rules Actionable
Section titled “Keep Rules Actionable”Each rule should clearly tell the AI what to do or what not to do. Vague rules get ignored.
Vague: “Be careful with client names.” Actionable: “Always spell-check client names against the Client Information section before using them. If unsure, ask the user to confirm.”
Review and Prune Regularly
Section titled “Review and Prune Regularly”Set a reminder to review your config file every few weeks. Remove rules that are:
- Outdated (the client left, the project ended)
- Redundant (two rules that say the same thing)
- Obvious (rules the AI would follow anyway without being told)
- Never triggered (rules for situations that never come up)
Use a Consistent Format
Section titled “Use a Consistent Format”Pick a format for your rules and stick with it. Consistency makes the file easier to scan, both for you and for the AI.
## Rules- [Rule]: [Explanation or context] — learned [date].Try It Yourself
Section titled “Try It Yourself”Pick a task you do regularly with AI (writing emails, creating content, summarizing documents) and create a configuration file for it:
- Start with 3-5 basic rules.
- Use the AI for the task three or four times over the next week.
- Each time the AI does something you would change, tell it to add a new rule to the config file.
- After a week, open the config file and review what has accumulated.
You will be surprised at how quickly the agent becomes tailored to your exact needs.
Key Takeaways
Section titled “Key Takeaways”- Configuration files are the only form of AI memory that persists across sessions. They are simple text files that the AI reads at the start of every conversation.
- The accumulation pattern (adding rules after each correction) turns a generic agent into a personalized one over time.
- Global config files set universal preferences; project-specific config files add context for individual projects.
- Keep your config file organized with clear headings, dated lessons, and actionable rules.
- Review and prune your config file regularly to keep it focused and within context window limits.