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.
npx skills add latestaiagents/agent-skills --skill long-context-1mgit clone --depth 1 https://github.com/latestaiagents/agent-skillsWrote 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.
[](https://agentmods.dev/skills/latestaiagents/agent-skills/long-context-1m)<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.
<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>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.
| Model | Per session | Once 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 |
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.
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:
- Put the instruction at the END — "Given the above, answer X" recalls better than instruction-then-context
- Section headers with XML tags —
<document index="1" title="...">...</document>— the model indexes on these - Repeat critical instructions — once at top, once at bottom
- Avoid homogeneous blobs — chunk with delimiters; recall degrades in undifferentiated text
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.
- 6d ago First seen · 134 lines · 109 tokens per session scan A fff6ab2c3f50
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.
Other skills, from other repositories
chain-of-thought-prompts
Chain-of-thought and step-by-step reasoning prompts for complex problem solving.
few-shot-example-gen
Few-shot example generation and optimization for improved LLM performance.
llm-classifier
LLM-based zero-shot and few-shot classification for flexible intent detection.
llm-structured-output
Get reliable JSON, enums, and typed objects from LLMs using responseformat, tooluse, and schema-constrained decoding across OpenAI, Anthropic, and Google APIs.
model-recommendation
Analyse chatmode or prompt files and recommend optimal AI models based on task complexity, required capabilities, and cost-efficiency.
prompt-builder
Guide users through creating high-quality GitHub Copilot prompt files with clear structure, appropriate tools, validation criteria, and maintainable instructions.