New
Apps 853Makers 852This week 853
Promote your app−30%
ctxlint screenshot 1
0views in
the last 30 days

ctxlint

Lint your AI agent context files (CLAUDE.md, AGENTS.md, etc.) against your codebase

Built with Claude Code

by yawlabs · added Oct 29, 2026
no ratings0 comments

Add to Yaw MCP

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. npx downloads 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 — --fix rewrites 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 — --watch re-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
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 PreToolUse hooks / permissions entries in .claude/settings.json pointing at scripts that no longer exist (a dead gate silently no-ops). Scans project .claude/settings.json[.local] by default; pass --hooks-global to also scan the user-global ~/.claude/settings.json
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 MEMORY.md past Claude Code's 200-line / 25KB session-load cap — entries beyond it are invisible to the agent
Shared temp path A fixed temp path (e.g. /tmp/pkg.bak) the agent writes and later reads back — any concurrent session can overwrite it in between
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 main/master with no intervening commit or branch-away
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.md, CLAUDE.local.md, .claude/rules/*.md Claude Code
AGENTS.md, AGENT.md, AGENTS.override.md AAIF / Multi-agent standard
.cursorrules, .cursor/rules/*.md, .cursor/rules/*.mdc, .cursor/rules/*/RULE.md Cursor
.github/copilot-instructions.md, .github/instructions/*.md, .github/git-commit-instructions.md GitHub Copilot
.windsurfrules, .windsurf/rules/*.md Windsurf
GEMINI.md Gemini CLI
.clinerules Cline
.aiderules Aider
.aide/rules/*.md Aide / Codestory
.amazonq/rules/*.md Amazon Q Developer
.goose/instructions.md, .goosehints Goose by Block
.junie/guidelines.md, .junie/AGENTS.md JetBrains Junie
.aiassistant/rules/*.md JetBrains AI Assistant
.continuerules, .continue/rules/*.md Continue
.rules Zed
replit.md 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-global

What MCP config files are scanned

File Client
.mcp.json Claude Code (universal project config)
.cursor/mcp.json Cursor
.vscode/mcp.json VS Code / GitHub Copilot
.amazonq/mcp.json Amazon Q Developer
.continue/mcpServers/*.json Continue

With --mcp-global, also scans Claude Desktop, Cursor, Windsurf, and Amazon Q global configs.

What MCP config checks catch

Check What it finds
Schema Invalid JSON, wrong root key (servers vs mcpServers), missing required fields
Security Hardcoded API keys and Bearer tokens in git-tracked config files
Commands Missing cmd /c wrapper for npx on Windows, broken file paths in args
Deprecated SSE transport usage (deprecated March 2025, use Streamable HTTP)
Env vars Wrong env var syntax for the client (${VAR} vs ${env:VAR} vs ${{ secrets.VAR }})
URLs Malformed URLs, 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}
    ✓ 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 info

MCP 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-only

Session 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 ~/.claude/history.jsonl ~/.claude/projects/*/memory/*.md
Codex CLI ~/.codex/history.jsonl —

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.

What session checks catch

Check What it finds
Missing secrets gh secret set ran on 2+ sibling repos but not this one
Diverged configs Shared config files (CI workflows, tsconfig, .prettierrc, etc.) with 20-90% line overlap — enough to be related, different enough to be drifting
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 MEMORY.md exceeds Claude Code's documented 200-line / 25KB session-load cap, so entries past the cap are invisible to the agent
Shared temp path A fixed temp path (e.g. /tmp/pkg.bak) the agent writes and later reads back — any concurrent session can overwrite it in between
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 main/master with

Description taken from the repository README.

Ratings

–
0 ratings
5 0
4 0
3 0
2 0
1 0

Rate this app

Sign in to rate

Comments 0

Sign in to comment

No comments yet.

Related apps

#linting · #context · #cli