Three tools, three problems
'RAG vs long context' is a false fight. A long context window, retrieval (RAG), and a persistent memory file each address a different need, and choosing the wrong one for the job is where setups go wrong.
The useful question isn't which wins, but which fits the data in front of you.
Long context
Putting everything in a big window is simple and great for a single task with a lot of immediately-relevant material. But it's expensive, slower, and dilutes attention as you scale — and it resets every session.
Reach for it for one-off, context-heavy tasks, not as your memory strategy.
Retrieval (RAG)
RAG keeps knowledge external and pulls in only the relevant chunks per query, so the window stays small while the knowledge base can be huge and frequently updated.
It's ideal for large documentation and codebases; its weakness is retrieval quality — irrelevant chunks poison the answer.
Project memory
A curated memory file carries the durable, always-relevant facts — architecture, conventions, decisions, constraints — re-supplied every session. It's small, human-editable, and high-signal.
This is what makes an agent consistent across sessions, where long context and RAG don't.
Combine them
In practice you want all three: project memory for stable facts, RAG for big/changing knowledge, and long context for the task at hand. They complement rather than replace each other.
Pick per data type and keep each curated — that combination is what reliable AI systems run on.