long-context-1m

long-context-1m is a skill for Claude Code from latestaiagents/agent-skills. It costs 109 tokens per session (1,285 once invoked), scanned A, original, MIT.

A guide to using Claude's 1-million-token input limit for very large codebases, documents, logs, or conversation histories.

In plain words
What is it for?
Use it when building Claude applications that process large inputs or reuse a large prompt with prompt caching.
Why use it?
It helps you decide when sending everything at once is useful, when it costs more, and when a search-based approach is better.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the claude-4-6-features plugin — 6 skills shipped together , and of latestaiagents

Good fit Use it when building Claude applications that process large inputs or reuse a large prompt with prompt caching.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/latestaiagents/agent-skills/long-context-1m
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add latestaiagents/agent-skills --skill long-context-1m
Clone the repo
git clone --depth 1 https://github.com/latestaiagents/agent-skills

Made for: Claude Code.

Or install claude-4-6-features, the plugin that ships this one along with the rest of its 6 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for long-context-1m

README.md
[![agentmods](https://agentmods.dev/badge/skills/latestaiagents/agent-skills/long-context-1m/github.svg)](https://agentmods.dev/skills/latestaiagents/agent-skills/long-context-1m)
Your own site
<a href="https://agentmods.dev/skills/latestaiagents/agent-skills/long-context-1m"><img src="https://agentmods.dev/badge/skills/latestaiagents/agent-skills/long-context-1m/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for long-context-1m

Your own site · 80×15
<a href="https://agentmods.dev/skills/latestaiagents/agent-skills/long-context-1m"><img src="https://agentmods.dev/badge/skills/latestaiagents/agent-skills/long-context-1m.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 109 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,285 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00109 $0.01285
Opus 5 $0.00055 $0.00642
Sonnet 5 $0.00022 $0.00257
Haiku 4.5 $0.00011 $0.00128

Measured 6d ago against content hash fff6ab2c3f50, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

long-context-1m scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/claude-4-6-features/long-context-1m/SKILL.md · 134 lines

How it starts

The opening of the file, as written. The whole thing — 134 lines — stays where its author put it; the contents beside it link to each section on GitHub.

1M Context Window

Claude Opus 4.6 and Sonnet 4.6 support 1M token context with the context-1m-2025-08-07 beta header. Use it well or burn money for nothing.

When to Use

  • You have a codebase, book, log bundle, or document set that fits in 1M tokens
  • You need cross-document reasoning that chunked RAG can't deliver
  • You're deciding between 1M-context vs a RAG pipeline
  • You want to cache a giant system prompt / knowledge base across requests

Enabling 1M Context

import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic();

const response = await client.messages.create(
  {
    model: "claude-sonnet-4-6",
    max_tokens: 4096,
    messages: [{ role: "user", content: giantDocument + "\n\nSummarize." }],
  },
  { headers: { "anthropic-beta": "context-1m-2025-08-07" } },
);

Without the beta header, requests over 200K tokens will error.

Pricing Tiers

Long context is priced differently above 200K input tokens. Check your provider's current rates; as a rule of thumb input above 200K costs ~2× the base rate. Output price is unchanged.

Rule: if you're only going to use 200K, don't enable 1M. Only pay for long-context pricing when you actually need > 200K.

1M Context vs RAG

When 1M context wins When RAG wins
Cross-document synthesis Fresh data that updates hourly
Full-codebase refactoring Unbounded corpus (> 1M tokens)
Holistic code review Per-user personal data (privacy isolation)
Single-shot analysis Many cheap lookups on small queries
Exploration where you don't know what's relevant Known query patterns

Hybrid: RAG retrieves the top 500K tokens; stuff those into 1M context. Best of both.

Structuring Long Inputs for Recall

Claude's long-context recall is strong but not uniform. Tips:

  1. Put the instruction at the END — "Given the above, answer X" recalls better than instruction-then-context
  2. Section headers with XML tags<document index="1" title="...">...</document> — the model indexes on these
  3. Repeat critical instructions — once at top, once at bottom
  4. Avoid homogeneous blobs — chunk with delimiters; recall degrades in undifferentiated text

Read the full file on GitHub · 134 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 134 lines · 109 tokens per session scan A fff6ab2c3f50

Subscribe to this mod's changes

long-context-1m is a skill published in the GitHub repository latestaiagents/agent-skills (5 stars, last pushed 4mo ago), licensed MIT. It adds 109 tokens to every session and 1,285 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.