How to stop your AI agent from repeating the same mistake

By Sebastián Téllez · Last updated: October 3, 2026

Short answer: an agent repeats a mistake because every session starts without knowing what happened before. To prevent it, the mistake and its fix have to be written down somewhere the agent checks before acting, and that check cannot depend on the agent remembering to do it. That is what NEXUS does.

Why agents repeat mistakes

  • The context resets. Every new session starts without what was learned in the previous one.
  • Native memory belongs to each tool. What ChatGPT remembers, Cursor does not see, and what Claude Code noted on one machine does not reach another.
  • Checking is up to the agent. If searching its memory is optional, it almost never does it: it does not know there is something it does not know.

What has to happen so it does not repeat

  • The mistake is recorded with its cause and its fix, not just “something went wrong”.
  • It is recalled before acting, every time: with hooks on agents that run on your machine, or with a concrete instruction on chat agents.
  • It reaches all your agents, not only the one that made the mistake.
  • It has validity: when the rule changes, the old one is marked as no longer valid so it does not get in the way.

Illustrative example

On Monday, an agent changes a database migration and breaks the month-end reports. It gets fixed, and NEXUS stores: “Mistake: changing the type of the date column broke the reports; fix: migrate in two steps and check the reports first”.

On Thursday, another agent, in another tool, is about to touch the same table. At the start of its turn it recalls that memory and proposes migrating in two steps before anyone asks.

How to do it with NEXUS

  • Connect your agents to https://nexus.eblas.link/mcp (steps at https://nexus.eblas.link/en/docs).
  • On Claude Code and Cursor, install the optional hooks: they recall memory at session start and save what matters when it ends.
  • On Claude and ChatGPT, paste these lines at the top of their instructions:
instructions for your agent
Your long-term memory is NEXUS (connector "Nexus AGI").
Every turn, before answering, call retrieve_memories with my message as the query and time_range="all_time".
If a result carries duda_de_fusion, decide it with decide_merge_proposal before answering; don't ask me about it.
When you learn something you would want to know next time (a decision, a preference, a mistake), save it with process_observation in that same turn.

Then work as usual. When something goes wrong, tell your agent with its cause and fix; when a rule changes, tell it the previous one no longer applies.

What NEXUS does not do

  • It does not guess: it knows what your agents tell it.
  • It does not guarantee there will never be a mistake: it reduces repeating one that already happened.
  • It does not block actions. To prevent something no matter what, use your tool’s controls, such as Claude Code’s blocking hooks.
  • Automatic conclusions, such as hypotheses or suggested relations, can be wrong and are shown with their evidence.

Why does my AI agent keep making the same mistake?

Because every session starts without the previous one’s context and, even with memory, checking it is usually optional. If the mistake was not recorded somewhere the agent reviews before acting, it has no way of knowing.

Isn't writing it in the agent's instructions enough?

For rules that do not change, it works. But instructions are edited by hand, belong to a single tool and do not grow with each new mistake. A shared memory takes each fix as it happens and hands it to every agent.

Does it work with ChatGPT?

Yes. ChatGPT connects to NEXUS as an app in developer mode. Since it has no hooks, the check is triggered by an instruction you paste into its custom instructions.

Does NEXUS guarantee my agent will not make mistakes?

No. It reduces repeating mistakes that already happened, as long as they are recorded. To prevent a specific action no matter what, use your tool’s blocking controls.