ctxlint
YawLabs · YawLabs/ctxlint
Ctxlint kiểm tra các tệp ngữ cảnh của AI agent và cấu hình máy chủ MCP dựa trên codebase để ngăn chặn các hướng dẫn lỗi thời và tham chiếu bị hỏng.
Kiểm tra các tệp ngữ cảnh của AI agent của bạn (CLAUDE.md, AGENTS.md, v.v.) so với codebase của bạn.
Xem trước
Bạn có thể làm gì với nó
- Tự động phát hiện các đường dẫn tệp bị hỏng trong CLAUDE.md của bạn sau khi tái cấu trúc dự án.
- Đảm bảo rằng tất cả các AI agent trong một nhóm sử dụng cấu hình ngữ cảnh cập nhật và nhất quán.
- Phát hiện các khóa API được mã hóa cứng hoặc thông tin nhạy cảm trong cấu hình MCP trước khi triển khai.
Kiểm tra an toàn
Không thấy dấu hiệu rủi ro trong các file đã quét.
Quét tự động các file trong repo. Luôn xem lại code trước khi chạy.
Trích từ README
ctxlint
One click adds this to your local Yaw MCP config so it's available in every Yaw Terminal session. Or install manually below.
Lint your AI agent context files, MCP server configs, and session data against your actual codebase. Context linting + MCP config linting + session auditing. 16 AI tools, 8 MCP clients, cross-project consistency, auto-fix. Works as a CLI, CI step, pre-commit hook, or MCP server.
Your CLAUDE.md is lying to your agent. Your .mcp.json has a hardcoded API key. ctxlint catches both.
Why ctxlint?
Every AI coding tool ships a context file: CLAUDE.md, .cursorrules, AGENTS.md, .mcp.json. These files are the single most important interface between you and your agent — they tell it what to build, how to test, where things live.
But context files rot fast. You rename a file, change a build script, or switch from Jest to Vitest — and your CLAUDE.md still says the old thing. Your agent follows those stale instructions faithfully, then fails. You lose 10 minutes debugging what turns out to be a wrong path in line 12 of a markdown file.
Multiply that across a team with 5 context files, 3 MCP configs, and 2 people who touched the build system last week — and you have a real problem with no existing solution.
ctxlint is a linter purpose-built for this. It reads your context files, cross-references them against your actual codebase, and catches the drift before your agent does.
- Instant startup — ships as a single self-contained bundle with zero runtime dependencies.
npxdownloads a ~400 KB tarball and starts immediately - Catches real problems — broken paths, wrong commands, stale references, contradictions across files
- Smart suggestions — detects git renames and fuzzy-matches to suggest the right path
- Auto-fix —
--fixrewrites broken paths automatically using git history - Token-aware — shows how much context window your files consume and flags redundant content
- Every AI tool — supports Claude Code, Cursor, Copilot, Windsurf, Gemini, Cline, Aider, and 9 more
- Multiple outputs — text, JSON, and SARIF (GitHub Code Scanning)
- MCP server — 7 tools for IDE/agent integration with tool annotations for auto-approval
- Watch mode —
--watchre-lints automatically when context files change
Install
Run directly (no install needed):
npx -y @yawlabs/ctxlint@latest
Project install (recommended for teams)
npm install -D @yawlabs/ctxlint
# or
pnpm add -D @yawlabs/ctxlint
Then add to your package.json scripts:
{
"scripts": {
"lint:ctx": "ctxlint --strict"
}
}
Global install
npm install -g @yawlabs/ctxlint
Useful if you want ctxlint available in every project without per-project setup.
What It Checks
| Check | What it finds |
|---|---|
| Broken paths | File references in context that don't exist in your project |
| Wrong commands | Build/test commands that don't match your package.json scripts or Makefile targets, and Gradle project paths or Maven -pl modules your build doesn't declare |
| Stale context | Context files not updated after recent code changes |
| Token waste | How much context window your files consume per session |
| Redundancy | Content the agent can already infer (e.g. "We use React" when react is in package.json) |
| Contradictions | Conflicting directives across context files (e.g. "use Jest" in one, "use Vitest" in another) |
| Frontmatter | Invalid or missing YAML frontmatter in Cursor .mdc, Copilot instructions, and Windsurf rules |
| CI coverage | Release/deploy workflows in .github/workflows/ not documented in any context file |
| CI secrets | Secrets used in CI workflows (${{ secrets.X }}) not mentioned in context files |