Configuration
Use .sweeprc to choose matches, exclusions, depth and cleanup size limits.
Sweep reads JSON from .sweeprc; no extension or YAML configuration is implied.
sweep init looks before it writes. It scans the folder (read-only), shows the
built-in artifacts it found and any opt-in names such as dist, .venv or
coverage, and in a terminal asks about each opt-in name. The file records
only your answers. Without a terminal, opt-in names are reported and left off.
sweep init --dry-run prints the file instead of writing it, and an existing
.sweeprc is never replaced without --force.
Or write one by hand:
{
"patterns": ["dist"],
"disabledPatterns": [".turbo"],
"ignore": ["packages/vendor-patched"],
"maxSizeGB": null,
"depth": -1
}dist is opt-in and remains dangerous because the name can contain authored work.
Do not add broad patterns such as * unless you understand every possible match.
| Field | Behavior |
|---|---|
patterns | Adds names or name globs to built-in defaults |
disabledPatterns | Subtracts patterns from the merged set |
ignore | Excludes artifact names, globs or relative path prefixes |
maxSizeGB | Optional deletion ceiling in GiB; defaults to null (no byte cap) |
depth | Discovery depth; defaults to -1, unlimited |
Use a number such as 600 to cap the reviewed selection at 600 GiB. null
explicitly disables an inherited byte cap; 0 permits only zero-byte selections.
Existing numeric caps remain effective. Override one run with
sweep ui . --max-size-gb 600 or deliberately use --max-size-gb none.
An uncapped run still confirms the exact selection and enforces path, identity,
mount and resource guards. Dry-run previews never require a byte-cap override.
maxSizeGB is a deletion policy, not a scan memory limit. Resource-budget
counters are not individual CLI flags or .sweeprc fields. Use
--resource-profile low-memory for smaller discovery and sizing allowances.
This controls logical admission; it does not cap the process RSS or UI memory.
Resolution order
For scalar settings, highest priority wins:
- Command-line options.
- Explicit
--configfile, when supplied. - Nearest project
.sweeprcfound by walking upward from the scan target, when no explicit--configfile is supplied. - Global config.
- Built-in defaults.
An explicit --config replaces the project-file layer; it does not add another
layer above the nearest .sweeprc. Global settings and built-in defaults still
apply. Pattern and ignore arrays merge and deduplicate across applicable layers;
disabled patterns are subtracted afterward. Scanning a nested project can inherit
an ancestor's config. Use sweep doctor . to investigate unexpected behavior.
Global config is ~/.config/sweep/config.json on Linux/macOS, honoring
XDG_CONFIG_HOME, and %APPDATA%\sweep\config.json on Windows.
SWEEP_CONFIG_DIR overrides the config directory and also determines history
storage. Use it for isolated automation.
On Linux/macOS, automatically discovered project and global config files must
be owned by the running user. This prevents another user's ancestor .sweeprc
from silently changing the selection policy. For a shared file you have reviewed,
pass --config PATH explicitly. Configs must be bounded regular JSON objects;
the same 1 MiB read limit applies to the UI pattern editor.
Unknown fields and non-object JSON are rejected. A misspelled ceiling cannot
silently fall back to an uncapped run.
Match rules
Patterns match entry names, not full paths. * matches zero or more characters;
? matches one character. For example, *.tsbuildinfo matches
tsconfig.tsbuildinfo. This is not shell brace expansion or a recursive **
path-glob interface.
Use an ignore prefix such as packages/vendor-patched to exclude a subtree;
a trailing slash is normalized. Preview any new pattern with sweep scan .
and inspect the resulting paths before cleanup.
In the UI, p opens the catalog. Names focus a pattern; its checkbox toggles it.
Choose Details to read a long pattern, Add to enter one, or Save (w)
to save your edits to .sweeprc. If the file exists, Sweep asks you to review
the pattern changes before saving. W opens the same review. Other settings,
such as ignores, scan depth and byte limits, are kept. A new nested config also
keeps settings inherited from its nearest ancestor project config, which remains
unchanged. If another editor changes
the file after review, Sweep refuses the save; review it again. This check does
not lock the file against an editor racing the final replacement.