Skip to content
/

AI Context Linter

ai-context-linter · MrDwarf7/ai-context-linter · ★ 1 · last commit 2026-04-21

Primitive shape
No installable primitives
00

Summary

AI Context Linter — Summary

AI Context Linter is a GitHub Action by MrDwarf7 that statically validates AI coding context files (CLAUDE.md, .cursorrules, AGENTS.md, COPILOT.md, .windsurfrules, .clinerules) against 12 rules covering security issues, structural problems, AI anti-patterns, and best practices — catching problems in CI before they silently degrade agent behavior.

Problem it solves: Context files written quickly or carelessly often contain hardcoded API keys, vague instructions ("follow best practices"), conflicting rules, or structural issues that make them harder for agents to parse. These problems are invisible until the agent produces bad output. The linter catches them automatically in CI.

Distinctive trait: It is the only framework in this batch that operates as a GitHub Action for CI integration rather than as an agent tool — it validates the inputs to agents rather than governing agent behavior. It also ships a custom config file (.ai-context-linter.yml) to disable rules or adjust token limits.

Scope: 12 rules across 4 categories: Security (2 errors), Structure (4 warnings), AI Anti-Patterns (3 warnings), Best Practices / File-Type Specific (3+ info). Configurable via YAML config file. Outputs issue count and files-checked as GitHub Action outputs.

Relationship: Sister repo to MrDwarf7/ai-context-templates — designed as the validate step for context files created with those templates.

Differs from seeds: No direct seed parallel exists — none of the 11 seeds include a CI linter for context files. The closest analogy is caliber (same batch) which has a caliber score command that evaluates context file quality with a 100-point rubric; ai-context-linter is a lightweight GitHub Action version of that concept with hardcoded rules rather than LLM-assisted scoring.

01

Overview

AI Context Linter — Overview

Origin

Published by MrDwarf7 on GitHub. 1 star, 0 forks, MIT license. Last commit: 2026-04-21. Language: JavaScript (Node.js 20 Action).

Philosophy

The core premise:

"If you're using Claude Code, Cursor, Copilot, or any AI coding agent, you've probably written a CLAUDE.md or .cursorrules file. Maybe you wrote it at 2 AM. Maybe it has your OpenAI key hardcoded in an example. Maybe it says 'follow best practices' and nothing else. Your AI agent reads that file every time it starts. If the file is wrong, the agent is wrong."

The design follows the standard CI quality gate pattern: catch problems early, before they reach production. Context files are treated as code artifacts that deserve lint enforcement.

Design Decisions

  • Zero AI calls: Scoring is deterministic static analysis — regex patterns and structural checks, no LLM involved
  • GitHub Action first: Designed as uses: MrDwarf7/ai-context-linter@v1 — one-liner CI integration
  • Configurable: .ai-context-linter.yml disables rules or adjusts maxTokens
  • Auto-detection: Scans for known context filenames by default, not just the specified glob
  • Three severity levels: Error (fail build), Warning (optional fail), Info (suggestions)
  • Cross-tool: Auto-detects CLAUDE.md, .cursorrules, AGENTS.md, COPILOT.md, .windsurfrules, .clinerules

Relationship to ai-context-templates

The README explicitly pairs them:

"Need Good Templates? This linter checks your files against best practices. If you want context files that pass every check on the first try: [AI Context Engineering Templates]"

02

Architecture

AI Context Linter — Architecture

Distribution

  • Type: GitHub Action (npm-package internally)
  • License: MIT
  • Language: JavaScript (Node.js 20)
  • Runtime: Node.js 20 (runs: using: 'node20')

Install Method

# Minimal usage in GitHub Actions workflow
- uses: MrDwarf7/ai-context-linter@v1
# Full configuration
- uses: MrDwarf7/ai-context-linter@v1
  with:
    files: '**/{CLAUDE.md,.cursorrules,AGENTS.md}'
    max-tokens: '3000'
    fail-on-warnings: 'false'
    config: '.ai-context-linter.yml'

Directory Tree

ai-context-linter/
├── src/
│   ├── index.js        # Main action runner + file discovery
│   └── rules.js        # 12 lint rules
├── dist/
│   └── index.js        # Compiled bundle (deployed to Actions)
├── __tests__/          # Test suite
├── action.yml          # Action manifest
├── package.json
└── README.md

Custom Config File

