In a one-on-one chat with an AI character, repetition is a memory problem. In a group chat with four of them, it is an echo problem — and it sounds different.
We run a small app where several AI characters share one group chat with the user. Each character has its own persona, mood, and memory. The group works: a director step picks who speaks each round, so not everyone replies to everything. But after a few dozen turns, a pattern showed up. One character would say something; two turns later another would say nearly the same thing in different words. Not a copy — a paraphrase. The conversation started to feel like a room full of people nodding at each other.
The prompt alone does not hold
The first fix was the obvious one: tell them not to. Every group prompt already carries a rule — don't restate what was already said, and if you have no new angle, change the subject or wrap up. It helps. It does not hold. A language model under a long prompt with a lively transcript will still drift back to the most recent phrasing, because the most recent phrasing is the most available material. The instruction competes with the context; the context usually wins.
So we added a second layer that does not ask. It measures.
The check: character bigrams, Jaccard, 0.42
Before a character's line is posted to the room, it goes through a verdict function. The core of it is deliberately boring: strip whitespace and punctuation, split what remains into character bigrams, and compute the Jaccard similarity against each of the last three turns in the room.
def _bigram_sim(a, b): def grams(s): s = clean(s) # strip whitespace and punctuation return {s[i:i+2] for i in range(len(s) - 1)} ga, gb = grams(a), grams(b) if not ga or not gb: return 0.0 return len(ga & gb) / len(ga | gb) If any of the last three turns scores 0.42 or above, the line is a hard echo. The threshold was not guessed. On our own transcripts, a genuine paraphrase scored around 0.67, while two lines that merely shared a topic scored around 0.17. 0.42 sits between the two, with room on both sides.
Two details matter. First, short lines are exempt from the similarity check: anything under twelve characters after cleaning is too small for bigrams to mean anything. But an exact duplicate is still caught — if a short line matches a recent line from the same speaker character for character, it counts as a hard echo. That rule exists because of catchphrases and pet sounds, which are short and repeat verbatim. Second, the comparison runs against the last three turns in the room, whoever spoke them, because an echo of another character is just as deadening as an echo of yourself.
What happens on a hit: one retry, then silence
A hard verdict does not edit the line. It throws it away and asks the model to try again, with a nudge appended to the system prompt: what you just said is too close to something already said — say something completely different, from a different angle, and do not repeat anything already said. One retry, not a loop.
If the second attempt is still over the threshold, the character does not speak that round. The turn is dropped. That is the part people question, and it is the part that makes the whole thing work. A dropped turn is invisible — the room just moves on. A repeated line is visible, and every visible repeat teaches the user that nobody in the room is listening. Silence is the cheaper failure.
There is one more branch: if the retry call itself fails, a hard verdict also drops the turn rather than posting the flagged line. The check never lets a known echo through because the machinery around it broke.
The soft check: circling the same topic
Not every failure is a paraphrase. Sometimes each line is worded differently but the group has been circling one topic for four turns, saying the same thing in new sentences. The bigram check misses that — the similarity stays low — so there is a second, softer verdict.
Take the candidate line, strip out the names of the people in the room, and split it into character trigrams, excluding a small stop list of filler phrases ("I think", "you know", "what should I do" — the connective tissue every sentence shares). If those trigrams show up in at least two of the speaker's last four turns, the topic is looping. The response is the same single retry, with a different nudge: this topic has been going for a while — take it somewhere else, or bring it to a close. But unlike the hard verdict, the result is accepted whatever it is. A topic loop is a warning, not a violation, and a forced silence every time a conversation lingers would make the room feel policed.
Pet sounds get their own rule
The group includes pets — characters who mostly communicate in sounds and actions, not sentences. Bigrams are useless on "喵~" and "呼噜呼噜". So pet lines get a separate dedupe pass: any line made entirely of sound characters is dropped if the same sound appeared in the pet's last two turns, or twice inside the reply itself. Action lines are always kept — a pet doing something new is never a repeat, even if it meowed while doing it. If the pass strips everything, the pet stays quiet that round. A pet that meows the same meow every turn stops being a character and becomes a sound effect; the dedupe is what keeps it a character.
Why group chat only
The sentinel is wired into the group paths and nowhere else. Solo chat has one voice, and one voice repeating itself is a different failure — usually a prompt or memory problem — that a similarity check against its own last three lines would punish wrongly. People repeat themselves to one person; it is normal, even affectionate. In a group, repetition is structural: four voices drawing on the same recent transcript converge on the same sentence. That is the failure the sentinel exists for, so that is the only place it runs.
What it costs
Almost nothing. The check itself is string operations on a handful of short lines. The retry is one extra model call, and only when a line is flagged — in practice a small fraction of turns. The real cost was deciding that silence is an acceptable outcome. Once that was settled, the rest was a hundred lines of code and a threshold picked from measured transcripts rather than from taste.
The lesson, if there is one: a persona prompt tells a character who to be. It cannot reliably tell four characters not to become each other. For that, you need something outside the model — a small, dumb check with a number attached, and the willingness to let a character say nothing at all.
The app this ships in, 心屿 (Xinyu), is available as a free edition at https://promptwork-tools.pages.dev/xinyu/

