Usage
Constraints
This skill does not generate files; it directly operates macOS Calendar, so the L0 org-mode/denote specification does not apply.
Core constraints:
- AppleScript date construction string parsing is prohibited, must assign field by field (see
references/applescript-patterns.md) - Field assignment order: year → month → day → hours → minutes → seconds
- Default write to
"个人"calendar; when the user specifies another calendar, write to the specified one - When parsing is uncertain, confirm with the user before writing
Instructions
To execute this skill, strictly follow these steps:
0. Determine the operation type
Branch based on user intent:
- Query("下周安排", "这周有什么事", "明天日程") → skip to step Q
- Write("加到日历", text/image with event information) → skip to step 1
Q. Query calendar events
Read references/applescript-patterns.md, using query mode.
Time range inference:
- "下周" → next Monday 00:00 to next Sunday 24:00
- "这周" → this Monday 00:00 to this Sunday 24:00
- "明天" → tomorrow 00:00 to tomorrow 24:00
- "最近" → today to the next 7 days
Iterate through all calendars via AppleScript, and output sorted by date. Distinguish all-day events from timed events; timed events display time and location.
Execution method: The Bash tool uses run_in_background: true to execute osascript, then retrieves the result via TaskOutput. The user side only sees the final formatted table, without exposing the raw script and output.
Present the results in a table. End after completion; do not continue to subsequent steps.
1. Read reference materials
Read references/applescript-patterns.md, load AppleScript safe mode.
2. Parse event information
Extract the following fields from the user input (text or image):
| Field | Required | Description |
|---|---|---|
| Title (summary) | Yes | Event name |
| Date (date) | Yes | Year, month, day |
| Start time (start) | No | If omitted, create an all-day event |
| End time (end) | No | If omitted, start time +2h |
| Location (location) | No | |
| Notes (description) | No | |
| Target calendar | No | Default "个人" |
Image input: First recognize the text content in the image (chat records, posters, email screenshots, etc.), then extract event information from it.
Date inference:
- Relative dates such as "明天" "下周三" → calculate based on the current date
- "3.4" "3/4" "3月4号" → the corresponding date in the current year
- Missing year → default to the current year; if that date has already passed and is < 30 days ago → still use the current year; otherwise use the next year
3. Confirmation (only when ambiguous)
If all fields can be clearly extracted, execute the write directly without confirmation.
Confirm with the user only in the following cases:
- The date is unclear (e.g., "in a while", "recently")
- Multiple possible events exist
- Key information is contradictory
4. Construct AppleScript and execute
Use the Bash tool to execute osascript -e '...', set run_in_background: true, then retrieve the result via TaskOutput.
Date construction template(strictly follow):
set startD to current date
set year of startD to {YEAR}
set month of startD to {MONTH}
set day of startD to {DAY}
set hours of startD to {HOUR}
set minutes of startD to {MINUTE}
set seconds of startD to 0
All-day event:allday event:true, set the end date to 00:00 of the next day.
5. Report the result
After a successful write, confirm concisely in one line:
已添加:{日期} {时间} — {标题} @ {地点}