awarer

scan inputs and ignore rules

awa v0.7.0 · slug ignores

On this page

awa scans the worktree for two purposes: history (checkpoints, changes, diff) and run input (the files a wrapped command could read). Both honor these production defaults:

  • .awa/ and .git/ are always protected and never scanned; ordinary config cannot re-include them.
  • Baseline excludes (build/dependency caches such as node_modules, target, __pycache__, .venv, and similar) apply to both history and run input.
  • History-only excludes (dist, build, coverage) apply to checkpoints/diff but NOT to run input — a build or test must still see them, so they do not affect run cache keys.
  • .awaignore is ON by default (awa's native ignore source).
  • .gitignore is OFF by default. It answers "what should not be committed", not "what can affect a command", so a gitignored file is still a real run input.

Because .gitignore is off by default, awa run sees files git ignores unless an awa rule (protected path, baseline exclude, or .awaignore) excludes them.

Which layer am I looking at

.awa/ and .git/ are a hard boundary: no rule or scope re-includes them. Every other exclusion is an ordinary rule, applied from lowest to highest priority, and the last matching rule decides:

  1. Baseline excludes — dependency and cache directories, for both history and run input.
  2. History-only excludes — dist, build, coverage. Hidden from checkpoints, changes, and diff; never hidden from run input, because a build or test must still see them.
  3. Config excludes — extra_excludes in [scope], then in [history] or [run] for that family.
  4. .gitignore, when enabled — from the project root down to deeper directories.
  5. .awaignore — from the project root down to deeper directories.

A higher source wins whatever its depth: a root .awaignore rule overrides a nested .gitignore. Within one source a deeper file overrides a shallower one and a later line an earlier one. Baseline and config excludes are therefore defaults, not a privacy boundary: !keep.log in .awaignore re-includes a file that extra_excludes = ["*.log"] excluded. To keep a file's bytes out of checkpoints whatever the scope, see awa help privacy.

An explicitly narrowed scope outranks excludes for the narrowed subtree: if you ask for a specific path with scope.include or --scope, you get it. The default scope of the whole project does not have that effect.

The built-in layers are not listed in any config file, because they are product defaults rather than project policy. To see the lists that are actually in force, including the built-ins and which layer each value came from:

awa config effective

Why .gitignore is not the input boundary

The two questions are different. .gitignore answers "what should not be committed"; awa's run scan must answer "what can affect this command". Generated files, local fixtures, and secrets are routinely gitignored and routinely change what a command does, so keying on git's answer would produce false cache hits — exactly the failure the cache is designed to avoid.

Turning .gitignore on (use_gitignore in [scope] or [run]) is therefore a deliberate decision to stop keying on those files, not a tidiness setting.

Ignored paths are outside the evidence

An excluded path is not scanned, so its content is not observed: it has no entry in a checkpoint or in a recorded run's before/after states, it is not in changes or diff output or a run input key, and awa cannot restore it. What a record does keep is the name of each excluded entry the scan met, as the boundary where observation stopped. Nothing below a pruned directory is listed, but those names can themselves be sensitive (see awa help privacy).

That is the intended trade, but it has a consequence worth stating plainly: a change confined to ignored paths is no change in awa changes and awa diff. When that matters — reviewing generated output, or checking what a formatter touched — either narrow the scope explicitly to include those paths, or use the project's own tooling instead of a checkpoint delta. Watched effect roots are observed separately for run reuse, as described below.

Effect roots vs excludes

The central run-cache decision for a generated or scratch directory:

  • The command writes output you need afterwards, or has side effects (deploy, migration, formatter, live probe) → awa run --record. A replay recreates no files, so it could report success with the output missing.
  • One exact check rewrites a directory whose prior contents cannot change its result and whose files are not needed after a replay → a [[run.validation]] policy for result-only reuse (awa help validation). Both assertions must hold; awa checks neither.
  • The command only reads a generated directory the run input scan no longer sees → [run].extra_effect_roots, so later changes to it invalidate reuse.
  • The input scan still sees that directory → configure nothing; its contents already key the run.
  • No command's result depends on the path, even if one writes it (scratch, logs) → [run].extra_excludes or .awaignore.

An effect-root selector is literal, never a glob: a name such as extra_effect_roots = ["bin"] matches at any depth, for example across monorepo packages; a path such as ["artifacts/bin"] matches only there, not other/bin or other/artifacts/bin.

Rules:

  • Writing to a watched root during the run makes the result non-reusable, unless a matched validation policy waives that exact directory.
  • The watched set is the built-in effect roots plus extra_effect_roots. An exclude neither silences a watched root nor is watched itself, so an excluded, unwatched directory is invisible to the cache for every command.
  • Never exclude a real dependency to get hits: a miss is cheaper than a false hit.
  • awa will not auto-edit config to improve the cache hit rate.

Pattern semantics

.awaignore, an enabled .gitignore, the extra_excludes lists, and [checkpoint].hash_only_patterns share one case-sensitive pattern language, Git's own ignore pattern format:

  • A name without a slash (*.log, cache) matches at any depth. A leading or inner slash anchors the pattern to the directory that declares it: foo/bar and /foo/bar both match only there, never deep/foo/bar. Config lists are declared at the project root; a nested ignore file declares at its own directory.
  • * and ? never match a slash and ? matches exactly one character. **, character classes, and backslash escapes work as in Git. A trailing slash matches directories only. Blank lines and lines starting with # are ignored, as are trailing spaces not escaped with a backslash.
  • The last matching rule decides, and a leading ! reverses it.
  • Scanning prunes an excluded directory, so a ! rule for something inside it cannot bring that back; re-include the directory itself. hash_only_patterns never prunes: it selects among files already scanned, a matching directory selects every file below it, and a later ! rule un-selects one file or a whole directory (*.env then !fixtures/). It is matched against the project-relative path a followed symlink is reached by, and never changes what is scanned.
  • A pattern Git would never match (an unclosed [, a lone trailing backslash, a bare ! or /) matches nothing. In an ignore file or an extra_excludes list awa keeps running and warns on stderr with the file and line or the key and element index, from every command that scans. awa config validate warns about the config lists; awa doctor reports those and the root ignore files (see awa help doctor). In hash_only_patterns it is a configuration error: a rule that silently selected nothing would store the bytes it was written to keep out.
  • Each config list element is one pattern. An element containing a line feed is a configuration error in every list; write it as separate elements. Trailing carriage returns of an extra_excludes element are dropped and one inside the pattern is literal; hash_only_patterns refuses carriage returns too. Line endings of the TOML file do not matter.
  • awa run --exclude takes such a pattern too, not a literal path. From the project root, --exclude name matches name at any depth and --exclude dir/name only at the root; *, ?, [, and a leading # or ! keep their meaning. Quote the pattern so the shell does not expand it.

Other lists are not patterns:

  • [run].extra_effect_roots — literal selectors, never globs, in one of two forms. A single segment is a directory NAME matched by basename wherever it appears: "target" watches every target/. A slash-separated project-relative PATH matches that one location only: "artifacts/bin" watches artifacts/bin and neither other/bin nor other/artifacts/bin. Matching is case-sensitive and / is the separator on every platform. A backslash, a volume spelling, and a ./.. component are rejected in either form; a path is also rejected when it begins or ends with a slash, holds an empty component, or names .git or .awa.

Use awa config effective to see the resolved effective lists and the layer each value came from.

See also