When using mutt I don't want all the messages to be cached, which could take up a lot of disk space. But if I purge an email, it also gets deleted on the server side, which is undesired because I may need to reference it in future. Is it possible to automatically clean up cached old messages when it's >100MB, while keeping those messages as they are on server and never retrieve them back to my laptop?
AFAIK you cannot do that directly in neomutt.
But in GMail and maybe other e-mail providers you can set limit for number of messages beeing fetched from folder/label over IMAP.
Forwarding and POP/IMAP (IMAP access section) under
Folder size limits
Limit IMAP folders to contain no more than this many messages