TL;DR
An agent with no place to write notes wakes up cold every session and fills the gaps with guesses. The fix is not a smarter model - it is a shared filesystem. Give your agents six folders, point the official filesystem MCP server at them, and force a read-execute-log loop with three prompts. Agents that can signal a problem stop hallucinating answers to it.
Why your agents keep losing context
Most people open a chat, paste a system prompt, and give the agent tasks. It does solid work inside that session - then the session ends and it wakes up with zero memory of what it built, decided, or where it left off. This is not an intelligence problem, it is a storage problem: the agent has no place to write notes, save outputs, or check what already happened. So you re-explain your brand voice, re-upload last week's research, re-paste the competitor list, and use AI to redo work you already did.
The file structure that works
Simple structures win, because agents are less likely to write to the wrong place. Six folders cover almost everything:
- /memory - persistent facts: brand voice, audience notes, offer details. All agents read; the brand agent writes.
- /research - raw topic research, competitor intel, trending signals. Research agent writes; content agent reads.
- /drafts - in-progress work before review. Content agent writes; editing agent reads.
- /published - final approved outputs with metadata. Editing agent writes; analytics agent reads.
- /logs - run history, errors, decisions made. All agents write; you read.
- /briefs - one-page job briefs for new tasks. You write; all agents read.
The /memory folder holds the facts that should never be re-explained - write them once and every agent reads them at the start of every run. The /briefs folder is how you hand off new work without opening a chat and typing instructions from scratch: drop a brief, the agent picks it up and runs.
Give the agent real file access
Anthropic's official MCP filesystem server. Point it at your six-folder directory and Claude can read, write and navigate those files through tool calls - safely scoped to the folders you allow. For a solo setup this is all you need; a plain local folder your agent tool can see works too.
claude_desktop_config.json{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/YOU/agent-workspace"
]
}
}
}Force the read-execute-log loop
Knowing the folders is step one. Step two is instructing every agent to actually use them at the start and end of each run - most people skip this, so their agents can see the folders but never read from them. Every agent should follow the same three-step loop: read /memory and the current brief first, execute and write outputs to the right folder with a timestamped filename, then write a three-line summary to /logs.
Prompt 1 - build your /memory fileYou are my [role] agent. Before any task, read /memory/brand.md - it
contains my brand voice, audience, offer and tone rules. If it does not
exist yet, ask me these one at a time, then write the answers to
/memory/brand.md:
1. How would your best client describe working with you in one sentence?
2. Who is your exact target audience (title, revenue range, biggest pain)?
3. What is your core offer and its price?
4. What three words describe your writing tone?
5. What topics are off-limits?
Write the completed file before doing anything else.Prompt 2 - force a log on every runAt the end of every task, write a log entry to
/logs/[your-agent-name]-YYYY-MM-DD.md with exactly three lines:
Line 1: What task did you complete? (one sentence, specific)
Line 2: What was the most important decision you made, and why?
Line 3: What does the next agent need to know to continue without asking me?
Do not skip this even if the task feels minor. The log is not optional.Prompt 3 - hand off research to contentBefore writing any content, check /research for the most recent file
(research-YYYY-MM-DD-[topic].md) and read it fully before drafting. Save
your draft to /drafts/draft-YYYY-MM-DD-[topic].md. Do not ask me to paste
research or name the topic - the research file has everything. If no
research file exists from the last 3 days, write one line to
/logs/content-agent-[date].md: 'No recent research found. Request a new
research run before drafting.' Then stop and wait.That last line - stop and wait - matters. Agents with nowhere to write their confusion will hallucinate an answer instead. Give them a structured way to signal a problem and they will use it.
Common questions
What does a filesystem have to do with hallucination?
An agent that loses context has to guess to keep going, and guessing is where fabrication comes from. A filesystem gives it somewhere to read real state and, crucially, somewhere to signal 'I don't have what I need' - so it stops and asks instead of inventing.
Do I need a special tool, or will a plain folder work?
For a solo operator running agents on your own machine, a plain local folder your agent tool can see is the fastest path. The official filesystem MCP server adds safe, scoped read/write access and is worth it once multiple agents share the same directory.
What is the most common mistake setting this up?
Building the folders but never updating the agent system prompts to use them. The agent will not find the folders on its own - you have to tell it where to read and what to write. Prompts 1, 2 and 3 do exactly that.
Why force a log entry on every run?
The log is your status update and your debugger. When something breaks, you open /logs and read the chain to find the failure fast, instead of reverse-engineering a broken chat thread. It also lets agents hand off to each other without you as the middleman.
How is this different from the memory MCP server?
The memory server stores facts as a knowledge graph the agent queries by meaning. A filesystem stores files - drafts, research, logs, briefs - in folders agents read and write directly. Many setups use both: memory for facts, the filesystem for work product.
Where should I start?
Create the six folders, use Prompt 1 to build /memory/brand.md in about 20 minutes, add the Prompt 2 logging block to every agent you run, then run one task and confirm a log file appears in /logs before going further.
Want the rest of the reliability stack?
Get the other 1 in the anti-hallucination stack - free, with 5,000+ builders.
Join the Club