Context is the information an AI model uses to produce its next response. Context management is the practice of giving the model the right information at the right time. This matters because AI does not work from your intent alone. It works from the text, files, screenshots, logs, examples, and conversation history available in its context window.Documentation Index
Fetch the complete documentation index at: https://docs.replit.com/llms.txt
Use this file to discover all available pages before exploring further.
What is a context window?
An AI model has a limit on how much information it can consider at once. That limit is called the context window. The context window can include:- Your prompt
- Earlier messages in the conversation
- Files or code the model can see
- Error messages and logs
- Screenshots, images, or design references
- Project instructions, such as
replit.md - Tool results from previous steps
Why context windows matter
If the important details are not in context, the model may guess. If too much unrelated information is in context, the model may focus on the wrong thing. For example, this prompt gives little context:Context window sizes vary
Different AI models can handle different amounts of context. Larger context windows can consider more text at once, but larger is not always better. Relevant context still matters more than dumping every detail into the conversation. Examples of public context window sizes:| Model family | Example context window |
|---|---|
| GPT-4.1 | Up to 1 million tokens |
| Claude Sonnet 4.5 | Up to 200,000 tokens |
| Gemini 2.5 Pro | Up to 1 million tokens |
Types of context
| Context type | Example |
|---|---|
| Goal | ”This landing page should collect waitlist signups.” |
| Audience | ”This is for busy restaurant owners.” |
| Constraints | ”Keep the current color palette and form fields.” |
| Non-goals | ”Do not add payments yet.” |
| Examples | A screenshot, mockup, sample data, or competitor page. |
| Project state | The current file, component, error message, or user flow. |
| Definition of done | ”A visitor can submit the form and see a thank-you message.” |
Fresh context and persistent context
Some context belongs in the current conversation. Use it when you are asking for a specific change, debugging one issue, or giving feedback on a recent result. Other context should persist across the project. Use persistent context for coding style, brand guidelines, naming conventions, reusable product rules, and constraints Agent should remember across work sessions. On Replit, replit.md is one way to give Agent persistent project context.When context gets noisy
Long conversations can drift. If a thread has mixed too many unrelated decisions, Agent may pay attention to old context that no longer matters. Start a fresh thread when:- You switch to an unrelated feature
- The conversation has many abandoned directions
- Agent keeps applying old constraints
- You want a clean plan for a new area
Common misconceptions
- “More context is always better.” Relevant context is better. Too much unrelated context can distract the model.
- “The model remembers everything perfectly.” AI uses available context, but you should restate important constraints when they matter.
- “Context is only text.” Screenshots, files, data, designs, logs, and examples can all be context.
Where to go next
Introduction to AI
Learn how language models work and how AI agents use models with tools to take action.
Build with Agent
Learn how to add context while working with Agent.
Effective prompting
See prompt examples that include useful context.
replit.md
Learn how to provide persistent project context.