.ai-context-linter.yml in project root:

maxTokens: 3000
disabledRules:
  - bp-too-short
  - struct-missing-description

Target Files (auto-detected)

  • CLAUDE.md / .claude
  • .cursorrules / .cursorrules.json
  • AGENTS.md / AGENTS
  • COPILOT.md / .copilot
  • .windsurfrules
  • CONVENTIONS.md
  • .clinerules
  • system-prompt.md
  • agent-prompt.md
03

Components

AI Context Linter — Components

12 Lint Rules

Security (severity: error — fails build)

Rule Catches
sec-api-key Hardcoded API keys (OpenAI, Stripe, GitHub PAT, Slack tokens)
sec-private-path Leaked home directory paths (/home/user/.ssh/...)

Structure (severity: warning)

Rule Catches
struct-too-long Files over token limit — dilutes instructions
struct-no-sections 500+ chars with no ## headings
struct-empty-sections Heading followed immediately by another heading
struct-missing-description No overview/description section

AI Anti-Patterns (severity: warning)

Rule Catches
ai-vague-instructions "Be good", "follow best practices", "don't be stupid"
ai-conflicting-rules "Always use tabs" + "never use tabs"
bp-redundant-instructions "Write code that works"

Best Practices / File-Type Specific (severity: info)

Rule Catches
bp-no-structure-hints No formatting/style guidance
bp-too-short Under 50 words
bp-html-comments Large hidden HTML comments (possible prompt injection)
ft-claude-missing-tools CLAUDE.md with no tool/command references
ft-cursor-no-globs .cursorrules with no file scope patterns

Action Inputs

Input Default Description
files common AI context file names Glob pattern for files to lint
config '' Path to .ai-context-linter.yml
fail-on-warnings false Fail action on warnings (not just errors)
max-tokens 4000 Max recommended token count per file

Action Outputs

Output Description
issues-found Total count of errors + warnings + suggestions
files-checked Number of context files found and checked
05

Prompts

AI Context Linter — Prompt Excerpts

This framework ships no agent prompts. It is a static analysis tool (GitHub Action) that validates context files, not a framework that provides prompts to AI agents.

Excerpt 1: Action Manifest (action.yml) — Tool Definition

name: 'AI Context Linter'
description: 'Lint and validate AI coding context files (CLAUDE.md, .cursorrules,
  AGENTS.md) against best practices. Catch security issues, structural problems,
  and optimization opportunities before they reach your AI agent.'
branding:
  icon: 'check-circle'
  color: 'green'
inputs:
  files:
    description: 'Glob pattern for context files to lint.'
    default: '**/{CLAUDE,CLAUDE.md,.claude,.cursorrules,...,AGENTS.md,...}'
  fail-on-warnings:
    default: 'false'
  max-tokens:
    default: '4000'
runs:
  using: 'node20'
  main: 'dist/index.js'

Design pattern: Standard GitHub Action manifest. The wide default glob pattern for files ensures zero-config adoption — teams don't need to know which context files they have.


Excerpt 2: Rule Logic Pattern (from src/index.js)

for (const [ruleId, rule] of Object.entries(RULES)) {
  const issues = rule.check(content, config, filename);
  fileIssues.push(...issues);
}

for (const issue of fileIssues) {
  const lineStr = issue.line ? ` (line ${issue.line})` : '';
  const icon = issue.severity === 'error' ? '❌'
    : issue.severity === 'warning' ? '⚠️' : '💡';
  info(`   ${icon} [${issue.rule}] ${issue.message}${lineStr}`);
}

Design pattern: Rule engine with severity-typed issue objects. Each rule in RULES is an object with a check(content, config, filename) method. This is the same pattern used by ESLint, Stylelint, and similar static analysis tools — familiar to developers who want to extend it.

09

Uniqueness

AI Context Linter — Uniqueness & Positioning

Differs From Seeds

None of the 11 seeds include a CI linter for context files. This is a genuinely distinct category: an input validator for AI context rather than an agent framework. The closest seed analogy is the quality-gate concept in spec-kit (18 hooks that run before/after each command) or caliber (deterministic scoring of context file quality) — but both of those are agent-side mechanisms; ai-context-linter is a CI-side mechanism that runs before the agent ever starts.

Positioning

Positioned as CI hygiene for AI teams: "catch these problems before they become problems in production." Competes with no named tools; the space of "AI context file linters" appears to be this tool and caliber's caliber score command.

