Also see notmuch [1] for a frontend-agnostic tagging/search system that also works great for multi-gigabyte maildirs. I use it with the Emacs client and lieer [2] for populating the maildir and syncing tags with Gmail labels using the Gmail API, which is a lot more reliable than offlineimap for me.
[1]: https://notmuchmail.org/
[2]: https://github.com/gauteh/lieer