/ai-context
Generate, update, or audit AI IDE context files with AGENTS.md as the canonical shared context and tool-specific bridge files. Signal Gate principle — only what agents cannot discover: $ARGUMENTS
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
- Load the
ai-contextskill for templates, the Signal Gate, and the codebase analysis workflow - Load the
context-qualityrule for quality criteria - Run the codebase analysis: detect language, framework, test runner, linter, conventions
- For
all,init, andupdate, generate or refreshAGENTS.mdas the canonical shared context - 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; useagentswhen you want to refreshAGENTS.mditself.
Arguments
Generate
- No arguments /
all: GenerateAGENTS.mdplus all applicable bridge files (CLAUDE.md,.cursorrules,.github/copilot-instructions.md,.windsurfrules,.clinerules,GEMINI.md) claude: Generate CLAUDE.md onlyagents: Generate AGENTS.md onlycursor: Generate .cursorrules onlycopilot: Generate .github/copilot-instructions.md onlywindsurf: Generate .windsurfrules onlycline: Generate .clinerules onlygemini: Generate GEMINI.md only
Single-tool generate modes leave AGENTS.md unchanged so targeted bridge refreshes stay predictable.
Lifecycle
init: Bootstrap a new project — generate missing context files, offer Context Guard hooks, run audit. Skips existing files.update: Patch only what drifted since the last context update, using git change detection. Preserves human edits.promote: Scan Claude Code’s auto-memory (MEMORY.md) for stable patterns and assist promoting them to CLAUDE.md.audit: Check existing context files for staleness, drift, discoverable content, and Context Guard status.
Output
Each generated file is written directly to disk. AGENTS.md holds the shared commands, conventions, hard constraints, and security rules. Bridge files should stay minimal and include only tool-specific material. Line counts should stay within the Signal Gate budgets (AGENTS.md <120, CLAUDE.md <80, other bridge files <60).
AI Context Files:
✓ AGENTS.md — generated canonical context (74 lines)
✓ CLAUDE.md — generated bridge (`@AGENTS.md` + Claude-specific notes, 14 lines)
✓ .cursorrules — generated bridge (12 lines)
✓ .github/copilot-instructions.md — generated bridge (11 lines)
✓ .windsurfrules — generated compatibility bridge (10 lines)
✓ .clinerules — generated bridge (15 lines)
✓ GEMINI.md — generated compatibility bridge (9 lines)
Audit mode:
AI Context Audit:
✓ AGENTS.md — up to date (74 lines, canonical shared context)
⚠ CLAUDE.md — bridge missing `@AGENTS.md` import
✗ .cursorrules — contradicts AGENTS.md lint command (`npm run lint` vs `pnpm lint`)
· GEMINI.md — not present (optional compatibility bridge)
ℹ MEMORY.md — contains 3 conventions that may belong in CLAUDE.md (run /contextdocs:ai-context promote)
Context Guard:
✓ Tier 1 active (Stop hook)
✗ Tier 2 not installed