Files
cline-multi-mirror/docs/prompting/understanding-context-management.mdx
T
Juan Pablo FloresandCopilot 8f8c4561a6 Docs upgrade (#6907)
* style(docs): update background color scheme to neutral tones

Update documentation background colors from purple-tinted theme to neutral gray tones. Changed light mode from lavender (#F0E6FF) to off-white (#fafaf9) and dark mode from pure black (#000000) to dark gray (#0f0f0f) for improved visual consistency.

* refactor(docs): remove gradient decoration from theme config

Remove the "decoration": "gradient" property from the documentation
theme configuration. This simplifies the theme settings by removing
the gradient decoration option from the color configuration object.

* docs: change documentation font family to Geist Mono

Replace Roboto with Geist Mono as the default font family in the documentation configuration. This updates the visual styling of the documentation to use a monospace font, which may improve readability for code-heavy content.

* docs: update branding and restructure navigation

- Replace robot panel logos with new Cline brand logos
- Add icons to navbar links (Docs, GitHub, Discord)
- Restructure navigation from groups to tabs format
- Add icons to navigation items for improved UX
- Include new Docs link in navbar with book icon

This update modernizes the documentation appearance and improves navigation hierarchy for better user experience.

* docs: restructure navigation with hierarchical groups and pages

Restructured documentation navigation from flat menu to organized groups:
- Removed redundant "Docs" link from navbar
- Migrated from "menu" to "groups/pages" structure
- Added comprehensive page organization with nested groups:
  * Introduction, Getting Started, Features
  * Prompting Skills, Cline's Tools, Enterprise Solutions
  * MCP Servers, Provider Configuration
- Organized features into logical subgroups (@ Mentions, Commands,
  Customization, Slash Commands)
- Improved documentation discoverability and hierarchy

This change provides better content organization and easier navigation
for users exploring different aspects of Cline documentation.

* docs: remove contextual options from documentation config

Remove the contextual configuration section containing the "copy" option from docs.json. This simplifies the documentation configuration by removing unused contextual menu options.

* docs(multiroot): improve workspace documentation with limitations and technical details

- Add important note about experimental limitations affecting Cline rules and checkpoints
- Add "How it works" section explaining automatic workspace detection and tracking
- Reorganize technical behavior section with detailed subsections for workspace detection, path resolution, and command execution
- Document workspace hint syntax for explicit file references (@workspaceName:path)
- Standardize heading capitalization to sentence case for consistency
- Improve overall content organization and clarity for better user understanding

This update provides users with clearer information about the multiroot feature's current state, its limitations, and how to effectively use workspace hints when working with multiple project folders.

* docs: restructure overview page with enhanced visual layout

- Convert plain markdown sections to CardGroup and Card components with icons
- Add tabbed interface for Plan & Act Mode explanation
- Update description from "development assistant" to "coding agent"
- Reorganize content for improved readability and visual hierarchy
- Enhance feature presentations with icon-based cards

Improves user experience by transforming the overview documentation into a more visually appealing and scannable format using modern documentation components.

* docs: improve installation guide with enhanced structure and UX

Restructure the Cline installation documentation to improve readability and user experience:

- Add prominent note highlighting 2-minute installation time
- Convert prerequisites into visual card components for better clarity
- Transform installation steps into structured Step components for easier following
- Add manual installation instructions for JetBrains IDEs
- Include feature compatibility accordion for JetBrains users
- Enhance visual hierarchy with improved component usage (CardGroup, Steps, Accordion)
- Simplify language and improve descriptions throughout

This makes the installation process clearer for new users and reduces friction during onboarding.

* style(docs): remove text opacity reduction for better readability

* docs: refactor model selection guide with visual step-by-step instructions

- Replace tab-based layout with linear step-by-step flow
- Add screenshots for each configuration step (config, provider, API, model)
- Reorganize content structure for improved clarity and user experience
- Add quickstart options and streamlined provider recommendations
- Improve navigation with visual aids to help users configure Cline faster

* docs: add installation screenshots and context management guide

* docs: flatten provider config structure in documentation

Remove the "Alternative Providers" grouping and move all provider configuration pages (OpenRouter, Cerebras, DeepSeek, Groq, xAI Grok, Mistral AI, Doubao, Fireworks, and ZAI) to the main provider configuration list. This simplifies the documentation navigation by treating all providers equally rather than categorizing some as alternatives.

* docs: restructure context management docs and improve content clarity

**Changes:**
- Reorganized documentation structure by moving context management from
  `/best-practices` to `/prompting` section for better categorization
- Added URL redirect to maintain backward compatibility for old links
- Updated navigation references in welcome page to point to new location
- Improved readability of context management explanations with more
  narrative, conversational prose
- Enhanced context window documentation by adding cache tokens indicator
  and using emoji-based formatting for better visual clarity
- Streamlined Cline Memory Bank setup instructions from 4 to 3 steps
- Updated context bar screenshot to use newer image asset

**Why:**
Better documentation organization and improved user experience through
clearer explanations of how Cline builds and manages context during tasks.

* docs(context-management): convert Quick Reference to Info component

Replace blockquote formatting with Info component for the Quick Reference
section in the context management documentation. This improves visual
presentation and maintains consistency with documentation standards.

Also removes trailing whitespace at the end of the file for cleaner
formatting.

* docs: add Cline Enterprise overview and restructure enterprise section

- Add comprehensive enterprise overview documentation covering security,
  governance, observability, and developer experience features
- Rename "Enterprise & Security" navigation group to "Enterprise"
- Consolidate enterprise documentation by replacing 4 pages with 2:
  new overview page and security concerns
- Document BYOI (Bring Your Own Inference), SSO authentication, and
  role-based access control capabilities

This restructuring provides a clearer entry point for enterprise users
and consolidates previously scattered enterprise information into a
cohesive overview document.

* docs(enterprise): streamline enterprise overview and update font

- Change documentation font from Geist Mono to Geist Sans
- Add enterprise website link card for detailed information
- Remove Developer Experience, Proven at Scale, and Pricing sections
- Consolidate Flexible Inference section content
- Simplify enterprise overview to focus on core capabilities

These changes reduce redundancy by directing users to the enterprise
website for pricing and detailed features while keeping the docs
focused on technical implementation and core capabilities.

* clean-images

* Update docs/getting-started/installing-cline.mdx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update docs/styles.css

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* docs(cline-cli): add platform availability warning to overview

Add a prominent warning callout indicating that Cline CLI is currently in preview and only supports macOS and Linux, with Windows support coming soon. This sets clear expectations for users about platform compatibility.

Also remove redundant introductory text in the "What you can build with this" section to improve content clarity.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-16 11:51:20 -07:00

173 lines
7.4 KiB
Plaintext

---
title: "Context Management"
description: "Master context management to unlock Cline's full potential"
---
<Info>
**Quick Reference**
- **Context** = All information Cline knows about your project
- **Context Window** = Maximum information Cline can process at once (varies by model)
- **Token** = Unit of text measurement (~3/4 of an English word)
- **Auto-management** = Cline automatically handles context through Focus Chain & Auto Compact
</Info>
## What is Context Management?
Context management is how Cline maintains understanding of your project throughout a conversation. Think of it as the shared memory between you and Cline - containing code, decisions, requirements, and progress.
<Frame caption="Context is like a shared workspace where Cline builds understanding of your project">
<img
src="https://storage.googleapis.com/cline_public_images/docs/assets/image%20(2).png"
alt="Context visualization showing the relationship between total context and context window"
/>
</Frame>
### The Three Layers of Context
1. **Immediate Context** - Current conversation and active files
2. **Project Context** - Your codebase, structure, and patterns
3. **Persistent Context** - Memory Bank, .clinerules, and documentation
## Understanding Context Windows
Every AI model has a **context window** - the maximum amount of information it can process in a single conversation. This is measured in tokens:
### Token Limits by Model
| Model | Context Window | Effective Limit* | Best For |
|-------|---------------|-----------------|----------|
| **Claude 3.5 Sonnet** | 200,000 tokens | 150,000 tokens | Complex tasks, large codebases |
| **Claude 3.5 Haiku** | 200,000 tokens | 150,000 tokens | Faster responses, simpler tasks |
| **GPT-4o** | 128,000 tokens | 100,000 tokens | General purpose development |
| **Gemini 2.0 Flash** | 1,000,000+ tokens | 400,000 tokens | Very large contexts |
| **DeepSeek v3** | 64,000 tokens | 50,000 tokens | Cost-effective coding |
| **Qwen 2.5 Coder** | 128,000 tokens | 100,000 tokens | Specialized coding tasks |
*Effective limit is ~75-80% of maximum for optimal performance
<Tip>
**Token Math Made Simple**
- 1 token ≈ 3/4 of an English word
- 100 tokens ≈ 75 words ≈ 3-5 lines of code
- 10,000 tokens ≈ 7,500 words ≈ ~15 pages of text
- A typical source file: 500-2,000 tokens
</Tip>
## How Cline Builds Context
Building effective context is what makes Cline truly useful. When you start a task, Cline doesn't just passively wait for information - he actively gathers context about your project, asks clarifying questions when needed, and adapts to what's happening in real-time. This combination of automatic discovery, user guidance, and dynamic adaptation ensures Cline always has the right information to solve your problems effectively.
### 1. Automatic Context Gathering
When you start a task, Cline proactively:
```mermaid
graph LR
A[Task Start] --> B[Scan Project Structure]
B --> C[Identify Relevant Files]
C --> D[Read Key Components]
D --> E[Map Dependencies]
E --> F[Build Mental Model]
```
**What Cline automatically discovers:**
- Project structure and file organization
- Import relationships and dependencies
- Code patterns and conventions
- Configuration files and settings
- Recent changes and git history (when using @git)
### 2. User-Guided Context
While automatic discovery handles much of the work, you control what Cline focuses on. The more specific and relevant context you provide, the better Cline can understand your needs and deliver accurate solutions.
You enhance context by:
- **@ Mentioning** files, folders, or URLs
- **Providing requirements** in natural language
- **Sharing screenshots** for UI context
- **Adding documentation** through .clinerules or Memory Bank
- **Answering questions** when Cline needs clarification
### 3. Dynamic Context Adaptation
Cline adapts context dynamically throughout your conversation. It considers the complexity of your request, available context window space, current task progress, error messages and feedback, plus previous decisions made during the conversation to determine what information matters most at each step.
## The Context Window Progress Bar
Monitor your context usage in real-time:
<Frame caption="The context window bar shows input/output token usage">
<img
src="https://storage.googleapis.com/cline_public_images/context-bar.png"
alt="Context window progress bar showing token usage"
/>
</Frame>
### Understanding the Indicators
- ⬆️ **Input Tokens**: Information sent to the model (your messages + context)
- ⬇️ **Output Tokens**: Model's responses and generated code
- ➡️ **Cache Tokens**: Previously processed tokens that's reused (reduces costs and improves speed)
- **Progress Bar**: Visual representation of usage
- **Percentage**: Current usage of total capacity
## Automatic Context Management Features
Cline includes intelligent systems that handle context for you:
### Focus Chain (Default: ON)
Focus Chain maintains task continuity through automatic todo lists. When you start a task, Cline generates actionable steps and updates them as work progresses. This keeps critical context visible even after Auto Compact runs, letting you track progress without scrolling through the entire conversation.
[Learn more →](/features/focus-chain)
### Auto Compact (Always ON)
When context usage hits around 80%, Auto Compact automatically creates a comprehensive summary of the conversation. This preserves all decisions and code changes while freeing up space for continued work. You'll see a message when this happens. The task continues seamlessly - you don't need to do anything.
[Learn more →](/features/auto-compact)
### Context Truncation System
If your conversation approaches the model's context window limit before Auto Compact runs, Cline's Context Manager automatically truncates older parts of the conversation to prevent errors.
The system prioritizes what matters most:
- Your original task description stays
- Recent tool executions and their results remain intact
- Current code state and active errors are preserved
- The logical flow of user-assistant messages is maintained
What gets removed first:
- Redundant conversation history from earlier in the task
- Completed tool outputs that are no longer relevant
- Intermediate debugging steps
- Verbose explanations that served their purpose
This happens automatically. You'll keep working without interruption, and Cline maintains enough context to continue solving your problem effectively.
## Best Practices
- **Be specific** - Clear objectives help Cline understand your needs
- **Use @ mentions strategically** - Reference specific files rather than entire folders
- **Monitor the progress bar** - Yellow/red means consider using `/smol` or `/newtask`
- **Trust auto-management** - Focus Chain and Auto Compact handle complexity automatically
- **Use Memory Bank** - Document persistent patterns and conventions
## Next Steps
<CardGroup cols={2}>
<Card title="Focus Chain" icon="link" href="/features/focus-chain">
Learn how Focus Chain maintains task continuity
</Card>
<Card title="Auto Compact" icon="compress" href="/features/auto-compact">
Understand automatic conversation compression
</Card>
<Card title="Memory Bank" icon="brain" href="/prompting/cline-memory-bank">
Set up persistent project knowledge
</Card>
<Card title="Cline Rules" icon="gavel" href="/features/cline-rules">
Define project-specific conventions
</Card>
</CardGroup>