#What degradation looks like
The first long-running agent I built held a full transcript and did well for around eighty turns. After that the quality curved downward in a way that was hard to point at. It was not hallucinating. It was not losing the thread exactly. It was giving answers that were consistent with something said forty turns earlier and irrelevant to what was being asked now.
My instinct was that it needed more context. It had the opposite problem. The three relevant facts were in there, underneath four hundred lines of resolved back and forth: clarifications that had been clarified, options that had been rejected, a tool call that failed and was retried successfully. All true, none current, all competing for attention.
There is measurement behind this intuition. Model performance depends on where in the context relevant information sits, and degrades when it is buried in the middle of a long input . Adding more surrounding text makes that worse rather than better.
#Three things instead of one
Working memory, bounded. A small, explicitly sized store of what is currently in play. Items are scored for relevance against the active goal and decay when they stop being referenced. The bound is a number you set rather than a consequence of how long the conversation has run, so per-turn cost stops being a function of the agent's age.
Conversation history, summarised. The transcript still exists, per agent per tenant, and it is not what gets sent. Older stretches compress into summaries. This is the least interesting part and the part that most obviously works.
Claims, graphed. At episode close, conclusions are emitted as typed claims with the observations they rest on and a confidence, and written into a knowledge graph.
The third is the one I care about. A transcript cannot contradict another transcript, because there is no operation over two transcripts that returns the fact that they disagree. Two claims about the same subject and predicate with different objects are directly comparable, and the graph knows they concern the same thing because node identity is derived rather than allocated.
#Memory in the agent literature
The generative agents work uses a memory stream with retrieval scored on recency, importance and relevance, plus periodic reflection that produces higher-level statements from observations . The structure I arrived at is close to that, and the difference is where the reflections go. Keeping them as graph edges with provenance rather than as text means a later contradiction can find them.
#Modelling the agent, not just the prompt
The other half of the design is a bet that a system prompt is the wrong unit. An agent gets skills with tools attached, personality traits, trigger and action behaviours, a cognitive style describing the phases it thinks in, a communication style, and a model of what it attends to. A persona composes those into a reusable identity.
The reason is maintenance rather than elegance. A nine hundred line system prompt cannot be tested, nobody can say which paragraph is load bearing, and changing one sentence to fix one behaviour reliably breaks another. Prompt structure demonstrably changes model behaviour , which is precisely why an unstructured prompt is an unmanageable artefact.
#What changed, and what did not
Token spend per turn stopped scaling with conversation length. Contradictions became detectable, because comparing claims is a query and comparing transcripts is not. Agents stopped visibly degrading in long sessions.
Nothing improved about single-turn reasoning quality. None of this makes an agent smarter within one exchange. It makes it not get worse, which is a different and more tractable problem.
#Still unresolved
Deciding what to distil is a judgement currently made by a model, and it is the weakest link. A conclusion that never becomes a claim is silently lost, with no signal at the time that it mattered. I have considered emitting low-confidence claims liberally and pruning later, which trades a silent loss problem for a graph pollution problem, and I do not know which is worse.
References
- [1]Nelson F. Liu et al., “Lost in the Middle: How Language Models Use Long Contexts”, Transactions of the Association for Computational Linguistics, vol. 12, pp. 157-173, 2024doi:10.1162/tacl_a_00638 ↗
- [2]Joon Sung Park et al., “Generative Agents: Interactive Simulacra of Human Behavior”, ACM Symposium on User Interface Software and Technology (UIST), 2023doi:10.1145/3586183.3606763 ↗
- [3]Jason Wei et al., “Chain-of-Thought Prompting Elicits Reasoning in Large Language Models”, Advances in Neural Information Processing Systems (NeurIPS), 2022
- [4]Tom B. Brown et al., “Language Models are Few-Shot Learners”, Advances in Neural Information Processing Systems (NeurIPS), 2020