flake-update-20260201

name: Email description: Maildir email management with mu indexing and mbsync synchronization. USE WHEN searching emails, analyzing mail patterns, working with Maildir folders, querying personal (icloud) or work (redhat) emails, extracting email information, or managing email workflows.

Email

Expert guidance for working with Maildir-format email repositories using mu for indexing/searching and mbsync for synchronization.

Context Detection

This skill activates when:

  • User wants to search emails or query the email repository
  • User asks about email patterns, threads, or analysis
  • User is working in /home/vincent/desktop/mails/ directory
  • User mentions mu, mbsync, or Maildir
  • User asks about personal (icloud) or work (redhat) emails
  • User needs to extract information from emails
  • User wants to analyze email data or statistics

Core Tools

mu (Mail Indexer)

Primary tool for searching and querying emails:

  • mu find - Search emails with powerful query language (read-only, works while mu4e is running)
  • mu view - View email content (read-only, works while mu4e is running)
  • mu extract - Extract attachments (read-only, works while mu4e is running)
  • mu index - Reindex Maildir (WRITE operation, blocked when mu4e is running)
  • mu server - Start mu server for clients (used by mu4e, holds write lock)

Available in nixpkgs as mu (version 1.12.13).

Important - Database Locking:

  • mu server (used by mu4e) holds a persistent write lock on the Xapian database
  • Read operations (mu find, mu view, mu extract) work while mu4e is running
  • Write operations (mu index) are blocked when mu4e is running
  • See reference/DatabaseLocking.md for detailed information and workarounds

isync/mbsync

IMAP synchronization tool:

  • Syncs emails from IMAP servers to local Maildir
  • Two-way synchronization support
  • Handles multiple accounts

Available in nixpkgs as isync (version 1.5.1).

mblaze

Unix utilities for Maildir processing:

  • Command-line tools for mail manipulation
  • Composing, threading, filtering
  • Alternative to traditional MUAs

Available in nixpkgs as mblaze (version 1.3).

Helper Tools

Located in tools/:

Tool Purpose Safe with mu4e?
smart-reindex.sh Intelligently reindex (detects mu4e, uses emacsclient if needed) ✅ Yes
check-mu-lock.sh Check if mu database is locked ✅ Yes (read-only)
archive-emails.sh Archive emails with smart reindexing ✅ Yes
ExtractAttachments.sh Extract attachments from emails ✅ Yes (read-only)

Usage in scripts:

# Check if safe to run mu index
if ~/.config/claude/skills/Email/tools/check-mu-lock.sh; then
    mu index  # Safe
else
    echo "mu4e is running"
fi

# Or just use smart reindex
~/.config/claude/skills/Email/tools/smart-reindex.sh

Workflow Routing

Workflow Trigger File
Search “search emails”, “find messages”, “query mail” workflows/Search.md
View “view email”, “show message”, “read email” workflows/View.md
Analyze “analyze emails”, “email statistics”, “mail patterns” workflows/Analyze.md
Extract “extract attachment”, “get attachments”, “save files from email” workflows/Extract.md
Archive “archive emails”, “clean inbox”, “remove old emails” tools/archive-emails.sh

Reference Documentation

Topic File
Database Locking reference/DatabaseLocking.md - Detailed locking behavior, workarounds, troubleshooting
Alternatives reference/Alternatives.md - Comparison of mu, notmuch, mairix, and migration guidance

Repository Structure

The email repository at /home/vincent/desktop/mails/ contains:

  • icloud/ - Personal email account
  • redhat/ - Work email account organized by projects
  • drafts/ - Draft messages

Critical: Always treat personal (icloud) and work (redhat) emails differently in terms of privacy and context.

mu Query Language

Quick reference for mu search queries:

# By sender/recipient
mu find from:sender@example.com
mu find to:recipient@example.com

# By subject/body
mu find subject:keyword
mu find body:text

# By date
mu find date:today
mu find date:20250101..20250131

# By maildir (folder)
mu find maildir:/icloud/Inbox
mu find maildir:/redhat/knative

# By flags
mu find flag:unread
mu find flag:flagged

# Boolean operators
mu find from:alice AND subject:important
mu find maildir:/redhat/* OR maildir:/icloud/Inbox

# Attachments
mu find attach:*.pdf
mu find attach:report

Best Practices

Searching

  • Always use mu find - Never use grep directly on email files
  • Use maildir: to scope searches to specific folders
  • Combine queries with AND/OR for precise results
  • Use –format=json for structured data processing
  • Safe while mu4e is running - All search operations are read-only

Archiving

  • Personal emails (icloud): Move to year-based folders icloud/Archives/YYYY/
  • Work emails (redhat/Gmail): Simply delete from Inbox (remains in Gmail All Mail)
  • Archive tool: Use archive-emails.sh for bulk archiving (handles locking automatically)
  • Smart reindexing: The archive tool detects mu4e and uses emacsclient if needed

Concurrent Access

  • Safe to run while mu4e is open: mu find, mu view, mu extract, mu cfind
  • Blocked while mu4e is open: mu index (use smart-reindex.sh instead)
  • In scripts: Use smart-reindex.sh or check-mu-lock.sh to handle locks
  • Read-only operations: No locking concerns, run freely

Reindexing

  • After external changes: Use smart-reindex.sh (handles mu4e detection)
  • Manual indexing: mu index works when mu4e is closed
  • While mu4e is running: Run (mu4e-update-index) in Emacs
  • From scripts: Use the smart-reindex.sh helper tool

Privacy

  • Keep personal (icloud) and work (redhat) queries separate
  • Be mindful of sensitive information in emails
  • Don’t mix personal and work contexts

Performance

  • mu maintains its own index for fast searches
  • Use specific maildir paths to speed up searches
  • Incremental indexing is fast (only new messages scanned)

Examples

Example 1: Search work emails about Kubernetes

User: "Find all emails about Kubernetes in my work account"
→ Invokes Search workflow
→ Uses: mu find maildir:/redhat/kubernetes/*

Example 2: Analyze email patterns

User: "Show me email volume by month from my manager"
→ Invokes Analyze workflow
→ Uses mu find with date queries and JSON output
→ Processes results to generate statistics

Example 3: Extract attachments from thread

User: "Extract all PDFs from emails about the Q4 report"
→ Invokes Extract workflow
→ Searches for relevant emails
→ Uses mu extract to save attachments

Integration

This skill works with:

  • Nix skill - For managing mu/mbsync installations
  • CORE skill - For workflow preferences
  • Standard shell tools for data processing (jq, awk, etc.)