Skip to content

littlebearapps/contextdocs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

ContextDocs

Keep your AI coding assistants in sync with your codebase — generate, maintain, and audit context files for 7 AI tools.

Give your AI the knowledge to generate lean, effective context files for every major AI coding tool — AGENTS.md, CLAUDE.md, .cursorrules, copilot-instructions.md, .windsurfrules, .clinerules, and GEMINI.md from a single codebase scan. Signal Gate filtering strips out what agents already discover on their own. Context Guard hooks enforce freshness. Health scoring catches drift before it costs you tokens. 100% Markdown, zero runtime dependencies.

Version License Claude Code Plugin OpenCode Compatible GitHub Stars

Get Started · Features · How It Compares · Commands · Other AI Tools · Contributing


⚡ Get Started

Get your first AI context files generated in under 60 seconds.

Prerequisites

Using a different AI tool? ContextDocs generates plain Markdown files that work with Codex CLI, Cursor, Windsurf, Cline, and Gemini CLI automatically.

Install

# 1. Add the LBA plugin marketplace (once)
/plugin marketplace add littlebearapps/lba-plugins

# 2. Install ContextDocs
/plugin install contextdocs@lba-plugins

# 3. Bootstrap AI context for your project
/contextdocs:ai-context init

Optional — install Context Guard hooks (Claude Code only):

# 4. Keep context files in sync as your project evolves
/contextdocs:context-guard install              # Tier 1 (Nudge) — reminds at session end
/contextdocs:context-guard install --tier enforce  # Tier 2 (Enforce) — also blocks commits

Optional — public-facing documentation:

For README, CHANGELOG, ROADMAP, user guides, and launch artifacts, install PitchDocs separately. Both plugins work independently and complement each other.


🚀 What ContextDocs Does

Your AI coding assistant works better when it understands your project's conventions — but overstuffed context files actually make things worse. Research shows bloated context reduces AI task success by ~3% and increases token costs by 20% (ETH Zurich, 2026). Most teams either write too much, write the wrong things, or let context files go stale within a week.

ContextDocs solves the full lifecycle. It scans your codebase and generates context files for 7 AI tools using the Signal Gate principle — only what agents cannot discover by reading source code on their own. No directory listings, no file trees, no architecture overviews that agents find themselves. Just the conventions, gotchas, and decisions that actually help.

Then it keeps them fresh: update patches drift incrementally, promote moves Claude's auto-learned MEMORY.md patterns into CLAUDE.md, context-verify scores health 0–100 across 5 dimensions, and Context Guard hooks enforce freshness at session end and commit time — with the context-updater agent applying fixes automatically.


🎯 Features

ContextDocs generates context files for 7 AI coding tools from a single codebase scan, applies Signal Gate filtering to strip discoverable content, enforces line budgets (CLAUDE.md <80, AGENTS.md <120, others <60), and scores health 0–100 across 6 dimensions. Context Guard hooks catch drift at session end and commit time.

  • 🧠 Signal Gate filtering — strips out discoverable content (directory listings, file trees, architecture overviews) so your context files contain only what actually helps AI tools, keeping them lean and under budget
  • 📋 7 context file types from one scan — AGENTS.md, CLAUDE.md, .cursorrules, copilot-instructions.md, .windsurfrules, .clinerules, and GEMINI.md generated together, so every AI tool on your team gets the same project knowledge
  • 🔄 Full lifecycle, not just generationinit bootstraps, update patches only what drifted, promote graduates MEMORY.md patterns to CLAUDE.md, audit flags staleness — so context files stay accurate as your project evolves
  • Health scoring (0–100) — grades context files across line budget, signal quality, path accuracy, cross-file consistency, freshness, and aggregate context load — export to CI with --min-score so drift never reaches your team
  • 🔒 Context Guard enforcement — two-tier hooks nudge at session end (Tier 1) and block commits (Tier 2) when context files are stale, so drift gets caught before it costs anyone tokens (Claude Code only)
  • 🤖 Autonomous context updates — the context-updater agent is launched automatically by hooks to update stale files without user intervention, closing the loop from detection to action (Claude Code only)
  • 🛡️ Content filter protection — guards against Claude Code's API filter (HTTP 400) for CODE_OF_CONDUCT, LICENSE, and SECURITY files, so hook installation never gets blocked (Claude Code only)
  • 📏 Line budgets that work — CLAUDE.md <80, AGENTS.md <120, all others <60 — backed by the ETH Zurich finding that shorter, focused context outperforms longer files
  • 🔌 Works with 7 AI tools — Claude Code and OpenCode natively; generated files work with Codex CLI, Cursor, Windsurf, Cline, and Gemini CLI automatically

