Tabbit
ResourcesBlogModels
Tabbit LogoTabbit

Tabbit — The AI Browser that Works for You

Topics

  • AI Browser Resources
  • Agentic Browser Resources
  • Browser Downloads and Install Guides
  • Browser Comparisons
  • AI Browser Alternatives
  • Browser Productivity Resources

Popular Guides

  • AI Browser
  • Agentic Browser Download
  • Best AI Browser 2026: Top 9 Tested & Ranked
  • AI Browser Download
  • Free AI Browser
  • Best AI Browser 2026
  • AI Browser Comparison 2026
  • AI Browser for Windows
  • AI Browser for Mac
  • Chrome Alternative 2026

Events

  • Tabbit Skill Competition
  • KPOP SBTI Fandom Personality Test
  • Tabbit Campus Creator Program
  • fifi's Picks: AI Skills for Research Papers
  • User Survey

About

  • Tabbit Blog
  • Press & Media
Prompt guide
MediaClaude Sonnet 4.6

Claude Sonnet 4.6: 1M Long Context and Context Compaction Architecture Configuration

Original source

Anthropic Platform Docs / Context Management & Compaction

AuthorAnthropic

Source date2026-02-17

Tabbit curation2026-08-20

Read original

One-sentence takeaway

By configuring Prompt Caching breakpoints and a rolling Context Compaction strategy, Claude Sonnet 4.6 can maintain global memory and precise recall across 1M-token massive contexts or ultra-long-horizon agent tasks while significantly reducing latency and recomputation cost.

Use cases

  • Suitable tasks: Large codebase refactors that include full history, long-form legal or earnings-report comparative analysis, and autonomous agents that run for extended periods with hundreds of tool calls.

  • Unsuitable tasks: Single-turn short Q&A and instant transformation tasks that do not need to preserve context state.

  • Applicable model version: Claude Sonnet 4.6 (claude-sonnet-4-6).

  • Applicable clients, agents, or APIs: Anthropic Messages API (with anthropic-beta: context-compaction-2026-02-15 and prompt-caching-2024-07-31).

  • Recommended reasoning tier and parameters: For long-context retrieval, effort=medium is recommended; for code-understanding tasks, set max_tokens=8192.

Ready-to-use content

Production-grade API request configuration example

{
  "model": "claude-sonnet-4-6",
  "max_tokens": 8192,
  "output_config": {
    "effort": "medium"
  },
  "system": [
    {
      "type": "text",
      "text": "You are a senior engineer responsible for deep code analysis and system architecture audits. Using the full code context provided, analyze module dependencies and propose a refactoring plan.",
      "cache_control": { "type": "ephemeral" }
    }
  ],
  "context_management": {
    "strategy": "compaction",
    "compaction_trigger_tokens": 180000,
    "compaction_target_tokens": 60000,
    "preserve_recent_messages": 8,
    "summary_prompt": "Preserve key technical decisions, the list of file changes, failed test cases, and outstanding to-dos; discard raw output from intermediate tool calls."
  },
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "<codebase_context>\n... [insert codebase files injected via directory parsing here] ...\n</codebase_context>",
          "cache_control": { "type": "ephemeral" }
        },
        {
          "type": "text",
          "text": "Analyze all files that use legacy authentication logic, and output refactoring steps and test cases."
        }
      ]
    }
  ]
}

Test/workflow steps

  1. Structured context injection: Place static long text (such as a full-project codebase or documents) at the front of the user message, and mark the end with cache_control: {"type": "ephemeral"}.

  2. Place dynamic queries afterward: Put specific analysis instructions or query questions after the cached block so later multi-turn questions can hit the front-loaded cache.

  3. Monitor cache hit rate: Check cache_creation_input_tokens and cache_read_input_tokens in the response headers, and verify the hit rate reaches 85% or higher.

  4. Validate compaction triggers: When multi-turn interaction exceeds compaction_trigger_tokens (for example, 180k tokens), observe whether the server-side compaction output preserves key decisions.

Original evidence and data

  • Official documentation states that Prompt Caching delivers up to a 90% discount on long-context read cost for Sonnet 4.6 and reduces time to first token (TTFT) to 20%-30% of the original.

  • Official long-context benchmarks (Needle In A Haystack / RULER): Sonnet 4.6 reaches 98.4% recall accuracy within the 1M-token window, with highly consistent recall at extreme positions and mid-window positions.

  • Context Compaction can compress effective context usage in long-running sessions by 60%-70% while preserving key constraints and error-diagnosis information through summary_prompt.

Scope and limitations

  • The 1M-token context window is in Beta; billing tiers and rate limits (RPM/TPM) beyond 200k tokens may differ, and configuration should be adjusted according to account quotas.

  • Frequently changing effort or the system prompt within a session invalidates prefix caching; keep configuration stable within a single continuous session.

  • Automatic compaction drops minor details from conversation history that are not captured in the summary; if the full original trace must be retained, persist logs locally in a database.

Source excerpt or observation (short compliant paraphrase only)

Official documentation: "Context compaction allows long-horizon agents to run indefinitely without manual memory trimming or token overflow errors." (quote from official documentation)

Curated by Tabbit

Prompt material is summarized from public sources and Tabbit editorial notes. Check the original licensing and intended use before copying it.

Claude Sonnet 4.6

Use in Tabbit

Claude Sonnet 4.6

Related prompts

MediaClaude Platform Docs / Prompting best practices

Clear Instructions, XML Context, and Self-Checking for Claude Sonnet 4.6

MediaClaude Platform Docs / Effort and Prompting best practices

Claude Sonnet 4.6: Effort and Tool-Triggering Configuration

MediaAnthropic Platform Docs / Computer Use API Reference2026-02-17

Claude Sonnet 4.6: Computer Use Tool Definitions and Automated Closed-Loop Workflow

CommunityGitHub / Claude Code Architecture & Best Practices2026-03-05

Claude Code: Sonnet 4.6 Engineering Architecture and Subagent Division

Claude Sonnet 4.6

Related reviews

MediaAnthropic News / Introducing Sonnet 4.62026-02-17

Claude Sonnet 4.6 Official Release: Coding, Computer Use, and Agent Benchmarks

MediaBenchLM2026-08-17

BenchLM's Public Evidence Ledger for Claude Sonnet 4.6

MediaIDP Leaderboard

IDP Leaderboard: Sonnet 4.6 Matches Opus 4.6 on Real-World Document Understanding

MediaArtificial Analysis

Artificial Analysis: Sonnet 4.6 Non-Reasoning Intelligence Index 37