agnix Agent Config Linter
repository·main·Indexed 43 days ago
https://github.com/agent-sh/agnixAn Agent Config Linter designed to catch syntax errors and bad patterns in AI agent configuration files, including CLAUDE.md, SKILL.md, MCP configs, and Cursor rules. It provides a CLI (agnix-cli), a core library (agnix-core), and a language server (agnix-lsp) with support for VS Code, Zed, Neovim, Helix, and JetBrains IDEs.
What's inside agnix
- agnix is a linter specifically designed for AI agent configuration files. It validates various components such as Skills, Hooks, Memory, Plugins, and MCP (Model Context Protocol) configurations across multiple AI agent platforms, including Claude Code, Cursor, GitHub Copilot, and Codex CLI. It provides validation against 456 rules, supports auto-fixing, and integrates with modern editors via LSP.
Navigate the AI Agent Knowledge Library
mainThe AI Agent Knowledge Library serves as a curated entrypoint to internal standards, validation rules, and authoritative external sources for building and configuring AI agents. Use the following resources to implement and maintain agent standards:
- Implementation & Validation: Refer to
VALIDATION-RULES.mdfor rules andstandards/for hard rules and opinions. - Design Patterns: Use
PATTERNS-CATALOG.mdto find established agent implementation patterns. - Platform-Specific Guidance: The
agent-docs/directory contains references for specific tools like Claude Code, Codex CLI, and OpenCode.
- Implementation & Validation: Refer to
Features of agnix-lsp
mainThe
agnix-lspserver provides real-time validation and developer productivity features for agent configuration files:- Real-time Diagnostics: Validation occurs as you type (
didChange), on file open, and on file save. - Comprehensive Rule Support: Supports all 456
agnixvalidation rules, including project-level cross-file rules (e.g.,AGM-006,XP-004/005/006,VER-001). - Diagnostic Details: Maps severity levels (Error, Warning, Info) and displays specific rule codes in messages.
- Code Actions: Provides quick-fix actions for auto-fixable diagnostics.
- IntelliSense:
- Hover: Documentation for frontmatter fields like
name,version, andmodel. - Completions: Context-aware completions for frontmatter keys, values, and snippets.
- Hover: Documentation for frontmatter fields like
- Real-time Diagnostics: Validation occurs as you type (
What agnix validates
mainagnix is a linter for agent configurations, supporting 443 rules across 40 categories. It validates a wide range of files used by various AI agent tools, including:
- Skills:
SKILL.md(34 rules) - Claude Code:
settings.json(Hooks),CLAUDE.md/CLAUDE.local.md(Memory),.claude/output-styles/*.md(Output Styles), and.claude/settings.json(Settings) - Instructions & Agents:
AGENTS.md(Cross-Tool),agents/*.md(Agents) - MCP: Tool definitions (26 rules)
- GitHub Copilot:
.github/copilot-instructions.md,.github/hooks/hooks.json, and related files - Cursor:
.cursorrules,.cursor/rules/*.mdc,.cursor/hooks.json, and.cursor/environment.json - Cline:
.clinerules,.clinerules/*.md, and.clinerules/*.txt - OpenCode:
opencode.jsonandopencode.jsonc - Windsurf:
.windsurf/rules/*.md,.windsurf/workflows/*.md, and.windsurfrules - Kiro:
.kiro/steering/*.md,.kiro/agents/**/*.{json,md},.kiro/hooks/*.kiro.hook, and.kiro/settings/*.json - Other tools: Gemini, Codex CLI, Roo Code, and Amp.
- Skills:
Navigate the agnix Knowledge Base
mainThe agnix Knowledge Base serves as the canonical documentation for validation rules, standards, and research sources used by the linter. Use the following files to find specific information:
- INDEX.md: Use this for master navigation and high-level summaries of the knowledge base.
- VALIDATION-RULES.md: Consult this file to view the 456 specific rules and their underlying detection logic.
- PATTERNS-CATALOG.md: Reference this for the 70 patterns derived from
agentsys. - standards/: Directory containing
HARD-RULESandOPINIONSorganized by topic. - agent-docs/: Directory containing platform references and research documentation.
Understand Agnix Detection Certainty Levels
mainAgnix categorizes linting detections into three certainty levels, which determine how they are reported and whether they can be automatically fixed:
- HIGH: >95% true positive rate. These are always reported and are considered safe for auto-fixing.
- MEDIUM: 75-95% true positive rate. These are reported in the default mode; auto-fixing should be done with caution.
- LOW: <75% true positive rate. These are only reported in verbose mode and are never auto-fixed.
Sandbox and isolate code execution
mainAI-generated code poses risks like filesystem access, network exfiltration, and resource exhaustion. Use isolation technologies based on your required security level:
- Docker: Low latency; provides process and namespace isolation. Best for development or trusted code.
- gVisor: Medium latency; provides user-space kernel isolation. Best for semi-trusted code.
- Firecracker microVM: Medium latency; provides full VM isolation. Best for untrusted code.
- WebAssembly: Very low latency; provides memory-safe sandboxing. Best for lightweight isolation.
Recommended Architecture: Use a Sandbox Controller to orchestrate and validate execution within an isolated environment that has no network by default, a read-only filesystem, and strict resource limits.
Understand Agent Skill validation rules
mainAgnix validates Agent Skill files (typically YAML frontmatter followed by a body) to ensure they adhere to the
agentskills.iospecification. Key validation checks include:- AS-001: Ensures the file starts with
---(YAML frontmatter exists). - AS-002: Ensures the
namefield is present and not empty. - AS-004: Validates the
nameformat. It should be a bare skill name or follow the<plugin>:<skill-name>pattern using kebab-case segments.
If
AS-001fails, validation stops because the frontmatter cannot be parsed.// Example of how AS-001 and AS-002 are checked internally if !content.starts_with("---") { diagnostics.push(Diagnostic::error(path, 1, 0, "AS-001", "Missing YAML frontmatter".to_string())); return diagnostics; } if frontmatter.name.is_empty() { diagnostics.push(Diagnostic::error(path, 2, 0, "AS-002", "Missing required field: name".to_string())); }- AS-001: Ensures the file starts with
Understand platform-specific standards (Claude Code, MCP, Multi-Platform)
mainAgnix provides deep technical context for specific agentic platforms and protocols. Use these resources to understand the constraints and best practices for each:
- Claude Code: Use
standards/claude-code-HARD-RULES.mdfor technical specifications andstandards/claude-code-OPINIONS.mdfor usage patterns. - MCP (Model Context Protocol): Use
standards/mcp-HARD-RULES.mdfor protocol compliance andstandards/mcp-OPINIONS.mdfor tool design patterns. - Multi-Platform: Use
standards/multi-platform-HARD-RULES.mdfor the compatibility matrix andstandards/multi-platform-OPINIONS.mdfor cross-platform tips. - Prompt Engineering: Use
standards/prompt-engineering-HARD-RULES.mdfor research-backed requirements.
- Claude Code: Use
Understand Codex CLI Sandbox Security
mainCodex CLI employs OS-level sandboxing to ensure safety, especially when running in
full-automode.- macOS: Uses Apple's Seatbelt to wrap commands. By default, network access is blocked, and the process is confined to the working directory and temporary storage.
- Linux: Uses Docker containerization. It includes an
iptablesfirewall that denies all egress except for necessary API calls, providing full filesystem isolation.
Full-Auto Mode Safety: In this mode, all commands are executed with network-disabled, confined to the working directory, and allowed access only to temporary storage.
Negotiate MCP Capabilities
mainBoth parties must respect the negotiated protocol version and only use capabilities successfully negotiated during initialization. If a server declares a capability, it MUST implement the associated methods.
Category Capability Required Implementation Server toolstools/list,tools/callServer resourcesresources/list,resources/readServer promptsprompts/list,prompts/getServer loggingAccept log messages Client rootsProvide filesystem roots Client samplingHandle LLM sampling requests Client elicitationHandle user input requests Design Reference Skills for Background Knowledge
mainReference Skills are used to provide background knowledge, conventions, or context that should be loaded automatically when relevant. They act as guardrails to reduce back-and-forth by providing the agent with established patterns (e.g., API design principles, folder structures, or coding standards).
Pattern: Define a skill with a name and description that outlines the conventions to follow.
--- name: api-conventions description: REST API design conventions for this codebase. Apply when working with API endpoints. --- ## API Design Principles ### URL Structure - Resources: Plural nouns (`/users`, not `/user`) - Nesting: Max 2 levels (`/users/:id/posts/:id`) - Actions: POST to collection, PUT to item ### Response Format ```json { "data": { /* response payload */ }, "meta": { "page": 1, "total": 100 } }Error Handling
- 400: Client error (invalid input)
- 401: Unauthorized
- 403: Forbidden
- 404: Not found
- 500: Server error
Validation
- Use Zod schemas
- Return detailed field errors
- Include error codes for client handling