grithdocs

2. Static path matching

Fifteen anchored path rules from paths.toml - the curated list of files that are always worth a decision.

Phase1, static
Score3.0, 4.0 or 5.0
Sourcecrates/grith-proxy/src/filters/path_match.rs
Configconfig/filters/paths.toml - 15 rules

The curated list. Fifteen rules, each naming a path shape, the operations it applies to, and a score. Every rule is tested and the highest-scoring match wins - overlapping rules like ~/.ssh/* and ~/.ssh/id_* are both considered, not short-circuited.

The shipped rules

RulePatternOperationsScore
ssh-private-key~/.ssh/id_*read, write, delete5.0
etc-shadow/etc/shadow*read, write5.0
gnupg~/.gnupg/*read, write, delete4.0
aws-credentials~/.aws/*read, write, delete4.0
gcloud-config~/.config/gcloud/*read, write, delete4.0
pem-files*.pemread, write, delete4.0
key-files*.keyread, write, delete4.0
terraform-state*.tfstateread, write, delete4.0
cargo-credentials-store~/.cargo/credentials*read, write, delete4.0
git-credentials-store.git-credentialsread, write, delete4.0
git-credentials-store-xdg~/.config/git/credentialsread, write, delete4.0
ssh-dir~/.ssh/*write, delete, list3.0
env-file.envread, write, delete3.0
env-file-variants.env.*read, write, delete3.0
etc-system-write/etc/*write, delete3.0

Patterns are anchored

A pattern is compiled once, with its anchor preserved. /etc/* means the real /etc, not any directory called etc further down a path - so a vendored node_modules/aria-query/lib/etc/ does not match. *.pem globs the basename, so /p/.pem-notes/a.js does not match. ~/ resolves against the user's home directory.

Two rules carry an exclude list. .env and .env.* skip .env.example, .env.sample, .env.template, .env.dist and .env.defaults - committed scaffolding holds placeholders. .env.local and .env.production are deliberately not excluded; they routinely hold real secrets.

Every path a call touches is judged

A rename carries two paths, a link carries the target and the link name. Each is scored with its own operation and the worst result wins, so a link planted at a protected location is priced like the write it substitutes for.

Adding your own rules

Copy config/filters/paths.toml, add [[rules]] entries, and put the file at ./config/filters/paths.toml relative to the working directory the daemon starts in. That file replaces the shipped one outright - it is not merged - so start from a copy. There is no ~/.config/grith/filters/paths.toml layer. See Filter config files.

See also

Last updated: 2026-08-24Edit this page on GitHub →