Skip to main content

Crate agnix_rules

Crate agnix_rules 

Source
Expand description

Validation rules for agnix - agent configuration linter.

This crate provides the rule definitions used by agnix to validate agent configurations including Skills, Hooks, MCP servers, Memory files, and Plugins.

§Usage

use agnix_rules::{RULES_DATA, VALID_TOOLS, TOOL_RULE_PREFIXES};

// RULES_DATA is a static array of (rule_id, rule_name) tuples
for (id, name) in RULES_DATA {
    println!("{}: {}", id, name);
}

// VALID_TOOLS contains all tool names from rules.json
for tool in VALID_TOOLS {
    println!("Tool: {}", tool);
}

// TOOL_RULE_PREFIXES maps rule prefixes to their tools
for (prefix, tool) in TOOL_RULE_PREFIXES {
    println!("Prefix {} -> Tool {}", prefix, tool);
}

§Rule Categories

  • AS-xxx: Agent Skills
  • CC-xxx: Claude Code (Hooks, Skills, Memory, etc.)
  • MCP-xxx: Model Context Protocol
  • COP-xxx: GitHub Copilot
  • CUR-xxx: Cursor
  • XML-xxx: XML/XSLT based configs
  • XP-xxx: Cross-platform rules

Constants§

RULES_DATA
Rule data as (id, name) tuples.
TOOL_RULE_PREFIXES
Mapping of rule ID prefixes to their associated tools.
VALID_TOOLS
Valid tool names derived from rules.json evidence.applies_to.tool.

Functions§

get_prefixes_for_tool
Returns all rule prefixes associated with a tool.
get_rule_name
Looks up a rule by ID, returning the name if found.
get_tool_for_prefix
Returns the tool name for a given rule ID prefix, if any.
is_valid_tool
Check if a tool name is valid (exists in rules.json).
normalize_tool_name
Normalize a tool name to its canonical form from rules.json.
rule_count
Returns the total number of rules.
valid_tools
Returns the list of valid tool names derived from rules.json.