diff --git a/optional-skills/email/mail-auto-draft/SKILL.md b/optional-skills/email/mail-auto-draft/SKILL.md index 900c243f8..2f26e63d3 100644 --- a/optional-skills/email/mail-auto-draft/SKILL.md +++ b/optional-skills/email/mail-auto-draft/SKILL.md @@ -14,13 +14,15 @@ prerequisites: # Mail Auto-Draft with Himalaya -Build a local inbound email automation workflow that: +Build a practical local inbound email automation workflow that: - reads new mail from INBOX via Himalaya - classifies simple inbound requests - automatically replies only to safe standard cases - avoids self-reply loops - runs continuously via systemd user timers +This skill is intentionally optional. It is highly useful for users who want mailbox automation, but it depends on local mail account setup, machine-specific deployment choices, and provider-specific operational details. + ## When to Use Use this skill when the user wants to automate replies to inbound email on their own mailbox, especially on Ubuntu/Linux with Himalaya. @@ -33,6 +35,15 @@ Typical requests: This skill is for user-owned mailboxes, not agent-owned inboxes like AgentMail. +## Quick Reference + +Typical flow: +1. configure Himalaya for the mailbox +2. create or adapt `process_inbox.py` and `config.yaml` +3. test in draft mode +4. enable auto-send only for safe whitelisted categories +5. run continuously with a `systemd --user` timer + ## Requirements 1. Himalaya CLI installed @@ -228,6 +239,14 @@ Manual run: python3 process_inbox.py --limit 1 ``` +## Example Workflow + +Example use case: +- a user wants automatic replies for simple inbound messages such as information requests, lightweight appointment requests, or simple acknowledgements +- Hermes helps configure Himalaya and the local processing script +- the workflow only auto-sends safe standard categories +- anything uncertain stays out of the auto-send path + ## Troubleshooting ### It replies to itself repeatedly @@ -265,3 +284,4 @@ A successful setup should show: ## References - `references/production-checklist.md` +- `references/setup-commands.md` diff --git a/optional-skills/email/mail-auto-draft/references/setup-commands.md b/optional-skills/email/mail-auto-draft/references/setup-commands.md new file mode 100644 index 000000000..1d1e9c198 --- /dev/null +++ b/optional-skills/email/mail-auto-draft/references/setup-commands.md @@ -0,0 +1,105 @@ +# Setup Commands + +Concrete command sequence for setting up a local Himalaya-based mail auto-reply workflow. + +## 1. Verify tools + +```bash +himalaya --version +python3 --version +systemctl --user --version +python3 -c "import yaml, requests" +``` + +## 2. Create project directories + +```bash +PROJECT_DIR="$HOME/Projekte/Automation/mail-auto-draft" +mkdir -p "$PROJECT_DIR"/{drafts,logs,data,runtime,prompts,deploy/systemd} +``` + +## 3. Create local secrets file + +```bash +mkdir -p "$HOME/.config/mail-auto-draft" +chmod 700 "$HOME/.config/mail-auto-draft" +cat > "$HOME/.config/mail-auto-draft/secrets.env" <<'EOF' +GMAIL_APP_PASSWORD='YOUR_APP_PASSWORD' +EOF +chmod 600 "$HOME/.config/mail-auto-draft/secrets.env" +``` + +## 4. Configure Himalaya for Gmail + +Example auth commands inside `~/.config/himalaya/config.toml`: + +```toml +backend.auth.cmd = "sh -lc '. $HOME/.config/mail-auto-draft/secrets.env && printf %s \"$GMAIL_APP_PASSWORD\"'" +message.send.backend.auth.cmd = "sh -lc '. $HOME/.config/mail-auto-draft/secrets.env && printf %s \"$GMAIL_APP_PASSWORD\"'" +``` + +## 5. Validate script syntax + +```bash +cd "$PROJECT_DIR" +python3 -m py_compile process_inbox.py +``` + +## 6. Test in draft mode + +```bash +cd "$PROJECT_DIR" +python3 process_inbox.py --mode draft --limit 5 +``` + +Review: +- drafts in `drafts/` +- logs in `logs/mail_actions.jsonl` + +## 7. Test in auto mode with one mail + +```bash +cd "$PROJECT_DIR" +python3 process_inbox.py --mode auto --limit 1 +``` + +## 8. Install systemd user units + +```bash +PROJECT_DIR="$HOME/Projekte/Automation/mail-auto-draft" +mkdir -p "$HOME/.config/systemd/user" +sed "s|__PROJECT_DIR__|$PROJECT_DIR|g" "$PROJECT_DIR/deploy/systemd/mail-auto-draft.service" > "$HOME/.config/systemd/user/mail-auto-draft.service" +cp "$PROJECT_DIR/deploy/systemd/mail-auto-draft.timer" "$HOME/.config/systemd/user/mail-auto-draft.timer" +systemctl --user daemon-reload +systemctl --user enable --now mail-auto-draft.timer +``` + +## 9. Start and inspect background processing + +```bash +systemctl --user start mail-auto-draft.service +systemctl --user status mail-auto-draft.timer --no-pager +systemctl --user status mail-auto-draft.service --no-pager +journalctl --user -u mail-auto-draft.service -n 50 --no-pager +``` + +## 10. Day-to-day commands + +Manual run: + +```bash +cd "$PROJECT_DIR" +python3 process_inbox.py --limit 1 +``` + +Stop timer: + +```bash +systemctl --user stop mail-auto-draft.timer +``` + +Restart timer: + +```bash +systemctl --user restart mail-auto-draft.timer +```