SuperAPI AI Directory

note-calendar

Office & productivity

View repository

Updated 10-16 08:08

About this skill

Note Calendar

Pre-checks (must be executed every time)

1. OS check

uname -s

If the return is not Darwin then terminate immediately:此 Skill 仅支持 macOS,当前系统不兼容。

2. Note tool check

wpsnote-cli status 2>/dev/null | grep -q "成功" && echo "CLI_OK" || echo "CLI_FAIL"
  • CLI_OK: use wpsnote-cli command throughout
  • CLI_FAIL: fall back to user-wpsnote MCP tool calls

After determining the mode, keep all subsequent note operations consistent.


Calendar scripts (bin/)

All scripts operate the macOS Calendar App through osascript . The first run may take 30-60 seconds due to iCloud sync.

# 查询
cal-query today                          # 今天
cal-query tomorrow                       # 明天
cal-query week                           # 本周(周一~周日)
cal-query next-week                      # 下周
cal-query +3                             # 3 天后当天
cal-query 2026-03-25                     # 指定日期
cal-query 2026-03-23 2026-03-29          # 指定范围
cal-query yesterday / last-week / weekend / ...  # 更多参数见脚本注释

# 写入(返回事件 UID,用于后续操作)
cal-add "<标题>" "<YYYY-MM-DD HH:MM>" "<YYYY-MM-DD HH:MM>"
cal-move <uid> "<YYYY-MM-DD HH:MM>" "<YYYY-MM-DD HH:MM>"
cal-delete <uid>

# 测试
cal-test        # 运行全量 CRUD 测试

Functional modes

Five modes, automatically determined based on what the user says:

What the user says Enter mode
"Check schedule" "What's on today" "Help me look at next week's arrangements" Mode A: Pure calendar query
"Write the schedule to notes" "Today's planning" "Help me manage today's schedule" Mode B: Calendar → Notes
"Help me add schedule based on notes" "There's xxx in the notes, put it in" Mode C: Notes → Calendar
"I have xxx tomorrow, what should I prepare today" "Help me do the prerequisites" Mode D: Smart prerequisites
"Help me plan today" "This afternoon is packed, help me schedule the morning" Mode E: Global planning
"Organize TODO" "Collect all to-dos" Mode F: TODO summary
The wording is unclear List the six modes for the user to choose

Note writing format reference docs/note-templates.md


Mode A: Pure calendar query

Call cal-querydirectly, format and output the returned result; do not write notes.

cal-query <参数>    # 根据用户描述选合适的参数

Mode B: Calendar → Notes

Organize today's schedule into a structured planning page and write it to notes.

  1. Query schedule:

    cal-query today      # 今天
    cal-query tomorrow   # 明天(用于生成前置建议)
    
  2. Search related notes for each event title:

    • CLI:wpsnote-cli find --keyword "<事件关键词>" --limit 3 --json
    • MCP:search_notes(keyword="<事件关键词>", limit=3)
  3. Confirm the writing location:

    • CLI:wpsnote-cli current --json / MCP:get_current_note()
    • There is an open note → ask "Write to the current note, or create a new one?"
    • None → create new:wpsnote-cli create --title "📋 今日规划 YYYY-MM-DD" --json
  4. Write according to the docs/note-templates.md Mode B structure

  5. Output summary:✓ 今日规划已写入「📋 今日规划 YYYY-MM-DD」|日程 N 条 | 关联笔记 N 篇


Mode C: Notes → Calendar

Extract content with time intent from the current note, and write it to the calendar after confirmation.

  1. Read the current note:

    • CLI:wpsnote-cli current --json → wpsnote-cli read --note_id <id> --json
    • Large document:wpsnote-cli outline + wpsnote-cli search --query "计划|打算|明天|下周|时间"
    • MCP:get_current_note() → read_note or get_note_outline + search_note_content
  2. Identify content that can be put into the calendar:

    • ✅ Clear time + item: "March 25 15:00 Product review"
    • ✅ Relative time + item: "Next Tuesday weekly meeting" "Tomorrow afternoon review"
    • ✅ TODO + deadline:- [ ] 提交报告(周五前)
    • ✅ Planning keywords: "Plan to tomorrow..." "Intend to next week..."
    • ❌ Not recognized: history, times in the data ("version 1.0 on 2024")
  3. Must confirm first, then write:

    📌 在「[笔记标题]」中识别到以下可落日历的事项:
      1. ✅ 产品评审 — 2026-03-25 15:00-16:00
      2. ⚠ 时间模糊:「下周提交报告」— 请补充具体时间
    确认哪些写入日历?(回复「全部」或编号)
    
  4. Write:cal-add "<标题>" "<start>" "<end>", and after success append an annotation to the corresponding block in the note


Mode D: Smart Pre-planning

