ai-context

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

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.

agentmods
npx agentmods add commands/littlebearapps/contextdocs/ai-context
Clone the repo
git clone --depth 1 https://github.com/littlebearapps/contextdocs
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. Scan, not verified.
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 $0.00039 $0.01154
Opus 5 $0.00019 $0.00577
Sonnet 5 $0.00008 $0.00231
Haiku 4.5 $0.00004 $0.00115

Measured yesterday against content hash 3be3185b59d9, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 yesterday.

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. yesterday 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 1mo ago), licensed MIT. It adds 39 tokens to every session and 1,154 once invoked, about $0.0002 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-08-31.