Hi, I would like to create the following process: 1) if I tag any message with the keyword 'kill', it means that I don't want to see any message from whole thread in my inbox At the moment I do something like THREADS=$(notmuch search --output=threads tag:kill) [ -z "$THREADS" ] || notmuch tag -unread -- '(' $THREADS ')' 2) if there is such a 'killed' thread and it won't receive message for 30 days, I want to remove the kill tag from the thread That I achieved by something like N=notmuch KILL=$( $N search --output=threads tag:kill ) if [ -n "$KILL" ]; then # Then find threads which contain messages younger than 30 days KILL_RECENT=$( $N search --output=threads '(' $KILL ')' and date:30days.. ) KILL_RECENT=${KILL_RECENT:-'*'} # Then find 'kill' threads not matching those recent KILL_COUNT=$( $N count --output=threads '(' $KILL ')' and not '(' $KILL_RECENT ')' ) if [ $KILL_COUNT -gt 0 ]; then echo "Threads to remove 'kill': $KILL" $N tag -kill -- $( $N search --output=threads '(' $KILL ')' and not '(' $KILL_RECENT ')' ) fi fi I was thinking if it could not be simplified. Without knowing anything about notmuch or xapian internals, it seems that it would be handy to change the search pattern to return threads. My two previous examples would then read like 1) notmuch tag -unread -- 'threads(tag:kill)' and 2) notmuch tag -kill -- 'threads(tag:kill)' and not 'threads(date:30days..)' Given that this would be possible in the first place, wouldn't it be a nice addition to notmuch? Thank you -- Vlad