Infer what needs to be prepared today based on future events.

  1. Fetch the next 3 days of schedule:cal-query today / cal-query tomorrow / cal-query +2

  2. Identify trigger words:

    Keyword Inferred preparation items
    Travel, tourism, flight, high-speed rail, business trip Pack luggage, confirm tickets, prepare power bank and ID documents
    Exam, test, exam Review related notes, prepare stationery, set the alarm
    Speech, report, presentation Organize materials, check equipment, rehearse once
    Interview Research the company background, prepare a self-introduction
    Date, dinner gathering, meal gathering Confirm the location, check the route, allow travel time
  3. Search related notes:

    • CLI:wpsnote-cli find --keyword "<事件关键词>" --limit 3 --json
    • MCP:search_notes(keyword="<事件关键词>", limit=3)
  4. Write the pre-task block (for the format see docs/note-templates.md Mode D)

  5. Ask whether to append to today's calendar (optional)


Mode E: Global Planning

Combine the calendar and to-dos to give complete suggestions for today's time allocation.

  1. Collect information:

    cal-query today     # 固定时间块
    cal-query tomorrow  # 判断今晚是否要早休
    

    To-do source: prioritize reading the user's existing TODO notes (seeCross-note TODO extraction), as the "task pool"

  2. Analyze:

    • Calculate free time slots (gaps between fixed events)
    • Identify high-load periods (3 or more consecutive meetings with no gaps)
    • Mark relaxed periods suitable for deep work
  3. Write the timeline plan according to the docs/note-templates.md Mode E structure


Mode F: TODO Summary

Collect unfinished checkboxes scattered everywhere and consolidate them into the user's existing TODO notes.

Core principle: follow the user's existing TODO notes, never start a new one.

SeeCross-note TODO extractionfor the complete process.


Cross-note TODO extraction (general process)

Modes C, E, and F all rely on this process.

Step 1: Find candidate notes

for kw in "任务" "计划" "记得" "需要" "安排"; do
  wpsnote-cli find --keyword "$kw" --limit 10 --json
done

Merge and deduplicate to get the candidate note list.

Step 2: Extract unchecked checkboxes

wpsnote-cli read --note_id <id> --json > /tmp/note_<id>.json
import re, json
with open('/tmp/note_<id>.json', encoding='utf-8') as f:
    content = json.load(f)['data']['content']
todos = re.findall(
    r'<p\s[^>]*listType="todo"[^>]*checked="0"[^>]*>(.*?)</p>',
    content, re.DOTALL
)
items = [re.sub('<[^>]+>', '', t).strip() for t in todos if t.strip()]
  • checked="0" = unfinished, collect only this type
  • Unrelated to note title naming, directly recognize the checkbox format

MCP fallback:read_note(note_id) parse the same way after fetching the content

Step 3: Determine the write target (find first, then ask, never create new)

wpsnote-cli find --keyword "TODO" --limit 10 --json
wpsnote-cli find --keyword "待办" --limit 10 --json
wpsnote-cli find --keyword "任务清单" --limit 5 --json

Find notes whose titles contain "TODO / to-do / task list / list":

  • Found 1: use it directly, and before writing inform:将把待办写入你已有的「[笔记标题]」
  • Found multiple: list them for the user to choose
  • None at all: only then ask whether to create a new one

Step 4: Write according to the user's existing format

First read the first 30 blocks of the target note, observe the organization method (by week/by project/flat), and make appended content follow it without introducing a new structure.

Entries from other notes are accompanied by a source note:

<p><span fontColor="#757575">↑ 来自「[原笔记标题]」</span></p>

Tool Quick Reference

Calendar (macOS only)

Action Command
Check schedule cal-query <today|tomorrow|week|+N|YYYY-MM-DD>
Create event cal-add "<title>" "<YYYY-MM-DD HH:MM>" "<YYYY-MM-DD HH:MM>"
Move event cal-move <uid> "<YYYY-MM-DD HH:MM>" "<YYYY-MM-DD HH:MM>"
Delete event cal-delete <uid>

Notes (CLI preferred / MCP fallback)

Action CLI MCP
Connection check wpsnote-cli status —
Current note wpsnote-cli current --json get_current_note()
Search notes wpsnote-cli find --keyword "..." --limit N --json search_notes(keyword=..., limit=N)
Search content wpsnote-cli search --note_id <id> --query "..." --json search_note_content(note_id, query=...)
Read full text wpsnote-cli read --note_id <id> --json read_note(note_id)
Read outline wpsnote-cli outline --note_id <id> --json get_note_outline(note_id)
Create note wpsnote-cli create --title "..." --json create_note(title=...)
Edit block wpsnote-cli edit --note_id <id> --op insert/replace ... edit_block(note_id, op=..., ...)

Error Handling

Error Handling
OS is not macOS Terminate immediately, indicating that only macOS is supported
wpsnote-cli status failed Fall back to MCP; if MCP is also unavailable, prompt to check the notes service
NO_ACTIVE_EDITOR_WINDOW Ask which note to write to, or create a new one
BLOCK_NOT_FOUND Re-fetch the outline to refresh the ID, then retry once
cal-query timed out Indicate that the calendar is syncing, wait and retry (the first time may take 60s)
cal-add failed Print the error, ask whether to manually specify the calendar name
Note search returned no results Skip the association step and process only the calendar data itself