How to Turn Your Email into a Personal Knowledge Base
On this page
Email holds instructions, decisions, and explanations you may need again. A personal knowledge base is a collection of useful information you can find, understand, and reuse. You do not need to sort every message into folders. Keep the original emails, and write short notes about messages with information you want to remember and use again.
For a portable local archive, mailmd is the best fit. It copies email into Markdown files, a plain-text format that works with editors and note apps, on your computer. You can search the archive to find your emails. Summaries and notes help you reuse information from selected messages.
Start with questions you will ask again #
Organize around future needs, such as “What did we decide?” or “Where are the setup instructions?” Save messages with reusable directions, important decisions, or details that would be hard to reconstruct. Leave ordinary correspondence in your mailbox unless it has lasting value.
A field study tracked 345 people who had used email for a long time as they tried to find messages again more than 85,000 times. It found that elaborate filing did not help people find messages, while search and conversation threads did. The study supports keeping organization lightweight, though it does not establish one ideal approach for everyone. The email-refinding study
Use your email service’s search before adding more labels or folders. In Gmail, searches such as from:alex@example.com and subject:handoff narrow results by sender or subject. Gmail’s search operators explain more options. Gmail archiving removes a message from the inbox while keeping it in All Mail, so it remains available for search. (How Gmail archiving works)
Build a local archive with mailmd #
mailmd is free, open-source software that you run by typing commands. It reads email through IMAP, a common way for software to access mail stored by a provider. It also connects to Gmail through the Gmail API and to Outlook.com or other Microsoft email through Microsoft Graph. Gmail and Microsoft API connections require your own OAuth app, a sign-in setup that grants mail access without giving mailmd your account password. (mailmd and its setup instructions)
On macOS, Linux, or Windows in Git Bash, install mailmd and connect your account. Choose the connection command that matches your mailbox:
curl -fsSL https://raw.githubusercontent.com/vincentsch/mailmd/main/install.sh | sh
mailmd connect imap --email you@example.com
mailmd connect gmail --client-secret client_secret.json
mailmd connect outlook --client-id <id>
mailmd syncUse the IMAP command for IMAP mailboxes, including Gmail with an app password. Many IMAP providers require an app password, and mailmd indicates when one is needed. For Gmail API access, create the OAuth app in Google Cloud; for Outlook.com or other Microsoft email, use Microsoft Entra. Then run the matching connect command and sync. Messages go into ~/mail/<account>.
Each email becomes a Markdown file, with headers such as the sender and subject stored as metadata about the message. Emails formatted with HTML become readable Markdown. Attachments sit next to their messages, and folders and years become directories on your computer. mailmd reads mail without marking it as read, and it does not move, delete, or send messages. Spam and trash are excluded unless requested. For Gmail over IMAP, it includes All Mail, so archived messages are included.
Turn selected messages into notes #
The archive preserves correspondence; a short note captures what you learned from it. When a message or thread answers a question you expect to face again, record the conclusion and enough details to find the original, such as sender, subject, and date. For example, a note about a recurring technical fix could state the steps that worked and link back to the email that explains them.
Search the archived files with an editor or a text-search command such as rg -i "handoff" ~/mail. mailmd does not include a search engine. You can also open the files in a note app, or use index.jsonl, a file listing the messages, with scripts.
Review your notes from time to time. Check new messages, mark outdated instructions, and make sure search still finds important emails. Personal knowledge management means finding useful information, saving it, organizing it, and using it. It works best when your notes reflect what you need, rather than trying to file everything. (University of Rhode Island’s introduction to personal knowledge management)
Keep the archive current and protect it #
Run mailmd sync to add new mail. It also updates whether messages are marked as read or starred. To keep the archive current, use a tool that runs commands automatically, such as cron, systemd, launchd, or Task Scheduler, to schedule mailmd sync --quiet. If you stop a sync with Ctrl-C, the files already saved remain, and the next sync picks up where it stopped. mailmd never deletes archived files. If you later delete a message from the mail server, its archived file remains and is marked to show that the server copy was deleted.
mailmd saves login details outside the archive. Only your user account can read them, but mailmd does not encrypt them. The archive stays on your computer, and mailmd does not send it to a mailmd server. Include the archive in your usual backups, and consider who can access them. If a coding agent reads your mail folder, it sends the content it reads to its model provider. Check your employer’s rules before connecting or exporting a work mailbox.
Free and open source
Try mailmd
mailmd is a free command-line tool that copies your email into Markdown files on your computer, one file per message. It works with any IMAP mailbox, and with Gmail and Outlook through their own APIs.
Install
$ curl -fsSL https://raw.githubusercontent.com/vincentsch/mailmd/main/install.sh | sh
Set it up with your coding agent
Set up mailmd so you can read my email. Use https://github.com/vincentsch/mailmd: read its AGENTS.md and follow the steps. Connect my mailbox and run the first sync. Then show me where the files are.