Profiles
Profiles let you store named dmd clean presets in config.json.
Use profiles when:
- you keep repeating the same cleanup command
- you want a reusable preset with retention and output defaults
- you want a cleaner base for recurring maintenance later
Do not reach for profiles too early if you are still learning the tool. For a first manual run, use First Run first.
The idea
Section titled “The idea”A profile is a saved baseline for dmd clean.
Instead of typing:
dmd clean --include-ids <id> --keep-within 2w --keep-last 20 --preserve-cache --dry-runevery time, you can store that shape once and run:
dmd clean --profile nightly-dmsCLI flags still override the profile for that run:
dmd clean --profile nightly-dms --keep-last 5 -vvBasic profile workflow
Section titled “Basic profile workflow”List configured profiles:
dmd list profilesInspect available field names and value types:
dmd profile fieldsFor exact accepted value formats, see Value Formats.
Create a profile:
dmd profile add nightly-dms \ --set include_ids=<id> \ --set keep_within=2w \ --set preserve_cache=trueFor include_ids and exclude_ids, profile commands accept full IDs or unique ID suffixes.
They validate those values through Discord and store full IDs in config.json.
When scope fields are set, profile commands use your stored login, DISCORD_TOKEN, or --token for validation.
Show what is stored:
dmd profile show nightly-dmsUpdate it later:
dmd profile update nightly-dms --set verbose=2 --unset fetch_within max_messagesRemove it when you no longer need it:
dmd profile remove nightly-dmsIf you want a full recurring-maintenance example, continue with Recurring Cleanup with Profiles.
Config structure
Section titled “Config structure”Profiles live under the top-level profiles object in config.json.
Example:
{ "profiles": { "nightly-dms": { "include_ids": ["123456789012345678"], "keep_last": 0, "keep_last_scope": "all", "keep_within": "2w", "preserve_cache": true, "verbose": 1 } }}Profile config supports both canonical JSON values and compact input forms. Profile commands may rewrite compact forms into canonical JSON.
The important rule: --set is an input format, not a promise that the exact text is preserved in config.json.
See Value Formats for the exact normalization rules.
Merge order
Section titled “Merge order”Effective settings are resolved in this order:
- built-in CLI defaults
- profile values
- explicit CLI flags
That means the profile is a base preset, not a lock. If you add a flag on the command line, the command line wins.
Managing profiles from the CLI
Section titled “Managing profiles from the CLI”Profile management commands keep command-output flags separate from stored profile values.
That means:
--json,--quiet, and-vaffect the command you are running now- stored profile values are written through
--set key=value
Examples:
dmd profile add nightly-dms --json \ --set include_ids=<id> \ --set keep_last=20 \ --set dry_run=truedmd profile update nightly-dms --set verbose=1 --unset fetch_withinIn the first example:
--jsonchanges the output format ofprofile addinclude_ids,keep_last, anddry_runare written into the stored profile
--set Values
Section titled “--set Values”--set uses stored snake_case field names directly.
Examples:
--set keep_last=20--set keep_within=2w--set preserve_cache=true--set include_ids=123,456--set retry_time_buffer=25,35--set redact_sensitive=4--set redact_names=falseDetailed parsing rules live in Value Formats.
For dmd profile update --set, none removes nullable fields such as fetch_within and max_messages from the profile:
dmd profile update nightly-dms --set max_messages=noneAllowed fields
Section titled “Allowed fields”You can inspect the live supported field list directly with:
dmd profile fieldsProfiles can define cleanup behavior and run-style settings for dmd clean, including:
include_idsexclude_idskeep_lastkeep_last_scopekeep_withinfetch_withinmax_messagesbuffer_per_channelkeep_reactionspreserve_cachepreserve_cache_pathmax_retriesretry_time_bufferfetch_sleep_timedelete_sleep_timedry_runquietverbosejsonredact_sensitiveredact_names
Not allowed:
tokenconfig_pathprofileversion
Omitted fields
Section titled “Omitted fields”If a profile should not set something, omit the field entirely.
Do not use null.
- missing field: the profile makes no statement
- present field: the profile intentionally overrides the default
- to remove nullable fields through the CLI, use
dmd profile update --set field=none
Preserve-cache behavior
Section titled “Preserve-cache behavior”If a profile enables preserve-cache and does not set preserve_cache_path, the CLI derives a profile-specific default path automatically.
That prevents multiple profiles from accidentally sharing the same preserve cache file.
You can still override the path explicitly:
{ "profiles": { "nightly-dms": { "preserve_cache": true, "preserve_cache_path": "/tmp/nightly-dms-cache.json" } }}