ctxlint
Uses Git history to detect renamed files and automatically fix broken paths in context files.
Checks GitHub secrets across sibling repositories and can emit SARIF results for GitHub Code Scanning.
Lints GitHub Actions workflows, flags undocumented release/deploy workflows and CI secrets, and checks workflow consistency across sibling projects.
Validates GitHub Copilot instruction files, including their YAML frontmatter and referenced paths, against the actual codebase.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
ctxlint
One click adds this to your local Yaw MCP config so it's available in every Yaw Terminal session. Tested with Yaw MCP 1.1.13 or newer. 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 ~670 KB tarball and starts immediatelyCatches 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 historyToken-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
Related MCP server: mcp-lint-tools
Install
Run directly (no install needed):
npx -y @yawlabs/ctxlint@latestProject install (recommended for teams)
npm install -D @yawlabs/ctxlint
# or
pnpm add -D @yawlabs/ctxlintThen add to your package.json scripts:
{
"scripts": {
"lint:ctx": "ctxlint --strict"
}
}Global install
npm install -g @yawlabs/ctxlintUseful 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. Existence is case-exact on every OS, so |
Wrong commands | Build/test commands that don't match your package.json scripts or Makefile targets, and Gradle project paths or Maven |
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 |
CI coverage | Release/deploy workflows in |
CI secrets | Secrets used in CI workflows ( |
Inline secrets | Real secrets pasted into context files — private-key headers, AWS/GitHub/Anthropic/OpenAI/npm/Slack/Google/Stripe token shapes. Messages never echo the secret (6-char redacted prefix only) |
Dead hooks | Hook commands and |
Missing secrets | GitHub secrets set on sibling repos but missing from current project |
Diverged configs | Canonical config files (CI, tsconfig, etc.) drifting across sibling projects |
Missing workflows | GitHub Actions workflows present in 2+ siblings but absent here |
Stale memory | Claude Code memory entries referencing paths that no longer exist |
Duplicate memory | Near-duplicate memories across projects (>60% content overlap) |
Loop detection | Agent stuck in loops — repeated commands or cyclic patterns in session history |
Memory overflow |
|
Shared temp path | A fixed temp path (e.g. |
Unverified gate | A lint/typecheck/test/build run that errored or printed nothing, followed by agent prose claiming it passed |
Default-branch edits | 10+ files edited on |
Unresolvable SHA | A memory cites a commit SHA that does not resolve in this repository |
Large reads | Whole-file Reads of 4,000+ tokens, with an estimate of the tokens they re-send as cached context on later turns (an info-level baseline) |
Supported Context Files
File | Tool |
| Claude Code |
| AAIF / Multi-agent standard |
| Cursor |
| GitHub Copilot |
| Windsurf |
| Gemini CLI |
| Cline |
| Aider |
| Aide / Codestory |
| Amazon Q Developer |
| Goose by Block |
| JetBrains Junie |
| JetBrains AI Assistant |
| Continue |
| Zed |
| Replit |
MCP Server Config Linting
ctxlint also lints MCP server configuration files — the JSON configs that tell AI clients which tools to connect to. These are context interfaces too: they shape what your agent can do.
# Lint context files + MCP configs
npx @yawlabs/ctxlint@latest --mcp
# Lint only MCP configs
npx @yawlabs/ctxlint@latest --mcp-only
# Include global/user-level configs (Claude Desktop, Cursor, Windsurf, etc.)
npx @yawlabs/ctxlint@latest --mcp-globalWhat MCP config files are scanned
File | Client |
| Claude Code (universal project config) |
| Cursor |
| VS Code / GitHub Copilot |
| Amazon Q Developer |
| Continue |
With --mcp-global, also scans the user-level configs:
File | Client |
| Claude Code |
| Claude Code |
| Claude Desktop |
| Cursor |
| Windsurf |
| Amazon Q |
| Cline |
When CLAUDE_CONFIG_DIR is set, settings.json is read from that directory, and .claude.json is read from it too, falling back to ~/.claude.json. Config exclude globs also drop project MCP configs.
What MCP config checks catch
Check | What it finds |
Schema | Invalid JSON, wrong root key ( |
Security | Hardcoded API keys, JWTs, Bearer and other |
Commands | Missing |
Deprecated | SSE transport usage (deprecated March 2025, use Streamable HTTP) |
Env vars | Wrong env var syntax for the client ( |
URLs | Malformed URLs or a scheme other than http/https/ws/wss, localhost in project configs, missing path component |
Consistency | Same server configured differently across client configs |
Redundancy | Disabled servers, identical configs at multiple scopes |
Example MCP config output
MCP Configs
.mcp.json
✗ mcp-security Server "api": hardcoded Bearer token in a git-tracked file
✗ mcp-deprecated Server "old-svc": SSE transport is deprecated — use "http"
✓ mcp-schema
✓ mcp-commands
.cursor/mcp.json
✗ mcp-env Server "api": Cursor uses ${env:VAR}, not ${VAR} (${API_KEY})
✓ mcp-schema
.vscode/mcp.json
✗ mcp-schema .vscode/mcp.json must use "servers" as root key, not "mcpServers"
Cross-file
⚠ Server "api" is configured differently in .mcp.json and .cursor/mcp.json
ℹ Server "db" is in .mcp.json but missing from .cursor/mcp.json
Summary: 3 errors, 2 warnings, 1 infoMCP Config Linting Specification
The full specification for MCP config linting rules, the cross-client config landscape, and a machine-readable rule catalog are published as open specifications:
MCP_CONFIG_LINT_SPEC.md— the full lint-rule set (rule count in the Specifications family table), the complete client/format reference, and implementation guidance. Tool-agnostic — any linter can implement it.mcp-config-lint-rules.json— Machine-readable rule catalog for programmatic consumption by AI agents, CI systems, and other tools.
Session Linting
ctxlint can audit AI agent session data — history files and memory entries — for cross-project consistency. Session checks compare your current project against sibling repos to catch drift and missing setup.
# Lint context files + session data
npx @yawlabs/ctxlint@latest --session
# Lint only session data
npx @yawlabs/ctxlint@latest --session-onlySession checks are opt-in because they access files outside the project directory (agent history in your home directory, sibling repos in the parent directory).
What session files are scanned
Agent | History | Memory |
Claude Code |
|
|
Codex CLI |
| — |
Checks whose signal is what the agent did (commands run, files written or read) also read the current project's Claude Code session transcripts, ~/.claude/projects/<encoded-project>/*.jsonl, bounded to the 5 most recent.
Claude Code config directory
Every Claude Code path ctxlint reads outside the project follows CLAUDE_CONFIG_DIR when it is set, the way Claude Code itself does: history, memories and transcripts (--session), skills and agents (--skills), the user-global settings.json (--hooks-global, --mcp-global and the tier-tokens/hard-enforcement-missing hook lookup), and .claude.json (--mcp-global). Codex history follows CODEX_HOME. The home directory is resolved as Claude Code resolves it: USERPROFILE before HOME on Windows.
What session checks catch
Check | What it finds |
Missing secrets |
|
Diverged configs | Shared config files (CI workflows, tsconfig, .prettierrc, etc.) with 20-90% line overlap (50-90% for |
Missing workflows | GitHub Actions workflows in 2+ siblings but absent from this project |
Stale memory | Memory entries referencing file paths that no longer exist |
Duplicate memory | Near-duplicate memory entries across projects (>60% overlap) |
Loop detection | Agent stuck in a loop — 3+ consecutive identical commands, or cyclic A,B,A,B patterns |
Memory index overflow |
|
Shared temp path | A fixed temp path (e.g. |
Unverified gate | A lint/typecheck/test/build run that errored or printed nothing, followed by agent prose claiming it passed |
Default-branch edits | 10+ files edited on |
Unresolvable SHA | A memory cites a commit SHA that does not resolve in this repository |
Large reads | Whole-file Reads of 4,000+ tokens, with an estimate of the tokens they re-send as cached context on later turns (an info-level baseline) |
Session Linting Specification
AGENT_SESSION_LINT_SPEC.md— the full lint-rule set (rule count in the Specifications family table), the agent session data landscape across 8 agents, sibling detection strategy, and implementation guidance.agent-session-lint-rules.json— Machine-readable rule catalog.
Example Output
ctxlint v0.29.0
Scanning /Users/you/my-app...
Found 2 context files (1,847 tokens total)
CLAUDE.md (1,203 tokens, 42 lines)
AGENTS.md -> CLAUDE.md (symlink)
CLAUDE.md
✗ Line 12: src/auth/middleware.ts does not exist
→ Did you mean src/middleware/auth.ts? (renamed 14 days ago)
✗ Line 8: "pnpm test" — script "test" not found in package.json
⚠ Last updated 47 days ago. src/routes/ has 8 commits since.
⚠ testing framework conflict: "Vitest" in CLAUDE.md vs "Jest" in AGENTS.md
ℹ Line 3: "Express" is in package.json dependencies — agent can infer this
Summary: 2 errors, 2 warnings, 1 info
Token usage: 1,203 tokens per agent session
Estimated waste: ~55 tokens (redundant content)Options
Usage: ctxlint [options] [command] [path]
Arguments:
path Project directory to scan (default: ".")
Options:
--strict Exit code 1 on any warning or error (for CI)
--checks <list> Comma-separated checks to run (see below)
--ignore <list> Comma-separated checks to skip
--fix Auto-fix broken paths using git history and fuzzy matching
--fix-dry-run Preview --fix changes without writing
--yes Skip interactive confirmation prompts (required for --fix in TTY)
--follow-symlinks Allow --fix to write through symlinks (default: skip)
--format <fmt> Output format: text, json, or sarif (default: text)
--tokens Show token breakdown per file
--verbose Show passing checks too
--quiet Suppress all output except errors (exit code only)
--config <path> Path to config file (default: .ctxlintrc in project root)
--depth <n> Max subdirectory depth to scan (default: 2)
--mcp Enable MCP config linting alongside context file checks
--mcp-only Run only MCP config checks, skip context file checks
--mcp-global Also scan user/global MCP config files (implies --mcp)
--session Enable session audit checks (cross-project consistency)
--session-only Run only session checks, skip context and MCP checks
--skills Run agent-skill checks (~/.claude/skills + ~/.claude/agents)
--skills-only Run only agent-skill checks, skip everything else
--hooks-global Also scan the user-global ~/.claude/settings.json in the
dead-hook check (default scans project .claude/ only)
--mcp-server Start the MCP server (alias: `serve` subcommand)
--lsp Start in LSP server mode (JSON-RPC over stdio for editor integration)
--no-ignore-file Disable .ctxlintignore suppression (see all findings)
--watch Re-lint on context file changes
-V, --version Output the version number
-h, --help Display help
Commands:
init [options] [path] Set up a git pre-commit hook that runs ctxlint --strict
(--shared-hooks: allow a hooks dir outside the repo)
serve Start the MCP server (same as --mcp-server)--lsp speaks JSON-RPC over stdio on its own; an editor's --stdio / --clientProcessId transport flags are accepted and ignored. ctxlint serve --help prints the serve usage, and ctxlint serve --version the version. A first argument of serve always starts the MCP server, so to lint a directory named serve, pass it as a path: ctxlint ./serve. --lsp and --mcp-server count only as standalone options (--checks --lsp is a checks list), and alongside --help or --version they print help or the version instead of starting a server.
Available checks: paths, commands, staleness, tokens, tier-tokens, redundancy, contradictions, frontmatter, ci-coverage, ci-secrets, content-secrets, hook-coverage, mcp-schema, mcp-security, mcp-commands, mcp-deprecated, mcp-env, mcp-urls, mcp-consistency, mcp-redundancy, session-missing-secret, session-diverged-file, session-missing-workflow, session-stale-memory, session-duplicate-memory, session-loop-detection, session-memory-index-overflow, session-shared-temp-path, session-unverified-gate-claimed-clean, session-default-branch-accumulation, session-unresolvable-sha, session-large-read, skill-frontmatter, skill-broken-ref, skill-trigger-collision, skill-orphaned, skill-dead-tool-restriction
Passing any mcp-* check name implies --mcp. Passing any session-* check name implies --session. Passing any skill-* check name implies --skills.
Watch Mode
npx @yawlabs/ctxlint@latest --watchRe-lints automatically when any context file, MCP config, package.json, .ctxlintrc[.json], .ctxlintignore, .claude/settings.json, .claude/settings.local.json, or anything under .github/workflows/ or .claude/hooks/ changes. Useful during development when you're editing context files alongside code. With --format json or sarif the watch banner goes to stderr, and --quiet suppresses it. If the project watcher cannot start, ctxlint exits 2 with Error: cannot watch <root>: ....
Use in CI
- name: Lint context files
run: npx @yawlabs/ctxlint@latest --strictExit Codes
Code | Meaning |
| Success — no issues, or issues below the strict threshold |
| Strict mode caught at least one error or warning ( |
| Config error, invalid CLI option, or internal failure |
In non-strict mode ctxlint always exits 0 — it's a reporting tool by default. Pass --strict to enforce in CI. An internal failure prints Error: <message> on stderr (no stack trace).
GitHub Action
- name: Lint context files
uses: yawlabs/ctxlint-action@v1Or with options:
- name: Lint context files
uses: yawlabs/ctxlint-action@v1
with:
args: '--strict --mcp'SARIF Output (GitHub Code Scanning)
- name: Lint context files
run: npx @yawlabs/ctxlint@latest --format sarif > ctxlint.sarif
- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: ctxlint.sarifEach SARIF result's ruleId is the specific rule (ctxlint/paths/not-found), with a matching rule descriptor. Artifact URIs are percent-encoded with forward slashes. Cross-file findings ((project), (mcp), session and skill buckets) carry their label as a logicalLocation, plus a physicalLocation at line 1 of an anchor file when the scan has one, so Code Scanning can show them. Hook-coverage findings are filed under the .claude/settings.json or .claude/settings.local.json they come from (user-global ones stay under (project)).
Auto-fix
npx @yawlabs/ctxlint@latest --fixWhen a broken path was renamed in git or has a close match in the project, --fix rewrites the context file automatically. With --mcp, it also moves hardcoded MCP secrets into environment-variable references written in the client's own syntax (${VAR}, ${env:VAR} or ${{ secrets.VAR }}), replacing only the secret itself. There is no secret fix for Claude Desktop, Amazon Q or Cline, whose configs have no interpolation.
--fix asks for confirmation only when both stdin and stdout are terminals (--yes skips it, --quiet does not). The log groups lines under a header naming each file and redacts secrets. A fix whose text is no longer on its line is logged as Skipped: text not found on line N. For JSON files the post-fix parse check compares against how well the original parsed, so a BOM-prefixed or JSONC file is not blamed on the fix.
Pre-commit Hook
Built-in
npx @yawlabs/ctxlint@latest initSets up a git pre-commit hook that runs npx --yes @yawlabs/ctxlint@<version> --strict before each commit, pinned to the installed ctxlint version, and prints the hook's absolute path. The hook goes where git runs hooks from (git rev-parse --git-path hooks), so init works in linked worktrees, submodules and repo subdirectories, and honours core.hooksPath (an MSYS-style /c/... value is resolved on Windows). A path that does not exist, or a git failure other than "not a git repository", exits 2.
Git runs hooks from the repository root, so init <subdir> (or init run from a subdirectory) writes that directory's repo-root-relative path into the hook command (npx --yes @yawlabs/ctxlint@<version> --strict packages/web). In a monorepo, run init once per package: each package gets its own hook line.
If the hooks directory is outside the repository, typically a user-level core.hooksPath that every repository shares, init refuses and names the directory and where core.hooksPath is set, because a hook written there runs for every repository. Pass --shared-hooks to install there anyway. A hooks directory whose parent does not exist is an error, not created.
Re-running init bumps the version pin and adds --yes to any existing ctxlint hook command that lacks it (an existing -y is kept).
pre-commit framework
Add to your .pre-commit-config.yaml:
repos:
- repo: https://github.com/yawlabs/ctxlint
rev: v0.29.0
hooks:
- id: ctxlintThe hook is language: system and runs npx --yes @yawlabs/ctxlint@<rev> --strict, so it needs npx on PATH and installs nothing into the pre-commit cache.
Config File
Create a .ctxlintrc or .ctxlintrc.json in your project root:
{
"checks": ["paths", "commands", "tokens", "contradictions", "frontmatter"],
"ignore": ["redundancy"],
"ignoreRules": [
{ "check": "paths", "match": "^docs/archive/", "reason": "archived docs cite removed files" }
],
"strict": true,
"tokenThresholds": {
"info": 500,
"warning": 2000,
"error": 5000,
"aggregate": 4000,
"tierBreakdown": 1000,
"tierAggregate": 4000
},
"contextFiles": ["CONVENTIONS.md", "docs/ai-rules.md"],
"exclude": ["fixtures/**", "examples/**"]
}The contextFiles array adds custom file patterns to scan alongside the built-in list. Useful for project-specific context files like CONVENTIONS.md.
The exclude array is its counterpart: globs of context files to drop from the scan entirely. Use it for files that are not this project's agent context at all — test fixtures, example projects, vendored templates.
exclude removes files, where ignore / ignoreRules / .ctxlintignore suppress findings. That distinction matters for the cross-file checks: contradictions and redundancy/duplicate-content compare the discovered set and report against the literal (project) path, which no per-file glob can match. Excluding the files is the only way to silence a conflict between two files you never wanted linted. Reach for .ctxlintignore when a real context file has one noisy finding; reach for exclude when the file shouldn't be in the corpus.
Config Reference
Field | Type | Default | Meaning |
|
| all checks | Checks to run. Check names include |
|
|
| Checks to skip, evaluated after |
|
|
| Per-finding suppression, finer than |
|
| required | The check the rule applies to, by exact name ( |
|
| none | Regex tested against the finding's message, both as raw and as redacted, so a rule copied from redacted output still fires. A rule with neither |
|
| none | Regex tested against each path a finding names; the rule fires only when every path matches. Honored only for |
|
| none | Why the finding is suppressed. Optional, but rules without one are listed in the report for review. |
|
|
| Exit non-zero on any warning or error. |
|
| see below | Per-file and cross-file token thresholds. |
|
|
| Per-file info threshold for |
|
|
| Per-file warning threshold for |
|
|
| Per-file error threshold for |
|
|
| Cross-file total threshold for |
|
|
| Always-loaded file threshold for |
|
|
| Combined always-loaded threshold for |
|
|
| Extra glob patterns to scan alongside the built-in list. |
|
|
| Globs of context files and project MCP configs to drop from the scan entirely, matched against each file's project-relative path (case-insensitively on Windows and macOS). Removes files rather than suppressing findings, so excluded files are also invisible to the cross-file checks. |
|
|
| Enable MCP config checks by default (same as |
|
|
| Run only MCP config checks, skip context-file checks (same as |
|
|
| Also scan user/global MCP configs (same as |
|
|
| Enable session audit checks (cross-project consistency); same as |
|
|
| Run only session checks, skip context and MCP checks (same as |
|
|
| Enable agent-skill checks ( |
|
|
| Run only agent-skill checks, skip everything else (same as |
|
|
| Also scan the user-global |
Config file resolution order: .ctxlintrc → .ctxlintrc.json in the project root. Use --config <path> to point elsewhere. CLI flags override config fields.
The config is validated on load. Invalid JSON, a non-object root, a field of the wrong type (Invalid config in <file>: "<key>" must be an array of strings, and likewise for booleans, objects, numbers and each ignoreRules[i] field), or a config file that exists but cannot be read is an error (exit 2). An unknown key, an unknown tokenThresholds key, or a threshold that is not a finite non-negative number is a warning on stderr; a bad threshold falls back to its default.
Ignore file (.ctxlintignore)
A .ctxlintignore file in the project root suppresses findings without touching .ctxlintrc. Each line is one rule, checkName [fileGlob] [# reason]:
# Blank lines and lines starting with # are skipped.
paths # every paths finding, in every file
tokens CLAUDE.md # tokens findings in CLAUDE.md only
redundancy .claude/** # redundancy findings in files under .claude/checkNameis a name from the Available checks list under Options (paths,tokens,mcp-security, ...), not a rule ID. A name that is not a check is not rejected: the rule never matches, so it is reported as never fired.fileGlobis optional. Without one, the rule covers every file. With one, it covers only findings in files whose path matches — the project-relative path ctxlint prints, with forward slashes on every platform, and dotfiles included. Cross-file findings fromcontradictionsandredundancy/duplicate-contentare reported against the path(project); match them with that literal (contradictions (project)).# reasonneeds a space before the#. Inpaths#legacy, the whole token is read as the check name. Only the first two tokens are read, so there is no message regex here; useignoreRulesfor that.Rules with a glob are applied first, in file order, then rules without one together with
ignoreRules. A finding is dropped by the first rule that matches it.Dropped counts, rules that dropped nothing, and rules without a reason are listed in the same "Ignore rules" report as
ignoreRules.--no-ignore-fileskips the file for a run;ignoreRulesstill apply.--watchre-lints when the file changes.
Inline suppressions
An HTML comment in a context file suppresses findings on one line:
<!-- ctxlint-ignore-next-line -->
<!-- ctxlint-ignore-next-line paths -->
<!-- ctxlint-ignore-line paths tokens -->
<!-- ctxlint-ignore-next-line paths/not-found -->With no target, every check on that line is suppressed. A target is a check name (paths), which matches the check and every rule under it, or a full rule ID (paths/not-found), which matches only that rule. Directives inside fenced code or inline code spans are ignored, so a file can document the syntax. A comment that starts like a directive but does not parse prints Warning: unrecognized ctxlint directive at <file>:<line>: ... on stderr. Only single-file rules can be suppressed inline: a rule-ID target that is unknown (paths/file-not-found) or names a cross-file rule (tokens/aggregate, contradictions/conflict, redundancy/duplicate-content, the CI rules, hook-coverage/dead-hook) suppresses nothing and prints a stderr warning naming the file and line. Use .ctxlintignore, ignoreRules or exclude for those.
Use as MCP Server
ctxlint ships with an MCP server that exposes seven tools (ctxlint_audit, ctxlint_mcp_audit, ctxlint_session_audit, ctxlint_skill_audit, ctxlint_validate_path, ctxlint_token_report, ctxlint_fix). All read-only tools declare annotations so MCP clients can skip confirmation dialogs. ctxlint_audit and ctxlint_mcp_audit honour the project's config exclude. The four audit tools cap their text at 90,000 bytes, and add a truncated field (droppedIssues, droppedFiles, reason) when they drop findings to fit; summary still counts everything. On Windows, projectPath rejects UNC and device paths.
Launch it with the serve subcommand (or the equivalent --mcp-server flag, kept for back-compat):
npx -y @yawlabs/ctxlint@latest serveWith Claude Code
claude mcp add ctxlint -- npx -y @yawlabs/ctxlint@latest serveWith .mcp.json (Claude Code project config, Cursor, Windsurf)
Create .mcp.json in your project root:
macOS / Linux / WSL:
{
"mcpServers": {
"ctxlint": {
"command": "npx",
"args": ["-y", "@yawlabs/ctxlint@latest", "serve"]
}
}
}Windows:
{
"mcpServers": {
"ctxlint": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@yawlabs/ctxlint@latest", "serve"]
}
}
}Tip: This file is safe to commit — it contains no secrets.
With VS Code / GitHub Copilot
Add to .vscode/mcp.json:
{
"servers": {
"ctxlint": {
"command": "npx",
"args": ["-y", "@yawlabs/ctxlint@latest", "serve"]
}
}
}With Claude Desktop
Add to your Claude Desktop config (claude_desktop_config.json):
{
"mcpServers": {
"ctxlint": {
"command": "npx",
"args": ["-y", "@yawlabs/ctxlint@latest", "serve"]
}
}
}JSON Output
npx @yawlabs/ctxlint@latest --format jsonReturns structured JSON with all file results, issues, and summary — useful for building integrations or dashboards.
summary.totalTokenscounts context files only, a symlink alias once. MCP configs keep their per-filetokensbut are not in the total. The text report's "Token usage" line and the--tokensTotal print the same number.An issue may carry a
filefield naming the file it was read from: hook-coverage findings from a project.claude/settings.jsonor.claude/settings.local.jsonset it to that file's project-relative path (user-global findings have none).versionSkew: { checkoutVersion, runningVersion }appears only when ctxlint scans a ctxlint checkout of a different version than the one running.Secrets never reach the output: messages, suggestions and details are redacted (6-character prefix +
...), and so are credentials insidefix.oldText/fix.newText(URL passwords and secret-named query values in every fix; key-shaped strings inmcp-*fixes only, so a CamelCase file name in apaths/*fix stays readable).--fixitself works on the real text in-process.
Specifications
ctxlint is the reference implementation of four open specifications for linting AI agent interfaces. These specs are tool-agnostic — any linter, IDE extension, or CI system can implement them.
Spec | What it covers |
43 rules for validating context files (CLAUDE.md, .cursorrules, AGENTS.md, etc.) across 16 clients. Covers file formats, frontmatter schemas, path/command validation, staleness, token budgets, redundancy, and contradictions. | |
30 rules for validating MCP server configs (.mcp.json, .cursor/mcp.json, .vscode/mcp.json, etc.) across 8 clients. Covers schema validation, hardcoded secrets, env var syntax, deprecated transports, and cross-file consistency. | |
13 rules for auditing agent session data (history, memory) across 8 agents. Covers cross-project secret consistency, config drift, stale memory, and loop detection. | |
5 rules for auditing Claude Code skill ( |
All specs include machine-readable rule catalogs for programmatic consumption:
context-lint-rules.json— context file rules and 16 supported format definitionsmcp-config-lint-rules.json— MCP config rules and 8 client definitionsagent-session-lint-rules.json— session lint rules and 8 agent data source definitionsagent-skill-lint-rules.json— agent-skill lint rules (~/.claude/skills,~/.claude/agents)
Also By Yaw Labs
Yaw — The AI-native terminal
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Research-backed lint + generation for agent context files (CLAUDE.md, AGENTS.md) + prompt enhancer.
Scan AI agent skills, MCP server packages and MCP configs before you install them. Static analysis.
Audit your MCP servers for poisoned tools and leaked secrets, and check AI-generated code for flaws.
Enforces architectural invariants and code quality rules inside your AI agent's edit loop.
Related MCP Servers
- AlicenseAqualityDmaintenanceStatic security linter for MCP servers. Scans tool definitions for vulnerabilities (path traversal, SQL injection, SSRF), scores description quality, and auto-rewrites descriptions for safer agent tool selection.2384 PyPI10MIT
- AlicenseNot gradedqualityDmaintenanceCode linting and style checking tools for AI agents, exposed as an MCP server. Supports style checks, naming conventions, complexity analysis, dead code detection, and import analysis.40 npmMIT
- AlicenseAqualityCmaintenanceGenerates AI context files (CLAUDE.md, AGENTS.md, Cursor/Windsurf/Cline/Continue/Kilo Code/Trae rules, GEMINI.md, Copilot, Aider, Junie, Warp) for any repository. Runs as CLI or MCP server, 100% local.346 npm1MIT
- AlicenseNot gradedqualityDmaintenanceEnables MCP-compatible AI agents to scan code for leaked secrets, copyleft licenses, unprotected routes, missing privacy policies, and risky card handling before committing or shipping.MIT