# context window Guides

URL: https://onlykin.ai/blog/tag/context-window
Markdown URL: https://onlykin.ai/llms/blog/tag/context-window
Updated: 2026-06-04
Guide count: 3

## Summary

OnlyKin guides about context window, grouped from 3 source-backed AI character chat and roleplay articles.

## Guides

### How Do AI Character Chatbots Work? Models, Context, and Memory

URL: https://onlykin.ai/blog/how-ai-character-chatbots-work
Updated: 2026-06-04
Category: Explainer
Tags: how AI chatbots work, LLM roleplay, context window, next-token prediction, AI character chat explained

An AI character chatbot works by rebuilding a prompt every turn: system rules, a character card, user persona, memory, recent messages, and safety instructions are sent to a language model that generates the next tokens. The model does not see the whole saved transcript unless the app re-injects it, so character quality depends on prompt assembly, context management, memory retrieval, sampling settings, and guardrails.

Key answers:

- How does AI character chat actually work?: AI character chat works by assembling a model-visible prompt every turn. The app combines system rules, a character card, user persona, memory summaries, retrieved lore, recent messages, sampling settings, and safety instructions, then sends that context to a language model. The model generates tokens one after another until the reply is complete. It does not automatically see every saved message; the app must decide which old facts to re-inject, which is why memory design and prompt assembly shape the illusion of a persistent character.
- What is next-token prediction in an AI chatbot?: Next-token prediction is the core generation loop of a language model: given the text in the current context, it estimates likely next tokens, selects one through sampling rules, appends it, and repeats. Tokens are pieces of text rather than whole sentences; OpenAI's rule of thumb is that one English token is about four characters or three-quarters of a word. A character's voice emerges because the prompt, card, persona, and conversation history make some continuations more likely than others.
- Why do AI characters forget or drift out of character?: AI characters forget because the context window has a finite token budget. As a chat grows, old messages stop influencing replies unless the app summarizes, pins, retrieves, or otherwise re-injects the important facts. Drift happens for a related reason: the character card's voice can be diluted by recent messages, weak examples, high-randomness sampling, or generic assistant defaults. Both problems improve when stable identity, compact memory, lorebooks, and recent scene context are kept visible to the model.
- What do temperature and top-p do in AI roleplay?: Temperature and top-p are sampling controls that decide how the model chooses among likely next tokens. Temperature scales the probabilities: low values near 0.2 make the model pick the safest, most predictable word, while higher values near 1.0 flatten the odds and allow more surprising, creative continuations. Top-p, or nucleus sampling, limits the choice to the smallest set of tokens whose combined probability crosses a threshold such as 0.9, trimming the unlikely tail. Higher settings raise creativity but also increase incoherence and the odds a character breaks voice.

### Why Your AI Character Forgets — and How to Keep Long Roleplays Coherent

URL: https://onlykin.ai/blog/why-ai-characters-forget-and-how-to-fix-it
Updated: 2026-06-04
Category: Memory
Tags: AI roleplay memory, context window, lorebook, long roleplay continuity

AI characters forget because a model can only read a limited token window plus whatever memory the app injects into the current prompt. Older details stop influencing replies when they fall outside that visible context. You fix it by feeding the right facts back in: compact summaries, pinned facts, keyword-triggered lorebook entries, personas, and source material that the app retrieves only when relevant.

Key answers:

- Why does my AI character forget things?: An AI character forgets because the model reads a limited window of recent text rather than your whole history. As a chat grows, the oldest messages fall outside that window, so early names, promises, and plot turns are no longer visible when the model writes its next reply. The information was not deleted; it simply scrolled out of view. Recall returns only when an app feeds those older facts back into the current prompt as summaries or triggered canon.
- What is a context window in AI roleplay?: A context window is the maximum amount of text, measured in tokens, that a model can read at once when it generates a reply. In roleplay it holds the recent messages plus any character card, summary, or injected canon. Tokens are pieces of words, so a long scene fills the window quickly. Once it is full, the oldest content drops out to make room, which is why early details quietly stop affecting the story.
- How do I make an AI character remember more?: You make an AI character remember more by re-injecting the right facts instead of relying on raw history. Keep a short summary of what changed: relationships, promises, injuries, locations, secrets, and unresolved decisions. Use a lorebook so canon appears whenever a keyword is mentioned. Pin durable facts in the memory tool, and restate important details in your own messages. Memory is selective recall, not a complete transcript, so prune anything that no longer affects the next scene.
- What is a lorebook and how does it improve memory?: A lorebook, sometimes called world info, is a set of entries that the app injects into the prompt only when their keywords appear in the conversation. An entry might hold a character bio, a place name, or a timeline fact. Because the entry is triggered on demand rather than stored in the running chat, the canon it contains never scrolls out of the context window. That keeps stable facts available across a long thread without spending space on every turn.
- What is the difference between short-term and long-term AI memory?: Short-term memory works within one session: the model recalls names, tone, and recent events because they still sit inside the context window. Long-term memory persists across sessions, so a character remembers you after you close and reopen the chat. Most apps handle short-term memory reasonably well because the text is right there. Long-term memory is the weak point, since it requires the app to store facts and deliberately feed them back into later sessions.

### AI Roleplay Glossary: 30 Key Terms Every Character Chat User Should Know

URL: https://onlykin.ai/blog/ai-roleplay-glossary-terms
Updated: 2026-06-04
Category: Reference
Tags: AI roleplay glossary, character chat terms, lorebook, context window

This glossary defines the core vocabulary of AI character chat, grouped into model basics, character building blocks, memory, scene play, roles, moderation, and tools. The terms matter because they explain why a character behaves a certain way, why it forgets, and how you steer a roleplay session.

Key answers:

- What is a lorebook in AI roleplay?: A lorebook, sometimes called world info, is a set of entries that inject background facts into an AI roleplay session only when their keywords appear. Instead of permanently filling the context window, each entry holds details such as a place, person, or rule and is added on demand. This lets a character recall a large fictional world without spending tokens on facts the current scene does not need.
- What is a context window in AI chat?: A context window is the maximum amount of text, measured in tokens, that a language model can consider at once when generating a reply. It includes the system prompt, the character definition, and recent messages. When a conversation grows past this limit, the oldest content is dropped or summarized, which is the main reason an AI character can appear to forget earlier parts of a long roleplay.
- What does OOC mean in roleplay?: OOC stands for out of character. It marks text that comes from the user or author as themselves rather than from the persona they are playing, and is used to give directions, ask questions, or set boundaries without disrupting the story. OOC notes are often wrapped in brackets or parentheses. Its opposite is IC, or in character, where everything is spoken as the role.
- What is a persona in AI character chat?: A persona is the identity the user adopts inside an AI character chat, describing who they are within the story. It typically includes a name, basic traits, and background, and is supplied to the model so the AI character can address the user consistently and react to them as a defined participant rather than an anonymous voice. A persona shapes the user side of a scene the way a character card shapes the AI side.
- What is a character card?: A character card is a structured bundle of data that defines an AI roleplay character. It commonly contains a name, a personality description, a scenario, a greeting, and example dialogue. The card is fed to the language model so the AI can stay in character across a conversation. Cards can be shared as files, letting one author's character be imported and reused by other people on compatible platforms.

