Why AI Agents Repeat the Same Mistakes — Project Knowledge Matters More Than Memory
Handing a coding agent everything — writing code, managing servers, deploying — I noticed something odd.
At first it was genuinely great.
Describe a feature and it writes the code. Something breaks and it digs into the cause. When it has to, it SSHes into the server and fixes the problem.
But over time a cost I hadn't planned for started creeping in.
I was spending more and more time re-explaining the project to the AI.
A structure we had designed together a few days earlier, I'd have to explain again in a fresh session. Sometimes it would reopen a problem we'd already fixed, or propose an approach we had abandoned long ago.
I build and run a small paid service on my own. Writing code, managing servers, deploying, handling incidents — a large chunk of it happens with an AI agent at my side.
So the AI's memory problem wasn't just an annoyance.
It was an operational risk: a bad call could turn into a real outage.
At first I figured more memory would fix it.
But the longer I used it, the more a different question nagged at me.
Is remembering past work the same thing as understanding the current project?
I now treat those as two separate things.
1. The code stays, but the design intent disappears
Picture two developers on one project.
The first one built the payment system.
They designed it so that price calculation always runs through a single shared function, and the price shown on screen and the amount actually charged both come from that same calculation.
The reasoning is simple.
If price logic is scattered across the codebase, a policy change can end up applied in only some of those places.
The goal is to prevent the situation where the screen says ₩9,900 but the customer is actually billed ₩12,900.
Then a new developer joins the project.
Read the source and you can see how the payment feature works.
But can you also see why it was designed so price calculation must happen in one place?
The new developer might decide it's simpler to add a separate price calculation to the feature they're changing.
For now, it works fine.
The trouble shows up later, when the pricing policy changes.
When the original design intent isn't carried forward, the code can still be written correctly while the architecture quietly erodes.
AI agents are no different.
Claude Code and Codex can read existing code and build new features.
But what alternatives were weighed, why a particular structure was chosen, which principles the team agreed to hold — none of that is fully recoverable from the code alone.
So the agent ends up re-deriving the design intent from the code every single time.
Here's the key distinction.
Code shows you how something is implemented right now. It doesn't always tell you why it was built that way.
2. Will more AI memory solve this?
Plenty of AI memory systems have appeared to tackle this.
The best-known approach is RAG (Retrieval-Augmented Generation).
It stores past conversations and work history, and when a new question comes in, it retrieves the relevant pieces and hands them to the AI.
Roughly, it looks like this.
Past conversations & work history
│
▼
Text chunking
│
▼
Embedding
│
▼
Vector Database
│
▼
Similarity search
│
▼
Retrieve relevant info
│
▼
AI Agent
Ask the AI to modify the payment feature, and it retrieves past payment-related conversations and work history to feed back in.
It's clearly a useful technique.
You don't have to re-read every conversation, and you can surface things discussed long ago.
But there's one problem.
Nothing guarantees the retrieved information is still valid today.
I hit exactly this kind of problem running my own service.
The name of an AI model I'd used early on was still sitting in a config file.
The config format itself was fine, so it passed validation.
But once that model was retired from the service, the free feature that relied on it stopped working.
The format was correct; the value just wasn't valid anymore.
AI memory can have the same flaw.
Say you decided to use Redis in January, then switched to a different store in March.
Both decisions are still there in the old conversations.
If the AI retrieves the January record and treats it as the current design, it might rebuild a structure you already threw out.
Sure, adding recency checks or metadata filtering to RAG reduces that risk.
But plain similarity search alone won't guarantee you get the design that's currently valid.
So when I use AI memory, I hold to one principle.
Whether something that was once true is still true has to be verified.
Especially for anything tied to real code — file names, function names, config values, API versions — I make it re-check the current state.
3. What matters more than memory is the current source of truth
Think about a company running an ERP.
A product spec changes.
To check the product's current spec, nobody searches three years of meeting minutes.
They look at the currently approved spec sheet.
Of course, if you need to know why the spec changed, you can go dig through the decision history.
But the standard you apply to actual production is the spec that's valid right now.
Software projects work the same way.
What an AI needs may be less the ability to remember every conversation and more the information to judge what the current standard is.
So project knowledge is worth separating like this.
Project
│
├── Architecture
│ ├── system-overview.md
│ ├── api-design.md
│ └── database-design.md
│
├── Decisions
│ ├── authentication.md
│ └── infrastructure.md
│
├── Specifications
│ ├── payment.md
│ └── user-management.md
│
└── Operations
├── deployment.md
└── troubleshooting.md
The number of documents isn't the point.
What they contain is.
There's no need to repeatedly record things you can learn by reading the code.
What you want to capture is what the code alone can't tell you.
Why was this structure chosen?
What alternatives were considered?
What constraints exist?
Which principles must not be changed?
Keep that information alive and a new AI agent can understand where the project is headed even on day one.
I think of this as a kind of project source of truth.
What decides a project's continuity isn't the volume of stored conversation but the quality of the knowledge that's currently valid.
4. How I work with AI agents — consult, build, update
As re-explaining the project to agents piled up, the way I work shifted too.
At first I spelled everything out in long prompts. Then I started keeping the instructions I used often in separate files.
Now I manage the common information that has to survive across sessions as Markdown documents.
I've split it around an index file, with maybe 50 separate files holding individual facts and rules.
Code change history lives separately. What matters there is recording not just when something changed, but why.
When I collaborate with other AI sessions, I sometimes use a separate Git branch as a kind of mailbox.
One agent leaves what it did, another picks it up.
It's nothing elaborate. Most of it is just Markdown and Git.
Running things this way, the work order I've settled into has three steps.
Consult → Build → Update
┌───────────────────────────┐
│ Project Knowledge │
│ │
│ Architecture │
│ Decisions │
│ Specifications │
│ Operations │
└─────────────┬─────────────┘
│
▼
① Consult
Check current design & rules
│
▼
② Build
Implement to the standard
│
▼
③ Update
Reflect changed facts in docs
│
└───────────┐
▼
Project Knowledge
The last step, update, is the one that matters most.
Even if the AI implemented a feature correctly, if the related docs didn't change, the next session will work off the old information.
Flip it around: change only the docs without reflecting it in the actual code, and the docs become a wrong standard.
So you need a step that checks the code and the docs stay consistent.
A document you don't keep updated turns, over time, from an asset into a liability.
5. Why project knowledge should live in Git too
The part I value most in document-based management is that you can use Git.
When AI memory lives only inside a specific service, it's hard to tell what's stored, when it changed, or who edited it.
Markdown documents, by contrast, a person can read directly.
And just like code, their change history can be managed.
Repository
│
├── src/
│
├── docs/
│ ├── architecture.md
│ ├── decisions.md
│ └── specifications.md
│
├── AGENTS.md
│
└── README.md
Say the AI modifies the authentication system and updates the architecture doc along with it.
You can see what changed with:
git diff
If a particular commit turned out wrong, you can roll it back:
git revert <commit>
The upside of this approach is that you don't have to blindly trust the knowledge the AI wrote down.
You can review the changes, fix the wrong parts, and restore an earlier state when needed.
Running a real service, I take that reversibility seriously.
Using AI speeds development up.
But faster development also means wrong changes can happen faster.
So I keep the version currently in production tagged separately, so I can roll back to the previous one when something breaks.
Of course, a Git tag alone doesn't automatically restore the service. You still have to account for database schema changes and the state of external integrations.
Even so, the principle holds.
The faster a system can change, the more it needs a way to roll back safely.
That principle applies not just to code but to the project knowledge the AI uses.
Changes that touch payment policy, security settings, or the production environment especially shouldn't go live just because the AI wrote them.
A person needs to review and approve them in the end.
6. So is RAG an unnecessary technology?
There's one misunderstanding to avoid here.
Document-based knowledge management being effective doesn't make RAG the wrong approach.
The two solve different problems.
RAG is strong at finding, within a huge pile of information, the parts relevant to the current question.
Structured project documents, on the other hand, are better at conveying the design and operational standards that are valid right now.
| Aspect | RAG-based memory | Document-based context |
|---|---|---|
| Main purpose | Retrieve relevant info | Hold the current design standard |
| Data | Conversations, logs, doc fragments | Structured documents |
| Access | Search and re-ranking | Index and document browsing |
| Change history | Depends on implementation | Works with Git |
| Strength | Searching large unstructured data | Preserving design intent and rules |
| Watch out for | Stale info can surface | Needs doc freshness upkeep |
If you need to analyze three years of incident history, a search system is useful.
It lets you find cases similar to a given incident and compare causes and fixes.
But if you need to check the service's current authentication policy, looking at the approved design doc first is the sensible move.
In the end, you can use both together.
AI Agent
│
┌──────────┴──────────┐
│ │
▼ ▼
Project Documents Knowledge Search
│ │
▼ ▼
Current design standard Past work history
Architecture principles Incident history
Feature specs Research material
Operations policy Reference docs
│ │
└──────────┬──────────┘
│
▼
Do the work
I think this split is more realistic.
Manage the currently valid information as documents, and reach for search when you need past events or reference material.
The important thing is to clearly define what wins when the search result and the current standard conflict.
Memory explains the past; documents provide the present standard.
And no, documents don't become accurate on their own. You still need a step that verifies they match the current state.
7. The real problem with AI agents isn't memory, it's continuity
The biggest shift in how I think came from using AI coding tools for a long time.
At first I saw the AI as a development assistant.
A tool for when I needed to write code or fix an error.
But once I connected it to servers and dev environments, gave it deploy access, and handed over operational work, its role changed.
It's no longer just a tool that answers questions — it's closer to an actor participating in the project.
And that's where a new problem shows up.
The longer you work with an AI, the higher the cost of starting a new session.
Hiring a person requires onboarding.
You explain the project structure, walk them through the rules, help them understand the existing systems.
AI agents are similar.
If every new session means re-explaining the architecture, relaying what was agreed before, and repeating problems you already solved, productivity drops.
The bigger issue is lock-in to a specific AI model.
You might use Claude Code now and Codex later.
When a new model shows up, you might switch to whatever fits best.
But if the project knowledge lives only in one AI service's conversation history or internal memory, what happens?
Every time you swap models, you re-explain the project.
From a software architecture standpoint, that's a dependency problem.
A good system is designed to reduce its reliance on any single component.
I think AI agents are no different.
Project Knowledge
(Markdown / Git)
│
┌──────────┼──────────┐
│ │ │
▼ ▼ ▼
Claude Codex Other AI
│ │ │
└──────────┼──────────┘
│
▼
Codebase
In this setup the project knowledge isn't bound to any one AI model.
You can swap the model, but the project's design and decisions carry on.
Granted, different agents won't interpret the same document in exactly the same way.
The tools they support and the environments they run in can differ too.
But at least the project's core knowledge stops depending on one model's memory.
A project's knowledge should stay with the project. The AI agent should be the actor that puts that knowledge to use.
That's the direction I see as important for AI agent architecture.
8. More documents doesn't mean the project is better understood
So would documenting everything solve it?
It wouldn't.
Tell the AI to document every single task and you create a different problem.
The documents pile up too far.
Write a manual every time you touch one function, generate a new doc for every small config change, and the project gets complicated fast.
In the end, the cost of reading the documents goes up.
So what matters isn't the quantity of documents but the content.
I think it's worth distinguishing which information is actually worth documenting.
What you can confirm from the code itself doesn't need to be written down again.
These, on the other hand, are worth keeping:
- Why a particular architecture was chosen
- Why another technology was not chosen
- Interfaces and contracts between systems
- Business policies and the constraints around changing them
- Problems found in operation and the principles for preventing their recurrence
It especially helps to separate the currently valid design from past decisions.
docs/
│
├── current/
│ ├── architecture.md
│ └── specifications.md
│
└── decisions/
├── ADR-001-authentication.md
└── ADR-002-database.md
You check the current system's standard in current.
Why a past decision was made, you check in the ADRs (Architecture Decision Records).
That way you manage the current design and the history of past decisions side by side.
You also have to check that the documents match the actual code.
If a doc the AI wrote is wrong, another agent working off that doc will make a wrong call too.
So document-based management needs operating rules of its own.
More documents don't make a better system. Managing the currently valid information so it can be trusted is what matters.
Conclusion: the AI doesn't need to remember everything
AI models keep getting better.
Their coding ability is improving, and models that handle longer context keep appearing.
But a smarter model doesn't automatically solve the project management problem.
Because what matters in software development isn't simply the ability to write code.
You have to understand the requirements, design so you don't collide with existing systems, respect past decisions, and keep changes consistent.
AI agents need those same standards.
Building and running a small service alone, I lean on AI pretty heavily.
At first I assumed a better model would solve most of my problems.
But over time my view changed.
However capable the AI is, if it misreads the project's current state, it can produce the wrong result.
Conversely, convey the design intent and constraints accurately and even a relatively small model can produce something genuinely useful.
So now I care about the structure for managing project knowledge as much as about expanding the AI's memory.
People don't work by remembering every meeting the company ever held.
They understand the current system, check the documents they need, and refer to past decisions as they go.
AI agents should be able to work that way too.
In the environment ahead, where we build alongside AI, the edge that matters won't be simply which model you use.
How you maintain, verify, and hand the project's knowledge to the next agent.
I think that, over the long run, will be a decisive factor in AI development productivity.
In the end, developing with AI is becoming less about waiting for a smarter model and more about building an environment where any model that walks in can understand the project and carry the work forward.
Was this post helpful?
One click helps me write the next one