Skip to content

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.

A profile is a saved baseline for dmd clean.

Instead of typing:

Terminal window
dmd clean --include-ids <id> --keep-within 2w --keep-last 20 --preserve-cache --dry-run

every time, you can store that shape once and run:

Terminal window
dmd clean --profile nightly-dms

CLI flags still override the profile for that run:

Terminal window
dmd clean --profile nightly-dms --keep-last 5 -vv

List configured profiles:

Terminal window
dmd list profiles

Inspect available field names and value types:

Terminal window
dmd profile fields

For exact accepted value formats, see Value Formats.

Create a profile:

Terminal window
dmd profile add nightly-dms \
--set include_ids=<id> \
--set keep_within=2w \
--set preserve_cache=true

For 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:

Terminal window
dmd profile show nightly-dms

Update it later:

Terminal window
dmd profile update nightly-dms --set verbose=2 --unset fetch_within max_messages

Remove it when you no longer need it:

Terminal window
dmd profile remove nightly-dms

If you want a full recurring-maintenance example, continue with Recurring Cleanup with Profiles.

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.

Effective settings are resolved in this order:

  1. built-in CLI defaults
  2. profile values
  3. 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.

Profile management commands keep command-output flags separate from stored profile values.

That means:

  • --json, --quiet, and -v affect the command you are running now
  • stored profile values are written through --set key=value

Examples:

Terminal window
dmd profile add nightly-dms --json \
--set include_ids=<id> \
--set keep_last=20 \
--set dry_run=true
dmd profile update nightly-dms --set verbose=1 --unset fetch_within

In the first example:

  • --json changes the output format of profile add
  • include_ids, keep_last, and dry_run are written into the stored profile

--set uses stored snake_case field names directly.

Examples:

Terminal window
--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=false

Detailed 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:

Terminal window
dmd profile update nightly-dms --set max_messages=none

You can inspect the live supported field list directly with:

Terminal window
dmd profile fields

Profiles can define cleanup behavior and run-style settings for dmd clean, including:

  • include_ids
  • exclude_ids
  • keep_last
  • keep_last_scope
  • keep_within
  • fetch_within
  • max_messages
  • buffer_per_channel
  • keep_reactions
  • preserve_cache
  • preserve_cache_path
  • max_retries
  • retry_time_buffer
  • fetch_sleep_time
  • delete_sleep_time
  • dry_run
  • quiet
  • verbose
  • json
  • redact_sensitive
  • redact_names

Not allowed:

  • token
  • config_path
  • profile
  • version

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

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"
}
}
}