dtk
Drush DTK - the "Drush Token Killer" - provides token-saving output defaults for common Drush commands. Inspired by RTK (the "Rust Token Killer"), it shrinks the output of frequently-run, read-only Drush commands so that AI agents (and humans) spend far fewer tokens reading them.
It works with lightweight Drush hooks that, when you have not asked for specific output yourself, select a compact set of fields and force CSV to drop the wide ASCII table chrome. No commands are added for everyday use - the module only alters the output of existing core and contrib Drush commands.
How it works
Each supported command has an INITIALIZE hook that sets sensible defaults (--fields and/or --format=csv) before the command runs. config:status also has an ALTER_RESULT hook that rewrites its verbose state strings to short tokens. The original commands and their behaviour are otherwise untouched.
Compressed commands
Command Default applied Savingspm:list (pml)
--status=enabled|disabled → --fields=name; otherwise --fields=name,status; CSV
up to 90%
core:requirements (rq)
--severity=1 (warnings + errors only), --fields=title,severity, CSV
up to 97%
config:status (cst)
CSV + state tokens (see below)
up to 45%
views:list (vl)
--fields=machine-name,status, CSV
up to 80%
watchdog:show (ws)
--fields=type,severity,message, CSV
up to 50%
role:list (rls)
--fields=rid,label, CSV (native default is YAML)
up to 50%
queue:list
CSV
small
migrate:status (ms)
CSV
varies
field:info (fi)
CSV
varies
config:status state tokens
The verbose state strings are collapsed to single tokens:
Original Token MeaningOnly in DB
only_db
In active storage, not in the sync dir - would be deleted on config:import; export with config:export to keep it.
Only in sync dir
only_sync
In the sync dir, not in active storage - would be created on config:import.
Different
different
Exists in both but differs - config:import overwrites the DB, config:export overwrites the file.
The --state filter still works with the original strings (e.g. drush config:status --state='Only in DB'), because the tokenisation runs after the command has already filtered.
Opting out
Add --no-ai-compress to any command to get its native, uncompressed output:
drush pml --no-ai-compressCompression is also skipped automatically whenever you choose your own output, i.e. you pass --field or --fields (and, for format, any --format other than the command's native default).
Limitations
- Pre-bootstrap commands cannot be compressed. Commands that run before Drupal's modules load - notably
core:statusandcache:rebuild(cr) - never receive this module's hooks.core:status --no-ai-compresseven reports "option does not exist". This is inherent to module-provided Drush hooks. config:import/config:exportpreviews are not reformatted. Those commands print their change preview as a hardcoded Symfony Console table straight to the terminal, mid-command, before the confirmation prompt - there is no formatter hook to retarget it. To preview pending config changes as CSV, useconfig:statusinstead (itsonly_sync/only_db/differenttokens are the same information framed as create / delete / update).
Requirements
- Drupal ^11
- Drush 13+
Installation
drush en drush_dtk drush cr