policy.json
~/.rematch/policy.json holds declared domains, caps, the omp profiles to skip on import, and the work/home export policy. An absent file means the defaults.
rematch policywrites it: an atomic replace that keeps the other keys.- With a profile, it is a link to
profile/config/policy.json.
| Key | Shape | Meaning | Written by |
|---|---|---|---|
domains |
[{"match": {"repo_remote": "...", "subpath": "..."}, "domain": "..."}] |
declared domains, first match wins; kept most specific first (with a subpath, then an exact remote, then globs) | rematch policy domain set|unset |
caps |
{"kept_per_domain": <n>} |
kept entries per top-level domain across branches (default 8) | rematch policy caps set kept_per_domain <n> |
skip_profiles |
["<profile>", …] |
omp profiles import --history skips, merged with --skip-profile |
— |
environment |
"work" or "home" |
missing ⇒ home; library export refuses at work unless export_enabled |
— |
export_enabled |
bool | allows library export at work |
— |
Example
Section titled “Example”On an empty root:
rematch policy domain set github.com/acme/web web.frontendrematch policy caps set kept_per_domain 6leaves:
{ "caps": { "kept_per_domain": 6 }, "domains": [ { "domain": "web.frontend", "match": { "repo_remote": "github.com/acme/web" } } ]}On a root without the file:
rematch policy show --textpolicy <root>/policy.json (absent)domains: none declaredcaps: kept_per_domain 8How declared domains are used: domains.