Files
agent-prod/skills/lead-inbox/references/einrichten.md
T

76 lines
6.4 KiB
Markdown
Raw Normal View History

# One-time setup (`/lead-inbox einrichten`)
Five steps, in this order. Each step is shown to Sascha with what it will change and waits for its own approval. Facts (folder list, cut-off date, rule table) come from `/home/sascha.koenig/ap/PM/.okf/systems/outlook.md`; after each step set the matching `Status` there (an OKF change, shown with the step and validated with the `validate` skill).
Before step 1 note `manage_mail_folder(action='get_details')` for `Inbox` and `Archive` (total and unread). The numbers go into the final report.
## 1. Folders
`manage_mail_folder(action='list')`, then for each missing folder of the table "Ordner": `manage_mail_folder(action='create', folder_name='<Name>', parent_folder='Inbox')`. Existing folders are skipped, never renamed.
**Done when** `list` shows all six folders under `Inbox`.
## 2. Backlog cut-off
Everything received before the cut-off date goes to `Archive` unseen. The connector moves at most one fetch (100 mails) at a time, so loop:
1. `search_emails(folder='Inbox', inference_classification='all', start_date='2015-01-01', end_date='<day before cut-off>T23:59')`.
2. Read all pages with `browse_email_cache(mode='llm')`; collect every cache number and note the first mail (received time, subject).
3. `manage_emails(action='archive_multiple', cache_numbers=[…all numbers of this fetch…])`.
4. Compare the returned count of moved mails with the fetch's `count`.
5. Next fetch.
Stop and report when `failed_count > 0`, or when two fetches in a row start with the same first mail (the move did not take effect). Tell Sascha the progress every five batches. With about 3,500 mails expect about 35 batches.
**Done when** the search returns `count: 0`, and `Inbox` + `Archive` totals equal the totals noted before the step (name any difference; new mail arriving meanwhile explains a few).
## 3. Presort from the cut-off date
Read the mails from the cut-off date to today day by day, as in step 1 of `SKILL.md`. Every mail matching a row in `muster.md` with a target folder becomes part of one batch item per folder. Present the batch items (count plus the list of subjects per folder), and after approval move them with `manage_emails(action='move_single', cache_number=<n>, destination_folder='Inbox/<Name>')`, finding each day's mails again first as `ausfuehren.md` describes. Rows marked "stays in `Inbox`" are left alone.
**Done when** no mail with `[Ticket#` in the subject is left in `Inbox`, and a sample of ten mails per target folder fits its pattern. What remains is the input of the first triage run.
## 4. Outlook rules
The connector cannot create rules, and the skill runs none of the commands below. Give Sascha both forms:
- the rule table from `systems/outlook.md`, for clicking the rules together in Outlook, and
- the Exchange Online PowerShell block below, filled from that table. The table decides; if it differs from this block, follow the table and say so.
```powershell
Connect-ExchangeOnline -UserPrincipalName sascha.koenig@azintec.com
$mb = "sascha.koenig@azintec.com"
# Folder names depend on the mailbox language. Check the real paths first:
Get-MailboxFolderStatistics $mb -FolderScope Inbox | ft Name,FolderPath
# If the inbox is shown as /Posteingang, replace "Inbox" below accordingly.
New-InboxRule -Mailbox $mb -Name "lead-inbox 01 Helpdesk" -FromAddressContainsWords "bot@az-gruppe.com" -SubjectContainsWords "[Ticket#" -MoveToFolder "${mb}:\Inbox\Helpdesk" -StopProcessingRules $true -WhatIf
New-InboxRule -Mailbox $mb -Name "lead-inbox 02 Alarme" -FromAddressContainsWords "MSSecurity-noreply@microsoft.com","Office365Alerts@microsoft.com","budgets@costalerts.amazonaws.com","quarantine@messaging.microsoft.com" -MoveToFolder "${mb}:\Inbox\Alarme" -StopProcessingRules $true -WhatIf
New-InboxRule -Mailbox $mb -Name "lead-inbox 03 Belege" -SubjectContainsWords "Invoice","Zahlungsbeleg","receipt","Neue Rechnungen sind jetzt verfügbar" -ExceptIfFromAddressContainsWords "@azintec.com" -MoveToFolder "${mb}:\Inbox\Belege" -StopProcessingRules $true -WhatIf
New-InboxRule -Mailbox $mb -Name "lead-inbox 04 Kalender" -MessageTypeMatches CalendaringResponse -MoveToFolder "${mb}:\Inbox\Kalender" -StopProcessingRules $true -WhatIf
New-InboxRule -Mailbox $mb -Name "lead-inbox 05 Newsletter" -FromAddressContainsWords <newsletter senders from muster.md, quoted and comma-separated> -MoveToFolder "${mb}:\Inbox\Newsletter" -StopProcessingRules $true -WhatIf
New-InboxRule -Mailbox $mb -Name "lead-inbox 06 Codes" -SubjectContainsWords "OTP","login code","passcode","Verification Code","sicherer Link zu Claude" -MoveToFolder "${mb}:\Inbox\Codes" -StopProcessingRules $true -WhatIf
New-InboxRule -Mailbox $mb -Name "lead-inbox 07 Workist-Bericht" -FromAddressContainsWords "noreply@workist.com" -SubjectContainsWords "Dein Workist Fortschrittsbericht" -MoveToFolder "${mb}:\Inbox\Newsletter" -StopProcessingRules $true -WhatIf
New-InboxRule -Mailbox $mb -Name "lead-inbox 08 Basecamp-Community" -FromAddressContainsWords "notifications@app.basecamp.com" -SubjectContainsWords "Basecamp (Community)" -MoveToFolder "${mb}:\Inbox\Newsletter" -StopProcessingRules $true -WhatIf
Get-InboxRule -Mailbox $mb | ft Name,Enabled,Priority
```
Write out rule 05 with the real sender list before handing the block over. Tell Sascha: run each line with `-WhatIf` first, then without it; rule 03 comes after 01 and 06 so that tickets and codes are sorted first; rules 07 and 08 can be removed once the reports are unsubscribed. No rule for Sage invoice approvals: they need action and stay in the inbox.
**Done when** Sascha reports which rules exist; set those rows to `aktiv` in `systems/outlook.md`.
## 5. Noise at the source
Not something the skill can do. Hand over the table "Lärm an der Quelle" from `systems/outlook.md` as `Für dich:` points, with where each setting lives as far as known:
- Zammad: avatar → Profil → Benachrichtigungen. Switch off the escalation reminders; limit updates to "meine Tickets" and mentions.
- Workist: unsubscribe link in the progress report.
- Basecamp Community: notification settings of the Community account.
- UPS Billing: change the invoice recipient in the UPS billing centre to accounting.
**Done when** the points are handed over. When Sascha reports one as done, set its status in `systems/outlook.md`.
## Final report
In German: folders created, mails archived (count, totals before and after), mails presorted per folder, rules handed over, open `Für dich:` points, and the number of mails left in `Inbox` for the first triage run.