# Claude Code Limits: Quotas, 200K Context Windows, and 5-Hour Usage Caps

Claude Code operates under two distinct boundaries: length limits dictated by a 200,000-token context window and usage limits enforced through 5-hour rolling windows and weekly organization caps. Every command, file read, and diff compounds in the session history, draining user quotas rapidly during iterative coding sessions. Controlling token consumption requires active terminal hygiene and offloading large codebase references to external storage through the Model Context Protocol.

Source: https://fast.io/resources/claude-code-limits/
Author: [Tom Langridge](https://fast.io/authors/tom-langridge/)
Last reviewed: 2026-10-20

## What are the official Claude Code limits?

Claude Code operates within a 200,000-token context window alongside dynamic 5-hour rolling usage quotas and weekly organization compute budgets on paid plans, according to Anthropic documentation (verified 2026-10-14). In Claude Code, these operational boundaries determine how long an agent can inspect directories, edit code, and execute tests before hitting throttling.

Claude Code limits are the operational boundaries enforced by Anthropic on its agentic coding tool, encompassing a 200,000-token context window, 5-hour rolling usage quotas, weekly organization budgets, and tool execution timeouts. Unlike standard chat interfaces where a human reads an answer before typing a response, a command-line agent runs continuous automated tool loops. Inspecting directories, reading source files, analyzing stack traces, and proposing code edits happen in rapid succession. When those operations outpace account allowances, Anthropic halts execution with rate limit errors.

Many developers confuse web chat upload limits with terminal coding limits. On the web interface, individual chats restrict attachment quantities and file sizes as detailed in Anthropic's [file upload documentation](https://support.claude.com/en/articles/8241126-upload-files-to-claude), while Claude Projects accepts documents within context window boundaries without a fixed file count ceiling. In contrast, Claude Code in the CLI does not ingest documents as chat attachments; instead, it reads files directly from the local file tree through terminal tool calls, compounding input tokens with every turn. You can review official documentation on [how usage and length limits work](https://support.claude.com/en/articles/11647753-how-do-usage-and-length-limits-work) to verify account allowances.

The operational boundaries governing Claude Code vary by authentication method, subscription tier, and execution surface:

| Operational Boundary | Specification | Reset Interval or Trigger | Applies To | Source & Checked Date |
| --- | --- | --- | --- | --- |
| Context Window (Length Limit) | 200,000 tokens standard | Triggers auto-compaction near capacity | Pro, Max, Team, Enterprise | [Claude Help Center (11647753)](https://support.claude.com/en/articles/11647753-how-do-usage-and-length-limits-work) (2026-10-14) |
| Session Quota (Usage Limit) | Dynamic message and token allowance | Resets on a 5-hour rolling window | Pro, Max, Team, Enterprise | [Claude Help Center (11647753)](https://support.claude.com/en/articles/11647753-how-do-usage-and-length-limits-work) (2026-10-14) |
| Weekly Organization Budget | Rolling weekly compute ceiling | Resets once every 7 days | Pro, Max, Team, Enterprise | [Claude Help Center (11647753)](https://support.claude.com/en/articles/11647753-how-do-usage-and-length-limits-work) (2026-10-14) |
| Pay-As-You-Go API Execution | Metered per token with RPM and TPM rate tiers | Billed consumption; continuous token bucket replenish | Console, Bedrock, Vertex AI | [Claude Code Limits (14552983)](https://support.claude.com/en/articles/14552983-models-usage-and-limits-in-claude-code) (2026-09-22) |
| Claude.ai Web Chat Attachments | 20 files per chat; 500MB per file; 1,000 pages per PDF | Per chat interaction | Free, Pro, Max, Team | [Claude Upload Docs (8241126)](https://support.claude.com/en/articles/8241126-upload-files-to-claude) (2026-09-14) |
| Claude Projects Knowledge | 30MB per file; unlimited file count (bounded by context) | Persistent project memory | Pro, Max, Team, Enterprise | [Claude Upload Docs (8241126)](https://support.claude.com/en/articles/8241126-upload-files-to-claude) (2026-09-14) |

Understanding how Claude Code enforces these boundaries requires examining the difference between length limits and usage limits.

## How do length limits and usage limits differ in Claude Code?

Anthropic divides operational constraints into two distinct categories: length limits and usage limits. Confusing the two causes developers to apply the wrong fixes when their sessions halt.

### Length Limits and the 200,000-Token Context Window

Length limits govern the depth and complexity of an individual session. They reflect the size of Claude's context window, which is the working memory the model can process on any single turn. For standard paid plans, Claude Code operates with a 200,000-token context window.

Every interaction in Claude Code sends three distinct elements to the model:

1. Conversation history: Every command, prompt, and tool response generated since the session started.
2. Project context: The project instruction file (`CLAUDE.md`) and any file contents Claude Code has opened.
3. Your new prompt: The current instructions entered in the terminal.

As an agent inspects files and writes code, the context window fills up. When the total volume of text approaches 200,000 tokens, older parts of the conversation fall out of focus, leading to degraded code quality and lost instructions. Length limits represent an immediate capacity ceiling for your current conversation rather than a time-based restriction. More details on model parameters are described in Anthropic's [models and limits guide for Claude Code](https://support.claude.com/en/articles/14552983-models-usage-and-limits-in-claude-code).

### Usage Limits and the Shared Subscription Pool

Usage limits control how much total work you can perform across specific time windows. They determine your overall conversation budget, controlling how many messages you can send or how many automated agent turns you can execute before waiting for a reset.

Paid plans have two types of usage limits: a session limit that resets every five hours, and weekly limits that reset once every week. The 5-hour rolling window is not a fixed daily quota that resets at midnight. Anthropic calculates consumption continuously across the preceding 5 hours. If an intensive coding run exhausts your allowance at 10:00 AM, that capacity recovers gradually until 3:00 PM.

A critical operational factor for engineering teams is that usage quotas are shared across surfaces. Note that your usage of all different Claude product surfaces (claude.ai, Claude Code, Claude Desktop) counts towards the same usage limit. Brainstorming an architecture document on claude.ai in the morning draws down the exact same token pool that Claude Code relies on in your terminal in the afternoon.

### Direct API Keys as an Alternative to Subscription Caps

Developers who run long development sessions often authenticate Claude Code with an Anthropic Console API key, AWS Bedrock, or Google Cloud Vertex AI rather than a web login.

When you use an API key, the 5-hour rolling session limit and weekly subscription caps do not apply. The session runs on pay-as-you-go consumption billed per token. API execution is governed by commercial rate limits: Requests Per Minute (RPM), Input Tokens Per Minute (ITPM), and Output Tokens Per Minute (OTPM). While this path eliminates hard subscription lockouts, it introduces direct financial costs that compound rapidly during unchecked agent execution loops.

## Why do agentic coding loops burn token quotas so quickly?

A developer typing in a web chat rarely exhausts a 5-hour usage quota in a single sitting. In contrast, Claude Code can consume an entire session budget within 30 minutes of active debugging. This gap stems from the architectural mechanics of agentic tool execution.

### Anatomy of an Autonomous Agent Turn

When you submit a prompt such as "fix the database connection retry logic in the billing service", Claude Code does not answer with a single response. It initiates an autonomous execution loop:

1. Directory discovery: It executes directory search tools to locate relevant configuration and source files.
2. Content extraction: It reads the billing client, connection pool settings, and database interface modules.
3. Search and grep: It scans the repository for related test cases and environment variables.
4. Test execution: It executes local test suites via bash tool calls to reproduce errors.
5. Code modification: It drafts edits, applies file diffs, and inspects the updated code.
6. Validation run: It re-runs test suites to confirm resolution.

Each of these steps represents an independent API call. In a routine debugging workflow, a single developer command can trigger 10 to 30 automated turns before returning control to the prompt.

### The Compounding Context Effect

The primary driver of quota exhaustion is context compounding. In Claude Code, tool execution is stateful. Every tool invocation, every file read, and every terminal command output is appended to the session history. On each subsequent turn, the entire accumulated history is re-sent to the model.

Consider the token progression of a typical troubleshooting task:

- Turn 1: System prompt, project instructions (`CLAUDE.md`), and developer prompt (3,000 tokens).
- Turn 2: Preceding context plus directory listings and file search output (6,000 tokens).
- Turn 3: Preceding context plus two source code files read into memory (24,000 tokens).
- Turn 4: Preceding context plus third source file and failed test output (42,000 tokens).
- Turn 5: Preceding context plus proposed code edit and second test run (65,000 tokens).

By turn 5, the agent is submitting 65,000 tokens on each request to generate a minor code adjustment. Because billing and usage quotas track the total input tokens processed on every turn, a short iterative loop can consume several hundred thousand tokens in a matter of minutes.

### Auto-Compaction Triggers and Quality Degradation

Claude Code includes a live indicator that monitors how full the context window has become. When accumulated tokens approach the 200,000-token ceiling, Claude Code initiates automatic context management.

During auto-compaction, the agent summarizes earlier conversation turns, compresses intermediate tool outputs, and condenses file reads into a concise recap. This process allows the session to continue without hitting a hard termination wall.

Auto-compaction carries operational tradeoffs:

- Loss of subtle context: Summaries preserve high-level goals but often discard specific variable names, edge-case test results, or configuration flags.
- Repetitive file reads: Because older file contents were compressed away, the agent frequently re-reads files it already inspected, consuming extra tool calls.
- Compounded usage consumption: The compaction step itself requires model reasoning and token generation, which draws further from your 5-hour quota.

Relying on auto-compaction as a standard workflow pattern accelerates quota burn while degrading code reliability.

## How can you preserve context and quota in the terminal?

Controlling token burn in Claude Code does not require writing fewer lines of code. It requires adopting disciplined terminal habits that keep prompt payloads lean.

### 1. Clear Between Distinct Tasks

The single most effective practice for managing quotas is running `/clear` whenever you switch tasks.

Every previous interaction remains in memory until cleared. If you spend 40 minutes refactoring an authentication module and then immediately ask Claude Code to write a new data migration, the migration prompt carries all the authentication code in its payload.

Run `/clear` whenever your next prompt would make complete sense in a clean terminal. Running `/clear` wipes the conversation history while preserving your `CLAUDE.md` instructions and local repository files. Note that `/clear` cannot be undone, so verify your pending edits before clearing.

### 2. Compact Intentionally Mid-Task

When you are deep in a complex refactor and cannot wipe history without losing necessary progress, run `/compact` manually.

Executing `/compact` prompts Claude Code to summarize the session history into an essential summary on demand. Running this command intentionally allows you to review the summary and guide the agent on what details matter before Anthropic's automated system triggers compaction under memory pressure.

### 3. Match Models to the Task with the Model Command

Claude Code allows developers to switch models mid-session without losing their conversation context. Run `/model` to inspect the active model or switch between tiers:

- Sonnet: The balanced choice for routine software engineering, including feature development, test writing, refactoring, and bug fixes.
- Opus: Reserved for deep architectural decisions, difficult multi-service debugging, or wide cross-cutting refactors. Because Opus consumes quota at a much faster rate, use it for planning and switch back to Sonnet for implementation.
- Haiku: The fastest and most economical option for mechanical tasks, such as renaming variables, generating boilerplate, parsing logs, or explaining regular expressions.

A disciplined pattern is to start an architectural planning session on Opus, establish the design, run `/compact`, switch to Sonnet via `/model`, and execute the implementation.

### 4. Point at File Paths Instead of Pasting Raw Text

Pasting large blocks of code, configuration files, or stack traces directly into the terminal window places that raw text permanently into context for every subsequent turn.

Instead of pasting an entire file into the prompt, reference its specific relative path:

```text
Look at the validateSession function in src/auth/session.ts and check why token expiration is failing.
```

Mentioning the path allows Claude Code to open the file selectively and examine the relevant lines. Avoid using the `@` symbol prefix when token conservation is a priority. In Claude Code, the `@` prefix injects the entire referenced file plus related project tree structures into context at once. For terminal logs or error traces, trim the output to the relevant 20 lines before submitting.

### 5. Keep Project Instructions Lean

The `CLAUDE.md` file in your repository root is prepended to every single request Claude Code makes. Prompt caching reduces the financial cost of repeated reads, but the file still occupies context window capacity on every turn.

Audit your `CLAUDE.md` to remove lengthy prose, historical changelogs, and redundant documentation. Keep the file focused strictly on essential terminal commands (build, test, lint), architectural conventions, and coding style constraints.

## How do remote MCP workspaces prevent context bloat?

Large software repositories create a structural dilemma for local coding agents. If Claude Code reads 50 architecture specifications, API contracts, and schema definitions into its session, it immediately exhausts its 200,000-token context window and triggers auto-compaction loops. If it reads none of them, it writes code that violates internal standards.

Developers frequently attempt to solve this by storing reference documents in local subdirectories or querying object storage buckets like Amazon S3 or Google Cloud Storage through custom scripts. However, raw local files still get swept up by terminal search tools, and object storage requires maintaining custom retrieval pipelines, chunking scripts, and vector databases from scratch. Teams that store reference assets in standard cloud drives like Google Drive or Dropbox encounter API rate limits and lack native Model Context Protocol interfaces for autonomous agents.

A more effective architecture uses indexed cloud workspaces designed specifically for agentic teams through [Fastio for AI agents](/storage-for-agents/). Fastio leaves every vendor's own upload limit exactly where it is; what it adds is a searchable place for the files that do not fit.

Rather than treating storage as passive drive space, Fastio workspaces feature Intelligence Mode, which automatically indexes files upon arrival. The system parses PDFs, Markdown files, Word documents, and source code into a hybrid search index combining full-text keywords, semantic embeddings, and metadata values.

### Connecting Claude Code to Fastio Over Streamable HTTP

Claude Code connects directly to Fastio through the remote Model Context Protocol (MCP) server. Instead of reading large files into local context, Claude Code queries the Fastio workspace remotely, retrieving only the precise paragraphs or code snippets relevant to the prompt.

To connect Claude Code to your Fastio workspace, run the following command in your terminal:

```bash
claude mcp add --transport http fast-io https://mcp.fast.io/mcp/code
```

After adding the connector, run `/mcp` inside Claude Code to complete authentication in your browser. For project-level configuration, declare the remote server directly inside your repository `.mcp.json` file:

```json
{
  "mcpServers": {
    "fast-io": {
      "type": "http",
      "url": "https://mcp.fast.io/mcp/code"
    }
  }
}
```

Once connected, Claude Code uses the Fastio MCP tools to search indexed files, inspect specific document sections, and write generated outputs directly into shared team folders. You can review the [Fastio MCP setup guide](https://mcp.fast.io/docs) and the [MCP skill reference](https://mcp.fast.io/skill.md) for endpoint parameter definitions.

### Workspace Infrastructure for Agentic Development Teams

Fastio provides the coordination layer where agent outputs become shared team assets:

- Scheduled Cloud Sync: Cloud Sync connects Google Drive, Dropbox, Box, and OneDrive folders to a workspace, one-way or two-way, on a schedule or on demand. Reference documentation stored in legacy cloud drives syncs into the workspace without manual file transfers.
- Per-File Version History: Every file in a workspace maintains a complete version history. If an agent refactor introduces an issue, previous file states can be restored without losing concurrent team changes.
- Role-Based Access Control: Permissions are configured per organization, workspace, and share through member roles. Scoped access boundaries ensure coding agents interact only with authorized project repositories.
- Detailed Activity Log: The workspace maintains a detailed activity log of all modifications, uploads, moves, and deletions, providing complete visibility into actions taken by people and agents.
- Metadata Views: Teams can turn collections of technical documents into structured, queryable tables at [Metadata Views](/product/document-data-extraction/), allowing agents to query schema properties and contract dates without reading complete files into context.

### Plan Structure and Free Trial Details

Creating an account on Fastio is free, while active development workspaces operate on paid organizational subscriptions. Monthly plans start with a 14-day free trial that requires a credit card. Review current tiers on the [Fastio pricing page](/pricing/):

| Plan Tier | Monthly Price | Annual Price | Included Seats & Workspaces | Storage & Credit Allowance |
| --- | --- | --- | --- | --- |
| Starter | $9.99/mo | $99/yr | 3 seats, 5 workspaces | 250 GB storage, 100,000 credits |
| Business | $49.99/mo | $499/yr | 10 seats, 50 workspaces | 5 TB storage, 600,000 credits |
| Enterprise | $199.99/mo | $1,999/yr | 30 seats included, 200 workspaces | 25 TB storage, 3,000,000 credits |

Credits meter AI work only, with overage priced at $10 per 100,000 credits. Maximum upload sizes are 25 GB on Starter, 50 GB on Business, and 100 GB on Enterprise. Offloading reference codebases to Fastio workspaces allows developers to keep Claude Code prompt context lean, avoid 5-hour rolling lockouts, and maintain high code quality across long sessions.

## Frequently asked questions

### What are the limits on Claude Code?

Claude Code operates under two primary boundaries: a 200,000-token context window that governs the depth of a single session, and dynamic usage quotas that restrict message volume across rolling 5-hour and weekly windows on paid subscription plans.

### How does the Claude Code 5-hour limit work?

The 5-hour limit is a rolling usage window enforced on Claude Pro, Max, and Team subscriptions. It evaluates total token and message consumption across the preceding 5 hours. Capacity replenishes gradually as older interactions pass the 5-hour mark.

### Can you increase Claude Code token limits?

You cannot expand the fixed 200,000-token context window for an active session, but you can avoid subscription usage lockouts by authenticating with an Anthropic Console API key, AWS Bedrock, or Google Cloud Vertex AI, which charge based on token consumption rather than 5-hour quotas.

### What triggers auto-compaction in Claude Code?

Auto-compaction triggers automatically when the accumulated session history, project instructions, file reads, and tool execution outputs approach the 200,000-token context window limit. Claude Code summarizes earlier messages to free up space while keeping the session active.

### Does Claude Code share usage limits with Claude.ai web chat?

Yes. Prompts executed in Claude Code in your terminal draw from the exact same subscription pool as conversations in claude.ai and the Claude Desktop application. Heavy usage on one interface reduces available capacity across all others.

### What is the difference between /clear and /compact in Claude Code?

The /clear command completely wipes conversation history, resetting your context window to zero while keeping your local repository files and CLAUDE.md intact. The /compact command summarizes the session history into an essential recap, preserving core context while reducing token usage.

## Sources

- [Claude Help Center](https://support.claude.com/en/articles/11647753-how-do-usage-and-length-limits-work): Paid plans have two types of usage limits: a session limit that resets every five hours, and weekly limits that reset once every week.
- [Claude Help Center](https://support.claude.com/en/articles/11647753-how-do-usage-and-length-limits-work): Note that your usage of all different Claude product surfaces (claude.ai, Claude Code, Claude Desktop) counts towards the same usage limit.

## About Fast.io

Fast.io provides shared workspaces where people and AI agents work on the same files, with built-in semantic search and citation-backed chat over what they hold. Agents reach it through a remote MCP server, a REST API at https://api.fast.io/current/, and a command line client published on npm as @vividengine/fastio-cli. MCP setup is at https://mcp.fast.io/docs: Claude and most MCP clients connect to https://mcp.fast.io/mcp/tools, ChatGPT to https://mcp.fast.io/mcp/operations, and coding agents to https://mcp.fast.io/mcp/code.
