Windsurf Context Window (Now Devin Desktop): Cascade Token Limits, Indexing, and MCP
The Windsurf context window (in the editor renamed Devin Desktop in June 2026) governs the active token budget and conversation history available to the Cascade coding agent before automatic summarization is triggered. While underlying models support large windows, Cascade relies on an Abstract Syntax Tree indexing engine and dynamic prompt assembly to manage multi-file repositories without context thrashing.
How the Windsurf Context Window and Token Limits Work
When a complex coding session spans dozens of tool executions and edits across multiple files, agent memory degrades quickly unless token allocation is actively budgeted. In Devin Desktop (formerly Windsurf, renamed in June 2026), the Cascade coding agent does not operate with a static, monolithic context allocation. The context window in Devin Desktop governs the active token budget and conversation history available to the Cascade coding agent before automatic summarization and session compression are triggered. Rather than exposing a raw frontier model context window directly to unmanaged transcripts, Cascade dynamically parcels its token allocation across system instructions, IDE telemetry, codebase index retrievals, and conversational turns.
Cascade allows developers to switch between frontier models, including Claude Opus 5 and GPT-5.6 Sol. While the underlying foundational models advertise context windows spanning hundreds of thousands of tokens, practical agent performance faces sharp operational boundaries. Long reasoning trajectories consume token capacity quickly when each step incorporates tool declarations, file diffs, and terminal outputs.
According to official documentation for Devin Desktop, Cascade can make up to 20 tool calls per prompt. When this trajectory limit is reached, execution pauses, prompting the developer to click continue or rely on an automated continuation setting. Each continuation resumes execution but draws down additional prompt credits and increases the cumulative conversational context.
To balance model depth against latency and cost, Devin Desktop organizes context management into three core operational layers:
- Dynamic prompt builder: Assembles system instructions, active file buffers, cursor coordinates, recent terminal outputs, and workspace conventions before dispatching the payload to the model.
- Automated session summarization: Monitors buffer consumption and applies lossy compression to older conversational turns when total tokens approach the model threshold.
- External Model Context Protocol tools: Offloads reference documentation, architectural schemas, and multi-repository indexes to external servers to avoid context saturation.
Understanding this division of labor prevents common failure modes where bloated conversation transcripts push critical architectural requirements out of the model's active attention span.
How Windsurf Indexes Workspaces Using AST Parsing
Rather than stuffing entire source trees into the active prompt, Devin Desktop relies on an automated local indexing engine designed to handle codebases with 50 or more files. When a repository opens, the IDE builds an indexed representation of the workspace using Abstract Syntax Tree (AST) parsing.
AST parsing breaks source code into structural syntax units, such as classes, functions, interface declarations, and type signatures, rather than arbitrary text chunks. By analyzing syntax trees, the indexing engine understands how code components relate across file boundaries.
Devin Desktop pairs structural parsing with a multi-dimensional retrieval pipeline that combines three discovery methods:
- Vector search: Uses semantic embeddings to discover functions and modules related to natural language queries.
- Keyword search: Employs precise text and symbol matching to resolve explicit variable names, imports, and method invocations.
- Code structure graph traversal: Traces import trees, call hierarchies, and dependency relationships across project directories.
When Cascade executes an internal code search, it applies a two-stage retrieval process. Candidate code blocks are gathered across the vector and keyword indexes, followed by a secondary reranking step that filters out irrelevant boilerplate. Only the highest-ranking code snippets are injected into the active prompt.
Developers can control what enters this index through local configuration files:
.codeiumignore: Placed in the project root, this file excludes build artifacts, compiled binaries, generated assets, and large data dumps from being indexed or viewed by Cascade.- Global ignore rules: Located at
~/.codeium/.codeiumignore, this file enforces system-wide exclusion patterns across all local workspaces. - Cascade Gitignore Access: A toggle in settings that prevents Cascade from reading or indexing files defined in
.gitignore.
Developers can also steer the retrieval engine manually. Typing @ in Cascade exposes direct pinning commands, such as @file, @directory, and @codebase. Pinning upweights specific modules in the retrieval step, ensuring critical interfaces remain in active memory during complex refactoring.
Why Context Thrashing Occurs in Long Cascade Sessions
As development tasks progress, long conversations inevitably exhaust active token budgets. Devin Desktop provides a real-time context window indicator in the Cascade interface footer, displaying how much of the active token buffer has been consumed.
When a session approaches the model limit, Cascade automatically initiates session compression. The agent summarizes early prompt exchanges, tool outputs, and diff histories into condensed narrative checkpoints. While this automatic pruning prevents hard runtime crashes, it introduces a subtle challenge known as context thrashing.
Context thrashing occurs when an agent loses fine-grained memory of initial project requirements because earlier conversation turns were summarized away. For instance, if specific edge-case requirements or database constraints were established early in the dialogue, the summarized checkpoint may retain only a generalized note like "configured user authentication." Under heavy compression, the model may:
- Revert previously accepted code changes or rewrite working utility functions.
- Forget negative constraints, such as avoiding specific third-party libraries.
- Repeatedly execute search tool calls looking for definitions that were already reviewed.
- Hallucinate missing parameters in internal API calls.
To prevent context degradation during extended development sessions, practitioners apply several deliberate hygiene practices:
- Partition tasks across discrete sessions: Rather than running an entire sprint feature in one monolithic Cascade thread, break work into modular tasks. Complete an API layer, commit the changes, and start a fresh Cascade session for frontend integration.
- Preserve state in persistent rules: Store non-negotiable architectural decisions in
.windsurfrulesor project documentation. Invariant rules load on every new session without depending on chat history. - Monitor tool trajectory limits: Because Cascade allows up to 20 tool calls per prompt, avoid open-ended requests like "refactor the whole repo." Issue targeted instructions that complete within focused tool operations to prevent runaway token accumulation.
Keep Large Codebase Documentation Out of the Agent Context Window
Index reference documentation and large file repositories in a dedicated Fast.io workspace. Connect Cascade via the remote MCP server to retrieve relevant snippets on demand without consuming active conversation tokens. Every organization starts with a 14-day free trial, which requires a credit card.
How to Configure MCP Servers for External Technical Context
While local AST indexing handles primary application code well, modern software projects frequently depend on extensive external context: API specifications, SDK documentation, compliance standards, and architectural blueprints. Attaching dozens of markdown or PDF reference files directly into Cascade rapidly saturates the context window, triggering early summarization before meaningful coding begins.
This limitation mirrors the barrier users encounter in Claude Projects, where project knowledge is limited by the context window, 30MB per file (see https://support.claude.com/en/articles/8241126-upload-files-to-claude). In Devin Desktop, dragging dozens of reference files directly into Cascade creates identical bloat, consuming the active token budget on static references rather than code reasoning.
The Model Context Protocol (MCP) provides an architectural solution to this bottleneck. Instead of attaching entire documentation sets to the prompt, Cascade connects to external MCP servers that query indexed data remotely. Cascade issues semantic search queries across the external corpus and receives only the relevant excerpt, preserving token capacity for code generation.
Devin Desktop configures MCP connections through a central configuration file:
- macOS and Linux:
~/.codeium/windsurf/mcp_config.json - Windows:
%USERPROFILE%\.codeium\windsurf\mcp_config.json
Cascade enforces a documented limit of 100 total tools across all configured MCP servers at any given time. Devin Desktop supports three transport types for MCP servers: stdio (local subprocesses), Streamable HTTP, and SSE (Server-Sent Events).
For local utilities, developers often start with local stdio servers. However, running local script-based servers requires maintaining Python or Node runtimes on every workstation, offers no centralized search indexing, and fails to synchronize across teammates.
Connecting a remote MCP endpoint allows Cascade to search centralized repositories over Streamable HTTP without local overhead. Teams setting up storage for AI agents can connect Cascade directly using an environment variable for the authentication token:
{
"mcpServers": {
"fastio": {
"url": "https://mcp.fast.io/mcp/key",
"headers": {
"Authorization": "Bearer ${env:FASTIO_API_KEY}"
}
}
}
}
Once added, Cascade automatically discovers the remote tools. When asked a question regarding external technical specifications or corporate guidelines, Cascade queries the server, receives precise excerpts, and incorporates the findings directly into its code trajectory.
Structuring External Repositories and Documentation in Fast.io
Solving the context window problem for large technical corpora requires shifting static files out of local prompts and into an intelligent storage tier. Storing documentation in a dedicated Fast.io workspace gives Cascade on-demand retrieval capabilities across gigabytes of project references without consuming local tokens.
Teams can populate workspaces through direct file uploads or automated cloud import. Fast.io supports importing files directly from Dropbox, Box, and OneDrive, while Google Drive imports today with sync coming soon. This allows engineering organizations to centralize architecture RFCs, product requirements, and legacy codebases without manual file transfers.
Once files land in a workspace, enabling Intelligence Mode activates built-in retrieval-augmented generation. Fast.io automatically builds a hybrid index combining full-text keyword matching, semantic vector embeddings, and search-by-metadata-value without requiring a separate vector database or custom embedding pipeline.
When Cascade needs clarification on an API contract or deployment rule, the workflow operates cleanly:
- The developer prompts Cascade: "Verify our payload validation rules against the billing specification."
- Cascade recognizes it lacks the specification in local files and calls the Fast.io search tool via MCP.
- Fast.io executes a hybrid search across the workspace and returns the exact matching section along with file citations.
- Cascade ingests the targeted snippet, applies the validation logic to the local codebase, and continues its task.
Fast.io does not alter or raise Devin Desktop's internal context window. Instead, it prevents context exhaustion by ensuring Cascade only ingests the precise paragraphs needed for the current prompt.
Beyond context reduction, centralizing project documentation in Fast.io provides governance features designed for engineering teams:
- Per-file version history: Every document retains complete revision tracking, allowing teams to audit changes when specifications are updated.
- Append-only audit log: Records workspace interactions, downloads, and search queries for security and operational oversight.
- Collaborative Notes: Provides real-time co-editing surfaces where developers and autonomous agents can maintain shared implementation checklists.
- Granular permissions: Controls access across organization, workspace, folder, and file tiers, ensuring coding agents only query authorized documentation.
Developers can explore MCP integrations with dedicated workspaces during onboarding. Creating an account is free; doing real work requires an organization on a paid subscription. Every organization starts with a 14-day free trial, which requires a credit card. Plans are Starter at $29/mo, Business at $99/mo, and Growth at $299/mo on Fast.io pricing.
Sources
References used to verify factual claims in this guide.
-
Cascade can make up to 20 tool calls per prompt.
-
Cascade has a limit of 100 total tools that it has access to at any given time.
-
Cascade model options include Claude Opus 5 and GPT-5.6 Sol.
Frequently Asked Questions
What is the context window for Windsurf Cascade?
In Devin Desktop (formerly Windsurf), Cascade does not have a single fixed context window because it supports multiple underlying frontier models, including Claude Opus 5 and GPT-5.6 Sol. The active token limit is determined by the selected model, but Cascade dynamically budgets this capacity across system rules, IDE telemetry, codebase indexing snippets, and chat history. When a conversation nears the model threshold, Cascade applies automated summarization to compress earlier messages and maintain session headroom.
How does Windsurf handle large codebases without running out of tokens?
Devin Desktop avoids saturating the context window by using an automated codebase indexing engine rather than reading entire repositories into memory. The indexing engine uses Abstract Syntax Tree parsing to divide code into structural semantic units, such as classes and functions. When a query is made, Devin Desktop combines vector search, keyword grep, and dependency graph traversal with an LLM-based reranker to inject only the most relevant code snippets into the prompt.
What happens when a Windsurf Cascade session reaches its token limit?
When a Cascade session reaches its token limit, Devin Desktop triggers automated session summarization. Earlier conversational turns, tool outputs, and file diffs are condensed into narrative checkpoints. While this allows the session to continue without crashing, the compression is lossy. To prevent context thrashing, where the agent forgets early requirements, developers should commit completed milestones and start fresh Cascade sessions for new tasks.
How do I configure MCP servers in Windsurf?
To configure MCP servers in Devin Desktop (formerly Windsurf), edit the central configuration file located at ~/.codeium/windsurf/mcp_config.json on macOS and Linux, or %USERPROFILE%\.codeium\windsurf\mcp_config.json on Windows. You can define servers using stdio for local command-line tools, or Streamable HTTP and SSE for remote endpoints. Cascade supports up to 100 total tools across all active MCP servers.
How does external MCP search compare to attaching files directly in Cascade?
Attaching files directly to Cascade consumes active context tokens immediately, accelerating the rate at which earlier instructions are compressed out of memory. Connecting Cascade to an external storage platform like Fast.io via MCP offloads the storage and indexing layer. The agent performs semantic queries across external documents and retrieves only the necessary text snippets, keeping the primary context window clear for code reasoning.
Related Resources
Keep Large Codebase Documentation Out of the Agent Context Window
Index reference documentation and large file repositories in a dedicated Fast.io workspace. Connect Cascade via the remote MCP server to retrieve relevant snippets on demand without consuming active conversation tokens. Every organization starts with a 14-day free trial, which requires a credit card.