#+TITLE: Find Email Workflow #+AUTHOR: Craig Jennings & Claude #+DATE: 2026-02-01 * Overview This workflow searches local maildir to find and identify emails matching specific criteria. Uses mu (maildir indexer) for fast searching. * Problem We're Solving Craig needs to find specific emails - shipping confirmations, receipts, correspondence with specific people, or messages about specific topics. Manually browsing mail folders is slow and error-prone. mu provides powerful search capabilities over the local maildir. * Exit Criteria Search is complete when: 1. Matching emails are identified (or confirmed none exist) 2. Relevant information is reported (subject, date, from, message path) 3. Craig has what they need to proceed (info extracted, or path for further action) * When to Use This Workflow When Craig says: - "find email about [topic]" - "search for emails from [person]" - "do I have an email about [subject]?" - "look for [shipping/receipt/confirmation] email" - Before extract-email workflow (to locate the target email) * The Workflow ** Step 0: Context Hygiene Before starting, write out the session context file and check with Craig whether we could compact the context. This might be a long process. If the context window collapses, we may forget important details. Writing out the session context prevents this data loss. ** Step 1: Ensure Mail is Current (Optional) If searching for recent emails, run sync-email workflow first: #+begin_src bash mbsync -a && mu index #+end_src Skip if Craig confirms mail is already synced. ** Step 2: Construct Search Query mu supports powerful search syntax: #+begin_src bash # By sender mu find from:jdslabs.com # By subject mu find subject:shipped # By date range mu find date:2w..now # last 2 weeks mu find date:2026-01-01.. # since Jan 1 # Combined queries mu find from:fedex subject:tracking date:1w..now # In specific folder mu find maildir:/gmail/INBOX from:amazon # Full text search mu find "order confirmation" #+end_src ** Step 3: Run Search #+begin_src bash mu find [query] #+end_src Default output shows: date, from, subject, path For more detail: #+begin_src bash mu find --fields="d f s l" [query] # date, from, subject, path mu find --sortfield=date --reverse [query] # newest first #+end_src ** Step 4: Report Results Report to Craig: - Number of matches found - Key details (date, from, subject) for relevant matches - Message path if Craig needs to extract or read it If no matches: - Confirm the search was correct - Suggest alternative search terms - Consider if mail needs syncing first * Search Query Reference | Field | Example | Notes | |----------+------------------------------+--------------------------| | from: | from:amazon.com | Sender address/domain | | to: | to:c@cjennings.net | Recipient | | subject: | subject:"order shipped" | Subject line | | body: | body:tracking | Message body | | date: | date:1w..now | Relative or absolute | | flag: | flag:unread | unread, flagged, etc. | | maildir: | maildir:/gmail/INBOX | Specific folder | | mime: | mime:application/pdf | Has attachment type | Combine with AND (space), OR (or), NOT (not): #+begin_src bash mu find from:amazon subject:shipped not subject:delayed #+end_src * Principles - **Sync first if needed** - Searching stale mail misses recent messages - **Start broad, narrow down** - Better to find too many than miss the target - **Use date ranges** - Dramatically speeds up searches for recent mail - **Report paths** - Message paths enable extract-email workflow * Living Document Update this workflow as we discover useful search patterns.