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-contextgit 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)<a href="https://agentmods.dev/skills/latestaiagents/agent-skills/long-context"><img src="https://agentmods.dev/badge/skills/latestaiagents/agent-skills/long-context/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"><img src="https://agentmods.dev/badge/skills/latestaiagents/agent-skills/long-context.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.00129 | $0.01479 |
| Opus 5.5 | $0.00052 | $0.00592 |
| Sonnet 5.5 | $0.00026 | $0.00296 |
| Haiku 4.5 | $0.00013 | $0.00148 |
Grade A, and why
long-context 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 26d 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 — 133 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Long Context
A large context window lets you send a lot; it does not make sending a lot free or accurate. Count first, structure the input, cache what repeats, and actively manage context as it grows.
When to Use
- Cross-document reasoning over a corpus that fits in the window
- Whole-repository review or refactoring where relevance is hard to predict
- Long-running agents whose history keeps growing
- Deciding between long context, retrieval (RAG), or both
Workflow
Step 1: Check the window for your model
Context window size depends on the model. The docs list which current models have a 1M-token window and which have 200K, and state that for models with a 1M window, 1M is the default with no beta header. Older guidance that required a context-1m-... beta header applies only to the models it was written for.
Do not hard-code the number. Read it at runtime:
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic();
const MODEL = process.env.ANTHROPIC_MODEL!; // a current model ID
const info = await client.models.retrieve(MODEL);
console.log(info.max_input_tokens, info.max_tokens); // context window, output cap
Pricing for very long prompts also varies by model; check the pricing page's long-context section rather than assuming a flat rate.
Step 2: Count tokens before you send
const { input_tokens } = await client.messages.countTokens({
model: MODEL,
system,
messages,
});
if (input_tokens > info.max_input_tokens! * 0.9) {
// trim, retrieve instead, or compact first
}
Everything counts: system prompt, every message (tool results, images, documents), tool definitions, and the output including thinking. If the input alone exceeds the window, the API returns 400 invalid_request_error ("prompt is too long"). On recent models, if input plus max_tokens would exceed the window, the request is accepted and generation can stop with stop_reason: "model_context_window_exceeded"; handle that stop reason.
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.
- 26d ago First seen · 133 lines · 129 tokens per session scan A 6726a3f1ae8c
long-context is a skill published in the GitHub repository latestaiagents/agent-skills (6 stars, last pushed 26d ago), licensed MIT. It adds 129 tokens to every session and 1,479 once invoked, about $0.0005 per session on Opus 5.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-11-04.
long-context compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| long-contextlatestaiagents/agent-skills | Skill | 6 | 26d ago | MIT | A | 129 | Claude Code |
| agent-v3-memory-specialistruvnet/ruflo | Skill | 83k | today | MIT | A | 25 | Claude Code |
| mem0-integrationa5c-ai/babysitter | Skill | 1.9k | 28d ago | MIT | A | 27 | Claude Code |
| vector-memorya5c-ai/babysitter | Skill | 1.9k | 28d ago | MIT | A | 31 | Claude Code |
| embeddingsruvnet/ruflo | Skill | 83k | today | MIT | A | 62 | Claude Code |
| install-openviking-memoryvolcengine/OpenViking | Skill | 43k | today | AGPL-3.0 | A | 191 | Claude Code, Codex |
| rag-hybrid-searcha5c-ai/babysitter | Skill | 1.9k | 28d ago | MIT | A | 28 | Claude Code |