Skip to main content

ailint_core/rules/semantic/
mod.rs

1//! Semantic rules: instruction quality, clarity, redundancy.
2//! Range: **AIL100 – AIL199**.
3
4pub mod duplicate_rules;
5pub mod excessive_length;
6pub mod instruction_bloat;
7pub mod missing_examples;
8pub mod negative_constraint_overload;
9pub mod vague_instruction;
10pub mod vendor_optimization;
11
12pub use duplicate_rules::NoDuplicateRulesRule;
13pub use excessive_length::ExcessiveRuleLengthRule;
14pub use instruction_bloat::DetectInstructionBloatRule;
15pub use missing_examples::NoMissingExamplesRule;
16pub use negative_constraint_overload::NegativeConstraintOverloadRule;
17pub use vague_instruction::NoVagueInstructionRule;
18pub use vendor_optimization::VendorOptimizationSyntaxRule;
19
20use crate::rules::{Rule, RuleId};
21
22/// AIL100: instruction uses vague, unactionable phrasing.
23pub const AIL100: RuleId = RuleId::new(100, "no-vague-instruction");
24/// AIL101: rules reference behavior without concrete examples.
25pub const AIL101: RuleId = RuleId::new(101, "no-missing-examples");
26/// AIL102: document exceeds the practical context-length budget.
27pub const AIL102: RuleId = RuleId::new(102, "excessive-rule-length");
28/// AIL103: the same rule is stated more than once in a document.
29pub const AIL103: RuleId = RuleId::new(103, "no-duplicate-rules");
30/// AIL104: instruction list dominated by negative ("do not") constraints.
31pub const AIL104: RuleId = RuleId::new(104, "negative-constraint-overload");
32/// AIL105: Claude/Cline guidance without the XML tags those tools favor.
33pub const AIL105: RuleId = RuleId::new(105, "vendor-optimization-syntax");
34/// AIL106: prose paragraph is long enough that agents will skim it.
35pub const AIL106: RuleId = RuleId::new(106, "detect-instruction-bloat");
36
37/// All semantic rules, in registration order.
38pub fn all_rules() -> Vec<Box<dyn Rule>> {
39    vec![
40        Box::new(NoVagueInstructionRule),
41        Box::new(NoMissingExamplesRule),
42        Box::new(ExcessiveRuleLengthRule),
43        Box::new(NoDuplicateRulesRule),
44        Box::new(NegativeConstraintOverloadRule),
45        Box::new(VendorOptimizationSyntaxRule),
46        Box::new(DetectInstructionBloatRule),
47    ]
48}