Skip to main content

Crate llmignore

Crate llmignore 

Source
Expand description

§llmignore

Parse and match .llmignore files — the .gitignore for AI.

Prevent AI coding tools from ingesting secrets, credentials, large binaries, and sensitive data into LLM context windows. Works with all 13 known AI ignore formats (.cursorignore, .aiignore, .aiexclude, .claudeignore, .codeiumignore, .geminiignore, .aiderignore, .clineignore, .rooignore, .augmentignore, .copilotignore, .repomixignore).

§Quick Start

use llmignore::{parse, matches};

let content = r#"
.env
.env.*
**/*.pem

!.env.example
"#;

let patterns = parse(content);

assert!(matches(&patterns, ".env"));
assert!(matches(&patterns, ".env.local"));
assert!(!matches(&patterns, ".env.example")); // negation re-includes it
assert!(matches(&patterns, "certs/server.pem"));
assert!(!matches(&patterns, "src/main.rs"));

§Zero Dependencies

This crate uses only the Rust standard library. No external crates required.

Spec: https://rival.tips/llmignore

Structs§

Format
Definition of an AI ignore file format.
Pattern
A single parsed pattern from an ignore file.

Constants§

FORMATS
All 13 known AI ignore file format definitions.

Functions§

match_all
Return all patterns that match a given path.
matches
Check whether a file path should be ignored according to the patterns.
parse
Parse .llmignore file content into a list of Pattern objects.