ai-context

ai-context is a command for Claude Code from littlebearapps/contextdocs. It costs 39 tokens per session (1,154 once invoked), scanned A, original, MIT.

A command for creating, updating, or reviewing instruction files that help AI coding assistants work in a project.

In plain words
What is it for?
Use it to generate or refresh instructions for tools such as Claude Code, Cursor, Copilot, Cline, Windsurf, Gemini CLI, Codex CLI, and OpenCode.
Why use it?
It keeps shared project rules in AGENTS.md and creates smaller files for specific coding tools, while leaving out information agents can discover themselves.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions CLAUDE.md; mentions Claude Code; mentions AGENTS.md.

Part of the contextdocs plugin — 4 skills, 3 commands, 2 agents shipped together

Good fit Use it to generate or refresh instructions for tools such as Claude Code, Cursor, Copilot, Cline, Windsurf, Gemini CLI, Codex CLI, and OpenCode.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/littlebearapps/contextdocs/ai-context
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.

Clone the repo
git clone --depth 1 https://github.com/littlebearapps/contextdocs

Made for: Claude Code.

Or install contextdocs, the plugin that ships this one along with the rest of its 4 skills, 3 commands, 2 agents.

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 ai-context

README.md
[![agentmods](https://agentmods.dev/badge/commands/littlebearapps/contextdocs/ai-context/github.svg)](https://agentmods.dev/commands/littlebearapps/contextdocs/ai-context)
Your own site
<a href="https://agentmods.dev/commands/littlebearapps/contextdocs/ai-context"><img src="https://agentmods.dev/badge/commands/littlebearapps/contextdocs/ai-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.

agentmods 80×15 button for ai-context

Your own site · 80×15
<a href="https://agentmods.dev/commands/littlebearapps/contextdocs/ai-context"><img src="https://agentmods.dev/badge/commands/littlebearapps/contextdocs/ai-context.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 39 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,154 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.00039 $0.01154
Opus 5.5 $0.00016 $0.00462
Sonnet 5.5 $0.00008 $0.00231
Haiku 4.5 $0.00004 $0.00115

Measured 2mo ago against content hash 3be3185b59d9, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

ai-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 2mo 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.

commands/ai-context.md · 76 lines

How it starts

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

/ai-context

Generate lean context files that help AI coding assistants understand your project's non-obvious conventions and constraints. ContextDocs now treats AGENTS.md as the canonical shared context, then emits tool-specific bridge files that reference or subset it plus add only tool-unique behaviour. Applies the Signal Gate principle — excludes discoverable content (directory listings, file trees, architecture overviews) that research shows reduces AI task success.

Behaviour

  1. Load the ai-context skill for templates, the Signal Gate, and the codebase analysis workflow
  2. Load the context-quality rule for quality criteria
  3. Run the codebase analysis: detect language, framework, test runner, linter, conventions
  4. For all, init, and update, generate or refresh AGENTS.md as the canonical shared context
  5. Generate the requested bridge file(s) from the same analysis, keeping them thin and limited to tool-specific additions. Single-tool modes (claude, cursor, copilot, windsurf, cline, gemini) update only the requested bridge; use agents when you want to refresh AGENTS.md itself.

Arguments

Generate

  • No arguments / all: Generate AGENTS.md plus all applicable bridge files (CLAUDE.md, .cursor/rules/agents.mdc, .windsurfrules, .clinerules/agents.md, GEMINI.md). Copilot bridge is optional — only generated when project needs Copilot-specific scoping (Copilot loads AGENTS.md natively).
  • claude: Generate CLAUDE.md only
  • agents: Generate AGENTS.md only
  • cursor: Generate .cursor/rules/agents.mdc (modern format). Legacy .cursorrules kept only if already present.
  • copilot: Generate .github/copilot-instructions.md only
  • windsurf: Generate .windsurfrules only
  • cline: Generate .clinerules/agents.md (directory mode). Flat .clinerules kept only if already present.
  • gemini: Generate GEMINI.md only

Single-tool generate modes leave AGENTS.md unchanged so targeted bridge refreshes stay predictable.

Read the full file on GitHub · 76 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. 2mo ago First seen · 76 lines · 39 tokens per session scan A 3be3185b59d9

Subscribe to this mod's changes

ai-context is a command published in the GitHub repository littlebearapps/contextdocs (5 stars, last pushed 3mo ago), licensed MIT. It adds 39 tokens to every session and 1,154 once invoked, about $0.0002 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-08-31.