aboutsummaryrefslogtreecommitdiff
path: root/.ai/workflows/delete-calendar-event.org
blob: 5bb92a141ae9f8afa6399f935276d36761bdfc2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#+TITLE: Delete Calendar Event Workflow
#+AUTHOR: Craig Jennings & Claude
#+DATE: 2026-02-01

* Overview

Workflow for deleting calendar events. Uses the Google Calendar MCP server (preferred) or gcalcli (fallback, personal account only).

* Triggers

- "delete the meeting"
- "cancel my appointment"
- "remove the event"
- "clear my calendar for..."

* Prerequisites

- Google Calendar MCP server configured and authenticated (=@cocal/google-calendar-mcp=)
- Two accounts available: =personal= (Craig Google) and =work= (Craig Deepsat)
- Fallback: gcalcli installed (personal account only)
- Event must exist on calendar

* Note: Calendar Visibility

The MCP server can delete events from both personal and work Google calendars. Proton calendar events are visible in =~/.emacs.d/data/pcal.org= but cannot be modified from here.

* Workflow Steps

** 1. Parse User Request

Extract:
- Which event (title, partial match, or date hint)
- Date context (if provided)

Examples:
- "Delete the dentist appointment" → search for "dentist"
- "Cancel tomorrow's meeting" → search tomorrow's events
- "Remove the 3pm call" → search by time

** 2. Search for Event

*** MCP (preferred)
Use =search-events= or =list-events= MCP tool with appropriate =account_id= ("personal" or "work").

*** gcalcli (fallback, personal only)
#+begin_src bash
gcalcli --calendar "Calendar Name" search "event title"
gcalcli --calendar "Calendar Name" agenda "date" "date 11:59pm"
#+end_src

** 3. Handle Multiple Matches

If search returns multiple events:

#+begin_example
Found 3 events matching "meeting":

1. Team Meeting - Feb 3, 2026 at 9:00 AM
2. Project Meeting - Feb 4, 2026 at 2:00 PM
3. Client Meeting - Feb 5, 2026 at 10:00 AM

Which event do you want to delete? (1-3)
#+end_example

** 4. Display Full Event Details

Show the event that will be deleted:

#+begin_example
Event to Delete:
================
Event: Team Meeting
When: Monday, Feb 3, 2026 at 9:00 AM
Duration: 1 hour
Location: Conference Room A
Description: Weekly sync
Calendar: Work
#+end_example

** 5. Explicit Confirmation

Ask clearly:

#+begin_example
Delete this event? (yes/no)
#+end_example

*Do NOT delete until user explicitly confirms with "yes".*

** 6. Execute Delete

*** MCP (preferred)
Use the =delete-event= MCP tool:
- =account_id=: "personal" or "work"
- =calendar_id=: calendar name or ID
- =event_id=: event ID (obtained from search/list results)

*** gcalcli (fallback, personal only)

gcalcli delete requires interactive confirmation. Pipe "y" to confirm:

#+begin_src bash
echo "y" | gcalcli --calendar "Calendar Name" delete "Event Title"
#+end_src

Use a date range to narrow matches:

#+begin_src bash
echo "y" | gcalcli --calendar "Calendar Name" delete "Event Title" 2026-02-14 2026-02-15
#+end_src

** 7. Verify

Confirm the event is gone:

*** MCP
Use =search-events= or =list-events= to verify the event no longer appears.

*** gcalcli (fallback)
#+begin_src bash
gcalcli --calendar "Calendar Name" search "Event Title"
#+end_src

Report success or failure to user.

* Recurring Events

*Warning:* Deleting a recurring event deletes ALL instances.

For recurring events:
1. Warn the user that all instances will be deleted
2. Ask for confirmation specifically mentioning "all occurrences"
3. Consider if they only want to delete one instance (not supported by simple delete)

#+begin_example
This is a recurring event. Deleting it will remove ALL occurrences.

Delete all instances of "Weekly Standup"? (yes/no)
#+end_example

* Error Handling

** Event Not Found
- Verify spelling
- Try partial match
- Check date range
- May have already been deleted

** Delete Failed
- Check calendar permissions
- Verify event exists
- Try with --calendar flag

** Wrong Event Deleted
- Cannot undo gcalcli delete
- Would need to recreate the event manually

* Safety Considerations

1. *Always show full event details* before asking for confirmation
2. *Never delete without explicit "yes"* from user
3. *Warn about recurring events* before deletion
4. *Verify deletion* by searching after
5. *Read-only calendars* (like Christine's) cannot have events deleted

* Read-Only Calendars

Some calendars are read-only:

| Calendar                  | Can Delete? | Account  |
|---------------------------+-------------+----------|
| Craig Google              | Yes         | personal |
| Christine                 | Yes         | personal |
| Craig Deepsat             | Yes         | work     |
| Todoist                   | Yes         | personal |
| Craig Jennings (TripIt)   | No          | personal |
| Holidays in United States | No          | personal |
| Craig Proton              | No          | personal |

If user tries to delete from read-only calendar:

#+begin_example
Cannot delete from "Craig Proton" - this is a read-only calendar.
#+end_example

* Related

- [[file:add-calendar-event.org][Add Calendar Event]] - create events
- [[file:read-calendar-events.org][Read Calendar Events]] - view events
- [[file:edit-calendar-event.org][Edit Calendar Event]] - modify events