⚖️ How ContextDocs Compares

ContextDocs automates what most teams do manually — writing and maintaining AI context files. Compared to hand-writing context files or asking a generic AI prompt, ContextDocs applies Signal Gate filtering, generates for 7 tools simultaneously, enforces line budgets, and keeps files in sync with Context Guard hooks.

Capability ContextDocs Writing Context Files Manually Generic AI Prompt
Filters out discoverable content Signal Gate principle — only undiscoverable signals Requires discipline and AI knowledge No filtering — dumps everything
Generates for multiple AI tools 7 formats from one scan Write each file separately One file at a time
Keeps files in sync over time update, audit, Context Guard hooks + autonomous agent Manual review after every change Start from scratch each time
Enforces quality standards 0–100 health score, CI integration, line budgets No enforcement No enforcement
Handles line budgets Automatic per-file limits Easy to exceed without noticing No awareness of budgets

🤖 Commands

ContextDocs provides 3 slash commands covering the full context file lifecycle — generation, freshness enforcement, and quality verification. All commands use the contextdocs: prefix when installed as a plugin.

Command What It Does Why It Matters
/contextdocs:ai-context Generate AI context files using Signal Gate — init, update, promote, audit, or per-tool (claude, agents, cursor, etc.) Every AI tool gets lean, accurate project context
/contextdocs:context-guard Install, uninstall, or check status of Context Guard hooks (Claude Code only) Stale context files get caught before they waste tokens
/contextdocs:context-verify Score context file health 0–100 — line budgets, stale paths, consistency, signal quality Drift never reaches your team — enforce in CI or check locally

Quick Examples

/contextdocs:ai-context init          # Bootstrap context for a new project
/contextdocs:ai-context update        # Patch only what drifted
/contextdocs:ai-context promote       # Move MEMORY.md patterns to CLAUDE.md
/contextdocs:ai-context audit         # Check for staleness and drift
/contextdocs:context-verify           # Score context file health (0–100)
/contextdocs:context-guard install    # Install freshness hooks
/contextdocs:context-guard status     # Check which hooks are active

🔀 Use with Other AI Tools

ContextDocs generates plain Markdown files placed where each AI tool expects them — CLAUDE.md for Claude Code, AGENTS.md for Codex CLI, .cursorrules for Cursor, and 4 more. No manual copying required for any supported tool.

ContextDocs works natively with Claude Code and OpenCode. The generated context files are plain Markdown — each is placed where the target tool expects it:

File Tool Automatically Discovered
CLAUDE.md Claude Code Yes — loaded every session
AGENTS.md Codex CLI, OpenCode, Gemini CLI Yes — read on startup
.cursorrules Cursor Yes — project root convention
.github/copilot-instructions.md GitHub Copilot Yes — GitHub convention
.windsurfrules Windsurf Yes — project root convention
.clinerules Cline Yes — project root convention
GEMINI.md Gemini CLI Yes — loaded on startup

Context Guard hooks are Claude Code only. All other features (generation, update, verify) work wherever the plugin runs.


📚 Documentation

  • Getting Started Guide — Installation, first context file generation, and Context Guard setup
  • Troubleshooting — Signal Gate issues, hook problems, content filter errors, and FAQ
  • Documentation Hub — All guides and reference links
  • Support — Getting help and common questions
  • Security — Vulnerability reporting and response timeline

🔗 Related

For public-facing repository documentation (README, CHANGELOG, ROADMAP, user guides, launch artifacts), see PitchDocs.


🤝 Contributing

Found a way to make generated context files even better? We'd love your help — whether it's improving Signal Gate filtering, fixing a hook script, or adding support for a new AI tool's context format.

See our Contributing Guide to get started. This project follows the Contributor Covenant v3.0.


📄 Licence

MIT — Made by Little Bear Apps 🐶