Beschreibung auf Auslöser umgestellt, Einladungen, weitergeleitete Anfragen Dritter, Basecamp-Dublettensuche, Grußformel nach Stil-Skill. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
98 lines
7.7 KiB
Markdown
98 lines
7.7 KiB
Markdown
# Executing approved proposals
|
|
|
|
Reached from step 4 of `SKILL.md`. Rule 7 of the approval protocol in `/home/sascha.koenig/ap/PM/.okf/processes/it-basecamp-regeln.md` says what is allowed; this file is the mechanics. The Zammad calls named in `code` are specified in `/home/sascha.koenig/ap/PM/.okf/systems/zammad.md` ("Aufrufe für `lead-inbox`"); use them exactly as written there.
|
|
|
|
## Order per thread
|
|
|
|
1. Create the ticket or to-do (or the internal note on an existing ticket).
|
|
2. Read it back: the ticket number or to-do URL exists.
|
|
3. Send the notice or reply, with the real number or link.
|
|
4. Move or archive every mail of the thread.
|
|
|
|
Work through the list in number order. A failing step ends that thread only: skip its remaining steps, leave its mails in the inbox, go on with the next item. Report the command, the error, and what already exists (ticket number, to-do URL), so the next run finds it through `dublette_suchen` and sends only the notice instead of creating a second ticket.
|
|
|
|
## Find the mail again before every mail action
|
|
|
|
Cache numbers are not stable: every `search_emails` renumbers. Before a reply, move, archive or categorize:
|
|
|
|
1. `search_emails` for the mail's calendar day (`folder='Inbox'`, `inference_classification='all'`).
|
|
2. Read the page holding the mail with `browse_email_cache`.
|
|
3. Compare received time, sender and subject with the approved proposal. All three match → use that cache number. Otherwise do nothing to this thread and report it.
|
|
|
|
Run no other `search_emails` between finding the mail and acting on it. Several mails of one day can be found in one fetch and handled in a row.
|
|
|
|
**Batch items without browsing.** For a batch item whose mails share a sender or a subject fragment, let the search do the selecting: `search_emails(folder='Inbox', inference_classification='all', search_type='sender'|'subject', query='<address or fragment>', start_date=…, end_date=…)`. The cache then holds only those mails, numbered 1..`count`. Compare `count` with the number in the approved proposal: equal → act on all numbers; different → do nothing and report the count found (a new mail has arrived, or one is gone). This replaces the three-way comparison for batch items only; replies and tickets always use it.
|
|
|
|
Give `end_date` as an explicit time (`'<today>T23:59'`); `'now'` sometimes fails with a Graph filter error. With `move_single`, go through the numbers in descending order.
|
|
|
|
## Zammad ticket
|
|
|
|
1. `kunde_suchen` with the sender's address (for a shared mailbox: the person from the signature). Exactly one hit is needed. No hit for an internal sender → `customer_id: "guess:<address>"`, shown as such in the proposal. Several hits → `Für dich:`.
|
|
2. `dublette_suchen` for that customer. An open ticket on the same matter → no new ticket; the proposal is `notiz_anlegen` with the mail's content on that ticket.
|
|
3. Attachments: `get_email_content(cache_number=<n>, download_attachments=true, download_path='<scratchpad>/<thread>')`. Take only attachments with `isInline: false`. Base64-encode each into the article. Empty the directory after the thread is done.
|
|
4. `ticket_anlegen`: title from the matter (plain, no prefix); group `IT`; no owner, the IT triage bot assigns owner and priority. Article body in HTML: one line "Per Mail an Sascha König am <date>, von <sender>", then the text of the mail that states the problem, unchanged. Leave out quoted chains below it and anything holding credentials or access links; say in the proposal what was left out.
|
|
5. Read back with `GET tickets/<id>?expand=true`: customer, group `IT`, article count; attachments via `GET ticket_articles/by_ticket/<id>`. Zammad rewrites the title shortly after creation, so refer to the ticket by number.
|
|
|
|
Zammad sends the customer no confirmation for API tickets. The redirect notice is the only message the sender gets.
|
|
|
|
## Basecamp to-do
|
|
|
|
Load the `basecamp` skill; check flags with `basecamp todos create --agent --help`. The CLI prints a keyring warning before its JSON: append `2>/dev/null` when parsing.
|
|
|
|
```bash
|
|
basecamp todos create "<Titel>" --in <project-id> [--todoset <id>] --list <list-id> \
|
|
--assignee <person-id> --due YYYY-MM-DD --description - [--attach <file> …] --json < <scratchpad-file>
|
|
```
|
|
|
|
- Title plain. Description (Markdown, from a scratchpad file so umlauts survive): one context sentence, the core of the mail, "Per Mail von <sender> am <date>", then the AI marker.
|
|
- Target: the project the mail clearly belongs to; 👥 IT (one of the six lists) for team work; otherwise 🔒 Meins, in its inbox list. IDs from `systems/basecamp.md`; projects with several to-do sets need `--todoset`.
|
|
- Owner and due date come from the approval. Without both, create nothing. The owner must be a member of the project (`basecamp people list --in <id>`), otherwise the item is a `Für dich:` point.
|
|
- Read back with `basecamp todos show <id> --json`: assignee, due date, attachments.
|
|
|
|
## Redirect notice
|
|
|
|
A reply to the original mail, in `sascha-internal-communication-style`. Decide the form while drafting in step 3 of `SKILL.md`:
|
|
|
|
- **Full form** (first notice to this person in 30 days): where the matter moved (ticket number, or to-do with owner and due date), why it is better kept there, and the request to file such matters there directly in future (`https://tickets.az-gruppe.com`, or the Basecamp project).
|
|
- **Short form:** where it moved, number or link. No reason, no request.
|
|
- Which one: `search_emails(folder='Sent Items', search_type='body', query='tickets.az-gruppe.com', days=30)`, then the same with `query='3.basecamp.com'`. The person appears in `to` of a hit → short form.
|
|
- A Basecamp link only for people with access to the project; otherwise name owner and due date in the text and leave the link out.
|
|
- Recipients: the sender. Keep the original Cc when that round followed the matter.
|
|
|
|
Greeting and closing follow the e-mail template of `sascha-internal-communication-style`. Model for tone, full form, Zammad:
|
|
|
|
```md
|
|
Hallo <Vorname>,
|
|
|
|
dein Anliegen zu <Thema> habe ich in unser Helpdesk umgezogen, es läuft dort jetzt als Ticket #<Nummer>. Über das Ticket bekommst du auch die Rückmeldungen.
|
|
|
|
Hintergrund: Anfragen an die IT bearbeiten wir im Helpdesk, damit nichts in einem einzelnen Postfach liegen bleibt und immer jemand aus dem Team übernehmen kann.
|
|
|
|
Mein Vorschlag: Stell solche Anliegen künftig direkt dort ein, über https://tickets.az-gruppe.com. Dann sparst du dir den Umweg über mich.
|
|
|
|
Mit freundlichen Grüßen / Best regards
|
|
|
|
Sascha König
|
|
|
|
*✨unterstützt durch KI✨*
|
|
```
|
|
|
|
## Sending
|
|
|
|
`send_email(action='reply', cache_number=<n>, htmlbody='<…>')`. Set `to` / `cc` only when the proposal differs from the original recipients.
|
|
|
|
- The text is the approved one, character for character; only the ticket number or link is filled in.
|
|
- HTML: `<p>` per paragraph, nothing between the tags, no `<br>`. Last paragraph: `<p><em>✨unterstützt durch KI✨</em></p>`.
|
|
- Success is the text `Reply email sent successfully` with `'status': 'accepted'`. Anything else is a failed step.
|
|
- Read back: `search_emails(folder='Sent Items', search_type='subject', query='<subject fragment>')` for today, then `browse_email_cache`: recipients, Cc and the preview match the approved text. The connector prefixes the subject with `RE:`.
|
|
|
|
## Moving mails
|
|
|
|
| Action | Call |
|
|
|---|---|
|
|
| Into a folder | `manage_emails(action='move_single', cache_number=<n>, destination_folder='Inbox/<Name>')` |
|
|
| Archive | `manage_emails(action='archive_multiple', cache_numbers=[…])` |
|
|
| Mark an approval | `manage_emails(action='categorize_single', cache_number=<n>, categories=['Freigabe'])` |
|
|
|
|
Batch items: find all mails of one day, act on them in one call, then the next day. Read back per day with one more fetch: the moved mails are no longer in `Inbox`.
|