Skip to main content

Bortom tokenväggen: varför AI-kompanjoner drabbas av kontextförfall

De flesta AI-kompanjoner börjar skarpt och blir sedan allt vagare. Det är inte modellen som tappar intresset – det är samtalet som faller utanför det fönster den kan se.

A line of glowing manuscript pages leads through a dark archive hall to a framed portrait of a woman, while the other pages dissolve into ash.

The illusion of memory

The first hour with a typical AI companion is uncanny. It picks up the thread, remembers the name of your sister, refers back to the argument you had two scenes ago. It feels like being known.

Then, somewhere around the thirtieth message, it starts to drift. It asks something you already answered. A character who left the room is suddenly speaking. The wound from yesterday has healed without anyone treating it.

Nothing broke. You simply reached the edge of what the model could see.

A language model has no memory between calls. Every turn is a fresh request carrying the whole conversation with it, and that request has a size limit — the context window. Grow past it and the oldest material is dropped. Your first scenes fall off the back of it, and from the model's point of view they never happened.

What context rot actually looks like

In most companion apps the failure is rarely dramatic. It is a slow loss of specificity, which is why it is so easy to blame on the model being "lazy".

  • Names blur. Two secondary characters merge into one, or a name is reused for someone new.
  • Promises evaporate. A character who swore to meet you at the harbour has no idea what you are talking about.
  • Stakes reset. The debt, the injury, the secret someone is keeping — the plot quietly relaxes back to neutral.
  • Established facts flip. A character who cannot swim goes swimming.

Each one on its own is a shrug. Together they are the difference between a story and a series of pleasant, disconnected scenes — and they are why long roleplay so often peters out rather than ending.

Four ways to hold on to the past

Four approaches are in use, and they fail in different places.

ApproachHow it holds the pastWhere it breaks
Sliding windowThe last N messages, verbatimEverything older is simply gone. Perfect recall inside the window, total amnesia outside it.
Very large windowTens or hundreds of thousands of tokens, verbatimCost and latency scale with every turn, and attention thins out across the middle of a long context — the model can see a detail and still not weight it.
Vector retrieval (RAG)Past messages embedded and searched by similarityReturns text that sounds relevant. It has no notion of what is currently true, so a fact and its later correction look equally good.
Structured story stateFacts, characters, relationships and events, written down as they happenTakes real work to maintain, and it is only ever as good as what gets written down — whatever is not recorded is lost.

I wanted a world that writes things down. When she remembers your third evening together, it is because she was really there for it.

Founder, projectDigo

Why a bigger window is not the answer

The obvious fix is to make the window enormous. It is also the most expensive one, and it does not do what people hope.

The whole context is re-sent and re-read on every single turn, so a conversation carrying a hundred thousand tokens of history pays for them again with each message — and waits longer for each reply. Worse, a model reading a very long context does not read it evenly: what your character said forty scenes ago can be technically present and practically invisible.

A large window buys time. It does not change the shape of the problem, because the problem is not capacity — it is that nothing is deciding what matters.

What we do instead

projectDigo keeps a record of the story.

What matters — who exists, what has happened between them, what is true right now — is held as the story's own state rather than left in a conversation that will eventually scroll out of view. Later scenes are written against that state. Scene four hundred knows what scene three established, because scene three was recorded rather than merely said.

How that record is built, kept current and put back to work is the part we have spent the longest on — and the part we keep to ourselves. What it delivers is simple enough: continuity that holds no matter how long you play.

The honest trade-off

This is not free. Keeping a record is more work per scene than forwarding a transcript, and a story can only remember what was worth recording — anything missed is lost as surely as a sliding window would have lost it.

What it buys is a story that accumulates. Ten hours in, the world has a history you can point at, and the characters behave like people who were there for it.

Vanliga frågor

Why not just use a model with a one-million-token context window?

Because you pay for the whole context on every turn, in money and in latency, and because attention thins out across the middle of a very long context — a detail can be present and still be effectively ignored. A large window postpones context rot rather than removing it.

Is this the same as RAG?

Related, but not the same. Retrieval finds passages that resemble the query, which is useful for looking things up and unreliable for knowing what is currently true: a fact and its later correction both look like good matches. A story record holds state — what is true now — rather than similar-sounding text.

Hur långt tillbaka kan en rollfigur faktiskt minnas?

I projectDigo, ända tillbaka till sessionens början. Det som bevaras är berättelsens tillstånd, inte formuleringen av varje meddelande, så minnet försämras inte ju längre sessionen pågår.

Motsäger modellen någonsin sitt eget minne?

Det kan hända – därför kontrollerar projectDigo konsekvensen innan en scen når dig. Oftast blir resultatet en rättelse som du aldrig ser. Inget fångar allt, men problemet blir enstaka felsägningar i stället för en ständig glidning.

← Alla artiklar