Abstract
An agent that appends its own outputs to its context treats every one of them as true. When one is wrong, later steps build on it, and the model tends to stay consistent with the mistake rather than correct it.
The literature on hallucination snowballing, on self-correction and on multi-agent failures describes the same mechanism from different angles: errors are cheap to make, expensive to notice from the inside, and they compound once they are in context. We argue that an agent’s memory should be a ledger of proven actions: input → output pairs that were executed and then validated by a human or by an independent AI verifier. Everything else, including the agent’s own plausible but unchecked reasoning, is discarded before it can steer the next loop.
How errors compound
The usual picture of a hallucination is a gap in knowledge: the model does not know, so it guesses. Zhang et al. show a second, more dangerous pattern. When a model commits to a wrong answer early, it then produces supporting claims that are also wrong, and that it would recognize as wrong in isolation [1]. They call this hallucination snowballing. Asked separately, GPT-3.5, GPT-4 and LLaMA2-70B-chat identify 67%, 87% and 94% of these incorrect claims as incorrect. The knowledge was there. The context overrode it.
The model knew better
Share of a model's own snowballed incorrect claims that it identifies as incorrect when asked in a fresh context. As reported by Zhang et al. (ICML 2024).
Source: Zhang et al. [1]. Three question-answering datasets built so that an early wrong answer forces later justifications. Each model's own reported rate; models were evaluated on their own outputs.
The authors attribute this to consistency pressure: once an answer is in the transcript, generating text that agrees with it is the likely continuation. In their experiments, common decoding and prompting changes such as beam search, higher-temperature sampling and zero-shot chain-of-thought did not remove the effect [1].
Multi-turn work shows the same dynamics at the level of a whole task. Laban et al. split the requirements of a task across several turns and observe an average performance drop of 39% across fifteen models. Most of it comes from unreliability: models make early assumptions, and once they take a wrong turn they rarely recover [2].
Agents are the worst case for both effects. A coding agent does not answer once; it produces a hypothesis, a patch, a test run, an interpretation of the test run, another patch. Each output becomes input to the next step. One unverified wrong step is not one error. It is a premise.
One wrong step, two memories
Same task graph, same wrong output at step 2. The only difference is whether it is checked before later steps can read it. Illustrative animation.
Each circle is one agent step; edges point from the outputs a step consumed. Rose: the step used the wrong output directly or through a parent. Amber: the wrong output sits in its context even if it did not build on it. Illustrative graph, not measured data.
Context is not neutral
It would be convenient if a model simply ignored the parts of its context that do not help. It does not. Shi et al. add a single irrelevant sentence to grade-school math problems and see accuracy drop sharply across prompting techniques [3]. Self-consistency decoding and an explicit instruction to ignore irrelevant information help, but do not make the problem disappear.
A wrong intermediate result is worse than an irrelevant sentence. It is on topic, it is phrased in the agent’s own voice, and it sits right where the next step expects useful information. If an irrelevant fact is enough to derail a math problem, a confident but false “the root cause is the cache layer” is enough to send a debugging session in the wrong direction for an hour.
The same holds for long-term memory. Xiong et al. study agents that store past task executions and retrieve them as examples. They find a strong experience-following effect: when a new task resembles a stored one, the agent’s output closely resembles the stored output [4]. That is exactly why memory works when the stored experience is good, and why it fails when it is not. The authors report that inaccuracies in stored experiences compound and degrade later performance, that some executions which look correct are misleading when replayed, and that regulating the quality of what enters the memory bank helps.
Memory does not just inform an agent. It is imitated. Whatever is stored will be copied, mistakes included.
A model cannot grade its own homework
The obvious fix is to ask the agent to check itself. The evidence says this is weaker than it looks.
Large Language Models Cannot Self-Correct Reasoning Yet
Huang et al. study intrinsic self-correction, where a model revises its answer with no external feedback. On reasoning tasks, models generally fail to improve, and in some cases performance gets worse after self-correction. [5]
When Can LLMs Actually Correct Their Own Mistakes?
Kamoi et al. survey the field and find no prior work demonstrating successful self-correction from prompted LLM feedback alone, outside tasks unusually suited to it. Self-correction works well when reliable external feedback is available. [6]
Reflexion
Shinn et al. let agents write verbal reflections on failed attempts and keep them in an episodic memory. On HumanEval, Reflexion reaches 91% pass@1, versus 80% reported for GPT-4. The signal that drives it is external: test results and environment feedback, not the model’s opinion of itself. [7]
LLM Evaluators Recognize and Favor Their Own Generations
Panickssery et al. show that models can distinguish their own outputs from others’ and that this self-recognition correlates with self-preference: models score their own text higher even when humans rate it equal. [8]
Read together, these results draw a clear line. Memory that improves an agent is built from grounded feedback: a test that ran, a check that passed, a person who said yes. Memory built from the agent’s own judgment of its own work inherits the agent’s blind spots, and adds a bias in its favor. Reflexion is a useful example of both sides: the reflections help because they are anchored to an external signal, and they remain unvalidated text that the next attempt will read.
Where agent systems break
Cemri et al. analyzed more than 1,600 annotated traces from seven popular multi-agent frameworks and derived a taxonomy of 14 failure modes in three categories: system design issues, inter-agent misalignment, and task verification [9]. The last category covers what happens at the end of a run: checks that are skipped, incomplete or wrong, so that a flawed result is reported as done. Annotators agreed on the taxonomy with a kappa of 0.88.
Two lessons carry over to any orchestration design. First, verification is not a detail that a capable model handles implicitly. It fails often enough to deserve its own category. Second, in a multi-agent system an unverified output does not stay local. It is passed to the next agent as an instruction, a plan or a fact, and the receiving agent has even less reason to doubt it than the one that produced it.
Memory as an attack surface
Contamination does not have to be accidental. AgentPoison shows that inserting a very small number of crafted entries into an agent’s long-term memory or retrieval base lets an attacker trigger targeted malicious behavior with high success rates, while the agent behaves normally on benign inputs [10]. The attack works because retrieved memory is trusted by construction.
A memory that only admits validated actions does not solve every security problem, but it changes the default. An entry exists because something checked it, and the check is recorded next to it. Unvalidated text from a tool result, a web page or an earlier hallucination has no path into the store.
There is also an analogy from training, and we use it only as an analogy. Shumailov et al. show that models trained indiscriminately on data generated by previous models lose the tails of the original distribution over generations, a process they call model collapse [11]. Agent memory is not model training, and nothing in Chad retrains a model. But the shape of the failure is similar: a system that keeps consuming its own unchecked outputs drifts away from the ground truth it started from. In both cases, the remedy is to keep validated, real data in the loop.
How Chad applies it
Chad does not carry a transcript from one loop to the next. Each loop starts empty, and a context compiler assembles about 6k tokens from durable memory: domain best practices, the validated intent and its acceptance criteria, related changes found in ClickHouse, validated actions, and the atomic task with its target files. The fourth layer is the one this paper is about.
- Actions are pairs, not prose. An action is stored as an input → output pair: what the loop was asked to do, what it actually produced, and how that output was checked. Reasoning traces, abandoned hypotheses and intermediate drafts are not memory.
- Nothing is written without a verdict. Validation is done by a human or by an AI verifier. A human can approve, correct or reject at any moment, from GitHub, Slack or any connected tool. The Verifier is a separate loop with its own small context, so it does not share the Builder’s transcript or its commitment to an answer.
- Grounded signals first. Where an objective check exists, it decides: tests, type checks, CI, a Sentry error that stops recurring, a Prometheus alert that clears. Model judgment is used where no such signal exists, and human review where the stakes require it.
- Rejected work is discarded, not summarized. A rejected action can trigger a retry, which is a new action with its own validation. The rejected attempt never reaches a later context, so the next loop does not start from a wrong premise.
- Everything is logged, only validated actions are retrieved. ClickHouse keeps the full record of events, inputs and signals for audit. The context compiler reads from the validated actions table, linked to the intent and to the git changes each action produced.
The memory ledger
Every action is checked by a human or an AI verifier. Only accepted input → output pairs become rows that future loops can read. Illustrative animation with example data.
Tasks, patches and verdicts are invented examples. Rejected actions may be retried as new actions, but the rejected attempt itself never enters the context of a later loop.
The effect is the right-hand side of the cascade figure above. A wrong output still happens; models are fallible and will stay so. What changes is where it stops. It is caught at the gate of the loop that produced it, and every later loop compiles its context from actions that were proven.
Limits & next steps
Validation is only as good as the validator. Tests can be incomplete, an AI verifier can share failure modes with the model it checks, and a busy reviewer can approve too quickly. A validated-only memory reduces contamination; it does not eliminate it. We treat each validated action as revisable: when a later signal contradicts it (a regression, a reverted commit, a human correction), the action is invalidated and stops being retrieved.
Discarding rejected attempts also discards some information, for example the fact that an approach was tried and failed. We record that outcome as a validated fact about the attempt (approach X was rejected because Y) rather than replaying the attempt itself, and we expect to keep refining that boundary.
The research cited here measures models and agent frameworks, not Chad. We have not published Chad measurements yet. We plan to publish a comparison of validated-only and unfiltered memory on real repositories, covering task success, error propagation across loops, and review load.
References
- Zhang, M., Press, O., Merrill, W., Liu, A., Smith, N. A. How Language Model Hallucinations Can Snowball. ICML, 2024 (arXiv:2305.13534).
- Laban, P., Hayashi, H., Zhou, Y., Neville, J. LLMs Get Lost In Multi-Turn Conversation. ICLR, 2026.
- Shi, F. et al. Large Language Models Can Be Easily Distracted by Irrelevant Context. ICML, 2023.
- Xiong, Z. et al. How Memory Management Impacts LLM Agents: An Empirical Study of Experience-Following Behavior. arXiv:2505.16067, 2025.
- Huang, J. et al. Large Language Models Cannot Self-Correct Reasoning Yet. ICLR, 2024.
- Kamoi, R., Zhang, Y., Zhang, N., Han, J., Zhang, R. When Can LLMs Actually Correct Their Own Mistakes? A Critical Survey of Self-Correction of LLMs. TACL, 2024.
- Shinn, N. et al. Reflexion: Language Agents with Verbal Reinforcement Learning. NeurIPS, 2023.
- Panickssery, A., Bowman, S. R., Feng, S. LLM Evaluators Recognize and Favor Their Own Generations. arXiv:2404.13076, 2024.
- Cemri, M. et al. Why Do Multi-Agent LLM Systems Fail?. arXiv:2503.13657, 2025.
- Chen, Z., Xiang, Z., Xiao, C., Song, D., Li, B. AgentPoison: Red-teaming LLM Agents via Poisoning Memory or Knowledge Bases. NeurIPS, 2024.
- Shumailov, I. et al. AI models collapse when trained on recursively generated data. Nature 631, 755–759, 2024.