Observable Failure Modes

  • 12 rules is a minimal set; real problems like inconsistent naming conventions, missing test runner specification, or contradictory architectural patterns are not caught
  • No rule explains how to fix an issue — the linter identifies problems but the fix is entirely up to the user
  • The ai-vague-instructions and bp-redundant-instructions rules require pattern matching on common phrases; novel vague instructions (custom to a project) pass undetected
  • Security rules sec-api-key catch obvious patterns but not obfuscated or custom key formats
  • No baseline comparison — a file that was fine before and now has new issues requires the user to diff manually

Cross-Tool Coverage

Detects: CLAUDE.md, .cursorrules, AGENTS.md, COPILOT.md, .windsurfrules, .clinerules. Notable gaps: .kiro/steering/, .openspec/, custom context formats.

Pair with ai-context-templates

The create/validate workflow: write context files with ai-context-templates, validate them with ai-context-linter. Both repos by the same author.

04

Workflow

AI Context Linter — Workflow

CI Integration Flow

Phase Action Artifact
Push / PR GitHub Action triggers Linter runs
File discovery Auto-detect known AI context filenames List of files to check
Rule execution Run 12 rules against each file Issues list per file
Reporting Print issues with severity icon and line number GitHub Actions log output
Gate Exit 1 if any errors (optionally: if any warnings) CI pass/fail

Phase-to-Artifact Map

Phase Artifact
Discovery File list
Linting issues-found count (Action output)
Reporting Formatted log with ❌/⚠️/💡 per issue

Approval Gates

None beyond standard CI pass/fail.

On Success (no issues)

AI Context Linter — checking 2 file(s)

📄 CLAUDE.md
   45 lines, ~210 tokens
   ✅ No issues found

📄 .cursorrules
   30 lines, ~140 tokens
   ✅ No issues found

On Failure (errors found)

📄 CLAUDE.md
   ❌ [sec-api-key] Potential API key found (line 14)
   ⚠️ [struct-too-long] File is 5200 tokens, exceeds limit of 4000
06

Memory Context

AI Context Linter — Memory & Context

State Storage

None. Stateless — runs once per CI invocation, produces output, exits.

Persistence

None. Results are ephemeral CI logs. No state file is written.

Note

This framework validates the context files that other frameworks write. It has no internal memory or context mechanism of its own.

07

Orchestration

AI Context Linter — Orchestration

Not applicable. This is a CI validation tool, not an agent framework. There is no agent, no orchestration, no multi-model routing, no execution lifecycle in the agent sense.

The "orchestration" is standard GitHub Actions: triggered on push/PR, runs a Node.js script, exits with 0 or 1.

08

Ui Cli Surface

AI Context Linter — UI / CLI Surface

CLI Binary

No dedicated binary. Can be run locally (non-GitHub-Actions) via node dist/index.js with INPUT_* environment variables, but this is not documented as a first-class usage mode.

Local UI

None.

GitHub Actions UI

Results appear in the GitHub Actions workflow logs with colored icons (❌ ⚠️ 💡) per issue. No special UI beyond standard Actions output.

Observability

Issues count and files-checked are available as Action step outputs (${{ steps.lint.outputs.issues-found }}), usable in downstream steps (e.g., comment on PR with issue count).

Related frameworks

same archetype · same primary tool · same memory type

claude-mem (thedotmack) ★ 78k

Background worker service captures every tool call as an observation, AI-compresses sessions, and auto-injects relevant past…

pi (badlogic/earendil) ★ 55k

A minimal, hackable, multi-provider terminal coding agent that adapts to your workflows via npm-installable TypeScript Extensions…

Agent Skills (Addy Osmani) ★ 46k

Encodes senior-engineer software development lifecycle as 23 auto-routed skills and 7 slash commands for any AI coding agent.

wshobson/agents Plugin Marketplace ★ 36k

Single Markdown source for 83 domain-specialized plugins that auto-generates idiomatic artifacts for five AI coding harnesses.

TabbyML/Tabby ★ 34k

Self-hosted AI coding assistant server (alternative to GitHub Copilot) with admin dashboard, RAG-based completions, and multi-IDE…

Compound Engineering ★ 17k

Make each unit of engineering work compound into easier future work via brainstorm→plan→execute→review→learn cycles.